Chinaunix首页 | 论坛 | 博客
  • 博客访问: 291935
  • 博文数量: 82
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 874
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-21 09:58
个人简介

traveling in cumputer science!!

文章分类

全部博文(82)

文章存档

2016年(13)

2015年(69)

我的朋友

分类: Python/Ruby

2015-07-15 18:13:05

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




































阅读(1152) | 评论(0) | 转发(0) |
1

上一篇:正则表达式

下一篇:spark RDD

给主人留下些什么吧!~~