@Test public void testSelect() throws Exception { String document = "Some text."; CAS cas = RutaTestUtils.getCAS(document); JCas jcas = cas.getJCas(); List<Annotation> select1 = Ruta.select(jcas, "W{REGEXP(\"t.*\")};"); Assert.assertEquals(1, select1.size()); Assert.assertEquals("text", select1.get(0).getCoveredText()); List<Annotation> select2 = Ruta.select(jcas, "Document<-{ANY @PERIOD;};"); Assert.assertEquals(1, select2.size()); Assert.assertEquals("Some text.", select2.get(0).getCoveredText()); List<Annotation> select3 = Ruta.select(jcas, "ANY @ANY;"); Assert.assertEquals(2, select3.size()); Assert.assertEquals("Some text", select3.get(0).getCoveredText()); Assert.assertEquals("text.", select3.get(1).getCoveredText()); }
public static List<Annotation> select(JCas jcas, String rule, Object... configurationData) throws AnalysisEngineProcessException, ResourceInitializationException { Object[] config = ArrayUtils.addAll(configurationData, RutaEngine.PARAM_DEBUG, true, RutaEngine.PARAM_DEBUG_WITH_MATCHES, true); applyRule(jcas, rule, config); List<Annotation> ruleMatches = getRuleMatches(jcas); removeDebugInformation(jcas); return ruleMatches; }
Ruta { public static List<Annotation> select(JCas jcas, String rule, Object... configurationData) throws AnalysisEngineProcessException, ResourceInitializationException { Object[] config = ArrayUtils.addAll(configurationData, RutaEngine.PARAM_DEBUG, true, RutaEngine.PARAM_DEBUG_WITH_MATCHES, true); applyRule(jcas, rule, config); List<Annotation> ruleMatches = getRuleMatches(jcas); removeDebugInformation(jcas); return ruleMatches; } }
Ruta { public static List<Annotation> select(JCas jcas, String rule, Object... configurationData) throws AnalysisEngineProcessException, ResourceInitializationException { Object[] config = ArrayUtils.addAll(configurationData, RutaEngine.PARAM_DEBUG, true, RutaEngine.PARAM_DEBUG_WITH_MATCHES, true); applyRule(jcas, rule, config); List<Annotation> ruleMatches = getRuleMatches(jcas); removeDebugInformation(jcas); return ruleMatches; }  }
Ruta { public static List<Annotation> select(JCas jcas, String rule, Object... configurationData) throws AnalysisEngineProcessException, ResourceInitializationException { Object[] config = ArrayUtils.addAll(configurationData, RutaEngine.PARAM_DEBUG, true, RutaEngine.PARAM_DEBUG_WITH_MATCHES, true); applyRule(jcas, rule, config); List<Annotation> ruleMatches = getRuleMatches(jcas); removeDebugInformation(jcas); return ruleMatches; }  static void applyRule(JCas jcas, String rule, Object... configurationData); static void apply(CAS cas, String script, Map<String, Object> parameters); static void apply(CAS cas, String script); static void removeDebugInformation(JCas jcas); static String inject(String script, String placeholder, int[] addresses); static String inject(String script, FeatureStructureImpl... annotations); static List<Annotation> select(JCas jcas, String rule, Object... configurationData); static boolean matches(JCas jcas, String rule, Object... configurationData); static AnalysisEngine wrapAnalysisEngine(URL descriptorUrl, String viewName,
          ResourceManager resourceManager); static AnalysisEngine wrapAnalysisEngine(URL descriptorUrl, String viewName,
          boolean rutaEngine, String encoding, ResourceManager resourceManager); @Deprecated static AnalysisEngineDescription createAnalysisEngineDescription(String script); @Deprecated static AnalysisEngineDescription createAnalysisEngineDescription(String script,
          TypeSystemDescription... tsds); }
Ruta { public static List<Annotation> select(JCas jcas, String rule, Object... configurationData) throws AnalysisEngineProcessException, ResourceInitializationException { Object[] config = ArrayUtils.addAll(configurationData, RutaEngine.PARAM_DEBUG, true, RutaEngine.PARAM_DEBUG_WITH_MATCHES, true); applyRule(jcas, rule, config); List<Annotation> ruleMatches = getRuleMatches(jcas); removeDebugInformation(jcas); return ruleMatches; }  static void applyRule(JCas jcas, String rule, Object... configurationData); static void apply(CAS cas, String script, Map<String, Object> parameters); static void apply(CAS cas, String script); static void removeDebugInformation(JCas jcas); static String inject(String script, String placeholder, int[] addresses); static String inject(String script, FeatureStructureImpl... annotations); static List<Annotation> select(JCas jcas, String rule, Object... configurationData); static boolean matches(JCas jcas, String rule, Object... configurationData); static AnalysisEngine wrapAnalysisEngine(URL descriptorUrl, String viewName,
          ResourceManager resourceManager); static AnalysisEngine wrapAnalysisEngine(URL descriptorUrl, String viewName,
          boolean rutaEngine, String encoding, ResourceManager resourceManager); @Deprecated static AnalysisEngineDescription createAnalysisEngineDescription(String script); @Deprecated static AnalysisEngineDescription createAnalysisEngineDescription(String script,
          TypeSystemDescription... tsds);  }