Search in sources :

Example 1 with LabledRegexNoQualifierProcessor

use of edu.uci.ics.texera.dataflow.regexmatcher.label.LabledRegexNoQualifierProcessor in project textdb by TextDB.

the class RegexMatcher method setUp.

@Override
protected void setUp() throws DataflowException {
    if (inputOperator == null) {
        throw new DataflowException(ErrorMessages.INPUT_OPERATOR_NOT_SPECIFIED);
    }
    Schema inputSchema = inputOperator.getOutputSchema();
    this.addResultAttribute = predicate.getSpanListName() != null;
    Schema.checkAttributeExists(inputSchema, predicate.getAttributeNames());
    if (addResultAttribute) {
        Schema.checkAttributeNotExists(inputSchema, predicate.getSpanListName());
    }
    Schema.Builder outputSchemaBuilder = new Schema.Builder(inputOperator.getOutputSchema());
    if (addResultAttribute) {
        outputSchemaBuilder.add(predicate.getSpanListName(), AttributeType.LIST);
    }
    outputSchema = outputSchemaBuilder.build();
    findRegexType();
    // Check if labeled or unlabeled
    if (this.regexType == RegexType.NO_LABELS) {
        regexPattern = predicate.isIgnoreCase() ? Pattern.compile(predicate.getRegex(), Pattern.CASE_INSENSITIVE) : Pattern.compile(predicate.getRegex());
    } else if (this.regexType == RegexType.LABELED_WITH_QUALIFIERS) {
        labeledRegexProcessor = new LabeledRegexProcessor(predicate);
    } else {
        labledRegexNoQualifierProcessor = new LabledRegexNoQualifierProcessor(predicate);
    }
}
Also used : LabeledRegexProcessor(edu.uci.ics.texera.dataflow.regexmatcher.label.LabeledRegexProcessor) LabledRegexNoQualifierProcessor(edu.uci.ics.texera.dataflow.regexmatcher.label.LabledRegexNoQualifierProcessor) Schema(edu.uci.ics.texera.api.schema.Schema) DataflowException(edu.uci.ics.texera.api.exception.DataflowException)

Aggregations

DataflowException (edu.uci.ics.texera.api.exception.DataflowException)1 Schema (edu.uci.ics.texera.api.schema.Schema)1 LabeledRegexProcessor (edu.uci.ics.texera.dataflow.regexmatcher.label.LabeledRegexProcessor)1 LabledRegexNoQualifierProcessor (edu.uci.ics.texera.dataflow.regexmatcher.label.LabledRegexNoQualifierProcessor)1