org.eyelanguage.rl.reading
Class SentenceWorld

java.lang.Object
  extended by org.eyelanguage.rl.reading.SentenceWorld
All Implemented Interfaces:
java.io.Serializable, World
Direct Known Subclasses:
SentenceWorldParallel

public class SentenceWorld
extends java.lang.Object
implements World, java.io.Serializable

Describes how states evolve in response to actions in a serial attention and word identification model.

See Also:
Serialized Form

Nested Class Summary
 class SentenceWorld.StateIteratorIndividualist
           
 
Field Summary
 int ACUITY_LIMIT
          Beyond this distance, visual acuity goes non-linearly to zero.
 boolean ACUITY_LINEAR_PENALIZE
          If true, means that as word identifcation time increases linearly as fovea is distanced from attended word center; otherwise just a constant penalty for any distance from the word center
 int ACUITY_LINEAR_PENALTY_SLOPE
          Amount of extra time required per character eccentricity.
 int ATTEND_INTERVAL
          By how much the 'attended time' dimension is incremented on each simulated timestep.
 boolean CACHE_ENABLED
           
protected  int length
           
 int MAX_ATTEND_TIME_WITH_PENALTIES
           
 int MAX_POSSIBLE_ACUITY_PENALTY
          When sentence world is initialized, this number reflects the maximum possible penalty on word identifiation time (which is useful for knowing the bounds of the state space).
 int MAX_POSSIBLE_ATTEND_TIME
          Maximum amount of time that could possibly be spent identifying a particular word given that we're looking at the center of the word.
 int MAX_POSSIBLE_ID_TIME
          Maximum amount of time to identify a word, ever (is this actually used?)
 int MAX_POSSIBLE_PENALTY
           
 int MAX_SACCADE_PROG_TIME
          The actual amount of time it takes to program a saccade.
 int MIN_ATTEND_TIME_WITH_PENALTIES
           
protected  java.lang.String name
           
 int SACCADE_PROGRAM_INTERVAL
          By how much the 'saccade program time' dimension is incremented on each simualted timestep.
 int SACCADE_TIME_PENALTY
          The amount of time subtracted from attending a word after making a saccade.
 boolean SACCADIC_ERROR
          Whether saccadic oculomotor error is enabled.
 boolean SACCADIC_ERROR_GAUSSIAN
           
 double SACCADIC_ERROR_SPREAD
          A larger value here means more error if saccadic error is enabled.
protected  java.lang.String sentenceString
           
 ReadingStateParallelRelative setStartingState
           
protected  java.util.HashSet terminalStatesCache
           
 
Constructor Summary
SentenceWorld(java.lang.String newName)
           
SentenceWorld(java.lang.String newName, long randomSeed)
           
 
Method Summary
 int acuityAdjustment(ReadingState previousState, ReadingState newState)
          If we saccade to a position, the time attended is worth less than future time that will be spent (see detail).
 int acuityIdentificationPenalty(int wid, int currentEyePosition)
           
 int acuityIdentificationPenalty(Word w, int currentEyePosition)
           
 int acuityIdentificationPenaltyAbsolute(int absoluteDistanceInCharacters)
           
 int applySaccadicError(int saccadeRequestDistance)
           
protected  void attemptAttendNextWord(ReadingState newState)
           
 ReadingState attendCurrentWord(ReadingState newState)
           
 void build()
          Here we construct the state space for this sentence.
 int calculateDistFromAttendedWordCenter(ReadingState state)
           
 ReadingState checkForAcuityLimit(ReadingState newState)
          If the eyes land too eccentricly, force eyes to land within acuity limit.
 ReadingState checkForWordIdentification(ReadingState newState)
           
 int distance(State state1, State state2)
           
