-4
A
回答
0
是text1
和text2
的一部分nltk的例子?然後看看它們,你會發現標記化並不像你想象的那麼多:-)
對於小型化,請看任何介紹性的python教程。對於卦,請查看nltk書。
-1
的情況下,如果你沒有爲 要找到所有卦的例子中,你應該首先記號化它
>>> import nltk
>>> from nltk import word_tokenize
>>> from nltk.util import ngrams
>>> text1 = "Hi How are you? i am fine and you"
>>> token=nltk.word_tokenize(text1) #tokenize your text
>>> tttt=nltk.word_tokenize(text.lower()) #tokenize your text and make it lowercase in onestep
>>> tttt
['hi', 'how', 'are', 'you', '?', 'i', 'am', 'fine', 'and', 'you']
>>> trigrams=ngrams(token,3) # find all the trigram in text1
>>> trigrams
[('Hi', 'How', 'are'), ('How', 'are', 'you'), ('are', 'you', '?'), ('you', '?', 'i'), ('?', 'i', 'am'), ('i', 'am', 'fine'), ('am', 'fine', 'and'), ('fine', 'and', 'you')]
有關使您的text2你只需要應用標記化的步驟
相關問題
- 1. 發現使用NLTK WordNet的
- 2. 使用nltk實現idf
- 3. nltk quadgram搭配發現者
- 4. 導入共發現在NLTK
- 5. 查找卦爲整個語料庫與NLTK
- 6. nltk.KneserNeyProbDist使用<a href="https://github.com/nltk/nltk" rel="nofollow noreferrer">nltk</a>給予0.25的概率分佈爲大多數我對語言建模工作卦
- 7. 使用nltk令牌化Unicode使用nltk
- 8. 字符串聚類(使用卦?)
- 9. NLTK pos_tag使用
- 10. Lemmainser使用NLTK
- 11. FreqDist使用NLTK
- 12. 濫用nltk的word_tokenize(發送)
- 13. 計算頂部卦
- 14. python使用nltk Sentiwordnet
- 15. 使用NLTK或Python
- 16. pg_search卦擴展不工作
- 17. 錯誤使用nltk word_tokenize
- 18. 在Xcode中使用NLTK
- 19. NLTK使用訓練分類
- 20. 使用php的NLTK錯誤
- 21. 使用NLTK提取關係
- 22. 如何使用NLTK幹
- 23. 在Python中使用NLTK Chinking
- 24. 皮普NLTK使用VIRTUALENV
- 25. 如何使用NLTK BigramAssocMeasures.ch_sq
- 26. 使用NLTK編碼問題
- 27. 發現使用
- 28. 如何呈現完美的使用Python NLTK
- 29. 什麼是ngram計數和如何實現使用nltk?
- 30. 當使用python2.7下載語料庫NLTK時出現UnicodeDecodeError
沒有顯示你自己的努力「任何人都可以幫助」聽起來像「任何人都可以爲我做這件事」。答案可能不是。 – georg
這聽起來像是功課似的... – aab