Search in sources :

Example 31 with TextField

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

the class NlpEntityTestConstants method getTwoSentenceTestTuple.

public static List<Tuple> getTwoSentenceTestTuple() {
    IField[] fields1 = { new TextField("Microsoft, Google and Facebook are organizations."), new TextField("Donald Trump and Barack Obama are persons") };
    IField[] fields2 = { new TextField("I made an appointment at 8 am."), new TextField("Aug 16, 2016 is a really important date.") };
    IField[] fields3 = { new TextField("I really love Kelly Clarkson's Because of You."), new TextField("Shirley Temple is a very famous actress.") };
    Tuple tuple1 = new Tuple(SCHEMA_TWO_SENTENCE, fields1);
    Tuple tuple2 = new Tuple(SCHEMA_TWO_SENTENCE, fields2);
    Tuple tuple3 = new Tuple(SCHEMA_TWO_SENTENCE, fields3);
    return Arrays.asList(tuple1, tuple2, tuple3);
}
Also used : TextField(edu.uci.ics.texera.api.field.TextField) IField(edu.uci.ics.texera.api.field.IField)

Example 32 with TextField

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

the class NlpEntityTestConstants method getTest4ResultTuples.

public static List<Tuple> getTest4ResultTuples() {
    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_two", 0, 12, NlpEntityType.PERSON.toString(), "Donald Trump");
    Span span5 = new Span("sentence_two", 17, 29, NlpEntityType.PERSON.toString(), "Barack Obama");
    spanList.add(span1);
    spanList.add(span2);
    spanList.add(span3);
    spanList.add(span4);
    spanList.add(span5);
    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);
    Tuple returnTuple = new Tuple.Builder(tuple1).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build();
    return Arrays.asList(returnTuple);
}
Also used : ArrayList(java.util.ArrayList) TextField(edu.uci.ics.texera.api.field.TextField) ListField(edu.uci.ics.texera.api.field.ListField) IField(edu.uci.ics.texera.api.field.IField) Span(edu.uci.ics.texera.api.span.Span)

Example 33 with TextField

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

the class NlpEntityTestConstants method getTest6ResultTuples.

public static List<Tuple> getTest6ResultTuples() {
    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");
    spanList.add(span1);
    spanList.add(span2);
    spanList.add(span3);
    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);
    Tuple returnTuple = new Tuple.Builder(tuple1).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build();
    return Arrays.asList(returnTuple);
}
Also used : ArrayList(java.util.ArrayList) TextField(edu.uci.ics.texera.api.field.TextField) ListField(edu.uci.ics.texera.api.field.ListField) IField(edu.uci.ics.texera.api.field.IField) Span(edu.uci.ics.texera.api.span.Span)

Example 34 with TextField

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

the class NlpEntityTestConstants method getTest8ResultTuples.

public static List<Tuple> getTest8ResultTuples() {
    List<Span> spanList = new ArrayList<Span>();
    Span span1 = new Span("sentence_one", 23, 34, NlpEntityType.MONEY.toString(), "300 dollars");
    spanList.add(span1);
    IField[] fields1 = { new TextField("This backpack costs me 300 dollars.") };
    Tuple tuple1 = new Tuple(SCHEMA_ONE_SENTENCE, fields1);
    Tuple returnTuple = new Tuple.Builder(tuple1).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build();
    return Arrays.asList(returnTuple);
}
Also used : ArrayList(java.util.ArrayList) TextField(edu.uci.ics.texera.api.field.TextField) ListField(edu.uci.ics.texera.api.field.ListField) IField(edu.uci.ics.texera.api.field.IField) Span(edu.uci.ics.texera.api.span.Span)

Example 35 with TextField

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

the class NlpEntityTestConstants method getTest7ResultTuples.

public static List<Tuple> getTest7ResultTuples() {
    List<Span> spanList = new ArrayList<Span>();
    Span span1 = new Span("sentence_one", 12, 16, NlpEntityType.ADJECTIVE.toString(), "warm");
    spanList.add(span1);
    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);
    Tuple returnTuple = new Tuple.Builder(tuple1).add(REULST_ATTRIBUTE, new ListField<Span>(spanList)).build();
    return Arrays.asList(returnTuple);
}
Also used : ArrayList(java.util.ArrayList) TextField(edu.uci.ics.texera.api.field.TextField) ListField(edu.uci.ics.texera.api.field.ListField) IField(edu.uci.ics.texera.api.field.IField) Span(edu.uci.ics.texera.api.span.Span)

Aggregations

TextField (edu.uci.ics.texera.api.field.TextField)115 IField (edu.uci.ics.texera.api.field.IField)99 Tuple (edu.uci.ics.texera.api.tuple.Tuple)89 ArrayList (java.util.ArrayList)84 IntegerField (edu.uci.ics.texera.api.field.IntegerField)78 StringField (edu.uci.ics.texera.api.field.StringField)78 Span (edu.uci.ics.texera.api.span.Span)78 Schema (edu.uci.ics.texera.api.schema.Schema)77 Test (org.junit.Test)76 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)56 SimpleDateFormat (java.text.SimpleDateFormat)56 Dictionary (edu.uci.ics.texera.dataflow.dictionarymatcher.Dictionary)29 ListField (edu.uci.ics.texera.api.field.ListField)11 JoinDistancePredicate (edu.uci.ics.texera.dataflow.join.JoinDistancePredicate)9 KeywordMatcherSourceOperator (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordMatcherSourceOperator)9 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 IOperator (edu.uci.ics.texera.api.dataflow.IOperator)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4