paralogical / glish

map all words to single-syllable version
MIT License
266 stars 18 forks source link

The glish translator only translates the first half of a word containing hyphens, such as "multi-directional". #1

Open Windowsfreak opened 11 months ago

Windowsfreak commented 11 months ago

There's a bug in your application. If you enter a word such as multi-directional, the second word doesn't get translated at all, compared to when it was separated with spaces. I suggest you'd use a tokeniser to pass on non-word characters unchanged and capture groups of word characters, instead of whatever you did to capture only the first half of a hyphenised compound word ;)

Windowsfreak commented 11 months ago

Maybe text.split(/([ \n\t]+)/) needs to be extended to capture all non-English characters, so that compound-words are correctly translated (and not the first half). cf. https://github.com/paralogical/glish/blob/main/ui/src/App.tsx#L24

paralogical commented 11 months ago

yeah, we probably need to be splitting on hyphen there, good catch.