开发者

how do I change hungggrrrrryyyy = hungry and other such english words

开发者 https://www.devze.com 2023-01-30 14:39 出处:网络
The problem is simpler to understand, but I think is difficult to solve. Given a word how to form a proper english word. example:

The problem is simpler to understand, but I think is difficult to solve. Given a word how to form a proper english word. example:

hunggrrryyy to hungry  
awweeeeseom 开发者_Python百科to awesome  
frusstrated to frustrated  
looooooove  to love  

Are there any known solutions to such problem?

Thanks


You probably could use a similar tack to what Peter Norvig did with this spell checker.

At the very least you'll need some context checking. Does "loooooooooser" map to "looser" or "loser" within a particular phrase?


Sure, google can do it. My guess is you need a bunch of data to do this.

If you can use a service, googles service might do it for you... it has spelling correction. http://code.google.com/apis/soapsearch/reference.html


Firstly, you could reduce all repeats of more than two letters. I'm pretty sure there are no english words with any 3 consecutive repeats.

This reduces:

hunggrrryyy to hunggrryy
awweeeeseom to aweesome
frusstrated to frusstrated (no change) looooooove to loove

You are then likely to have more success with traditional spell-checking approaches.

Since you know you are looking for duplicates, you could also generate all the variants by turning the duplicates into single letters:

hunggrryy -> hungrryy, hungryy, hungry etc

and see if one of then matches a dictionary lookup. Note that you may get false positives for similar words like lose, loose; son, soon

0

精彩评论

暂无评论...
验证码 换一张
取 消