it.unimi.dsi.fastutil.objects.ObjectSet Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.objects.ObjectSet.
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: MultipleBlendingRetriever.java From samantha with MIT License | 6 votes |
public RetrievedResult retrieve(RequestContext requestContext) { ObjectSet<String> items = new ObjectOpenHashSet<>(); List<ObjectNode> entities = new ArrayList<>(maxHits); for (Retriever retriever : retrievers) { long start = System.currentTimeMillis(); RetrievedResult results = retriever.retrieve(requestContext); Logger.debug("{} time: {}", retriever, System.currentTimeMillis() - start); List<ObjectNode> initial = results.getEntityList(); initial = ExpanderUtilities.expand(initial, expanders, requestContext); for (ObjectNode entity : initial) { String item = FeatureExtractorUtilities.composeConcatenatedKey(entity, itemAttrs); if (!items.contains(item)) { items.add(item); entities.add(entity); if (maxHits != null && entities.size() >= maxHits) { return new RetrievedResult(entities, maxHits); } } } } return new RetrievedResult(entities, entities.size()); }
Example #2
Source File: KnnModelTrigger.java From samantha with MIT License | 6 votes |
public List<ObjectNode> getTriggeredFeaturesWithoutScore(List<ObjectNode> bases) { ObjectSet<String> items = new ObjectOpenHashSet<>(); for (ObjectNode inter : bases) { double weight = 1.0; if (inter.has(weightAttr)) { weight = inter.get(weightAttr).asDouble(); } String key = FeatureExtractorUtilities.composeConcatenatedKey(inter, feaAttrs); if (weight >= 0.5 && featureKnnModel != null) { getNeighbors(items, featureKnnModel, key); } if (weight < 0.5 && featureKdnModel != null) { getNeighbors(items, featureKdnModel, key); } } List<ObjectNode> results = new ArrayList<>(); for (String item : items) { ObjectNode entity = Json.newObject(); Map<String, String> attrVals = FeatureExtractorUtilities.decomposeKey(item); for (Map.Entry<String, String> ent : attrVals.entrySet()) { entity.put(ent.getKey(), ent.getValue()); } results.add(entity); } return results; }
Example #3
Source File: Fastutil.java From incubator-hivemall with Apache License 2.0 | 5 votes |
@Nonnull public static ObjectIterable<Int2LongMap.Entry> fastIterable(@Nonnull final Int2LongMap map) { final ObjectSet<Int2LongMap.Entry> entries = map.int2LongEntrySet(); return entries instanceof Int2LongMap.FastEntrySet ? new ObjectIterable<Int2LongMap.Entry>() { public ObjectIterator<Int2LongMap.Entry> iterator() { return ((Int2LongMap.FastEntrySet) entries).fastIterator(); } } : entries; }
Example #4
Source File: Fastutil.java From incubator-hivemall with Apache License 2.0 | 5 votes |
@Nonnull public static ObjectIterable<Int2FloatMap.Entry> fastIterable(@Nonnull final Int2FloatMap map) { final ObjectSet<Int2FloatMap.Entry> entries = map.int2FloatEntrySet(); return entries instanceof Int2FloatMap.FastEntrySet ? new ObjectIterable<Int2FloatMap.Entry>() { public ObjectIterator<Int2FloatMap.Entry> iterator() { return ((Int2FloatMap.FastEntrySet) entries).fastIterator(); } } : entries; }
Example #5
Source File: Fastutil.java From incubator-hivemall with Apache License 2.0 | 5 votes |
@Nonnull public static <V> ObjectIterable<Int2ObjectMap.Entry<V>> fastIterable( @Nonnull final Int2ObjectMap<V> map) { final ObjectSet<Int2ObjectMap.Entry<V>> entries = map.int2ObjectEntrySet(); return entries instanceof Int2ObjectMap.FastEntrySet ? new ObjectIterable<Int2ObjectMap.Entry<V>>() { public ObjectIterator<Int2ObjectMap.Entry<V>> iterator() { return ((Int2ObjectMap.FastEntrySet<V>) entries).fastIterator(); } } : entries; }
Example #6
Source File: Fastutil.java From incubator-hivemall with Apache License 2.0 | 5 votes |
@Nonnull public static <K, V> ObjectIterable<Object2ObjectMap.Entry<K, V>> fastIterable( @Nonnull final Object2ObjectMap<K, V> map) { final ObjectSet<Object2ObjectMap.Entry<K, V>> entries = map.object2ObjectEntrySet(); return entries instanceof Object2ObjectMap.FastEntrySet ? new ObjectIterable<Object2ObjectMap.Entry<K, V>>() { @SuppressWarnings("unchecked") public ObjectIterator<Object2ObjectMap.Entry<K, V>> iterator() { return ((Object2ObjectMap.FastEntrySet<K, V>) entries).fastIterator(); } } : entries; }
Example #7
Source File: KnnModelTrigger.java From samantha with MIT License | 5 votes |
private void getNeighbors(ObjectSet<String> items, IndexedVectorModel knnModel, String key) { if (knnModel.hasKey(key)) { RealVector sims = knnModel.getKeyVector(key); for (int i=0; i<sims.getDimension(); i+=2) { int idx = (int)sims.getEntry(i); String recItem = knnModel.getKeyByIndex(idx); items.add(recItem); } } }
Example #8
Source File: Int2IntBiMap.java From ViaVersion with MIT License | 4 votes |
@Override public ObjectSet<Entry> int2IntEntrySet() { return map.int2IntEntrySet(); }
Example #9
Source File: ShortDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Short2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.short2ObjectEntrySet(); }
Example #10
Source File: IntDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Int2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.int2ObjectEntrySet(); }
Example #11
Source File: ByteDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Byte2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.byte2ObjectEntrySet(); }
Example #12
Source File: ShortDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Short2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.short2ObjectEntrySet(); }
Example #13
Source File: IntDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Int2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.int2ObjectEntrySet(); }
Example #14
Source File: ByteDictionaryMap.java From tablesaw with Apache License 2.0 | 4 votes |
ObjectSet<Byte2ObjectMap.Entry<String>> getKeyValueEntries() { return keyToValue.byte2ObjectEntrySet(); }