org.pandora.thought.language
Class Comprehension
java.lang.Object
org.pandora.thought.BasicThought
org.pandora.thought.SubconsciousThought
org.pandora.thought.language.Comprehension
- All Implemented Interfaces:
- Thought
public class Comprehension
- extends SubconsciousThought
Analyse input for gramatic rules.
Define a language state machine for input response pairs.
Nested Class Summary |
static class |
Comprehension.PathType
Define the traversal path types for the language state machine. |
Method Summary |
boolean |
checkQuotient(Vertex currentState,
Vertex sentence,
Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
Check if any of the existing quotients match, if none do, then add a new quotient. |
Vertex |
createFormula(Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
Attempt to create a formula response from the question and response. |
boolean |
isConsciousProcessingRequired()
The input must be processed by language first to associate the question/response. |
boolean |
processInput(Vertex input,
Network network)
If the input is a sentence process it for language rules and variable substitution. |
boolean |
processState(Vertex currentState,
java.util.List<Vertex> words,
int index,
java.lang.String statePath,
Comprehension.PathType path,
Vertex sentence,
Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
Check if any of the current states match the next word,
if no match, or quotient does not match, add a new case. |
Methods inherited from class org.pandora.thought.BasicThought |
getName, getPandora, getPrimitive, getShortTermMemory, initialize, log, log, setName, setPandora, stop, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MAX_IDENTIFIER
public static int MAX_IDENTIFIER
Comprehension
public Comprehension()
isConsciousProcessingRequired
public boolean isConsciousProcessingRequired()
- The input must be processed by language first to associate the question/response.
- Overrides:
isConsciousProcessingRequired
in class SubconsciousThought
processInput
public boolean processInput(Vertex input,
Network network)
- If the input is a sentence process it for language rules and variable substitution.
- Specified by:
processInput
in class SubconsciousThought
processState
public boolean processState(Vertex currentState,
java.util.List<Vertex> words,
int index,
java.lang.String statePath,
Comprehension.PathType path,
Vertex sentence,
Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
- Check if any of the current states match the next word,
if no match, or quotient does not match, add a new case.
Return if the quotient matched.
checkQuotient
public boolean checkQuotient(Vertex currentState,
Vertex sentence,
Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
- Check if any of the existing quotients match, if none do, then add a new quotient.
createFormula
public Vertex createFormula(Vertex questionInput,
Vertex responseInput,
java.util.Map<Vertex,Vertex> variables,
Network network)
- Attempt to create a formula response from the question and response.