LGames
Class Meaning

java.lang.Object
  |
  +--LGames.Meaning

public class Meaning
extends java.lang.Object

This class implements the representations of meanings. The meanings are represented as prototypes, an n-dimensional vector. The class controls the meaning and implements certain operations that can be performed on this representation.

Copyright (c) 2004 Paul Vogt


Field Summary
protected  double alpha
           
protected  int cover
           
protected  double epsilon
           
protected  double epsilonRegion
           
protected  int ID
           
protected  int layer
           
protected  double[] prototype
           
protected  double temperature
           
protected  int use
           
 
Constructor Summary
Meaning()
          Empty constructor
Meaning(double[] fv, int n)
          Constructs a meaning with the given feature vector as the new prototype and id.
Meaning(double[] fv, int n, int l)
          Constructs a meaning with the given feature vector as the new prototype, an id and its hierarchical layer
Meaning(double[] fv, int n, int c, int l)
          Constructs a meaning with the given feature vector as the new prototype, an id, its cover and its hierarchical layer.
The cover also indicates on which dimensions the prototypes are added.
Meaning(int id)
          Constructs a dummy meaning with feature values of -100.
Meaning(int[] dcs, java.util.List o)
          Constructs a meaning based on the categorical features specified in the dcs and given in the ontology o
Meaning(int id, int c)
          Constructs a meaning used for testing.
 
Method Summary
 boolean comparePType(double[] c)
          compares two prototypes (or possibly a feature vector) with each other.
 int elementOf(java.util.List o)
          This function searches the index of this meaning in the ontology o
 boolean equals(Meaning m)
          The function equals checks whether two meanings are equal.
 int getCover()
           
 int getID()
           
 int[] getkNN(java.util.List o, int k)
          This function returns the k-nearest neighbours of this meaning in the ontology o.
 int getLayer()
           
 double[] getPrototype()
           
 int getUse()
           
 boolean inContext(Context cxt)
          Checks whether the meaning is in the context.
 void increaseUse()
          increases the usage counter by 1
 int memberOf(java.util.List o)
          Checks wether this meaning is a member of the ontology
 void merge(Meaning M)
          if after shifting prototypes, two prototypes come within a certain Eucledian distance of each other, the two are merged.
 java.lang.String mstring()
          returns a string representation of the meaning that is used for writing to the log file in the Stats class.
 void print()
          Writes the meaning to the standard output
 void print(java.io.PrintWriter outfile)
          Writes the meaning to a file
 void setID(int id)
           
 void shift_prototype(double[] fv, char updateType)
          This function shifts each dimension of the prototype in the direction of the corresponding dimension of the feature vector.
 int similarDimensions(double[] x)
          Calculates the cover of the similarity between the vector x and the prototype
 java.lang.String string()
          Returns a string representation of the meaning.
 java.lang.String toString()
          returns a string representation of the meaning that is used for writing to the log file in the Stats class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prototype

protected double[] prototype

ID

protected int ID

epsilon

protected final double epsilon
See Also:
Constant Field Values

use

protected int use

alpha

protected final double alpha
See Also:
Constant Field Values

temperature

protected double temperature

cover

protected int cover

epsilonRegion

protected final double epsilonRegion
See Also:
Constant Field Values

layer

protected int layer
Constructor Detail

Meaning

public Meaning()
Empty constructor


Meaning

public Meaning(double[] fv,
               int n)
Constructs a meaning with the given feature vector as the new prototype and id.

Parameters:
fv - the feature vector
n - the id

Meaning

public Meaning(double[] fv,
               int n,
               int l)
Constructs a meaning with the given feature vector as the new prototype, an id and its hierarchical layer

Parameters:
fv - the feature vector
n - the id
l - the layer

Meaning

public Meaning(double[] fv,
               int n,
               int c,
               int l)
Constructs a meaning with the given feature vector as the new prototype, an id, its cover and its hierarchical layer.
The cover also indicates on which dimensions the prototypes are added. Currently not used (i think)

Parameters:
fv - the feature vector
n - the id
c - the cover
l - the layer

Meaning

public Meaning(int id)
Constructs a dummy meaning with feature values of -100. This is placed at the front of the ontology list, for which the score matrix holds other information. If this is not done, the meaning may be used as a real one.


Meaning

public Meaning(int[] dcs,
               java.util.List o)
Constructs a meaning based on the categorical features specified in the dcs and given in the ontology o


Meaning

public Meaning(int id,
               int c)
Constructs a meaning used for testing.

Method Detail

getID

public int getID()
Returns:
the meaning's id

setID

public void setID(int id)

getPrototype

public double[] getPrototype()
Returns:
the meaning's prototype

increaseUse

public void increaseUse()
increases the usage counter by 1


getUse

public int getUse()
Returns:
usage counter

getCover

public int getCover()
Returns:
the cover of the meaning

getLayer

public int getLayer()
Returns:
the hierarchical layer of the meaning

memberOf

public int memberOf(java.util.List o)
Checks wether this meaning is a member of the ontology

Parameters:
o - the ontology
Returns:
index of this meaning in the ontology (-1 if this meaning is not in the ontology)

equals

public boolean equals(Meaning m)
The function equals checks whether two meanings are equal. They are equal if the prototypes are.

Parameters:
m - the second meaning
Returns:
true if the two meanings are equal, false otherwise

toString

public java.lang.String toString()
returns a string representation of the meaning that is used for writing to the log file in the Stats class.

Overrides:
toString in class java.lang.Object

mstring

public java.lang.String mstring()
returns a string representation of the meaning that is used for writing to the log file in the Stats class.


string

public java.lang.String string()
Returns a string representation of the meaning.


shift_prototype

public void shift_prototype(double[] fv,
                            char updateType)
This function shifts each dimension of the prototype in the direction of the corresponding dimension of the feature vector.

Parameters:
fv - the feature vector.
updateType - specifies the way the prototypes are shifted. There is one that uses a center-of-mass method, one uses simulated annealing and another a direct walk

merge

public void merge(Meaning M)
if after shifting prototypes, two prototypes come within a certain Eucledian distance of each other, the two are merged. This is tricky as both the Meaning and Symbols are connected at two places. And all information, including the associated symbols have to be merged without making doubles.

Parameters:
M - the meaning to be merged.

comparePType

public boolean comparePType(double[] c)
compares two prototypes (or possibly a feature vector) with each other.

Parameters:
c - the prototype (feature vector) to be compared.
Returns:
true if both are equal, false otherwise.

print

public void print()
Writes the meaning to the standard output


print

public void print(java.io.PrintWriter outfile)
Writes the meaning to a file


inContext

public boolean inContext(Context cxt)
Checks whether the meaning is in the context.

Parameters:
cxt - the context
Returns:
true if it is in the context, false otherwise

similarDimensions

public int similarDimensions(double[] x)
Calculates the cover of the similarity between the vector x and the prototype

Parameters:
x - the vector
Returns:
cover of the similarity

getkNN

public int[] getkNN(java.util.List o,
                    int k)
This function returns the k-nearest neighbours of this meaning in the ontology o. This is currently not used

Parameters:
o - the ontology
k - the number of nearest neighbours
Returns:
an array integers with the indices to the nearest neighbours

elementOf

public int elementOf(java.util.List o)
This function searches the index of this meaning in the ontology o

Parameters:
o - the ontology
Returns:
the index of this meaning (-1 is it is not in o)