static List <TripleTerm> ExtractTriple(string content) { List <TripleTerm> result = new List <TripleTerm>(); edu.stanford.nlp.simple.Document doc = new edu.stanford.nlp.simple.Document(content); var list = doc.sentences(); for (int i = Variable.VariableZero; i < list.size(); i++) { edu.stanford.nlp.simple.Sentence sentence = (edu.stanford.nlp.simple.Sentence)list.get(i); var tripleList = sentence.openieTriples(); for (int j = Variable.VariableZero; j < tripleList.size(); j++) { var tripleListArray = tripleList.toArray(); RelationTriple relationTriple = (RelationTriple)tripleListArray[j]; var currentTriple = new TripleTerm( relationTriple.subjectGloss(), relationTriple.relationGloss(), relationTriple.objectGloss()); result.Add(currentTriple); } } return(result); }
/// <summary> /// Create a new document from the passed in text. /// </summary> /// <param name="text">The text of the document.</param> public Document(string text) { nlpDoc = new edu.stanford.nlp.simple.Document(text); }