Java Code Examples for gnu.trove.TIntIntHashMap#keys()
The following examples show how to use
gnu.trove.TIntIntHashMap#keys() .
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: Util.java From whyline with MIT License | 5 votes |
public static void writeIntIntMap(DataOutputStream stream, TIntIntHashMap map) throws IOException { stream.writeInt(map.size()); for(int key : map.keys()) { stream.writeInt(key); stream.writeInt(map.get(key)); } }
Example 2
Source File: CoTrainer.java From jatecs with GNU General Public License v3.0 | 5 votes |
protected IIndex createEnrichedTraining(TIntIntHashMap map, IIndex testAllCats, IIndex training) { IIndex idx = training.cloneIndex(); TroveMainIndexBuilder builder = new TroveMainIndexBuilder(idx); int numDocs = training.getDocumentDB().getDocumentsCount(); int[] keys = map.keys(); for (int i = 0; i < keys.length; i++) { int docID = keys[i]; ArrayList<String> features = new ArrayList<String>(100); String docName = "" + (numDocs + (i + 1)); IIntIterator feats = testAllCats.getContentDB().getDocumentFeatures(docID); while (feats.hasNext()) { int featID = feats.next(); String featName = testAllCats.getFeatureDB().getFeatureName(featID); int count = testAllCats.getContentDB().getDocumentFeatureFrequency(docID, featID); for (int j = 0; j < count; j++) features.add(featName); } ArrayList<String> categories = new ArrayList<String>(); IShortIterator cats = testAllCats.getClassificationDB().getDocumentCategories(docID); while (cats.hasNext()) { short catID = cats.next(); String catName = testAllCats.getCategoryDB().getCategoryName(catID); categories.add(catName); } builder.addDocument(docName, features.toArray(new String[0]), categories.toArray(new String[0])); } return idx; }
Example 3
Source File: AbstractDataGetter.java From consulo with Apache License 2.0 | 5 votes |
private void runLoadCommitsData(@Nonnull Iterable<Integer> hashes) { long taskNumber = myCurrentTaskIndex++; TIntIntHashMap commits = getCommitsMap(hashes); TIntHashSet toLoad = new TIntHashSet(); for (int id : commits.keys()) { cacheCommit(id, taskNumber); toLoad.add(id); } myLoader.queue(new TaskDescriptor(toLoad)); }