function summary of nltk in python

来源:互联网 发布:淘宝卖衣服从哪进货 编辑:程序博客网 时间:2024/06/10 21:16
1. re.findall(regexp,word):find the characters in word by the pattern 'regexp'
2. nltk.regexp_tokenize(text,pattern): find the characters in text by the pattern 'pattern' 
3. re.split(r',',string):divide the string by ','
4. text.concordance('hello'):find 'hello' in text and output the at line 
5. text.similar('hello'):find the similar attribute like 'hello' and output the word 
6. sorted(word_list):sort the words in word_list
7. set(word_list):delete the words 
8. word_list.append('hello'):add 'hello' to the word_list
9. len(word_list):count the words number 
10. word_list.count('hello'):count the number of 'hello' in the word_list  
11. word_list.index('hello'):return the index of the first 'hello' in the word_list
12. fdist = FreqDist(word_list):calculate the words number and create the word:number pairs 
13. nltk.***.words('fileid'):get the content of 'fileid' in type of words
14. ***.fileids():return all the fileid in the language library '***'
15. text = nltk.Text(wordlist):convert the wordlist into the text mode 
16. PlaintextCorpusReader(path,'.*'):get all the file content in the path
17. nltk.word_tokenize(string):divide the string into wordlist
18. nltk.sent_tokenize(string):divide the string into sent
19. the for used in nltk
    for item in s : traverse elements in s
    for item in set(s) :  traverse elements in s and no repeat
    for item in sort(s) ; traverse elements in s by order
    for item in reversed(s) : traverse elements in s by reversed order
    for item in set(s).difference(t) : traverse elements in s but not in t
    for item in random.shuffle(s) : traverse elements in s by random order




































<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(10) | 评论(0) | 转发(0) |
1

上一篇:正则表达式

下一篇:spark RDD

相关热门文章
  • 欢迎pythonin在ChinaUnix博客...
  • openstack的liberty版本
  • 微信开发服务器验证代码python...
  • 欢迎pythonTester在ChinaUnix...
  • bootstrap table 的onClickCel...
  • python 自动化测试平台 Robot ...
  • python 自动化测试平台 Robot ...
  • python snmp 自动化2-在python...
  • 自动化测试详细测试计划 模板...
  • python snmp 自动化3-修改pyth...
  • linux dhcp peizhi roc
  • 关于Unix文件的软链接
  • 求教这个命令什么意思,我是新...
  • sed -e "/grep/d" 是什么意思...
  • 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~