Search in sources :

Example 16 with TableTuple

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

the class DataListTest method test2.

@Test
public void test2() {
    final TableTuple tup = new TableTuple("Charlie Sheen", "02/12/2016", "arrest on domestic violence charges");
    final DataList dl = new DataList();
    dl.insert("Justin Bieber", "23/01/2015", "drunk driving");
    assertEquals(1, dl.getNumOfTuples());
    dl.insert(tup);
    assertEquals(2, dl.getNumOfTuples());
}
Also used : TableTuple(main.database.TableTuple) DataList(main.database.DataList) Test(org.junit.Test)

Example 17 with TableTuple

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

the class AnalyzeSourcesTest method testAddSourceFile.

@Test
public void testAddSourceFile() {
    boolean check = false;
    final AnalyzeSources as = new AnalyzeSources();
    try {
        as.addSourceFile((Resources.getResource("text3.txt") + "").replace("file:", ""));
    } catch (Exception e) {
        check = true;
    }
    assert check;
    try {
        as.addSourceFile((Resources.getResource("text1.txt") + "").replace("file:", ""), "2013");
        ArrayList<TableTuple> details = as.getData().getList();
        assert "Tito Ortiz".equals(details.get(0).getName());
        assert "01/06/2013".equals(details.get(0).getDate());
        assert "driving under influence".equals(details.get(0).getReason());
        as.addSourceFile((Resources.getResource("text2.txt") + "").replace("file:", ""));
        details = as.getData().getList();
        assert "Mark Salling".equals(details.get(3).getName());
        assert "12/29/2016".equals(details.get(3).getDate());
        assert "possession of pornography".equals(details.get(3).getReason());
    } catch (IOException e) {
        fail();
    }
}
Also used : TableTuple(main.database.TableTuple) AnalyzeSources(main.Analyze.AnalyzeSources) IOException(java.io.IOException) IOException(java.io.IOException) Test(org.junit.Test)

Example 18 with TableTuple

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

the class GetCategoryTest method init.

@Before
public void init() throws Exception {
    clearDB();
    DataList lin = new DataList();
    TableTuple t1 = new TableTuple("Austin Chumlee Russell", "01/09/2014", "driving without a licesnce");
    t1.addKeyWord("driving license");
    TableTuple t2 = new TableTuple("Austin Chumlee Russell", "01/09/2014", "driving without a licesnce");
    t2.addKeyWord("driving license");
    TableTuple t3 = new TableTuple("Chris Kattan", "02/10/2015", "attacking wife");
    t3.addKeyWord("attacking");
    TableTuple t4 = new TableTuple("Hugh Jackman", "02/12/2015", "drunk driving");
    t4.addKeyWord("drunk driving");
    TableTuple t5 = new TableTuple("Austin Chumlee Russell", "03/09/2013", "drunk driving");
    t5.addKeyWord("drunk driving");
    TableTuple t6 = new TableTuple("Ben Stiller", "02/12/2015", "driving without a licesnce");
    t6.addKeyWord("driving license");
    TableTuple t7 = new TableTuple("Emile Hirsch", "02/12/2015", "drunk driving");
    t7.addKeyWord("drunk driving");
    TableTuple t8 = new TableTuple("Chris Kattan", "01/23/2014", "attacking wife");
    t8.addKeyWord("attacking");
    TableTuple t9 = new TableTuple("Austin Chumlee Russell", "01/09/2014", "sexual assault");
    t9.addKeyWord("assault");
    TableTuple t10 = new TableTuple("Ben Stiller", "02/12/2015", "sexual assault");
    t10.addKeyWord("assault");
    lin.insert(t1);
    lin.insert(t2);
    lin.insert(t3);
    lin.insert(t4);
    lin.insert(t5);
    lin.insert(t6);
    lin.insert(t7);
    lin.insert(t8);
    lin.insert(t9);
    lin.insert(t10);
    addEvents(lin);
    addAllKeywords(lin);
}
Also used : DataList(main.database.DataList) TableTuple(main.database.TableTuple) Before(org.junit.Before)

Example 19 with TableTuple

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

the class AnalyzeParagraphTest method test4.

@Test
public void test4() {
    final Sentence sent = new Sentence("Axl Rose was arrested for consuming drugs on October 5th 2012 in NY during rock concert .");
    final TableTuple tt = new AnalyzeParagragh(sent, "2012").Analyze();
    assertEquals("Axl Rose", tt.getName());
    assertEquals("drugs consuming during concert", tt.getReason());
    assertEquals("10/05/2012", tt.getDate());
}
Also used : TableTuple(main.database.TableTuple) AnalyzeParagragh(main.Analyze.AnalyzeParagragh) Sentence(edu.stanford.nlp.simple.Sentence) Test(org.junit.Test)

Example 20 with TableTuple

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

the class AnalyzeParagraphTest method test5.

@Test
public void test5() {
    final Sentence sent = new Sentence("Axl Rose was arrested after driving drunk in New Zeland on March 1.");
    final TableTuple tt = new AnalyzeParagragh(sent, "2015").Analyze();
    assertEquals("Axl Rose", tt.getName());
    assertEquals("driving drunk in New Zeland", tt.getReason());
    assertEquals("03/01/2015", tt.getDate());
}
Also used : TableTuple(main.database.TableTuple) AnalyzeParagragh(main.Analyze.AnalyzeParagragh) Sentence(edu.stanford.nlp.simple.Sentence) Test(org.junit.Test)

Aggregations

TableTuple (main.database.TableTuple)27 Test (org.junit.Test)22 Sentence (edu.stanford.nlp.simple.Sentence)12 AnalyzeParagragh (main.Analyze.AnalyzeParagragh)12 DataList (main.database.DataList)7 AnalyzeSources (main.Analyze.AnalyzeSources)4 InteractiveTableTuple (main.database.InteractiveTableTuple)3 IOException (java.io.IOException)2 Before (org.junit.Before)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 Color (java.awt.Color)1 Dimension (java.awt.Dimension)1 Point (java.awt.Point)1