diff --git a/README.md b/README.md index 3a7de39..b008e2e 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,45 @@ An OIE system aims to make the following extractions: ``` ("AMD"; "is based in"; "U.S.") ("AMD"; "is"; "technology company") +``` + +# Demo + +A short demo: + +``` +import de.uni_mannheim.minie.MinIE; +import de.uni_mannheim.minie.annotation.AnnotatedProposition; +import de.uni_mannheim.utils.coreNLP.CoreNLPUtils; + +import edu.stanford.nlp.pipeline.StanfordCoreNLP; + +public class Demo { + public static void main(String args[]) { + // Dependency parsing pipeline initialization + StanfordCoreNLP parser = CoreNLPUtils.StanfordDepNNParser(); + + // Input sentence + String sentence = "The Joker believes that the hero Batman was not actually born in foggy Gotham City."; + + // Generate the extractions (With SAFE mode) + MinIE minie = new MinIE(sentence, parser, MinIE.Mode.SAFE); + + // Print the extractions + System.out.println("\nInput sentence: " + sentence); + System.out.println("============================="); + System.out.println("Extractions:"); + for (AnnotatedProposition ap: minie.getPropositions()) { + System.out.println("\tTriple: " + ap.getTripleAsString()); + System.out.print("\tFactuality: " + ap.getFactualityAsString()); + if (ap.getAttribution().getAttributionPhrase() != null) + System.out.print("\tAttribution: " + ap.getAttribution().toStringCompact()); + else + System.out.print("\tAttribution: NONE"); + System.out.println("\n\t----------"); + } + + System.out.println("\n\nDONE!"); + } +} ``` \ No newline at end of file