org.carrot2.text.preprocessing
Class SparseArray

java.lang.Object
  extended by org.carrot2.text.preprocessing.SparseArray

public final class SparseArray
extends Object

Sparse array encoding utilities. Sparse means an index and its value are kept in an array as a pair.


Constructor Summary
SparseArray()
           
 
Method Summary
static int countUnique(int[] buffer, int fromIndex, int toIndex)
          Count unique values in the sorted array.
static int[] mergeSparseArrays(Iterable<int[]> source)
          Merge data from one or more sparse arrays.
static String sparseToString(int[] intIntArray)
          Convert an int-int compact mapping array to a string.
static int[] toSparseEncoding(com.carrotsearch.hppc.IntStack documents)
          Convert a list of documents to sparse document-count representation.
static int[] toSparseEncodingByHash(com.carrotsearch.hppc.IntStack documents)
          Convert to sparse encoding using a hash map.
static int[] toSparseEncodingBySort(com.carrotsearch.hppc.IntStack documents)
          Convert to sparse encoding using sorting and counting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SparseArray

public SparseArray()
Method Detail

toSparseEncoding

public static int[] toSparseEncoding(com.carrotsearch.hppc.IntStack documents)
Convert a list of documents to sparse document-count representation.


toSparseEncodingByHash

public static int[] toSparseEncodingByHash(com.carrotsearch.hppc.IntStack documents)
Convert to sparse encoding using a hash map.


toSparseEncodingBySort

public static int[] toSparseEncodingBySort(com.carrotsearch.hppc.IntStack documents)
Convert to sparse encoding using sorting and counting.


countUnique

public static int countUnique(int[] buffer,
                              int fromIndex,
                              int toIndex)
Count unique values in the sorted array.


mergeSparseArrays

public static int[] mergeSparseArrays(Iterable<int[]> source)
Merge data from one or more sparse arrays.


sparseToString

public static String sparseToString(int[] intIntArray)
Convert an int-int compact mapping array to a string.



Copyright (c) Dawid Weiss, Stanislaw Osinski