clause direct object tracking
All checks were successful
studiorailgun/trpg/pipeline/head This commit looks good
All checks were successful
studiorailgun/trpg/pipeline/head This commit looks good
This commit is contained in:
parent
962586a5fd
commit
f66f1d6816
@ -5,15 +5,15 @@ sitting in a tavern by a fireplace
|
||||
|
||||
|
||||
|
||||
Use arguments from clause parsing to perform queries when answering question
|
||||
- use subject to find some node
|
||||
- use interrogative argument to apply filters to the lookup
|
||||
|
||||
|
||||
Comprehend the sentence "My name is ${name}"
|
||||
- Transfer statement eval
|
||||
|
||||
|
||||
Update parsers to use "Arguments" (currently called "NounStack"), "Predicates" (Not defined yet, but essentially verbs), and "Adjuncts" (also not defined yet, are noncritial information eg "yesterday")
|
||||
Update parsers to determine valence of sentence (maybe create a dictionary to lookup?)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,8 @@ import java.util.Set;
|
||||
|
||||
import org.studiorailgun.conversation.evaluators.query.NounStack;
|
||||
import org.studiorailgun.conversation.parser.PennTreebankTagSet;
|
||||
import org.studiorailgun.conversation.parser.depend.Clause;
|
||||
import org.studiorailgun.conversation.parser.depend.Predicate;
|
||||
import org.studiorailgun.conversation.tracking.Conversation;
|
||||
import org.studiorailgun.conversation.tracking.Quote;
|
||||
import org.studiorailgun.conversation.tracking.Sentence;
|
||||
@ -25,14 +27,15 @@ public class AnswerSynthesis {
|
||||
*/
|
||||
public static Sentence evaluate(Conversation conversation, Quote query, Sentence sentence){
|
||||
SemanticGraph semanticGraph = sentence.getGraph();
|
||||
if(semanticGraph.getRoots().size() > 1){
|
||||
String message = "Multiple roots to sentence!\n" +
|
||||
"\"" + sentence.getRaw() + "\"\n" +
|
||||
semanticGraph;
|
||||
throw new UnsupportedOperationException(message);
|
||||
}
|
||||
IndexedWord root = semanticGraph.getFirstRoot();
|
||||
if(PennTreebankTagSet.isVerb(root.tag())){
|
||||
Clause mainClause = sentence.getMainClause();
|
||||
Predicate predicate = mainClause.getPredicate();
|
||||
if(predicate.getCopular() != null){
|
||||
String message = "Copular verb type not supported yet!\n" +
|
||||
"\"" + sentence.getRaw() + "\"\n" +
|
||||
semanticGraph;
|
||||
throw new UnsupportedOperationException(message);
|
||||
} else if(PennTreebankTagSet.isVerb(root.tag())){
|
||||
if(PennTreebankTagSet.isBe(root.tag())){
|
||||
String answerRaw = AnswerSynthesis.evaluateBe(conversation, query, sentence);
|
||||
Sentence rVal = new Sentence(answerRaw);
|
||||
|
||||
@ -60,6 +60,11 @@ public class Clause {
|
||||
*/
|
||||
Argument subject;
|
||||
|
||||
/**
|
||||
* The direct object
|
||||
*/
|
||||
Argument directObject;
|
||||
|
||||
/**
|
||||
* The adjuncts of the sentence
|
||||
*/
|
||||
@ -133,6 +138,7 @@ public class Clause {
|
||||
case "direct object": {
|
||||
Argument arg = new Argument(child, ArgumentType.NOMINAL);
|
||||
rVal.arguments.add(arg);
|
||||
rVal.directObject = arg;
|
||||
} break;
|
||||
|
||||
//indirect objects
|
||||
@ -243,30 +249,62 @@ public class Clause {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the predicate
|
||||
* @return The predicate
|
||||
*/
|
||||
public Predicate getPredicate() {
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the arguments of the clause
|
||||
* @return The arguments
|
||||
*/
|
||||
public List<Argument> getArguments() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the subject of the clause
|
||||
* @return The subject
|
||||
*/
|
||||
public Argument getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the adjuncts of the clause
|
||||
* @return The adjuncts
|
||||
*/
|
||||
public List<Adjunct> getAdjuncts() {
|
||||
return adjuncts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sub clauses of this clause
|
||||
* @return The sub clauses
|
||||
*/
|
||||
public List<Clause> getClauses(){
|
||||
return clauses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the coordinator for this clause
|
||||
* @return The coordinator
|
||||
*/
|
||||
public Coordinator getCoordinator(){
|
||||
return coordinator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the direct object
|
||||
* @return The direct object
|
||||
*/
|
||||
public Argument getDirectObject(){
|
||||
return directObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user