public int indexOfSV(Object value) { switch (_fieldSpec.getDataType()) { case INT: return _intValueToIndexMap.get((int) value); case LONG: return _longValueToIndexMap.get((long) value); case FLOAT: return _floatValueToIndexMap.get((float) value); case DOUBLE: return _doubleValueToIndexMap.get((double) value); case STRING: return _stringValueToIndexMap.getInt(value); case BYTES: return _bytesValueToIndexMap.get(new ByteArray((byte[]) value)); default: throw new UnsupportedOperationException("Unsupported data type : " + _fieldSpec.getDataType()); } }
/** * This is a rough breakpoint factor - it's a measure of the "power" of a coolant relative to the Water baseline - higher is *better*. */ public static int getCoolantFactor(Fluid fluid) { return coolantFactorMap.get(fluid.getName()); }
/** * This is for the full bucket. */ public static int getCoolantRF(Fluid fluid) { return coolantMap.get(fluid.getName()); }
/** * Computes the score of a given type using the log-likelihood with respect to a previously computed language model * * @param type identifier of the type you are scoring * @return score of the type for the previously set context */ public double getScoreOf( short type ) { Double score = scoreCache.get( type ); if( score != null ) return score; score = 0D; final String t = typeMapping.get( type ); if( t == null ) return DEFAULT_SCORE; //type not found in mapping - warning? final Object2IntOpenHashMap<String> lm = models.languageModels.get( t ); if( lm == null ) return DEFAULT_SCORE; for( String w : ngrams ) { Integer f = lm.get( w ); if( f != null ) { //else add zero, = do nothing score += Math.log( ( f + muLM * ( ( double ) models.backgroundModel.get( w ) / models.totalFreq ) ) / ( models.freqs.get( t ) + muLM ) ); } } if( score == 0D ) score = DEFAULT_SCORE; scoreCache.put( type, score ); return score; } }
public int[] originalAssignment( final UncompressedWordVectors map, ArrayList<String> words, Object2IntOpenHashMap<String> order ) { final int len = map.vectors.entrySet().size(); int[] original = new int[ len ]; Random r = new Random(); for( int i = 0; i < len; i++ ) { original[ i ] = r.nextInt( words.size() ); } int j = 0; for( String s : words ) { original[ order.get( s ) ] = j++; } return original; }
Integer freq = typeHash.get( queryS ); if( freq == null ) { typeHash.put( queryS, 0 );