2015-01-12 44 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