use of gnu.trove.map.hash.THashMap in project cogcomp-nlp by CogComp.
the class BrownClusters method printOovData.
public final void printOovData(Data data) {
HashMap<String, Boolean> tokensHash = new HashMap<>();
HashMap<String, Boolean> tokensHashIC = new HashMap<>();
ArrayList<LinkedVector> sentences = new ArrayList<>();
for (int docid = 0; docid < data.documents.size(); docid++) for (int sid = 0; sid < data.documents.get(docid).sentences.size(); sid++) sentences.add(data.documents.get(docid).sentences.get(sid));
for (LinkedVector sentence : sentences) for (int j = 0; j < sentence.size(); j++) {
String form = ((NEWord) sentence.get(j)).form;
tokensHash.put(form, true);
tokensHashIC.put(form.toLowerCase(), true);
}
for (THashMap<String, String> wordToPath : wordToPathByResource) {
HashMap<String, Boolean> oovCaseSensitiveHash = new HashMap<>();
HashMap<String, Boolean> oovAfterLowercasingHash = new HashMap<>();
for (LinkedVector sentence : sentences) {
for (int j = 0; j < sentence.size(); j++) {
String form = ((NEWord) sentence.get(j)).form;
if (!wordToPath.containsKey(form)) {
oovCaseSensitiveHash.put(form, true);
}
if ((!wordToPath.containsKey(form)) && (!wordToPath.containsKey(form.toLowerCase()))) {
oovAfterLowercasingHash.put(form.toLowerCase(), true);
}
}
}
}
}
Aggregations