name transmission tests
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
ede82384de
commit
16e8e666d4
@ -5,7 +5,6 @@ sitting in a tavern by a fireplace
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Parse the sentence "I am John"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,69 @@
|
|||||||
|
package org.studiorailgun.transfer.name;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.studiorailgun.Globals;
|
||||||
|
import org.studiorailgun.ai.conversation.evaluators.transfer.TransferEval;
|
||||||
|
import org.studiorailgun.ai.conversation.parser.NLPParser;
|
||||||
|
import org.studiorailgun.ai.conversation.tracking.Quote;
|
||||||
|
import org.studiorailgun.ai.conversation.web.ConversationQuery;
|
||||||
|
import org.studiorailgun.ai.knowledge.Node;
|
||||||
|
import org.studiorailgun.ai.linguistics.NameQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests for evaluating transfer statements
|
||||||
|
*/
|
||||||
|
public class TransferNameEvaluationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEval1(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("My name is John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
|
||||||
|
Globals.conversation.addQuote(ConversationQuery.getOtherParticipant(), input);
|
||||||
|
|
||||||
|
TransferEval.evaluate(Globals.conversation, input, input.getSentences().get(0));
|
||||||
|
|
||||||
|
//search for the name being assigned in the knowledge web
|
||||||
|
Node otherParticipant = ConversationQuery.getOtherParticipant();
|
||||||
|
List<Node> names = NameQuery.getNames(otherParticipant);
|
||||||
|
assertEquals(names.get(0).getName(),"John");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEval2(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("I am John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
|
||||||
|
Globals.conversation.addQuote(ConversationQuery.getOtherParticipant(), input);
|
||||||
|
|
||||||
|
TransferEval.evaluate(Globals.conversation, input, input.getSentences().get(0));
|
||||||
|
|
||||||
|
//search for the name being assigned in the knowledge web
|
||||||
|
Node otherParticipant = ConversationQuery.getOtherParticipant();
|
||||||
|
List<Node> names = NameQuery.getNames(otherParticipant);
|
||||||
|
assertEquals(names.get(0).getName(),"John");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEval3(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("I'm John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
|
||||||
|
Globals.conversation.addQuote(ConversationQuery.getOtherParticipant(), input);
|
||||||
|
|
||||||
|
TransferEval.evaluate(Globals.conversation, input, input.getSentences().get(0));
|
||||||
|
|
||||||
|
//search for the name being assigned in the knowledge web
|
||||||
|
Node otherParticipant = ConversationQuery.getOtherParticipant();
|
||||||
|
List<Node> names = NameQuery.getNames(otherParticipant);
|
||||||
|
assertEquals(names.get(0).getName(),"John");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package org.studiorailgun.transfer.name;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.studiorailgun.Globals;
|
||||||
|
import org.studiorailgun.ai.conversation.parser.NLPParser;
|
||||||
|
import org.studiorailgun.ai.conversation.parser.depend.Clause;
|
||||||
|
import org.studiorailgun.ai.conversation.tracking.Quote;
|
||||||
|
import org.studiorailgun.ai.conversation.tracking.Sentence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transfer statement parsing tests
|
||||||
|
*/
|
||||||
|
public class TransferNameParsingTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParse1(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("My name is John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
Sentence sentence = input.getSentences().get(0);
|
||||||
|
Clause mainClause = sentence.getMainClause();
|
||||||
|
|
||||||
|
//has a copular verb
|
||||||
|
assertEquals(mainClause.getPredicate().getRoot().originalText(),"John");
|
||||||
|
assertEquals(mainClause.getPredicate().getCopular().originalText(),"is");
|
||||||
|
assertEquals(mainClause.getSubject().getRoot().originalText(), "name");
|
||||||
|
assertEquals(mainClause.getSubject().getPossessiveModifier().originalText(), "My");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParse2(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("I am John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
Sentence sentence = input.getSentences().get(0);
|
||||||
|
Clause mainClause = sentence.getMainClause();
|
||||||
|
|
||||||
|
//has a copular verb
|
||||||
|
assertEquals(mainClause.getPredicate().getRoot().originalText(),"John");
|
||||||
|
assertEquals(mainClause.getPredicate().getCopular().originalText(),"am");
|
||||||
|
assertEquals(mainClause.getSubject().getRoot().originalText(), "I");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParse3(){
|
||||||
|
Globals.init("./data/webs/test/web.json");
|
||||||
|
Quote input = new Quote("I'm John.");
|
||||||
|
NLPParser.parse(input);
|
||||||
|
Sentence sentence = input.getSentences().get(0);
|
||||||
|
Clause mainClause = sentence.getMainClause();
|
||||||
|
|
||||||
|
//has a copular verb
|
||||||
|
assertEquals(mainClause.getPredicate().getRoot().originalText(),"John");
|
||||||
|
assertEquals(mainClause.getPredicate().getCopular().originalText(),"'m");
|
||||||
|
assertEquals(mainClause.getSubject().getRoot().originalText(), "I");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user