nltk.extract_rels(subjclass, objclass, doc, corpus='ace', pattern=None, window=10)[source]

Filter the output of semi_rel2reldict according to specified NE classes and a filler pattern.

The parameters subjclass and objclass can be used to restrict the Named Entities to particular types (any of ‘LOCATION’, ‘ORGANIZATION’, ‘PERSON’, ‘DURATION’, ‘DATE’, ‘CARDINAL’, ‘PERCENT’, ‘MONEY’, ‘MEASURE’).

  • subjclass (str) – the class of the subject Named Entity.
  • objclass (str) – the class of the object Named Entity.
  • doc (ieer document or a list of chunk trees) – input document
  • corpus (str) – name of the corpus to take as input; possible values are ‘ieer’ and ‘conll2002’
  • pattern (SRE_Pattern) – a regular expression for filtering the fillers of retrieved triples.
  • window (int) – filters out fillers which exceed this threshold

see mk_reldicts

Return type: