use of org.corpus_tools.annis.gui.flatquerybuilder.SpanBox in project ANNIS by korpling.
the class FlatQueryBuilderTest method twoTokenInSentence.
@Test
void twoTokenInSentence() throws InterruptedException {
initQueryBuilder(0);
// Add a two tokens
queryBuilder.addLinguisticSequenceBox("tok");
queryBuilder.addLinguisticSequenceBox("tok");
List<SearchBox> searchBoxes = _find(queryBuilder, SearchBox.class);
assertEquals(2, searchBoxes.size());
_get(searchBoxes.get(0), ComboBox.class).setValue("Feigenblatt");
_get(searchBoxes.get(1), ComboBox.class).setValue("Die");
// Add a scope
queryBuilder.addSpanBox("Sent");
SpanBox spanBox = _get(queryBuilder, SpanBox.class);
_get(spanBox, ComboBox.class).setValue("s");
// Create the AQL query
_click(_get(queryBuilder, Button.class, spec -> spec.withCaption("Create AQL Query")));
assertEquals("tok=/Feigenblatt/ & tok=/Die/\n& Sent = \"s\"\n& #1 . #2\n" + "& #3_i_#1\n" + "& #3_i_#2", ui.getQueryState().getAql().getValue());
}
use of org.corpus_tools.annis.gui.flatquerybuilder.SpanBox in project ANNIS by korpling.
the class FlatQueryBuilderTest method regularExpressionScope.
@Test
void regularExpressionScope() {
initQueryBuilder(0);
// Add a token
queryBuilder.addLinguisticSequenceBox("tok");
_get(queryBuilder, SearchBox.class).setValue("Feigenblatt");
// Add a scope and add a regular expression as value
queryBuilder.addSpanBox("Sent");
SpanBox spanBox = _get(queryBuilder, SpanBox.class);
// Set first to regex mode (so the value is not escaped)
_get(spanBox, CheckBox.class).setValue(true);
spanBox.setValue(".*");
// Create the AQL query
_click(_get(queryBuilder, Button.class, spec -> spec.withCaption("Create AQL Query")));
assertEquals("tok=/Feigenblatt/\n& Sent = /.*/\n& #2_i_#1", ui.getQueryState().getAql().getValue());
}
Aggregations