Search in sources :

Example 96 with IField

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

the class RegexTestConstantsCorp method getSampleCorpTuples.

public static List<Tuple> getSampleCorpTuples() {
    IField[] fields1 = { new StringField("Facebook"), new StringField("404 Not Found"), new StringField("66.220.144.0") };
    IField[] fields2 = { new StringField("Weibo"), new StringField("http://weibo.com"), new StringField("180.149.134.141") };
    IField[] fields3 = { new StringField("Microsoft"), new StringField("https://www.microsoft.com/en-us/"), new StringField("131.107.0.89") };
    IField[] fields4 = { new StringField("Google"), new StringField("websit: www.google.com"), new StringField("8.8.8.8.8.8") };
    Tuple tuple1 = new Tuple(SCHEMA_CORP, fields1);
    Tuple tuple2 = new Tuple(SCHEMA_CORP, fields2);
    Tuple tuple3 = new Tuple(SCHEMA_CORP, fields3);
    Tuple tuple4 = new Tuple(SCHEMA_CORP, fields4);
    return Arrays.asList(tuple1, tuple2, tuple3, tuple4);
}
Also used : StringField(edu.uci.ics.textdb.api.field.StringField) IField(edu.uci.ics.textdb.api.field.IField)

Example 97 with IField

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

the class RegexTestConstantsText method getTextTuple.

private static Tuple getTextTuple(String content) {
    IField field = new TextField(content);
    Tuple tuple = new Tuple(SCHEMA_TEXT, field);
    return tuple;
}
Also used : TextField(edu.uci.ics.textdb.api.field.TextField) IField(edu.uci.ics.textdb.api.field.IField) Tuple(edu.uci.ics.textdb.api.tuple.Tuple)

Example 98 with IField

use of edu.uci.ics.textdb.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.textdb.api.field.TextField) IField(edu.uci.ics.textdb.api.field.IField)

Example 99 with IField

use of edu.uci.ics.textdb.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.textdb.api.field.TextField) IField(edu.uci.ics.textdb.api.field.IField)

Example 100 with IField

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

the class NlpEntityTestConstants method getTest3ResultTuples.

public static List<Tuple> getTest3ResultTuples() {
    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");
    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 and Donald Trump and Barack Obama are persons.") };
    Tuple tuple1 = new Tuple(SCHEMA_ONE_SENTENCE, fields1);
    Schema returnSchema = Utils.addAttributeToSchema(tuple1.getSchema(), new Attribute(RESULTS, AttributeType.LIST));
    Tuple returnTuple = DataflowUtils.getSpanTuple(tuple1.getFields(), spanList, returnSchema);
    resultList.add(returnTuple);
    return resultList;
}
Also used : Attribute(edu.uci.ics.textdb.api.schema.Attribute) Schema(edu.uci.ics.textdb.api.schema.Schema) ArrayList(java.util.ArrayList) TextField(edu.uci.ics.textdb.api.field.TextField) IField(edu.uci.ics.textdb.api.field.IField) Span(edu.uci.ics.textdb.api.span.Span)

Aggregations

IField (edu.uci.ics.textdb.api.field.IField)140 ArrayList (java.util.ArrayList)110 TextField (edu.uci.ics.textdb.api.field.TextField)105 Tuple (edu.uci.ics.textdb.api.tuple.Tuple)102 Schema (edu.uci.ics.textdb.api.schema.Schema)90 Span (edu.uci.ics.textdb.api.span.Span)85 StringField (edu.uci.ics.textdb.api.field.StringField)84 Attribute (edu.uci.ics.textdb.api.schema.Attribute)84 Test (org.junit.Test)84 IntegerField (edu.uci.ics.textdb.api.field.IntegerField)80 DoubleField (edu.uci.ics.textdb.api.field.DoubleField)68 DateField (edu.uci.ics.textdb.api.field.DateField)64 SimpleDateFormat (java.text.SimpleDateFormat)63 Dictionary (edu.uci.ics.textdb.exp.dictionarymatcher.Dictionary)24 ListField (edu.uci.ics.textdb.api.field.ListField)16 JoinDistancePredicate (edu.uci.ics.textdb.exp.join.JoinDistancePredicate)9 KeywordMatcherSourceOperator (edu.uci.ics.textdb.exp.keywordmatcher.KeywordMatcherSourceOperator)9 AttributeType (edu.uci.ics.textdb.api.schema.AttributeType)5 IOperator (edu.uci.ics.textdb.api.dataflow.IOperator)4 StorageException (edu.uci.ics.textdb.api.exception.StorageException)4