public class NetricsWeightedDictionary
extends java.lang.Object
Constructor and Description |
---|
NetricsWeightedDictionary(java.lang.String name)
A weighted dictionary is used to weight terms which should have more or
less relevance than other terms.
|
NetricsWeightedDictionary(java.lang.String name,
java.lang.String filename,
java.lang.String encoding)
Create a weighted dictionary from a CSV file.
|
Modifier and Type | Method and Description |
---|---|
int |
addClassesFrom(NetricsFieldedReader rsrc)
Add a set of classes from a fielded source.
|
void |
addEquivalenceClass(java.lang.String[] terms,
double weight)
Add terms with associated weights.
|
void |
setCharmap(java.lang.String name)
Set the character map for this thesaurus.
|
void |
setExactMatchMode()
Select exact match mode.
|
public NetricsWeightedDictionary(java.lang.String name)
name
- The name of the weighted dictionary to be created.public NetricsWeightedDictionary(java.lang.String name, java.lang.String filename, java.lang.String encoding)
name
- The name of the dictionary to be createdfilename
- The name of the file from which to read the dictionaryencoding
- This defines the character encoding used
in the file. Currently supported encodings are:
"UTF-8" or "LATIN1". DEFAULT: "LATIN1"public void addEquivalenceClass(java.lang.String[] terms, double weight)
terms
- The terms to be weighted.weight
- The weight of the term.public int addClassesFrom(NetricsFieldedReader rsrc) throws NetricsFileFormatException, NetricsException
rsrc
- a NetricsFieldedReader object that provides the
equivalence classes.NetricsFileFormatException
- if there was an error reading
records from the source.NetricsException
- if an equivalence class has less than 2
entries or the first entry is not a float value.NetricsFieldedReader
,
NetricsCSVReader
public void setCharmap(java.lang.String name)
name
- The name of an existing character map.public void setExactMatchMode()