function summary of nltk in python

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

给主人留下些什么吧!~~
评论热议
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值