public class TermCodes extends Object
This class is used for assigning codes to terms as we index a document collection.
It makes use of two properties from the default properties file. The first one is termcodes.initialcapacity, which specifies the initial capacity of the used hash map. The default value is 3000000.
The second property is termcodes.garbagecollect, which enables or disables garbage collection during the call of the method reset(). The default value is true.
Constructor and Description |
---|
TermCodes() |
Modifier and Type | Method and Description |
---|---|
static int |
getCode(String term)
Returns the code for a given term.
|
static void |
initialise()
Initialises the properties from the property file.
|
static void |
reset()
Resets the hashmap that contains the mapping
from the terms to the term ids.
|
static void |
setTermCode(String term,
int termCode)
For when you manually want to set the term for a given term, and you
know that this term and termcodes do NOT exist, then you can use
this method.
|
public static void initialise()
public static final int getCode(String term)
term
- String the term for which
the code will be returned.public static void reset()
public static void setTermCode(String term, int termCode)
Terrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow