Created
November 2, 2012 13:32
-
-
Save gupul2k/4001384 to your computer and use it in GitHub Desktop.
NER and POS Tagging with NLTK and Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Script tags POS and NER[Named Entity Recognition] for a supplied text file. | |
#Date: Nov 2 2012 | |
#Author: Hota Sobhan | |
import nltk | |
f = open('C:\Python27\Test_File.txt') | |
data = f.readlines() | |
#Parse the text file for NER with POS Tagging | |
for line in data: | |
tokens = nltk.word_tokenize(line) | |
tagged = nltk.pos_tag(tokens) | |
entities = nltk.chunk.ne_chunk(tagged) | |
print entities | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment