### Question:
NerDataSet { public static NerDataSet load(Path path, AnnotationStyle style) throws IOException { switch (style) { case BRACKET: return loadBracketStyle(path); case ENAMEX: return loadEnamexStyle(path); case OPEN_NLP: return loadOpenNlpStyle(path); } throw new IOException(String.format("Cannot load data from %s with style %s", path, style)); } NerDataSet(List<NerSentence> sentences); List<NerSentence> getSentences(); void shuffle(); static NerDataSet load(Path path, AnnotationStyle style); static String normalizeForNer(String input); void addSet(NerDataSet set); NerDataSet getSubSet(int from, int to); String info(); static final String OUT_TOKEN_TYPE; }### Answer:
@Test public void testOpenNlpStyle() throws IOException { Path p = TestUtil.tempFileWithData( "<Start:ABC> Foo Bar <End> ivir zivir <Start:DEF> haha <End> . "); NerDataSet set = NerDataSet.load(p, AnnotationStyle.OPEN_NLP); System.out.println("types= " + set.types); Assert.assertTrue(TestUtil.containsAll(set.types, "ABC", "DEF", "OUT")); }
@Test public void testBracketStyle() throws IOException { Path p = TestUtil.tempFileWithData( "[ABC Foo Bar] ivir zivir [DEF haha] . "); NerDataSet set = NerDataSet.load(p, AnnotationStyle.BRACKET); System.out.println("types= " + set.types); Assert.assertTrue(TestUtil.containsAll(set.types, "ABC", "DEF", "OUT")); }