2015-01-12 36 views
0

Pythons NLTK是否提供了一种功能,可以用英文名称替换文本中的数字?NLTK是否可以用英文单词替换数字?

例如:

You had 1 job. -> You had one job. 
42 is the answer. -> Fourty-two is the answer. 
3.14 is almost pi -> Three point one four is almost pi. 

(我不关心大小写)。

+0

我希望我没有做例子中的任何错误(英语不是我的母语) 。 –

回答

0

不可以。NLTK不会给英语发生器提供一个号码(至少现在还没有)。

但这里有一个可以处理整数从1-1,000,000,000:Numbernator,也有很多其他选择,请参阅http://pastebin.com/WwFCjYtt