public class MatrixBasedTermSimilarityNetwork extends java.lang.Object implements RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
Modifier and Type | Field and Description |
---|---|
protected Matrix |
similarities
The similarities between terms.
|
protected TermIndex |
termIndex
The index of terms.
|
Constructor and Description |
---|
MatrixBasedTermSimilarityNetwork(TermIndex termIndex,
Matrix similarities)
Creates a new
MatrixBasedTermSimilarityNetwork . |
Modifier and Type | Method and Description |
---|---|
java.util.Set<IndexedTermSimilarityRelation> |
getAllRelations(IndexedTerm source,
IndexedTerm target)
Gets all the relation between the source and the target.
|
int |
getObjectCount()
Gets the number of objects that the relations are between.
|
java.util.Set<IndexedTerm> |
getObjects()
Gets the set of objects that make up the nodes in the network.
|
IndexedTermSimilarityRelation |
getRelation(IndexedTerm source,
IndexedTerm target)
Gets a relation between the source and the target.
|
IndexedTerm |
getRelationSource(IndexedTermSimilarityRelation relation)
Gets the source of a given relation.
|
IndexedTerm |
getRelationTarget(IndexedTermSimilarityRelation relation)
Gets the target of a given relation.
|
Matrix |
getSimilarities()
Gets the similarities between terms.
|
double |
getSimilarity(IndexedTerm source,
IndexedTerm target)
Gets the similarity between the two given terms.
|
double |
getSimilarity(int sourceIndex,
int targetIndex)
Gets the similarity between the two given terms.
|
double |
getSimilarity(Term sourceTerm,
Term targetTerm)
Gets the similarity between the two given terms.
|
TermIndex |
getTermIndex()
Gets the index of terms.
|
boolean |
hasRelation(IndexedTerm source,
IndexedTerm target)
Determines if the network has a relation between the two given objects.
|
boolean |
isObject(java.lang.Object o)
Determines whether or not the given object is a node in the relation
network.
|
java.util.Set<IndexedTermSimilarityRelation> |
relationsFrom(IndexedTerm source)
Gets all of the relations where the given object is the source.
|
java.util.Set<IndexedTermSimilarityRelation> |
relationsOf(IndexedTerm term)
Gets all of the relations that involve the given object.
|
java.util.Set<IndexedTermSimilarityRelation> |
relationsTo(IndexedTerm target)
Gets all of the relations where the given object is the target.
|
protected void |
setSimilarities(Matrix similarities)
Gets the similarities between terms.
|
protected void |
setTermIndex(TermIndex termIndex)
Sets the index of terms.
|
protected TermIndex termIndex
protected Matrix similarities
public MatrixBasedTermSimilarityNetwork(TermIndex termIndex, Matrix similarities)
MatrixBasedTermSimilarityNetwork
.termIndex
- The index of terms that contains the nodes of the network.similarities
- The square matrix of similarities between terms. Must have a number
of rows and columns equal to the number of terms in the term index.public double getSimilarity(Term sourceTerm, Term targetTerm)
sourceTerm
- The source term.targetTerm
- The target term.public double getSimilarity(IndexedTerm source, IndexedTerm target)
source
- The source term.target
- The target term.public double getSimilarity(int sourceIndex, int targetIndex)
sourceIndex
- The index of the source term.targetIndex
- The index of the target term.public int getObjectCount()
RelationNetwork
getObjectCount
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
public java.util.Set<IndexedTerm> getObjects()
RelationNetwork
getObjects
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
public boolean isObject(java.lang.Object o)
RelationNetwork
isObject
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
o
- An object.public boolean hasRelation(IndexedTerm source, IndexedTerm target)
RelationNetwork
hasRelation
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
source
- The source object.target
- The target object.public IndexedTermSimilarityRelation getRelation(IndexedTerm source, IndexedTerm target)
RelationNetwork
getRelation
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
source
- The source object.target
- The target object.public java.util.Set<IndexedTermSimilarityRelation> getAllRelations(IndexedTerm source, IndexedTerm target)
RelationNetwork
getAllRelations
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
source
- The source object.target
- The target object.public IndexedTerm getRelationSource(IndexedTermSimilarityRelation relation)
RelationNetwork
getRelationSource
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
relation
- A relation from the network.public IndexedTerm getRelationTarget(IndexedTermSimilarityRelation relation)
RelationNetwork
getRelationTarget
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
relation
- A relation from the network.public java.util.Set<IndexedTermSimilarityRelation> relationsOf(IndexedTerm term)
RelationNetwork
relationsOf
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
term
- An object (node) from the network.public java.util.Set<IndexedTermSimilarityRelation> relationsFrom(IndexedTerm source)
RelationNetwork
relationsFrom
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
source
- An object (node) from the network.public java.util.Set<IndexedTermSimilarityRelation> relationsTo(IndexedTerm target)
RelationNetwork
relationsTo
in interface RelationNetwork<IndexedTerm,IndexedTermSimilarityRelation>
target
- An object (node) from the network.public TermIndex getTermIndex()
protected void setTermIndex(TermIndex termIndex)
termIndex
- The index of terms.public Matrix getSimilarities()
protected void setSimilarities(Matrix similarities)
similarities
- The similarities between terms.