Search in sources :

Example 46 with IField

use of edu.uci.ics.texera.api.field.IField in project textdb by TextDB.

the class NlpEntityTestConstants method getTest10ResultTuples.

public static List<Tuple> getTest10ResultTuples() {
    List<Tuple> resultList = new ArrayList<>();
    List<Span> spanList = new ArrayList<Span>();
    Span span1 = new Span("sentence_one", 0, 9, NlpEntityType.ORGANIZATION.toString(), "Microsoft");
    Span span2 = new Span("sentence_one", 11, 17, NlpEntityType.ORGANIZATION.toString(), "Google");
    Span span3 = new Span("sentence_one", 22, 30, NlpEntityType.ORGANIZATION.toString(), "Facebook");
    Span span4 = new Span("sentence_one", 53, 65, NlpEntityType.PERSON.toString(), "Donald Trump");
    Span span5 = new Span("sentence_one", 70, 82, NlpEntityType.PERSON.toString(), "Barack Obama");
    Span span6 = new Span("sentence_one", 23, 34, NlpEntityType.MONEY.toString(), "300 dollars");
    Span span7 = new Span("sentence_one", 18, 25, NlpEntityType.ORGANIZATION.toString(), "Samsung");
    IField[] fields1 = { new TextField("Microsoft is an organization.") };
    IField[] fields2 = { new TextField("Microsoft, Google and Facebook are organizations.") };
    IField[] fields3 = { new TextField("Microsoft, Google and Facebook are organizations and Donald Trump and Barack Obama are persons.") };
    IField[] fields5 = { new TextField("This backpack costs me 300 dollars.") };
    IField[] fields6 = { new TextField("What't the brand, Samsung or Apple?") };
    Tuple tuple1 = new Tuple(SCHEMA_ONE_SENTENCE, fields1);
    Tuple tuple2 = new Tuple(SCHEMA_ONE_SENTENCE, fields2);
    Tuple tuple3 = new Tuple(SCHEMA_ONE_SENTENCE, fields3);
    Tuple tuple5 = new Tuple(SCHEMA_ONE_SENTENCE, fields5);
    Tuple tuple6 = new Tuple(SCHEMA_ONE_SENTENCE, fields6);
    spanList.add(span1);
    resultList.add(new Tuple.Builder(tuple1).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build());
    spanList.add(span2);
    spanList.add(span3);
    resultList.add(new Tuple.Builder(tuple2).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build());
    spanList.add(span4);
    spanList.add(span5);
    resultList.add(new Tuple.Builder(tuple3).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build());
    spanList.clear();
    spanList.add(span6);
    resultList.add(new Tuple.Builder(tuple5).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build());
    spanList.clear();
    spanList.add(span7);
    resultList.add(new Tuple.Builder(tuple6).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build());
    return resultList;
}
Also used : ArrayList(java.util.ArrayList) TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField) Span(edu.uci.ics.texera.api.span.Span)

Example 47 with IField

use of edu.uci.ics.texera.api.field.IField in project textdb by TextDB.

the class NlpEntityTestConstants method getTest7Tuple.

public static List<Tuple> getTest7Tuple() throws ParseException {
    IField[] fields1 = { new TextField("Feeling the warm sun rays beaming steadily down, the girl decided there was no need to wear a coat.") };
    Tuple tuple1 = new Tuple(SCHEMA_ONE_SENTENCE, fields1);
    return Arrays.asList(tuple1);
}
Also used : TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField)

Example 48 with IField

use of edu.uci.ics.texera.api.field.IField in project textdb by TextDB.

the class NlpEntityTestConstants method getTest4Tuple.

public static List<Tuple> getTest4Tuple() throws ParseException {
    IField[] fields1 = { new TextField("Microsoft, Google and Facebook are organizations."), new TextField("Donald Trump and Barack Obama are persons") };
    Tuple tuple1 = new Tuple(SCHEMA_TWO_SENTENCE, fields1);
    return Arrays.asList(tuple1);
}
Also used : TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField)

Example 49 with IField

use of edu.uci.ics.texera.api.field.IField in project textdb by TextDB.

the class NlpEntityTestConstants method getTest9Tuple.

public static List<Tuple> getTest9Tuple() {
    IField[] fields1 = { new TextField("I made an appointment at 8 am."), new TextField("Aug 16, 2016 is a really important date.") };
    Tuple tuple1 = new Tuple(SCHEMA_TWO_SENTENCE, fields1);
    return Arrays.asList(tuple1);
}
Also used : TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField)

Example 50 with IField

use of edu.uci.ics.texera.api.field.IField in project textdb by TextDB.

the class NlpEntityTestConstants method getTest1Tuple.

public static List<Tuple> getTest1Tuple() throws ParseException {
    IField[] fields1 = { new TextField("Microsoft is an organization.") };
    Tuple tuple1 = new Tuple(SCHEMA_ONE_SENTENCE, fields1);
    return Arrays.asList(tuple1);
}
Also used : TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField)

Aggregations

IField (edu.uci.ics.texera.api.field.IField)145 ArrayList (java.util.ArrayList)113 Tuple (edu.uci.ics.texera.api.tuple.Tuple)106 TextField (edu.uci.ics.texera.api.field.TextField)100 Span (edu.uci.ics.texera.api.span.Span)99 Schema (edu.uci.ics.texera.api.schema.Schema)92 Test (org.junit.Test)84 StringField (edu.uci.ics.texera.api.field.StringField)79 IntegerField (edu.uci.ics.texera.api.field.IntegerField)78 DoubleField (edu.uci.ics.texera.api.field.DoubleField)63 DateField (edu.uci.ics.texera.api.field.DateField)58 Attribute (edu.uci.ics.texera.api.schema.Attribute)57 SimpleDateFormat (java.text.SimpleDateFormat)56 ListField (edu.uci.ics.texera.api.field.ListField)32 Dictionary (edu.uci.ics.texera.dataflow.dictionarymatcher.Dictionary)29 JoinDistancePredicate (edu.uci.ics.texera.dataflow.join.JoinDistancePredicate)9 KeywordMatcherSourceOperator (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordMatcherSourceOperator)9 IOperator (edu.uci.ics.texera.api.dataflow.IOperator)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4