use of org.apache.stanbol.entityhub.indexing.core.EntityIterator.EntityScore in project stanbol by apache.
the class EntityIneratorToScoreProviderAdapter method initialise.
@Override
public void initialise() {
//initialise the source entity iterator
if (entityIterator.needsInitialisation()) {
entityIterator.initialise();
}
//initialise this instace
Map<String, Float> entityScoreMap = new HashMap<String, Float>();
while (entityIterator.hasNext()) {
EntityScore entityScore = entityIterator.next();
entityScoreMap.put(entityScore.id, entityScore.score);
}
//close the source because it is no longer needed!
entityIterator.close();
provider = new MapEntityScoreProvider(entityScoreMap);
//initialise the wrapped score provider
if (provider.needsInitialisation()) {
provider.initialise();
}
}
Aggregations