You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
Great solution! But it still has some problem
e.g. a phrase like "wohenhaonine?" it will split into wo hen hao nine
leaving the last "ne" unseparated.
I believe the problems is in this regex: .replace(new RegExp(`([${vowels}])([^${vowels}nr])`, 'gi'), '$1 $2')
Sorry, I can't make a pull request because I'm not a javascript coder but I'm porting your code to dart and have found this problem.
So, my proposed solution is to add one more match group like this: .replace(new RegExp(`([${vowels}])(([^${vowels}nr])|(ne))`, 'gi'), '$1 $2')
Not sure if it will not break anything, but as long as I tested it in dart, it works ok
Cheers!
The text was updated successfully, but these errors were encountered:
Thanks for opening this issue! The thing is, as the script doesn't understand any meaning or context, "nin" "e" would be a possible split as well as "ni" "ne", so it just skips it. You'd have to separate the input using a single quote (there's actually already a similar test case, "Wǒhěnhǎoxièxiènǐ'ne"). I'm not sure if adding this special treatment for "ne" is a good idea or if there are actual use cases for "nin e". Input from a native speaker would be welcome!
Yes, that's a good point. Unfortunately I'm not a native speaker but I've just checked how Android's pinyin keyboard handles it trying to type 'nine' and it gave me "ni'ne". I also tried to type something like ninema (I think native speakers would laugh at me at this point) but android keyboard also gave me ni'ne'ma
Hi!
Great solution! But it still has some problem
e.g. a phrase like "wohenhaonine?" it will split into wo hen hao nine
leaving the last "ne" unseparated.
I believe the problems is in this regex:
.replace(new RegExp(`([${vowels}])([^${vowels}nr])`, 'gi'), '$1 $2')
Sorry, I can't make a pull request because I'm not a javascript coder but I'm porting your code to dart and have found this problem.
So, my proposed solution is to add one more match group like this:
.replace(new RegExp(`([${vowels}])(([^${vowels}nr])|(ne))`, 'gi'), '$1 $2')
Not sure if it will not break anything, but as long as I tested it in dart, it works ok
Cheers!
The text was updated successfully, but these errors were encountered: