@Override public void importVocabulary(VocabCache<VocabWord> vocabCache) { for (VocabWord word : vocabCache.vocabWords()) { if (vocabs.containsKey(word.getLabel())) { wordFrequencies.incrementCount(word.getLabel(), word.getElementFrequency()); } else { tokens.put(word.getLabel(), word); vocabs.put(word.getLabel(), word); wordFrequencies.incrementCount(word.getLabel(), word.getElementFrequency()); } totalWordOccurrences.addAndGet((long) word.getElementFrequency()); } }
@Override public void removeElement(VocabWord element) { removeElement(element.getLabel()); }
@Override public synchronized void addToken(VocabWord word) { tokens.put(word.getLabel(), word); }