对于stackoverflow可能是一个非常广泛的问题,但在这里,
我正试图规范句子中的单词,例如:
INPUT:
输出 (注意开发地理位置分散之间的空格)
因为使用外部API不可用(例如使用 google API )。
我需要设计内部Java API
显而易见且天真的解决方案是这样的:
for all word in sentence do:
if word is in dictionary then ignore
else:
if word is reduce-able to a set of dictionary keywords then split
else ignore
od;
所以在我开始使用这种方法之前,我的问题是,如果有更好的方法吗?例如一些 OPEN SOURCE库,甚至是不同的方法?