Skip to content

semantalytics/bites-corenlp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project implements three custom RDF extractors based on Stanford's CoreNLP library.

CoreNLPMentionRDFExtractor

Extracts named entities mentions, with the same output format as Stardog's entities extractor.

CoreNLPEntityLinkerRDFExtractor

Extracts and links entity mentions to existing resources in a knowledge graph. Same output format as Stardog's linker extractor.

CoreNLPRelationRDFExtractor

Extracts relations between named entity mentions. For example, the sentence:

The Orioles are a professional baseball team based in Baltimore

Will generate three triples:

entity:e435cd0347642bc7d2736155815a54e2 rdfs:label "Orioles"
entity:eb3cdb4e267d28feebb638711f8bd7b1 rdfs:label "Baltimore"
iri:e435cd0347642bc7d2736155815a54e2 relation:org:city_of_headquarters iri:eb3cdb4e267d28feebb638711f8bd7b1

Usage

  1. Download the latest release
  2. Add the jar to Stardog's classpath:
    • Copy it to server/ext or other folder in the server (e.g., server/dbms)
    • OR
    • Point the environment variable STARDOG_EXT to the its folder
  3. Restart the Stardog server
  4. CoreNLPMentionRDFExtractor, CoreNLPEntityLinkerRDFExtractor, and CoreNLPRelationRDFExtractor will be available as RDF extractors, accessible through the CLI, API, and HTTP interfaces

For example, using the CLI, if you want to add a document to BITES and extract its entities:

stardog doc put --rdf-extractors CoreNLPMentionRDFExtractor myDatabase document.pdf

CoreNLP models can consume large amounts of system memory. If greeted with a GC overhead limit exceeded error when using any of the extractors, increase the amount of memory available to Stardog.

Advanced Usage

  1. Tweak build.gradle to the language of your choice (e.g., change CoreNLP dependency to models-spanish)
  2. Run gradlew clean fatjar for a single jar, or gradlew clean copyDeps for individual dependencies
  3. Add files in build/libs to Stardog's classpath
  4. Restart the Stardog server

About

CoreNLP extractors for Stardog

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%