Here you can find the source of loadVocab(String vocabFilePath, double factor)
public static Map<String, Integer> loadVocab(String vocabFilePath, double factor)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.*; public class Main { public static Map<String, Integer> loadVocab(String vocabFilePath, double factor) { if (factor < 0) factor = 1.0;//from ww w . ja v a2s . c o m Map<String, Integer> counts = new LinkedHashMap<>(); try { BufferedReader reader = new BufferedReader(new FileReader(vocabFilePath)); String line; while ((line = reader.readLine()) != null) { if (line.isEmpty()) continue; String[] tokens = line.trim().split("\t"); String word = tokens[0].trim(); int count = Integer.parseInt(tokens[1].trim()); if (factor != 1.0) count = (int) (count * factor); counts.put(word, count); } reader.close(); } catch (IOException e) { e.printStackTrace(); } return counts; } }