private int getHead(int i) { int h = heads.get(i); if(h==-1) return i; else return getHead(h); }
public int lookupIndex(int code, int indent) { if (indent < 1) throw new IllegalArgumentException( "Invalid Argument in FeatureAlphabet: " + indent); int ret = intdata.get(code); if (ret==-1 && !frozen) {//字典中没有,并且允许插入 synchronized (this) { intdata.put(code, last); ret = last; last += indent; } } return ret; }
assert(index.get(ngramidx) == n1gramidx); else index.put(ngramidx, n1gramidx);
int str = index.get(base); int id = newfeat.lookupIndex(str, interv); for (int j = 0; j < interv; j++) {
lastactivesegment.put(lastSplitCalc, lastActiveSegment); lastSplitCalc = segment.splitNo; lastActiveSegment = lastactivesegment.get(splitParents.get(segment.splitNo)); splitResistance = lastActiveSegment < segment.segmentNo ? 50 : 0; lastActiveSegment = lastactivesegment.get(0); for(Iterator<FXLightningSegment> iterator = segments.iterator(); iterator.hasNext();) { FXLightningSegment segment = iterator.next(); if(lastSplitCalc != segment.splitNo) { lastSplitCalc = segment.splitNo; lastActiveSegment = lastactivesegment.get(segment.splitNo);
public static char getCharFromInt(int i) { int c = charFromIntMap.get(i); if (c > -1) { return (char) charFromIntMap.get(i); } else { throw new SolverException("Unknown value \"" + i + "\". Note that only integers in [" + (int) Character.MIN_VALUE + "," + (int) (Character.MAX_VALUE) + "] are allowed by FiniteAutomaton."); } }
@Override public boolean execute(int hash, int id) { if (featureCounts.get(id) > threshold) lex.feature2Id.put(hash, id); return true; } });
/** * Get the internal id for this feature */ public int lookupId(String featureName) { int featureHash = getFeatureHash(featureName); return feature2Id.get(featureHash); }
private void loadRedirectsIntoDatabase(Language language) throws DaoException{ int i = 0; LOG.info("Begin loading redirects into database: "); for(int src : redirectIdsToPageIds.keys()){ if(i%10000==0) LOG.info("loaded " + i + " into database."); redirects.save(language, src, redirectIdsToPageIds.get(src)); metaDao.incrementRecords(Redirect.class, language); i++; } LOG.info("End loading redirects into database."); }
private float calculateScore() throws IOException { score = (float) ((2.0f * (float) scoredDocs.get(currentDoc)) / (float) (reader.getTermFreqVector(currentDoc, termCountField).size() + uniqueTermSize)) * 100.0f; return score; }
/** * Given a constituent, it returns the canonical constituent which represents the cluster. */ @Deprecated public Constituent getCanonicalEntity(Constituent c) { findCanonicalEntries(); int cId = this.canonicalEntitiesMap.get(this.constituents.indexOf(c)); return this.constituents.get(cId); }
/** * Given a constituent, it returns the canonical constituent which represents the cluster. */ @Deprecated public Constituent getCanonicalEntity(Constituent c) { findCanonicalEntries(); int cId = this.canonicalEntitiesMap.get(this.constituents.indexOf(c)); return this.constituents.get(cId); }
/** * Increment the count for featureId. */ public synchronized void countFeature(int featureId) { synchronized (featureCounts) { if (!featureCounts.containsKey(featureId)) featureCounts.put(featureId, 1); else featureCounts.put(featureId, featureCounts.get(featureId) + 1); } }
public synchronized void countFeature(int featureId) { synchronized (featureCounts) { if (!featureCounts.containsKey(featureId)) featureCounts.put(featureId, 1); else featureCounts.put(featureId, featureCounts.get(featureId) + 1); } } }
private void insertDSlices() { for (int i = 0; i < nbDims; i++) { for (int x = 0; x < vInSize.get(); x++) { int j = vIn.quickGet(x); int t = dStarts[j].getUB(); profilesMin[i].put(t, profilesMin[i].get(t) + dUsages[i][j]); t = dStarts[j].getLB(); profilesMax[i].put(t, profilesMax[i].get(t) + dUsages[i][j]); } } }
/** * Increment the count for featureId. */ public synchronized void countFeature(int featureId) { synchronized (featureCounts) { if (!featureCounts.containsKey(featureId)) featureCounts.put(featureId, 1); else featureCounts.put(featureId, featureCounts.get(featureId) + 1); } }
private void merge(TIntIntHashMap linked, int start, int target) { if (start == target) return; final int old = linked.get(start); if (old > target) { linked.put(start, target); merge(linked, old, target); } else { merge(linked, target, old); } } },
public void setLogWeight(int i, int j, double weight) { int relJ = this.indexMap[i].get(j); if(relJ < 0) { this.indexMap[i].put(j, this.weights[i].size()); this.weights[i].add(weight); } else { this.weights[i].set(relJ, weight); } }