twoword
index
/usr/home/andreas/laac/twoword.py

 
Modules
       
math
xml.dom.minidom

 
Functions
       
analyze(situation)
Analyzes a situation. This includes finding LAs that fit the situation
and its utterance and then either reinforcing found LAs or
hypothesizing a new LA.
Return: None.
chattest()
Input words and look for a matching linguistic abstraction, then
try to find a new utterance as a reply, different from the input.
findLAList(scoresWordsMeanings)
Find a list of LAs that fit the meanings in the argument.
Return: list of LA hashes.
fits(meaning, LA)
Return True if supplied meaning fits in the
linguistic abstraction.
Converts both arguments to a flat string representation,
and iterates over the lines of the LA. When a matching line
with the meaning argument is found, a counter is increased.
If the counter reaches the number of lines in the meaning,
the meaning matched the LA. If a line is found which does
not match the LA, the counter is resetted.
 
Arguments:
meaning -- a meaning frame, without VAR elements
LA -- a linguistic abstraction, with VAR elements in properties or id
frame2words(frame)
Searches the linguistic corpus for relevant LAs given a meaning frame. Then
produces a list of 2-word utterances using these LAs.
Return: list of strings.
frames2wordstest()
For each situation in the corpus, show the twoword utterances that can
be generated from it with its linguistic abstraction.
getWordorder(u, word1, word2)
hypothesize(utterance, scoresWordsMeanings)
Make a new LA based on the meanings in the second argument. First search for
the highest scoring meaning that has a subframe also in the list of
meanings. Then get the wordorder of the two words corresponding with these
meanings and make a new LA using these frames and the wordorder.
Return: None.
invertassociations(associations)
Make a dictionary with framehashes as keys and their most likely 
words/scores as values. The data is taken from the associations
dictionary from the     oneword stage.
la2words(la, meaning)
return utterances matching a LA and a meaning
onewordtest()
Ask for a word and show which meanings oneword associates with it.
reinforce(LAList)
Reinforce LAs corresponding to the list of LAhashes in the first
argument.
Return: None.
twMain()
Create one-word data. Pass situations in the corpus to analyze using this
data.
uniqueutterancestest()
similar to frames2words, but count how many utterances are
generated which are unique, as in, not found in the corpus.
words2frame(w1, w2)
Searches the linguistic corpus for relevant LAs given two words.
Return: list of frames.
words2framestest()
Input words and show a matching linguistic abstraction and meaning for
each pair of words.

 
Data
        LADict = {}
M2WLADict = {}
MDict = {}
W2MLADict = {}
argv = ['/usr/local/bin/pydoc', '-w', './twoword.py']
stdin = <open file '<stdin>', mode 'r'>
stdout = <open file '<stdout>', mode 'w'>