I am working on an information extractor specifically purposed with parsing relationships between entities such as movies, directors, and actors. NLTK appears to provide the necessary tools to construct such a system. However, it is not clear how one would go about adding custom labels (e.g. actor, director, movie title).

Similarly, Chapter 7 of the NLTK Book discusses information extraction using a named entity recognizer, but it glosses over labeling details.

So, I have two questions:

How would I add custom labels? If I have bare lists of relevant named entities (e.g. movies, actors, etc.), how can I include them as features? It appears that I would need to use IOB format, but I am unsure about how to do this when I only have lists of named entities.


2 Answers 2


Once you have your own lists of named entities, and you're only interested in extracting the relations, I believe there are simpler solutions (although I never tried relation extraction in NLTK, so I might be wrong):

  • ReVerb - a tool written in Java. Once it produces the results, you can simply keep the rows, where your labels are present as objects of the relation.

  • OpenIE - the successor of ReVerb (also written in Java). The authors claim better perfomance, and the output might be more informative.

  • IEPY - a relation extraction tool in Python. You should be able to provide your own labels/named entities using gazetees.

  • MITIE - this library has bindings in Python, and it offers relation extraction functionality.

  • $\begingroup$ Thanks for the suggestions. I had hoped to use NLTK entirely, but these tools look promising as well. $\endgroup$
    – grill
    May 13, 2015 at 16:15

Lots of keyword extraction techniques are there depends on factors like:

Grammatical quality of text. Length of text Are you looking for a single keyword or phrasal keyword etc. But in general If you have long text and you want to extract keywords automatically from that, I would recommend you to go through follow articles:

  1. TextRank

  2. Rake [Rapid Automatic Keyword Extraction]

  3. Topica

Also to extract custom(special) keywords which is not coming through above techniques, have a look at this post.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.