|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--LGames.Rules2
Constructor Summary | |
Rules2()
Empty constructor |
|
Rules2(IntArray DCS,
int cov,
java.util.List g,
java.util.List o,
int mc,
int ab)
Constructor for inventing a holistic rule/expression |
|
Rules2(int cHead,
int cTail,
IntArray mHead,
IntArray mTail,
java.util.List g,
java.util.List o,
int mc,
int ab)
Constructor for making a compositional rule |
|
Rules2(int cov,
java.lang.String f,
IntArray DCS,
java.util.List g,
java.util.List o,
int mc,
int ab)
Constructor for adopting/incorporating an expression in a terminal (possibly holistic) rule |
|
Rules2(Rules2 r)
Copy constructor |
Method Summary | |
void |
adapt(java.lang.String head,
java.lang.String tail,
IntArray mHead,
IntArray mTail)
Function to add the meanings of the head and tail the proposed chunk in case the function matches returned true. |
void |
addMeaning(IntArray m,
int n)
This function adds category features to the IntArray meanings, removes any doubles and sets initial values to scores and usage, and indicates to which constituent (group) the categories belong. |
int |
compositionality()
|
boolean |
equals(Rules2 r1)
Implementation of an alternative equals |
boolean |
exploit(java.lang.String f,
int lg)
This function exploits a partial parse to adopt a part of the utterance. |
void |
generalise(java.lang.String f,
IntArray m,
int c,
int n)
This function generalises the grammar by searching unexplored rules that can be generalised based on a new rule. |
boolean |
generaliseAndMerge(int rule)
This function implements generalise and merge. |
IntArray |
getComposition()
Returns the composition of the rule |
boolean |
getCompositional()
|
java.lang.String |
getExpression()
This function returns the expression of the rule. |
int |
getFrequency()
Returns the frequency of the rule |
boolean |
getHolistic()
|
double[][] |
getMeaning(java.lang.String l,
java.lang.String l1,
int dim)
returns a matrix representation of the meaning. |
java.lang.String[] |
getParts()
This function returns the words of the rule's composition as a string array |
double |
getScore()
This function returns the score of the rule. |
double |
getScore(int[] f,
int c)
This function calculates the score of the composition. |
java.lang.String |
getString(java.lang.String l)
Returns a string representation for the linguistic categories that make up this rule. |
int |
getTotalUse()
|
double |
getWeight()
This function returns the rule weight |
void |
initGame()
Initialised the rule for a new language game. |
boolean |
isSentence()
|
boolean |
match(IntArray DCS,
int totCover)
Function that calls itself with an additional argument (lg=-1) |
boolean |
match(IntArray DCS,
int totCover,
int lg)
Function to check wether the semantics of the rule matches the meaning of the distinctive categories. |
boolean |
matches(int cHead,
int cTail)
Function to see if the rule is compositional, and if so, if its constituents coinside with cHead and cTail. |
java.lang.String |
niceString()
a string form of the rule |
boolean |
parse(java.lang.String f,
IntArray DCS,
int totCover)
The function that implements the parsing/decoding part for holistic or non-terminal nodes. |
boolean |
partialMatch(IntArray DCS,
int totCover)
This function checks if the topic's meaning (DCS) matches a part of the semantics of this rule |
boolean |
partialParse(java.lang.String f,
IntArray DCS,
int totCover)
This function tries to parse a part of the speaker's utterance. |
java.lang.String |
printSH()
Returns a string representation of the rule |
java.lang.String |
produceExpression()
If we have a partial match, this function invents the non-covering part and produces and expression |
void |
setComposition(IntArray c)
Sets the composition to the given composition |
boolean |
similar(java.util.List g)
This function searches the grammar g if it has a rule that is similar to this one. |
java.lang.String |
toString()
general string form |
void |
updateFrequency(int[] f,
int c)
This function updates the frequency with which it has been able to encode or decode an expression, irrespective of whether it was finally selected or not. |
void |
updateScore(boolean s)
Updates all weights of this rule and their meanings. |
void |
updateScore(boolean s,
IntArray d)
Function that calls the function updateScore(boolean s) function, after the tmpMeanings array is initialised with the proper meanings specified in d |
boolean |
wordMatch(java.lang.String u,
IntArray dcs)
This function checks whether the utterance matches the rule's expression. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Rules2()
public Rules2(Rules2 r)
public Rules2(IntArray DCS, int cov, java.util.List g, java.util.List o, int mc, int ab)
DCS
- the meaning of the new rule.cov
- the cover of the new rule (recall cover is a bit-representation for the
conceptual space and acts as the terminal label of this rule)g
- a pointer to the agent's grammar (this helps for searching)o
- a pointer to the agent;s ontology (this helps for searching)mc
- the maximum cover, ie. the conceptual space of the sentenceab
- the alphabet sizepublic Rules2(int cov, java.lang.String f, IntArray DCS, java.util.List g, java.util.List o, int mc, int ab)
cov
- the cover of the new rule (recall cover is a bit-representation for the
conceptual space and acts as the terminal label of this rule)f
- the expressionDCS
- the meaning of the new rule.g
- a pointer to the agent's grammar (this helps for searching)o
- a pointer to the agent;s ontology (this helps for searching)mc
- the maximum cover, ie. the conceptual space of the sentenceab
- the alphabet sizepublic Rules2(int cHead, int cTail, IntArray mHead, IntArray mTail, java.util.List g, java.util.List o, int mc, int ab)
cHead
- the cover of the first constituentcTail
- the cover of the second constituentmHead
- the possible meanings of the first constituent (this speeds up searching)mTail
- the possible meanings of the second constituent (this speeds up searching)g
- a pointer to the agent's grammar (this helps for searching)o
- a pointer to the agent;s ontology (this helps for searching)mc
- the maximum cover, ie. the conceptual space of the sentenceab
- the alphabet sizeMethod Detail |
public void initGame()
public void addMeaning(IntArray m, int n)
m
- the IntArray of category featuresn
- the consituent to which these belongpublic boolean matches(int cHead, int cTail)
cHead
- the cover of the head (1st constituent)cTail
- the cover of the tail (2nd constituent)
public void adapt(java.lang.String head, java.lang.String tail, IntArray mHead, IntArray mTail)
head
- the string of the first constituenttail
- the string of the second constituentmHead
- the meanings of the first constituentmTail
- the meanings of the second constituentpublic boolean match(IntArray DCS, int totCover)
public boolean match(IntArray DCS, int totCover, int lg)
DCS
- the distinctive categoriestotCover
- the linguistic category that is currently searchedlg
- language game number used as a time stamp
public boolean partialMatch(IntArray DCS, int totCover)
DCS
- the meaning of the topictotCover
- the linguistic category/conceptual space under consideration
public java.lang.String produceExpression()
public boolean parse(java.lang.String f, IntArray DCS, int totCover)
f
- the string to be parsedDCS
- the meaning of this stringtotCover
- the linguistic category of this string
public boolean partialParse(java.lang.String f, IntArray DCS, int totCover)
f
- the speaker's utteranceDCS
- the meaning to be consideredtotCover
- the linguistic category
public boolean exploit(java.lang.String f, int lg)
f
- the original expression, part of which is adopted herelg
- language game number
return true if exploitation succeeds (should normally be the case)public void generalise(java.lang.String f, IntArray m, int c, int n)
f
- the expression of the new rulem
- the meaning of the new rulec
- the cover/conceptual space/linguistic category of the new rulen
- the position/constituent of the new rulepublic double getWeight()
public double getScore()
public double getScore(int[] f, int c)
f
- not used at the momentc
- not used at the momentpublic void updateFrequency(int[] f, int c)
public java.lang.String[] getParts()
public java.lang.String getExpression()
public IntArray getComposition()
public void setComposition(IntArray c)
c
- the compositionpublic double[][] getMeaning(java.lang.String l, java.lang.String l1, int dim)
public boolean wordMatch(java.lang.String u, IntArray dcs)
u
- the utterancedcs
- the distinctive category
public boolean generaliseAndMerge(int rule)
rule
- index to the rule to be compared.
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String niceString()
public java.lang.String printSH()
public java.lang.String getString(java.lang.String l)
l
- the string with labels of all features used in the simulation
public boolean equals(Rules2 r1)
r1
- the rule to compare
public void updateScore(boolean s)
s
- boolean indicating the success of the gamepublic void updateScore(boolean s, IntArray d)
s
- boolean indicating the success of the gamed
- the IntArray containing the distinctive categoriespublic int getFrequency()
public boolean getCompositional()
public int compositionality()
public boolean getHolistic()
public boolean isSentence()
public boolean similar(java.util.List g)
g
- grammar of another agent
public int getTotalUse()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |