public class Rank
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Rank.WordAndRank
data structure.
|
Constructor and Description |
---|
Rank() |
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<Rank.WordAndRank> |
highestRanking(DISCO disco,
java.util.Set<java.lang.String> words,
DISCO.WordspaceType type)
Finds the words in the index in whose similarity or collocation lists the
words rank highest. |
int |
rankCol(DISCO disco,
java.lang.String w1,
java.lang.String w2)
Computes the rank of w2 among the collocations of w1.
|
int |
rankSim(DISCO disco,
java.lang.String w1,
java.lang.String w2)
Computes the rank of w2 in the similarity list of w1.
|
public int rankSim(DISCO disco, java.lang.String w1, java.lang.String w2) throws java.io.IOException, WrongWordspaceTypeException
DISCO.WordspaceType.COL
(use
de.linguatools.disco.Rank.rankCol
instead).disco
- w1
- input word #1 (must be a single token).w2
- input word #2 (must be a single token).java.io.IOException
WrongWordspaceTypeException
- if the disco
word space
is not of type DISCO.WordspaceType.SIM
.public int rankCol(DISCO disco, java.lang.String w1, java.lang.String w2) throws java.io.IOException
disco
- w1
- input word #1 (must be a single token).w2
- input word #2 (must be a single token).java.io.IOException
public java.util.ArrayList<Rank.WordAndRank> highestRanking(DISCO disco, java.util.Set<java.lang.String> words, DISCO.WordspaceType type) throws java.io.IOException, WrongWordspaceTypeException
words
rank highest. There must be at least one word in
words
.v
from the vocabulary, the method looks up on
which rank v
occurs among the similar words or collocations
of the words from the input set. The score of v
is the
product of these ranks. The lower the rank product, the more similar
v
is to words
.disco
- DISCO word space (in-memory)words
- set of input words (all words must be single tokens).type
- If type is WordspaceType.SIM
then the list of the
semantically most similar words is searched, otherwise the list of
significant co-occurrences (=collocations) is searched. Therefore,
WordspaceType.SIM
is only possible with word spaces of this
type!words
was found in the index, the return value is null.java.io.IOException
WrongWordspaceTypeException