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");
    }

}
