Search in sources :

Example 1 with InteractiveTableTuple

use of main.database.InteractiveTableTuple in project Info-Evaluation by TechnionYP5777.

the class InteractiveTableTupleTest method test3.

@Test
public void test3() {
    ReasonPair rp = new ReasonPair();
    rp.setProbability(0.4);
    rp.setReason("stubbing");
    LinkedList<ReasonPair> lst = new LinkedList<>();
    lst.add(rp);
    InteractiveTableTuple t = new InteractiveTableTuple("Justin Bieber", "12/02/2016", lst);
    assertEquals(t.getDate(), "12/02/2016");
    assertEquals(t.getName(), "Justin Bieber");
    assertEquals((t.getRegularDate() + ""), "Fri Dec 02 00:00:00 IST 2016");
    assert t.getKeyWords().isEmpty();
    assertEquals(t.getReasons().get(0).getProbability(), 0.4, 0);
    assertEquals(t.getReasons().get(0).getReason(), "stubbing");
    t.addKeyWord("stubbing");
    assertEquals(t.getKeyWords().get(0), "stubbing");
    t.addKeyWord("arrested");
    assertEquals(t.getKeyWords().get(1), "arrested");
}
Also used : ReasonPair(main.database.ReasonPair) LinkedList(java.util.LinkedList) InteractiveTableTuple(main.database.InteractiveTableTuple) Test(org.junit.Test)

Example 2 with InteractiveTableTuple

use of main.database.InteractiveTableTuple in project Info-Evaluation by TechnionYP5777.

the class InteractiveTableTupleTest method test0.

@Test
public void test0() {
    InteractiveTableTuple t = new InteractiveTableTuple();
    assertNull(t.getDate());
    assertNull(t.getName());
    assertNull(t.getRegularDate());
    assert t.getKeyWords().isEmpty();
    assert t.getReasons().isEmpty();
}
Also used : InteractiveTableTuple(main.database.InteractiveTableTuple) Test(org.junit.Test)

Example 3 with InteractiveTableTuple

use of main.database.InteractiveTableTuple in project Info-Evaluation by TechnionYP5777.

the class AnalyzePageTest method testInteractiveParagraph.

@Test
public void testInteractiveParagraph() {
    List<InteractiveTableTuple> detailsTable = new AnalyzePage(text).getInteractiveDetails();
    assertEquals(detailsTable.size(), 4);
    assert "Soulja Boy".equals(detailsTable.get(2).getName());
    boolean realReason = false;
    for (ReasonPair ¢ : detailsTable.get(1).getReasons()) if ("driving under influence".equals(¢.getReason()))
        realReason = true;
    assert realReason;
    assert "12/29/2013".equals(detailsTable.get(3).getDate());
}
Also used : AnalyzePage(main.Analyze.AnalyzePage) ReasonPair(main.database.ReasonPair) InteractiveTableTuple(main.database.InteractiveTableTuple) Test(org.junit.Test)

Example 4 with InteractiveTableTuple

use of main.database.InteractiveTableTuple in project Info-Evaluation by TechnionYP5777.

the class InteractiveTableTupleTest method test1.

@Test
public void test1() {
    InteractiveTableTuple t = new InteractiveTableTuple("Justin Bieber", "12/02/2016", null);
    assertEquals(t.getDate(), "12/02/2016");
    assertEquals(t.getName(), "Justin Bieber");
    assertEquals((t.getRegularDate() + ""), "Fri Dec 02 00:00:00 IST 2016");
    assert t.getKeyWords().isEmpty();
}
Also used : InteractiveTableTuple(main.database.InteractiveTableTuple) Test(org.junit.Test)

Example 5 with InteractiveTableTuple

use of main.database.InteractiveTableTuple in project Info-Evaluation by TechnionYP5777.

the class InteractiveTableTupleTest method test2.

@Test
public void test2() {
    InteractiveTableTuple t = new InteractiveTableTuple();
    t.setName("Justin Bieber");
    t.setDate("12/02/2016");
    assertEquals(t.getDate(), "12/02/2016");
    assertEquals(t.getName(), "Justin Bieber");
    assertEquals((t.getRegularDate() + ""), "Fri Dec 02 00:00:00 IST 2016");
    assert t.getKeyWords().isEmpty();
    ReasonPair rp = new ReasonPair();
    rp.setProbability(0.4);
    rp.setReason("stubbing");
    LinkedList<ReasonPair> lst = new LinkedList<>();
    lst.add(rp);
    t.setReasons(lst);
    assertEquals(t.getReasons().get(0).getProbability(), 0.4, 0);
    assertEquals(t.getReasons().get(0).getReason(), "stubbing");
}
Also used : ReasonPair(main.database.ReasonPair) LinkedList(java.util.LinkedList) InteractiveTableTuple(main.database.InteractiveTableTuple) Test(org.junit.Test)

Aggregations

InteractiveTableTuple (main.database.InteractiveTableTuple)8 Test (org.junit.Test)7 ReasonPair (main.database.ReasonPair)6 Sentence (edu.stanford.nlp.simple.Sentence)2 LinkedList (java.util.LinkedList)2 AnalyzeParagragh (main.Analyze.AnalyzeParagragh)2 SentencesAnnotation (edu.stanford.nlp.ling.CoreAnnotations.SentencesAnnotation)1 IndexedWord (edu.stanford.nlp.ling.IndexedWord)1 Annotation (edu.stanford.nlp.pipeline.Annotation)1 StanfordCoreNLP (edu.stanford.nlp.pipeline.StanfordCoreNLP)1 SemanticGraph (edu.stanford.nlp.semgraph.SemanticGraph)1 CollapsedDependenciesAnnotation (edu.stanford.nlp.semgraph.SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation)1 SemanticGraphEdge (edu.stanford.nlp.semgraph.SemanticGraphEdge)1 CoreMap (edu.stanford.nlp.util.CoreMap)1 Properties (java.util.Properties)1 AnalyzePage (main.Analyze.AnalyzePage)1