public abstract class FactoryforMatrixSWsynonyms
extends java.lang.Object
Factory also provides a tool for creating co-occurrence matrices using a sliding window w based on a given dictionary. The dictionary can be changed during the course of creating a matrix. The matrix is build in sparse form and is build iteratively. An instance of a co-occurrence matrix must always be included when building a co-occurrence matrix, in the first iteration an empty matrix must be included., Nina Tahmasebi, L3S Research Center
CoOccurrenceMatrix,
Dictionary| Constructor and Description |
|---|
FactoryforMatrixSWsynonyms()
Constructor is never used.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addTermsInList(java.util.ArrayList<Term> list,
CoOccurrenceMatrix myMatrix) |
static Dictionary |
buildDictionary(java.io.Reader termList,
Dictionary dict)
Builds a dictionary based on a term list.
|
static CoOccurrenceMatrix |
buildMatrixGR(Dictionary dictionary,
java.io.Reader textInput,
CoOccurrenceMatrix startMatrix)
Builds a co-occurrence matrix based on a starting matrix, a dictionary
and a text file using grammatical relations such as (and, or , comma).
|
static CoOccurrenceMatrix |
buildMatrixSW(Dictionary dictionary,
java.io.Reader textInput,
CoOccurrenceMatrix startMatrix,
int windowsize)
Builds a co-occurrence matrix based on a starting matrix, a dictionary
and a text file using a sliding window.
|
static void |
convertFiles(java.io.Reader r,
java.io.Writer w)
Specially written for e-books where text is chopped up in 8-10 words per
line.
|
static CoOccurrenceMatrix |
createMatrixFromFile(java.io.Reader matrixSource,
Dictionary dict)
Creates a CoOccurrenceMatrix from a file.
|
public FactoryforMatrixSWsynonyms()
public static final Dictionary buildDictionary(java.io.Reader termList, Dictionary dict) throws java.io.IOException
termList - Each line should contain a term and term frequency where
the term and the frequency are separated by one tab.java.io.IOExceptionpublic static final CoOccurrenceMatrix createMatrixFromFile(java.io.Reader matrixSource, Dictionary dict) throws java.io.IOException
matrixSource - the location from which the CoOccurrenceMatrix
should be createddict - the dictionary associated with this
CoOccurrenceMatrixjava.io.IOExceptionpublic static final CoOccurrenceMatrix buildMatrixSW(Dictionary dictionary, java.io.Reader textInput, CoOccurrenceMatrix startMatrix, int windowsize)
dictionary - use the dictionary that is created from the collection
where matrixInputreader comes.textInput - contains the text from which we should find
co-occurrences from the terms in dictionarystartMatrix - matrix representing the previous iterationwindowsize - the size of the window in which we want to find
co-occurrencesjava.io.IOExceptionpublic static void convertFiles(java.io.Reader r,
java.io.Writer w)
throws java.io.IOException
r - original source of text that needs to be convertedw - source where text should be stored after conversionjava.io.IOExceptionpublic static final CoOccurrenceMatrix buildMatrixGR(Dictionary dictionary, java.io.Reader textInput, CoOccurrenceMatrix startMatrix) throws java.io.IOException
dictionary - use the dictionary that is created from the collection
where matrixInputreader comes.textInput - contains the text from which we should find
co-occurrences from the terms in dictionarystartMatrix - matrix representing the previous iterationjava.io.IOExceptionpublic static void addTermsInList(java.util.ArrayList<Term> list, CoOccurrenceMatrix myMatrix)