![JAR search and dependency download from the Maven repository](/logo.png)
edu.stanford.nlp.StanfordKBReporter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stanford-adept Show documentation
Show all versions of stanford-adept Show documentation
The project file to build and run stanford applications using Maven
The newest version!
package edu.stanford.nlp;
import java.io.*;
import java.util.*;
import adept.common.*;
import adept.kbapi.*;
import edu.stanford.nlp.io.*;
public class StanfordKBReporter {
public static void main(String[] args)
throws IOException, KBConfigurationException, KBQueryException, KBUpdateException {
// set up sample text
KBParameters kbParameters = new KBParameters("adept/kbapi/KBParameters.xml");
KB kb = new KB(kbParameters);
KBOntologyMap kbOntMap = KBOntologyMap.getTACOntologyMap();
List matchingEntities = kb.getEntitiesByRegexMatch(".*", true);
List matchingRelations = kb.getRelationsByRegexMatch(".*", true);
System.out.println("Accessing remote KB...");
if (args.length != 0) {
if (args[0].equals("delete"))
for (KBEntity kbe : matchingEntities)
kb.deleteKBObject(kbe.getKBID());
for (KBRelation kbr : matchingRelations)
kb.deleteKBObject(kbr.getKBID());
}
for (KBEntity kbe : matchingEntities) {
System.out.println("---");
System.out.println("KB entity id: "+kbe.getKBID());
System.out.println("KB entity canonical string: "+kbe.getCanonicalString());
}
for (KBRelation kbr : matchingRelations) {
System.out.println("---");
System.out.println("KB relation type: "+kbr.getType().getType());
for (KBRelationArgument kba : kbr.getArguments()) {
System.out.println("argument id: "+kba.getTarget().getKBID());
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy