Java Code Examples for gnu.trove.map.hash.TObjectIntHashMap#iterator()
The following examples show how to use
gnu.trove.map.hash.TObjectIntHashMap#iterator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityLinkingManager.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static Entities getEntities(Set<KBIdentifiedEntity> kbEntities) throws EntityLinkingDataAccessException { TObjectIntHashMap<KBIdentifiedEntity> ids = DataAccess.getInternalIdsForKBEntities(kbEntities); Entities entities = new Entities(); for (TObjectIntIterator<KBIdentifiedEntity> itr = ids.iterator(); itr.hasNext(); ) { itr.advance(); entities.add(new Entity(itr.key(), itr.value())); } return entities; }
Example 2
Source File: DataAccess.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static Entities getAidaEntitiesForKBEntities(Set<KBIdentifiedEntity> entities) throws EntityLinkingDataAccessException { TObjectIntHashMap<KBIdentifiedEntity> kbEntities = DataAccess.getInternalIdsForKBEntities(entities); Entities aidaEntities = new Entities(); for (TObjectIntIterator<KBIdentifiedEntity> itr = kbEntities.iterator(); itr.hasNext(); ) { itr.advance(); aidaEntities.add(new Entity(itr.key(), itr.value())); } return aidaEntities; }
Example 3
Source File: DataAccess.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static Map<KBIdentifiedEntity, EntityMetaData> getEntitiesMetaData(Set<KBIdentifiedEntity> entities) throws EntityLinkingDataAccessException { TObjectIntHashMap<KBIdentifiedEntity> ids = getInternalIdsForKBEntities(entities); TIntObjectHashMap<EntityMetaData> metadata = getEntitiesMetaData(ids.values()); Map<KBIdentifiedEntity, EntityMetaData> result = new HashMap<KBIdentifiedEntity, EntityMetaData>(); for (TObjectIntIterator<KBIdentifiedEntity> itr = ids.iterator(); itr.hasNext(); ) { itr.advance(); int id = itr.value(); result.put(itr.key(), metadata.get(id)); } return result; }
Example 4
Source File: DataAccessSQL.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
@Override public Entities getAllEntities() throws EntityLinkingDataAccessException { TObjectIntHashMap<KBIdentifiedEntity> entityIds = getAllEntityIds(); Entities entities = new Entities(); for (TObjectIntIterator<KBIdentifiedEntity> itr = entityIds.iterator(); itr.hasNext(); ) { itr.advance(); entities.add(new Entity(itr.key(), itr.value())); } return entities; }
Example 5
Source File: DataAccessSQL.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
@Override public Entities getAllEntities(boolean isNamedEntity) throws EntityLinkingDataAccessException { TObjectIntHashMap<KBIdentifiedEntity> entityIds = getAllEntityIds(isNamedEntity); Entities entities = new Entities(); for (TObjectIntIterator<KBIdentifiedEntity> itr = entityIds.iterator(); itr.hasNext(); ) { itr.advance(); entities.add(new Entity(itr.key(), itr.value())); } return entities; }
Example 6
Source File: KeyphrasesMeasureTracer.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static TIntObjectHashMap<String> getAllWordIds() throws EntityLinkingDataAccessException { TObjectIntHashMap<String> wordIds = DataAccess.getAllWordIds(); TIntObjectHashMap<String> idWords = new TIntObjectHashMap<String>(wordIds.size()); for (TObjectIntIterator<String> itr = wordIds.iterator(); itr.hasNext(); ) { itr.advance(); idWords.put(itr.value(), itr.key()); } return idWords; }
Example 7
Source File: KeytermEntityEntityMeasureTracer.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static TIntObjectHashMap<String> getAllWordIds() throws EntityLinkingDataAccessException { TObjectIntHashMap<String> wordIds = DataAccess.getAllWordIds(); TIntObjectHashMap<String> idWords = new TIntObjectHashMap<String>(wordIds.size()); for (TObjectIntIterator<String> itr = wordIds.iterator(); itr.hasNext(); ) { itr.advance(); idWords.put(itr.value(), itr.key()); } return idWords; }
Example 8
Source File: UnitMeasureTracer.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static TIntObjectHashMap<String> getAllWordIds() throws EntityLinkingDataAccessException { TObjectIntHashMap<String> wordIds = DataAccess.getAllWordIds(); TIntObjectHashMap<String> idWords = new TIntObjectHashMap<>(wordIds.size()); for (TObjectIntIterator<String> itr = wordIds.iterator(); itr.hasNext(); ) { itr.advance(); idWords.put(itr.value(), itr.key()); } return idWords; }
Example 9
Source File: FileUtils.java From ambiverse-nlu with Apache License 2.0 | 5 votes |
public static <T> void writeTObjectIntMapToFile(File file, TObjectIntHashMap<T> map) throws IOException { BufferedWriter writer = getBufferedUTF8Writer(file); for (TObjectIntIterator<T> itr = map.iterator(); itr.hasNext(); ) { itr.advance(); writer.write(itr.key() + "\t" + itr.value()); writer.newLine(); } writer.flush(); writer.close(); }