python - NLTK Relation Extraction - custom corpus in relextract.extract_rels -


i learnt there built-in function in nltk extract relations ner-tagged sentences according following:

   import re     in = re.compile(r'.*\bin\b(?!\b.+ing\b)')     fileid in ieer.fileids():        doc in ieer.parsed_docs(fileid):            rel in relextract.extract_rels('org', 'loc', doc, corpus='ieer', pattern = in):                print(relextract.rtuple(rel)) 

it seems me promising general purpose, understood relextract.extract_rels accepts 'ieer' or 'conll2002' parameter corpus. in case, usage restricted these 2 corpora, isn't it? how 1 utilize own corpus (presuming, of course, ner-tagged).

this should more of comment don't have enough reputation.

you can pass custom corpus doc argument after it's been pos-tagged , converted list of chunked trees. custom corpus, should use corpus='ace'.

for example, in this answer, use extract_rels tag custom corpus.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -