use of edu.uci.ics.textdb.exp.nlp.entity.NlpEntityPredicate in project textdb by TextDB.
the class NlpExtractorPerformanceTest method matchNLP.
/*
* This function does match based on tokenType
*/
public static void matchNLP(String tableName, NlpEntityType tokenType) throws Exception {
List<String> attributeNames = Arrays.asList(MedlineIndexWriter.ABSTRACT);
ISourceOperator sourceOperator = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
NlpEntityPredicate nlpEntityPredicate = new NlpEntityPredicate(tokenType, attributeNames, null);
NlpEntityOperator nlpEntityOperator = new NlpEntityOperator(nlpEntityPredicate);
nlpEntityOperator.setInputOperator(sourceOperator);
long startMatchTime = System.currentTimeMillis();
nlpEntityOperator.open();
Tuple nextTuple = null;
int counter = 0;
while ((nextTuple = nlpEntityOperator.getNextTuple()) != null) {
ListField<Span> spanListField = nextTuple.getField(SchemaConstants.SPAN_LIST);
List<Span> spanList = spanListField.getValue();
counter += spanList.size();
}
nlpEntityOperator.close();
long endMatchTime = System.currentTimeMillis();
double matchTime = (endMatchTime - startMatchTime) / 1000.0;
totalMatchingTime += matchTime;
totalResults += counter;
}
use of edu.uci.ics.textdb.exp.nlp.entity.NlpEntityPredicate in project textdb by TextDB.
the class PredicateBaseTest method testNlpEntity.
@Test
public void testNlpEntity() throws Exception {
NlpEntityPredicate nlpEntityPredicate = new NlpEntityPredicate(NlpEntityType.LOCATION, attributeNames, "nlpEntityResults");
testPredicate(nlpEntityPredicate);
}
Aggregations