diff --git a/src/main/java/org/aksw/word2vecrestful/word2vec/W2VNrmlMemModelKMeans.java b/src/main/java/org/aksw/word2vecrestful/word2vec/W2VNrmlMemModelKMeans.java index 82a2b23..30bcd8b 100644 --- a/src/main/java/org/aksw/word2vecrestful/word2vec/W2VNrmlMemModelKMeans.java +++ b/src/main/java/org/aksw/word2vecrestful/word2vec/W2VNrmlMemModelKMeans.java @@ -181,7 +181,10 @@ private String getClosestEntry(float[] vector, String subKey) { double cosSimVal = Word2VecMath.cosineSimilarityNormalizedVecs(curCompVec, vector); int indx = getBucketIndex(cosSimVal); BitSet curBs = new BitSet(word2vec.size()); - curBs.or(csBucketContainer[i][indx]); + BitSet tempBs = csBucketContainer[i][indx]; + if(tempBs!=null) { + curBs.or(tempBs); + } int temIndx = indx + 1; if (temIndx < csBucketContainer[i].length && csBucketContainer[i][temIndx] != null) { curBs.or(csBucketContainer[i][temIndx]);