Once all original documents have been added, this method is called so that post processing steps can be applied.
()
| 272 | * that post processing steps can be applied. |
| 273 | */ |
| 274 | protected void finishAdding() |
| 275 | { |
| 276 | noMoreAdding = true; |
| 277 | |
| 278 | workSpace = null; |
| 279 | storageSpace = null; |
| 280 | wordCounts = null; |
| 281 | |
| 282 | int finalLength = currentLength.get(); |
| 283 | int[] frqs = new int[finalLength]; |
| 284 | for(Map.Entry<Integer, AtomicInteger> entry : termDocumentFrequencys.entrySet()) |
| 285 | frqs[entry.getKey()] = entry.getValue().get(); |
| 286 | for(SparseVector vec : vectors) |
| 287 | { |
| 288 | //Make sure all the vectors have the same length |
| 289 | vec.setLength(finalLength); |
| 290 | } |
| 291 | weighting.setWeight(vectors, IntList.view(frqs, finalLength)); |
| 292 | |
| 293 | System.out.println("Final Length: " + finalLength); |
| 294 | for(SparseVector vec : vectors) |
| 295 | { |
| 296 | //Unlike normal index functions, WordWeighting needs to use the vector to do some set up first |
| 297 | weighting.applyTo(vec); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Returns a new data set containing the original data points that were |