use of edu.uci.ics.texera.dataflow.fuzzytokenmatcher.FuzzyTokenPredicate in project textdb by TextDB.
the class PredicateBaseTest method testFuzzyToken.
@Test
public void testFuzzyToken() throws Exception {
FuzzyTokenPredicate fuzzyTokenPredicate = new FuzzyTokenPredicate("token1 token2 token3", attributeNames, "standard", 0.8, "spanListName");
testPredicate(fuzzyTokenPredicate);
FuzzyTokenSourcePredicate fuzzyTokenSourcePredicate = new FuzzyTokenSourcePredicate("token1 token2 token3", attributeNames, "standard", 0.8, "tableName", "spanListName");
testPredicate(fuzzyTokenSourcePredicate);
}
use of edu.uci.ics.texera.dataflow.fuzzytokenmatcher.FuzzyTokenPredicate in project textdb by TextDB.
the class FuzzyTokenMatcherTestHelper method getScanSourceResults.
/*
* Gets the query results by scanning the table and passing the data into a FuzzyTokenMatcher.
*/
public static List<Tuple> getScanSourceResults(String tableName, String query, double threshold, List<String> attributeNames, int limit, int offset) throws TexeraException {
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
FuzzyTokenPredicate fuzzyTokenPredicate = new FuzzyTokenPredicate(query, attributeNames, RelationManager.getInstance().getTableAnalyzerString(tableName), threshold, RESULTS);
FuzzyTokenMatcher fuzzyTokenMatcher = new FuzzyTokenMatcher(fuzzyTokenPredicate);
fuzzyTokenMatcher.setLimit(limit);
fuzzyTokenMatcher.setOffset(offset);
fuzzyTokenMatcher.setInputOperator(scanSource);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
fuzzyTokenMatcher.open();
while ((tuple = fuzzyTokenMatcher.getNextTuple()) != null) {
results.add(tuple);
}
fuzzyTokenMatcher.close();
return results;
}
Aggregations