Word2VEC_java icon indicating copy to clipboard operation
Word2VEC_java copied to clipboard

关于MapCount的size问题

Open ThdLee opened this issue 7 years ago • 0 comments

 private void readVocab(File file) throws IOException {
    MapCount<String> mc = new MapCount<>();
    try (BufferedReader br = new BufferedReader(new InputStreamReader(
        new FileInputStream(file)))) {
      String temp = null;
      while ((temp = br.readLine()) != null) {
        String[] split = temp.split(" ");
        trainWordsCount += split.length;
        for (String string : split) {
          mc.add(string);
        }
      }
    }
    for (Entry<String, Integer> element : mc.get().entrySet()) {
      wordMap.put(element.getKey(), new WordNeuron(element.getKey(),
          (double) element.getValue() / mc.size(), layerSize));
    }
  }

其中的MapCount的size是否不应该用HashMap的size,而是应该用HashMap中所有value之和?

ThdLee avatar Apr 03 '18 08:04 ThdLee