@Test public void addTypesIfTaxonomyDeclared() { Collection<Object> taxonomy = new ArrayList<>(); taxonomy.add("Person"); OdinConfigurationProcessor ruleProcessor = new OdinConfigurationProcessor(taxonomy, "taxonomy:\n- Entity\n\nrules:"); String processedRules = ruleProcessor.process(); assertTrue(processedRules.contains("- Entity")); assertTrue(processedRules.contains("- Person")); assertTrue(processedRules.contains("- name: ner-person")); }
public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); String process(); }
OdinConfigurationProcessor { public String process() { Object loaded = yaml.load(configuration); Map<String, Object> map; if (loaded instanceof Map<?, ?>) { map = (Map<String, Object>) loaded; } else { map = new LinkedHashMap<>(); } addTaxonomy(map); addEntityRules(map); return yaml.dump(map); } OdinConfigurationProcessor(Collection<Object> taxonomy, String configuration); String process();  }