自然语言9_NLTK计算中文高频词

以下代码仅限于python2

 

NLTK计算中文高频词

  1. >>> sinica_fd=nltk.FreqDist(sinica_treebank.words())
  2. >>> top100=sinica_fd.items()[0:100]
  3. >>> for (x,y) in top100:
  4. print x,y
  1.  
  2.  6776
  3.  1482
  4.  1331
  5.  1317
  6.  1190
  7.  759
  8.  724
  9.  688
  10.  627
  11.  612
  12.  580
  13.  542
  14.  526
  15.  467
  16.  417
  17.  404
  18.  389
  19. 我們 384
 
原文地址:https://www.cnblogs.com/webRobot/p/6068858.html