@Test public void testGetEntityTypes() throws Exception { String text = "America is a big country."; System.setProperty(NamedEntityParser.SYS_PROP_NER_IMPL, NLTKNERecogniser.class.getName()); Tika tika = new Tika(new TikaConfig(NamedEntityParser.class.getResourceAsStream("tika-config.xml"))); Metadata md = new Metadata(); tika.parse(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), md); Set<String> names = new HashSet<>(Arrays.asList(md.getValues("NER_NAMES"))); if(names.size() != 0) { assertTrue(names.contains("America")); assertTrue(names.size() == 1); } }
public Set<String> getEntityTypes() { return ENTITY_TYPES; }
NLTKNERecogniser implements NERecogniser { public Set<String> getEntityTypes() { return ENTITY_TYPES; } }
NLTKNERecogniser implements NERecogniser { public Set<String> getEntityTypes() { return ENTITY_TYPES; } NLTKNERecogniser(); }
NLTKNERecogniser implements NERecogniser { public Set<String> getEntityTypes() { return ENTITY_TYPES; } NLTKNERecogniser(); boolean isAvailable(); Set<String> getEntityTypes(); Map<String, Set<String>> recognise(String text); }
NLTKNERecogniser implements NERecogniser { public Set<String> getEntityTypes() { return ENTITY_TYPES; } NLTKNERecogniser(); boolean isAvailable(); Set<String> getEntityTypes(); Map<String, Set<String>> recognise(String text); static final Set<String> ENTITY_TYPES; }