private static Pattern untokenizedParenPattern1 = Pattern.compile("([^ ])([({)}])");
private static Pattern untokenizedParenPattern2 = Pattern.compile("([({)}])([^ ])");
public static ParserME getParser(String dataDir, boolean useTagDictionary, boolean useCaseSensitiveTagDictionary, int beamSize, double advancePercentage) throws IOException {
if (useTagDictionary) {
return new ParserME(
new SuffixSensitiveGISModelReader(new File(dataDir + "/build.bin.gz")).getModel(),
new SuffixSensitiveGISModelReader(new File(dataDir + "/check.bin.gz")).getModel(),
new ParserTagger(dataDir + "/tag.bin.gz", dataDir + "/tagdict", useCaseSensitiveTagDictionary ),//, new Dictionary(dataDir+"/dict.bin.gz")),
new ParserChunker(dataDir + "/chunk.bin.gz"),
new HeadRules(dataDir + "/head_rules"),beamSize,advancePercentage);
}
else {
return new ParserME(
new SuffixSensitiveGISModelReader(new File(dataDir + "/build.bin.gz")).getModel(),
new SuffixSensitiveGISModelReader(new File(dataDir + "/check.bin.gz")).getModel(),
new ParserTagger(dataDir + "/tag.bin.gz",null), //new Dictionary(dataDir+"/dict.bin.gz")),
new ParserChunker(dataDir + "/chunk.bin.gz"),
new HeadRules(dataDir + "/head_rules"),beamSize,advancePercentage);
}
}