|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.di.mg4j.index.cluster.ContiguousLexicalStrategy
public class ContiguousLexicalStrategy
A lexical strategy that partitions terms into contiguous segments.
To partition terms in contiguous segments, you must provide an array of cutpoints, which define each segment of terms. More precisely, given cutpoints c0,c2,…,ck, terms will be partitioned into k local indices containing the terms numbered from c0 (included) to c1 (excluded), from c1 (included) to c2 and so on. Note that necessarily c0=0 and ck=T, where T is the number of terms in the global index.
To make mapping of terms (as opposed to term numbers) possible, you must also provide
a parallel array of character sequences that
contain the terms corresponding to the terms numbers
c0,c2,…,ck.
The content of the last element of the array should be null
.
The properties()
method provides two properties, termfrom and termto,
that contain the first (included) and last (excluded) term in the local index, and two
analogous properties termnumberfrom and termnumberto.
Constructor Summary | |
---|---|
ContiguousLexicalStrategy(int[] cutPoint,
CharSequence[] cutPointTerm)
Creates a new contiguous lexical strategy with the given cutpoints. |
Method Summary | |
---|---|
int |
globalNumber(int localIndex,
int localNumber)
Returns the global term number given a local index and a local term number (optional operation). |
int |
localIndex(CharSequence term)
Returns the index to which a given term is be mapped by this strategy. |
int |
localIndex(int globalNumber)
Returns the index to which a given term number is mapped by this strategy. |
int |
localNumber(int globalNumber)
Returns the local term number given a global term number. |
int |
numberOfLocalIndices()
Returns the number of local indices created by this strategy. |
Properties[] |
properties()
Returns an array of properties, one for each local index, that specify additional information about local indices. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ContiguousLexicalStrategy(int[] cutPoint, CharSequence[] cutPointTerm)
cutPoint
- an array of cutpoints (see the class description}.cutPointTerm
- a parallel array of cutpoints terms; the last element must be null
.Method Detail |
---|
public int numberOfLocalIndices()
PartitioningStrategy
numberOfLocalIndices
in interface ClusteringStrategy
numberOfLocalIndices
in interface PartitioningStrategy
public int localIndex(int globalNumber)
LexicalPartitioningStrategy
localIndex
in interface LexicalPartitioningStrategy
globalNumber
- the term global number.
public int localIndex(CharSequence term)
LexicalClusteringStrategy
localIndex
in interface LexicalClusteringStrategy
term
- a term.
public int globalNumber(int localIndex, int localNumber)
LexicalClusteringStrategy
This operation is not, in general, necessary for a LexicalCluster
to work, as no action on a local index returns local numbers. It is defined here
mainly for completeness and for debugging purposes (in case it is implemented).
globalNumber
in interface LexicalClusteringStrategy
localIndex
- the local index.localNumber
- the local term number.
public int localNumber(int globalNumber)
LexicalPartitioningStrategy
localNumber
in interface LexicalPartitioningStrategy
globalNumber
- a global term number.
public Properties[] properties()
PartitioningStrategy
properties
in interface PartitioningStrategy
null
(in that case, the set of properties is assumed to be empty).public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |