Extracting all Nouns from a text file using nltk

前端 未结 7 1867
清歌不尽
清歌不尽 2020-12-08 08:35

Is there a more efficient way of doing this? My code reads a text file and extracts all Nouns.

import nltk

File = open(fileName) #open file
lines = File.rea         


        
7条回答
  •  余生分开走
    2020-12-08 08:52

    if you get Resource punkt not found. Please use the NLTK Downloader to obtain the resource: error

    just do

    import nltk
    nltk.download('punkt')
    

提交回复
热议问题