How do I add a text file to IEER?

I want to make my text file in IEER corpus format so that I can use functions extract_rels()

and directly parsed_docs()

. How to do it? I am using python and NLTK.

What i tried

ws = nltk.corpus.reader.ieer.IEERCorpusReader(corpus_root, 'doc1.txt') print ws.fileids() #ws is a instantaneous of ieer corpus RELATION=re.compile(r'\bin\b') for t in ws.fileids(): for doc in ws.parsed_docs(t): for rel in nltk.sem.extract_rels('PER', 'LOC', doc , corpus='ieer', pattern=RELATION): print nltk.sem.clause(rel, relsym= 'RELATION' )

I did it, but no output comes up and also no error.

+3


source to share





All Articles