The Graphene-Core library offers methods for the complete extraction, as well as for individual and composite steps of the information extraction process.
If you want to use Graphene inside your application, you first have to create a new instance of the Graphene class:
// create new Graphene instance
Graphene graphene = new Graphene();
This will replace mentions of entities in the text that refer to the same entity in the world (e.g. pronouns and abbreviated names) by their full entity names.
Parameters:
- text: The input text.
CoreferenceContent cc = graphene.doCoreference("The text.");
// get result as a string
String substituted = cc.getSubstitutedText();
This will transform complex input sentences into a simpler representation of semantically annotated and linked sentences.
Parameters:
- text: The input text.
- doCoreference: Specifies whether coreference resolution should be applied.
- isolateSentences: Specifies whether the sentences from the input text should be processed individually (This will not extract relationships that occur between neighbored sentences). Set true, if you run Graphene over a collection of independent sentences and false for a full coherent text.
DiscourseSimplificationContent dsc = graphene.doDiscourseSimplification("The text.", true, false);
// ### OUTPUT #####
// default
String defaultRep = dsc.defaultFormat(false); // set **true** for resolved format
// flat
String flatRep = dsc.flatFormat(false); // set **true** for resolved format
// ### SERIALIZE & DESERIALIZE ###
DiscourseSimplificationContent.serializeToJSON(new File("file.json"));
DiscourseSimplificationContent loaded = DiscourseSimplificationContent.deserializeFromJSON(new File("file.json"), DiscourseSimplificationContent.class);
This will generate relational tuples (subject-predicate-object extractions) out of the simplified sentences that have been generated by Discourse Simplification.
Parameters: same as for Discourse Simplification
RelationExtractionContent rec = graphene.doRelationExtraction("The text.", true, false);
// ### OUTPUT AS RDFNL #####
// default
String defaultRep = rec.defaultFormat(false); // set **true** for resolved format
// flat
String flatRep = rec.flatFormat(false); // set **true** for resolved format
// ### OUTPUT AS PROPER RDF (N-Triples) ###
String rdf = ec.rdfFormat();
// ### SERIALIZE & DESERIALIZE ###
RelationExtractionContent.serializeToJSON(new File("file.json"));
RelationExtractionContent loaded = RelationExtractionContent.deserializeFromJSON(new File("file.json"), RelationExtractionContent.class);