@Test public void test() { String test = "Hello acetone world!"; Oscar4TextAnalyser oa = new Oscar4TextAnalyser(); SolrRecord solr = SolrRecordFactory.createFactory(null).createRecord(); oa.analyse(test, solr); Collection<Object> results = solr .getField(SolrFields.SOLR_TIKA_METADATA_LIST) .getValues(); assertTrue("Cannot find expected value.", results .contains("OSCAR4:MATCH:acetone")); assertTrue("Cannot find expected value.", results .contains("OSCAR4:STD_INCHI:InChI=1S/C3H6O/c1-3(2)4/h1-2H3")); }
@Override public void analyse(String text, SolrRecord solr) { List<ResolvedNamedEntity> entities = oscar .findAndResolveNamedEntities(text); Set<String> uniqueEntities = new HashSet<String>(); for (ResolvedNamedEntity ne : entities) { uniqueEntities.add("OSCAR4:MATCH:" + ne.getSurface()); ChemicalStructure stdInchi = ne .getFirstChemicalStructure(FormatType.STD_INCHI); if (stdInchi != null) { uniqueEntities.add("OSCAR4:" + stdInchi.getType() + ":" + stdInchi.getValue()); } } for (String ent : uniqueEntities) { solr.addField(SolrFields.SOLR_TIKA_METADATA_LIST, ent); } }
Oscar4TextAnalyser extends AbstractTextAnalyser { @Override public void analyse(String text, SolrRecord solr) { List<ResolvedNamedEntity> entities = oscar .findAndResolveNamedEntities(text); Set<String> uniqueEntities = new HashSet<String>(); for (ResolvedNamedEntity ne : entities) { uniqueEntities.add("OSCAR4:MATCH:" + ne.getSurface()); ChemicalStructure stdInchi = ne .getFirstChemicalStructure(FormatType.STD_INCHI); if (stdInchi != null) { uniqueEntities.add("OSCAR4:" + stdInchi.getType() + ":" + stdInchi.getValue()); } } for (String ent : uniqueEntities) { solr.addField(SolrFields.SOLR_TIKA_METADATA_LIST, ent); } } }
Oscar4TextAnalyser extends AbstractTextAnalyser { @Override public void analyse(String text, SolrRecord solr) { List<ResolvedNamedEntity> entities = oscar .findAndResolveNamedEntities(text); Set<String> uniqueEntities = new HashSet<String>(); for (ResolvedNamedEntity ne : entities) { uniqueEntities.add("OSCAR4:MATCH:" + ne.getSurface()); ChemicalStructure stdInchi = ne .getFirstChemicalStructure(FormatType.STD_INCHI); if (stdInchi != null) { uniqueEntities.add("OSCAR4:" + stdInchi.getType() + ":" + stdInchi.getValue()); } } for (String ent : uniqueEntities) { solr.addField(SolrFields.SOLR_TIKA_METADATA_LIST, ent); } }  }
Oscar4TextAnalyser extends AbstractTextAnalyser { @Override public void analyse(String text, SolrRecord solr) { List<ResolvedNamedEntity> entities = oscar .findAndResolveNamedEntities(text); Set<String> uniqueEntities = new HashSet<String>(); for (ResolvedNamedEntity ne : entities) { uniqueEntities.add("OSCAR4:MATCH:" + ne.getSurface()); ChemicalStructure stdInchi = ne .getFirstChemicalStructure(FormatType.STD_INCHI); if (stdInchi != null) { uniqueEntities.add("OSCAR4:" + stdInchi.getType() + ":" + stdInchi.getValue()); } } for (String ent : uniqueEntities) { solr.addField(SolrFields.SOLR_TIKA_METADATA_LIST, ent); } }  @Override void configure(Config conf); @Override void analyse(String text, SolrRecord solr); }
Oscar4TextAnalyser extends AbstractTextAnalyser { @Override public void analyse(String text, SolrRecord solr) { List<ResolvedNamedEntity> entities = oscar .findAndResolveNamedEntities(text); Set<String> uniqueEntities = new HashSet<String>(); for (ResolvedNamedEntity ne : entities) { uniqueEntities.add("OSCAR4:MATCH:" + ne.getSurface()); ChemicalStructure stdInchi = ne .getFirstChemicalStructure(FormatType.STD_INCHI); if (stdInchi != null) { uniqueEntities.add("OSCAR4:" + stdInchi.getType() + ":" + stdInchi.getValue()); } } for (String ent : uniqueEntities) { solr.addField(SolrFields.SOLR_TIKA_METADATA_LIST, ent); } }  @Override void configure(Config conf); @Override void analyse(String text, SolrRecord solr);  }