private void initAutomataWithCustomHeader(String body, boolean allowMatchingEmptySequences, String header) {
try {
body = header + body;
CharStream input = CharStreams.fromString(body);
UimaTokenRegexParser parser = initListenerAndGetParser(input, new URL("file://dynamic.text"));
parser.removeErrorListeners();
parser.addErrorListener(new ThrowingErrorListener(new URL("file://dynamic.text")));
listener.setAllowMatchingEmptySequences(allowMatchingEmptySequences);
ParseTreeWalker.DEFAULT.walk(listener, parser.ruleList());
this.rules = listener.getRules();
} catch(MalformedURLException e) {
throw new RuntimeException(e);
}
}
AutomatonParserSpec.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:uima-tokens-regex
作者:
评论列表
文章目录