protected  ReadingState executeSaccade(ReadingState oldState)
           
 java.util.List getAllStatesFromEyePosition(int eyePosition)
           
 java.util.List getAllStatesWhereAttendingWordAt(int eyePosition)
           
 int getATTEND_INTERVAL()
           
 int getCenterOfWord(int wid)
           
 int getCenterOfWord(Word w)
           
 java.util.List getDeadendStates()
           
 boolean getIsBuilt()
          Allows you to determine if the world has been built yet or not.
 int getMAX_ATTEND_TIME_WITH_PENALTIES()
          Getter for property MAX_ATTEND_TIME_WITH_PENALTIES.
 int getMAX_POSSIBLE_ATTEND_TIME()
           
 int getMAX_POSSIBLE_ID_TIME()
           
 int getMAX_SACCADE_PROG_TIME()
           
 int getMIN_ATTEND_TIME_WITH_PENALTIES()
           
 java.lang.String getName()
           
 ReadingState getNewState(ReadingState rs, ReadingAction ra)
           
 State getNewState(State oldGenericState, Action genericAction)
          This critical method returns the new state given an action from an old state, and in this case, simply adds state to position to simulate movement.
 State getNewState(State oldGenericState, Action genericAction, java.lang.String r)
           
 int getNumberOfPositions()
           
 int getNumberOfStates()
           
 int getNumWords()
           
 java.util.List<java.lang.Integer> getPossibleEyePositions(Word thisWord)
           
 java.util.List getPossibleEyePositionsSlow(Word thisWord)
           
 State getRandomState()
           
 int getSACCADE_PROGRAM_INTERVAL()
           
 int getSACCADE_TIME_PENALTY()
           
 int getSentenceLength()
           
 java.lang.String getSettings()
           
 State getStartingState()
           
 ReadingStateFactory getStateFactory()
           
 java.util.List getStateList()
          Returns a list of all the states (i.e.
 java.util.HashSet getTerminalStates_notUsed()
           
 java.util.HashSet getTerminalStates()
           
 Word getWord(int id)
           
 Word getWordAtEyePosition(int eyePosition)
           
protected  int getWordLengthOrZero(int id)
           
protected  double getWordPredictabilityOrZero(int id)
           
 void growBounds(State state)
           
 boolean isLastWordID(int wordID)
           
 boolean isOnWord(int eyePosition)
           
 boolean isTerminalState(State state)
          Reports whether this particular state is a terminal state.
static void main(java.lang.String[] args)
           
protected  int maxOf(int a, int b)
           
protected  int minOf(int a, int b)
           
 void setATTEND_INTERVAL(int ATTEND_INTERVAL)
           
 void setBoundedBufferSize(int n)
           
 void setMAX_POSSIBLE_ATTEND_TIME(int MAX_POSSIBLE_ATTEND_TIME)
           
 void setMAX_POSSIBLE_ID_TIME(int MAX_POSSIBLE_ID_TIME)
           
 void setMAX_SACCADE_PROG_TIME(int MAX_SACCADE_PROG_TIME)
           
 void setRequester(java.lang.String r)
           
 void setSACCADE_PROGRAM_INTERVAL(int SACCADE_PROGRAM_INTERVAL)
           
 void setSACCADE_TIME_PENALTY(int SACCADE_TIME_PENALTY)
           
 void setSentence(java.lang.String newSentenceString, java.lang.String predictabilities, java.lang.String minIDTimes)
           
 void setSentence(java.lang.String newSentenceString, java.lang.String predictabilities, java.lang.String minIDTimes, java.lang.String lengths, boolean lengthsManuallyOverridden)
           
 void setupReadingStateFactory(int kind)
           
 void setupReadingStateFactory(int kind, boolean pooling)
           
 java.util.Iterator stateIterator()
          Returns an object which lets you iterate over all states (positions) in the world.
 java.lang.String toString()
           
protected  int totalIdentificationTimePlusAcuityEffect(int wid, int fromEyePosition)
           
protected  int totalIdentificationTimePlusAcuityEffect(Word w, int fromEyePosition)
           
 java.lang.String toText()
          Returns a text representation of the world, if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACUITY_LIMIT

public int ACUITY_LIMIT
Beyond this distance, visual acuity goes non-linearly to zero. Attend actions do not advance attend time at this stage. Somehow, this has to be penalized, but do we want to avoid sending predicted reward to infinity?


ATTEND_INTERVAL

public int ATTEND_INTERVAL
By how much the 'attended time' dimension is incremented on each simulated timestep.


ACUITY_LINEAR_PENALIZE

public boolean ACUITY_LINEAR_PENALIZE
If true, means that as word identifcation time increases linearly as fovea is distanced from attended word center; otherwise just a constant penalty for any distance from the word center


ACUITY_LINEAR_PENALTY_SLOPE

public int ACUITY_LINEAR_PENALTY_SLOPE
Amount of extra time required per character eccentricity.


SACCADE_PROGRAM_INTERVAL

public int SACCADE_PROGRAM_INTERVAL
By how much the 'saccade program time' dimension is incremented on each simualted timestep.


MAX_POSSIBLE_ID_TIME

public int MAX_POSSIBLE_ID_TIME
Maximum amount of time to identify a word, ever (is this actually used?)


MAX_SACCADE_PROG_TIME

public int MAX_SACCADE_PROG_TIME
The actual amount of time it takes to program a saccade.


MAX_POSSIBLE_ACUITY_PENALTY

public int MAX_POSSIBLE_ACUITY_PENALTY
When sentence world is initialized, this number reflects the maximum possible penalty on word identifiation time (which is useful for knowing the bounds of the state space).


MAX_POSSIBLE_ATTEND_TIME

public int MAX_POSSIBLE_ATTEND_TIME
Maximum amount of time that could possibly be spent identifying a particular word given that we're looking at the center of the word.


MAX_POSSIBLE_PENALTY

public int MAX_POSSIBLE_PENALTY

SACCADIC_ERROR_SPREAD

public double SACCADIC_ERROR_SPREAD
A larger value here means more error if saccadic error is enabled.


SACCADE_TIME_PENALTY

public int SACCADE_TIME_PENALTY
The amount of time subtracted from attending a word after making a saccade.


MIN_ATTEND_TIME_WITH_PENALTIES

public int MIN_ATTEND_TIME_WITH_PENALTIES

MAX_ATTEND_TIME_WITH_PENALTIES

public int MAX_ATTEND_TIME_WITH_PENALTIES

SACCADIC_ERROR

public boolean SACCADIC_ERROR
Whether saccadic oculomotor error is enabled.


length

protected int length

sentenceString

protected java.lang.String sentenceString

name

protected java.lang.String name

CACHE_ENABLED

public boolean CACHE_ENABLED

SACCADIC_ERROR_GAUSSIAN

public boolean SACCADIC_ERROR_GAUSSIAN

setStartingState

public ReadingStateParallelRelative setStartingState

terminalStatesCache

protected java.util.HashSet terminalStatesCache
Constructor Detail

SentenceWorld

public SentenceWorld(java.lang.String newName,
                     long randomSeed)

SentenceWorld

public SentenceWorld(java.lang.String newName)
Method Detail

minOf

protected int minOf(int a,
                    int b)

maxOf

protected int maxOf(int a,
                    int b)

growBounds

public void growBounds(State state)

main

public static void main(java.lang.String[] args)

acuityAdjustment

public int acuityAdjustment(ReadingState previousState,
                            ReadingState newState)
If we saccade to a position, the time attended is worth less than future time that will be spent (see detail). In detail it is important to note that the time already spent is taken from newState -- this is ok in the serial attention case because attendWord has not yet been called. The subtlety becomes more relevant in the parallel attention case, because attendWord *has* already been called by super() [nonparallel sentence world code is called.] It seems for parallel processing correctness, if parallel lexical processing is called first, then the acuity adjustment code should subtract some time.


calculateDistFromAttendedWordCenter

public int calculateDistFromAttendedWordCenter(ReadingState state)

totalIdentificationTimePlusAcuityEffect

protected int totalIdentificationTimePlusAcuityEffect(int wid,
                                                      int fromEyePosition)

totalIdentificationTimePlusAcuityEffect

protected int totalIdentificationTimePlusAcuityEffect(Word w,
                                                      int fromEyePosition)

getCenterOfWord

public int getCenterOfWord(Word w)

getCenterOfWord

public int getCenterOfWord(int wid)

setRequester

public void setRequester(java.lang.String r)

getNewState

public State getNewState(State oldGenericState,
                         Action genericAction,
                         java.lang.String r)

getNewState

public State getNewState(State oldGenericState,
                         Action genericAction)
This critical method returns the new state given an action from an old state, and in this case, simply adds state to position to simulate movement. Note that there are no boundary conditions set up here. ROADMAP ------- handle action: executing saccade else not executing saccade (staying in current eye position) handle action: requesting saccade (start programming) handle action: attend next word handle state: programming saccade

Specified by:
getNewState in interface World

checkForAcuityLimit

public ReadingState checkForAcuityLimit(ReadingState newState)
If the eyes land too eccentricly, force eyes to land within acuity limit.


applySaccadicError

public int applySaccadicError(int saccadeRequestDistance)

executeSaccade

protected ReadingState executeSaccade(ReadingState oldState)

checkForWordIdentification

public ReadingState checkForWordIdentification(ReadingState newState)

attendCurrentWord

public ReadingState attendCurrentWord(ReadingState newState)

getWordLengthOrZero

protected int getWordLengthOrZero(int id)

getWordPredictabilityOrZero

protected double getWordPredictabilityOrZero(int id)

attemptAttendNextWord

protected void attemptAttendNextWord(ReadingState newState)

getNewState

public ReadingState getNewState(ReadingState rs,
                                ReadingAction ra)

distance

public int distance(State state1,
                    State state2)

getSentenceLength

public int getSentenceLength()

setSentence

public void setSentence(java.lang.String newSentenceString,
                        java.lang.String predictabilities,
                        java.lang.String minIDTimes)

setSentence

public void setSentence(java.lang.String newSentenceString,
                        java.lang.String predictabilities,
                        java.lang.String minIDTimes,
                        java.lang.String lengths,
                        boolean lengthsManuallyOverridden)

acuityIdentificationPenalty

public int acuityIdentificationPenalty(int wid,
                                       int currentEyePosition)

acuityIdentificationPenalty

public int acuityIdentificationPenalty(Word w,
                                       int currentEyePosition)

acuityIdentificationPenaltyAbsolute

public int acuityIdentificationPenaltyAbsolute(int absoluteDistanceInCharacters)

isTerminalState

public boolean isTerminalState(State state)
Description copied from interface: World
Reports whether this particular state is a terminal state.

Specified by:
isTerminalState in interface World

getNumberOfPositions

public int getNumberOfPositions()

getTerminalStates

public java.util.HashSet getTerminalStates()

getTerminalStates_notUsed

public java.util.HashSet getTerminalStates_notUsed()

getDeadendStates

public java.util.List getDeadendStates()

setupReadingStateFactory

public void setupReadingStateFactory(int kind,
                                     boolean pooling)

setupReadingStateFactory

public void setupReadingStateFactory(int kind)

build

public void build()
Here we construct the state space for this sentence.

Specified by:
build in interface World

stateIterator

public java.util.Iterator stateIterator()
Description copied from interface: World
Returns an object which lets you iterate over all states (positions) in the world.

Specified by:
stateIterator in interface World

setBoundedBufferSize

public void setBoundedBufferSize(int n)

getAllStatesFromEyePosition

public java.util.List getAllStatesFromEyePosition(int eyePosition)

isOnWord

public boolean isOnWord(int eyePosition)

getWordAtEyePosition

public Word getWordAtEyePosition(int eyePosition)

getAllStatesWhereAttendingWordAt

public java.util.List getAllStatesWhereAttendingWordAt(int eyePosition)

getPossibleEyePositions

public java.util.List<java.lang.Integer> getPossibleEyePositions(Word thisWord)

getPossibleEyePositionsSlow

public java.util.List getPossibleEyePositionsSlow(Word thisWord)

getSettings

public java.lang.String getSettings()

toText

public java.lang.String toText()
Description copied from interface: World
Returns a text representation of the world, if possible.

Specified by:
toText in interface World

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNumWords

public int getNumWords()

getWord

public Word getWord(int id)

isLastWordID

public boolean isLastWordID(int wordID)

getName

public java.lang.String getName()

getIsBuilt

public boolean getIsBuilt()
Description copied from interface: World
Allows you to determine if the world has been built yet or not.

Specified by:
getIsBuilt in interface World

getATTEND_INTERVAL

public int getATTEND_INTERVAL()

setATTEND_INTERVAL

public void setATTEND_INTERVAL(int ATTEND_INTERVAL)

getSACCADE_PROGRAM_INTERVAL

public int getSACCADE_PROGRAM_INTERVAL()

setSACCADE_PROGRAM_INTERVAL

public void setSACCADE_PROGRAM_INTERVAL(int SACCADE_PROGRAM_INTERVAL)

getMAX_POSSIBLE_ID_TIME

public int getMAX_POSSIBLE_ID_TIME()

setMAX_POSSIBLE_ID_TIME

public void setMAX_POSSIBLE_ID_TIME(int MAX_POSSIBLE_ID_TIME)

getMAX_SACCADE_PROG_TIME

public int getMAX_SACCADE_PROG_TIME()

setMAX_SACCADE_PROG_TIME

public void setMAX_SACCADE_PROG_TIME(int MAX_SACCADE_PROG_TIME)

getMAX_POSSIBLE_ATTEND_TIME

public int getMAX_POSSIBLE_ATTEND_TIME()

setMAX_POSSIBLE_ATTEND_TIME

public void setMAX_POSSIBLE_ATTEND_TIME(int MAX_POSSIBLE_ATTEND_TIME)

getSACCADE_TIME_PENALTY

public int getSACCADE_TIME_PENALTY()

setSACCADE_TIME_PENALTY

public void setSACCADE_TIME_PENALTY(int SACCADE_TIME_PENALTY)

getMIN_ATTEND_TIME_WITH_PENALTIES

public int getMIN_ATTEND_TIME_WITH_PENALTIES()

getMAX_ATTEND_TIME_WITH_PENALTIES

public int getMAX_ATTEND_TIME_WITH_PENALTIES()
Getter for property MAX_ATTEND_TIME_WITH_PENALTIES.

Returns:
Value of property MAX_ATTEND_TIME_WITH_PENALTIES.

getNumberOfStates

public int getNumberOfStates()
Specified by:
getNumberOfStates in interface World

getStateFactory

public ReadingStateFactory getStateFactory()

getStartingState

public State getStartingState()
Specified by:
getStartingState in interface World

getRandomState

public State getRandomState()

getStateList

public java.util.List getStateList()
Description copied from interface: World
Returns a list of all the states (i.e. positions) in the world.

Specified by:
getStateList in interface World