1
내가 가짜 일본어 단어를 생성하는 데 사용되는 토큰의 목록을 가지고, 그것은 다음과 같습니다알려진 토큰 목록에서 문자열을 토큰 화하는 방법은 무엇입니까?
var syllables = ["chi","tsu","shi","ka","ki","ku","ke","ko","ta","te","to","sa","su","se","so","na","ni","nu","ne","no","ha","hi","fu","he","ho","ma","mi","mu","me","mo","ya","yu","yo","ra","ri","ru","re","ro","wa","wo"];
는 "yoniyotachihochinitarehakemukenushihofure"와 같은 단어를 감안할 때,이 같은 배열로 별도의 토큰으로 분할 할 수 있습니다 [ "yo", "ni", "yo"... RegExps 사용?
지금까지, 나는
var s="";
for(var i=0;i<syllables.length;i++)
s+=("("+syllables[i]+")");
s+="+";
console.log(s);
var splitregex = new RegExp(s,"gi");
console.log(str.split(splitregex));
을하고 난 "[ 'yoniyotachihochinitarehakemukenushihofure']"돌아
알 관련성이 높습니다. http://thedailywtf.com/Articles/The-Automated-Curse-Generator.aspx – striking