I'm doing a NLP project.
The purpose of the project is to extract possible relationship between two things. For example, for a pair "location" and "person" the extracted results would be "near", "lives in", "works in", etc.
Is there any existing NLP tool capable of doing this?
There are a few different tools you might want to look at:
MIT's new MITIE tool supports basic relationship extraction. Included in the distribution are 21 English binary relation extraction models trained on a combination of Wikipedia and Freebase data. You can also train your own custom relation detectors. Here's a listing of the MITIE/MITIE-models/english/binary_relations/ directory, which is downloaded when you run the make MITIE-models
target during the build process (the names should be relatively self-explanatory):
OpenIE from the Univ of Washington will extract relationships from text, representing the output as triples in the form of (Arg1, Arg2, Relation)
. For example, given the input sentence:
The U.S. president Barack Obama gave his speech on Tuesday to thousands of people.
OpenIE will extract these binary relations:
Note: OpenIE uses a non-standard open source license that expressly prohibits commercial use.
The Stanford Relation Extractor extracts relations Live_In, Located_In, OrgBased_In, and Work_For. If you want to use a different set of relations, you can train your own relation extractor using the code (details provided on the webpage).
If you want basic dependencies, you can also use the Stanford Dependency Parser:
The Stanford Dependency Parser (part of the Stanford Parser) will extract grammatical relations between words in a sentence. For example, given this input:
Bills on ports and immigration were submitted by Senator Brownback, Republican of Kansas
The Stanford Parser will extract these grammatical dependencies:
GATE from the Univ of Sheffield also includes a relation extraction capability, though I've never used it myself. This presentation provides an overview of how it works: https://gate.ac.uk/sale/talks/gate-course-may10/track-3/module-11-ml-adv/module-11-relations.pdf