@elsat We gotta fix this. 😂
It’s using Apple’s Natural Language API language recognizer to make a prediction. It’ll take the top predicted language if Apple tells us the confidence is at least 50% or higher. Sometimes it gets it wrong. I’ve done a bunch of tweaking and this was the best I could do with their API, but maybe there’s more to be done that I’m not realizing.
Great, so can I send you an invoice for 1 sat for every letter that it gets wrong? 😆
Talk to my lawyer!
Oh, wait. Wtf? On macOS running similar code, it thinks that text is English with 93% confidence, while Norwegian Bokmål is only 4%. Either the iOS language model is messed up or there’s a bug in Damus. https://image.nostr.build/ad67852e46903ba1c462a02b384485024aaf23b227ab7ba2327691f51e2824e6.png
I got down to the bottom of it. I typed in the text wrong. With the ‘ apostrophe, it think it’s English. With the ’ apostrophe, which is what Noshole used, it thinks it’s Norwegian Bokmål with 52% confidence while English is only 41%, which we know is wrong. OK, blame Apple. Maybe we can try to hack it to be smarter such that if your device locale trails the top prediction by X%, we don’t attempt to translate the note. https://image.nostr.build/0f07e0b5ec2b40ae877be6455bcda73a4f88bdac92e298ba95d7f6faf2cba5c3.png
Punctuation matters!
I helped my uncle jack off the horse.
Let’s eat grandma.
But he slipped on a soap opera.
Happened again. I think what I’ll do is convert from one apostrophe ’ to another ' before running the language recognizer as a bandaid fix to Apple’s incorrect language model. https://image.nostr.build/8845e6c3906c76103b7760a04fe561062efbcc2ee5e665d967671c54e383ad03.jpg
Nobody knows I’m Turkish. 😆 https://image.nostr.build/6f8fc495315b101e549f2717388606c8c76611f93b7f46499138ba3d44a0adaa.gif
OK, I sent the patch to @jb55 to review and the fix seems to work on my local iPhone simulator. There should be fewer wasted sats / translation quota. https://groups.google.com/a/damus.io/g/patches/c/kpfRQ7b1XN8
🙏
Tim Apple owes me some sats.