Search in sources :

Example 1 with Condition

use of de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition in project webanno by webanno.

the class ConditionVisitorTest method test.

@Test
public void test() throws Exception {
    ConstraintsGrammar parser = new ConstraintsGrammar(new FileInputStream("src/test/resources/rules/6.rules"));
    Parse p = parser.Parse();
    List<Condition> conditions = new ArrayList<>();
    p.accept(new ConditionVisitor(), conditions);
    for (Condition cond : conditions) {
        System.out.printf("%s %n", cond);
    }
}
Also used : Condition(de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition) Parse(de.tudarmstadt.ukp.clarin.webanno.constraints.grammar.syntaxtree.Parse) ArrayList(java.util.ArrayList) ConstraintsGrammar(de.tudarmstadt.ukp.clarin.webanno.constraints.grammar.ConstraintsGrammar) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Example 2 with Condition

use of de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition in project webanno by webanno.

the class ConditionVisitor method visit.

@Override
public void visit(de.tudarmstadt.ukp.clarin.webanno.constraints.grammar.syntaxtree.Condition aN, List<Condition> aArgu) {
    path = null;
    value = QuoteUtil.unquote(aN.f2.tokenImage);
    super.visit(aN, aArgu);
    aArgu.add(new Condition(path, value));
}
Also used : Condition(de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition)

Example 3 with Condition

use of de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition in project webanno by webanno.

the class RuleVisitor method visit.

@Override
public void visit(RuleDeclaration aN, List<Rule> aArgu) {
    List<Condition> conditions = new ArrayList<>();
    List<Restriction> restrictions = new ArrayList<>();
    // super.visit(aN, aArgu);
    aN.accept(new ConditionVisitor(), conditions);
    aN.accept(new RestrictionVisitor(), restrictions);
    aArgu.add(new Rule(conditions, restrictions));
}
Also used : Condition(de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition) Restriction(de.tudarmstadt.ukp.clarin.webanno.constraints.model.Restriction) ArrayList(java.util.ArrayList) Rule(de.tudarmstadt.ukp.clarin.webanno.constraints.model.Rule)

Aggregations

Condition (de.tudarmstadt.ukp.clarin.webanno.constraints.model.Condition)3 ArrayList (java.util.ArrayList)2 ConstraintsGrammar (de.tudarmstadt.ukp.clarin.webanno.constraints.grammar.ConstraintsGrammar)1 Parse (de.tudarmstadt.ukp.clarin.webanno.constraints.grammar.syntaxtree.Parse)1 Restriction (de.tudarmstadt.ukp.clarin.webanno.constraints.model.Restriction)1 Rule (de.tudarmstadt.ukp.clarin.webanno.constraints.model.Rule)1 FileInputStream (java.io.FileInputStream)1 Test (org.junit.Test)1