Oct-21-2016, 04:15 PM
alright guys I stayed up until 4am until I passed out really doing some studying and working out some code. the following is what I was satisfied with after elaborated on snippsat's coding:
a YUGE thanks to everyone that guided me on here
import nltk from nltk import pos_tag, PunktSentenceTokenizer, word_tokenize, RegexpParser from nltk.corpus import state_union def process_content(tokenized): for i in tokenized: words = word_tokenize(i) tagged = pos_tag(words) pos_tag(words) chunkGram = r"""Chunk: {<RB.?>*<VB.?>*<NNP>+<NN>?}""" chunkParser = RegexpParser(chunkGram) chunked = chunkParser.parse(tagged) chunked.draw() if __name__ == '__main__': train_text = state_union.raw("2005-GWBush.txt") sample_text = state_union.raw("2006-GWBush.txt") custom_sent_tokenizer = PunktSentenceTokenizer(train_text) tokenized = custom_sent_tokenizer.tokenize(sample_text) process_content(tokenized)it was then successfully plotted with matplotlib and showed up as it should have.
a YUGE thanks to everyone that guided me on here