diff --git a/.gitignore b/.gitignore index 463f3f0f..f4f33683 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ local.properties *.idea -.target \ No newline at end of file +.target + +resources/word2vec_toy_data_and_model \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a917a644 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "roboy_parser"] + path = roboy_parser + url = git://github.com/Roboy/roboy_parser.git diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 7fc543ad..bbf5b54e --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # DialogSystem [![Documentation Status](https://readthedocs.org/projects/roboydialog/badge/?version=master)](http://roboydialog.readthedocs.io/en/master/?badge=master) -## What is it? +## What is it This repository contains a dialog system developed for the humanoid robot Roboy (roboy.org). -## How does it work? +## How does it work The basic NLP architecture is designed as a pipeline. An input device (derived from de.roboy.io.InputDevice) is producing text, which is passed to a variety of linguistic analyzers (derived from de.roboy.linguistics.sentenceanalysis.Analyzer). This currently consists of a Tokenizer and a POS tagger (both in de.roboy.linguistics.sentenceanalysis.SentenceAnalyzer) but could in the future be accompanied by named entity recognition, a syntactical and semantical analysis, an interpretation of the sentence type or other tools. The results of all these linguistics analyzers are collected together with the original text (de.roboy.linguistics.sentenceanalysis.Interpretation) and passed on to a state machine (states are derived from de.roboy.dialog.personality.states.State) within a personality class (derived from de.roboy.dialog.personality.Personality) that decides how to react to the utterance. In the future, the intentions (de.roboy.logic.Intention) determined by the state machine will then formulated into proper sentences or other actions (de.roboy.dialog.action.Action) by a module called Verbalizer. Currently, these actions are still directly created in the personality class. Finally, the created actions are sent to the corresponding output device (de.roboy.io.OutputDevice). @@ -13,7 +13,7 @@ There are interfaces for each step in the processing pipeline to enable an easy The implementation of the pipeline is in Java. Integrations with tools in other languages, like C++ RealSense stuff, should be wrapped in a module in the pipeline. -## How to run it? +## How to run it The repository contains a project that can be readily imported into Eclipse. Best use the EGit Eclipse Plugin to check it out. The code can be executed by running de.roboy.dialog.DialogSystem. @@ -28,7 +28,7 @@ To execute: mvn exec:java -Dexec.mainClass="roboy.dialog.DialogSystem" ``` -## How to extend it? +## How to extend it Pick the corresponding interface, depending on which part of the system you want to extend. If you want to add new devices go for the input or output device interfaces. If you want to extend the linguistic analysis implement the Analyzer interface or extend the SentenceAnalyzer class. If you are happy with input, linguistics and output and just want to create more dialog, implement the Personality interface. diff --git a/config.properties b/config.properties old mode 100644 new mode 100755 index 3a05f4e0..2592f7c3 --- a/config.properties +++ b/config.properties @@ -1 +1,4 @@ -ROS_HOSTNAME: 10.183.122.142 \ No newline at end of file +ROS_HOSTNAME: 127.0.0.1 +PARSER_PORT: 5000 +DEMO_GUI: false +PERSONALITY_FILE: "resources/personalityFiles/ExamplePersonality.json" \ No newline at end of file diff --git a/docs/Architecture/0_deployment.rst b/docs/Architecture/0_deployment.rst old mode 100644 new mode 100755 diff --git a/docs/Architecture/1_sequence.rst b/docs/Architecture/1_sequence.rst old mode 100644 new mode 100755 diff --git a/docs/Architecture/2_buildingblock.rst b/docs/Architecture/2_buildingblock.rst old mode 100644 new mode 100755 diff --git a/docs/Architecture/images/buildingblock.png b/docs/Architecture/images/buildingblock.png old mode 100644 new mode 100755 diff --git a/docs/Architecture/images/deployment.png b/docs/Architecture/images/deployment.png old mode 100644 new mode 100755 diff --git a/docs/Architecture/images/sequence.png b/docs/Architecture/images/sequence.png old mode 100644 new mode 100755 diff --git a/docs/Doxyfile b/docs/Doxyfile old mode 100644 new mode 100755 diff --git a/docs/ScopeContext/6_API.rst b/docs/ScopeContext/6_API.rst old mode 100644 new mode 100755 diff --git a/docs/Usage/0_installation.rst b/docs/Usage/0_installation.rst old mode 100644 new mode 100755 diff --git a/docs/Usage/1_getting_started.rst b/docs/Usage/1_getting_started.rst old mode 100644 new mode 100755 diff --git a/docs/Usage/2_personality_and_states.rst b/docs/Usage/2_personality_and_states.rst old mode 100644 new mode 100755 index 264524c6..7cb35ece --- a/docs/Usage/2_personality_and_states.rst +++ b/docs/Usage/2_personality_and_states.rst @@ -12,21 +12,41 @@ During one run-through, the Dialog System uses a single Personality instance (`` The current primary personality is the SmallTalkPersonality (``de.roboy.dialog.personality.SmallTalkPersonality``). -State ------ +A new personality (``roboy.newDialog.StateBasedPersonality``) is currently being implemented. Similarly to the SmallTalkPersonality, it is built on top of a state machine. The new personality is designed to be more generic one and allows to load the behaviour from a personality file. The file stores a representation of the state machine. Additionally, it is still possible to define the dialog structure directly from code (as it was done in previous implementations). + +Legacy State +------------ A state's activity can be divided into two stages. When the state is entered, the initial action from the ``act()`` method is carried out, which is expected to trigger a response from the person. After Roboy has received and analyzed the response, the ``react()`` method completes the current state's actions and Roboy moves on to the next state. The AbstractBooleanState describes a special case where the state's reaction depends on whether the ``act()`` method resulted in successful interaction. States which implement AbstractBooleanState can respond differently move on into different stages according to their ``determineSuccess()`` method. -For example, the intial action of ``de.roboy.dialog.personality.states.IntroductionState`` is to ask the user's name. Then the response is analyzed externally and when the state's determineSuccess() method is called, it checks whether a name was extracted. If this is the case, then the system outputs predefined sentences with the extracted name embedded into them. Otherwise, fallback sentences are used which do not include a name. +For example, the initial action of ``de.roboy.dialog.personality.states.IntroductionState`` is to ask the user's name. Then the response is analyzed externally and when the state's determineSuccess() method is called, it checks whether a name was extracted. If this is the case, then the system outputs predefined sentences with the extracted name embedded into them. Otherwise, fallback sentences are used which do not include a name. + +New State +--------- + +Currently, we are improving the state system. Old state implementations will be replaced with newer ones. The functionality of the AbstractBooleanState will be improved to allow arbitrary conditional transitions in every new state. Nested states will be replaced with the fallback concept. + +A state's activity can be divided into two stages. When the state is entered, the initial action from the ``act()`` method is carried out, which is expected to trigger a response from the person. After Roboy has received and analyzed the response, the ``react()`` method completes the current state's actions and Roboy picks a transition to the next state defined by the ``getNextState()`` method of the current state. + +It is possible to remain in the same state for many cycles. In this case the ``getNextState()`` method just returns a reference to the current state (``this``) and the ``act()`` and ``react()`` methods are carried out again. + +A state can have any number of transitions to other states. Every transition has a name (like "next" or "errorState"). When changing states, the following state can be selected based on internal conditions of the current state. For example, a state can expect a "yes/no" answer and have tree outgoing transitions: "gotYes", "gotNo" and "askAgain" (if the reply is not "yes/no"). + +When designing a new state, only the transition names are defined. The following states are defined in the personality file later. At run time the state machine loads the file and initializes the transitions to point it correct states. The destination state can be retrieved by the transition name using ``getTransition(transitionName)``. + +A fallback can be attached to a state. In the case this state doesn't know how to react to an utterance, it can return ``null`` from the ``react()`` function. The state machine will query the fallback in this case. This concept helps to decouple the states and reduce the dependencies between them. When implementing the ``react()`` function of a new state, it is sufficient to detect unknown input and return ``null``. + + + -State machine structure ------------------------ +Legacy State machine structure +------------------------------ -Every state defines at least one successor state, and more complex hierarchies can be realized - for example as a fallback system for cases when a single state cannot respond in a meaningful manner. The following is an example from the documentation of SmallTalkPersonality: +Every state defines at least one successor state, and more complex hierarchies can be realized - for example as a fallback system for cases when a single state cannot respond in a meaningful manner. The fallback system implemented using nested states in the legacy state machine and will be improved in the newer implementation. The following is an example from the documentation of SmallTalkPersonality: -The current state machine looks like this: +The current legacy state machine looks like this: Greeting state | @@ -39,6 +59,6 @@ Greeting state |_Segue state |_Wild talk state - The Question Randomizer, Question Answering, Segue and Wilk talk states are stacked. If one cannot give an appropriate reaction to the given utterance, the utterance is passed on to the next one. The Wild talk state will always answer. + The Question Randomizer, Question Answering, Segue and Wilk talk states are nested. If one cannot give an appropriate reaction to the given utterance, the utterance is passed on to the next one. The Wild talk state will always answer. diff --git a/docs/Usage/3_memory.rst b/docs/Usage/3_memory.rst old mode 100644 new mode 100755 index f96b2fe1..f25e6542 --- a/docs/Usage/3_memory.rst +++ b/docs/Usage/3_memory.rst @@ -25,6 +25,6 @@ Roboy's Dialog System interactions with the Memory module are based on ROS messa | CypherMemoryQuery | For more complex queries (future) | +--------------------+--------------------------------------------------+ -The messages received from Memory are in JSON format. To enable flexible high-level handling of Memory information, two classes were created to incorporate the node structures and logic inside the Dialog System. The ``de.roboy.memory.nodes.MemoryNodeModel`` contains the labels, properties and relations in a format which can be directly parsed from and into JSON. For this, Dialog is using the GSON parsing methods which enable direct translation of a JSON String into its respective Java class representation. +The messages received from Memory are in JSON format. To enable flexible high-level handling of Memory information, two classes were created to incorporate the node structures and logic inside the Dialog System. The ``de.roboy.memory.nodes.MemoryNodeModel`` contains the labels, properties and relationships in a format which can be directly parsed from and into JSON. For this, Dialog is using the GSON parsing methods which enable direct translation of a JSON String into its respective Java class representation. Methods such as ``getRelation()`` or ``setProperties()`` were implemented to allow intuitive handling of the MemoryNodeModel instances. A separate class, ``de.roboy.memory.nodes.Interlocutor``, encapsulates a MemoryNodeModel and is intended to further ease saving information about the current conversation partner of Roboy. Interlocutor goes one step further by also abstracting the actual calls to memory, such that adding the name of the conversant performs an automatic lookup in the memory with subsequent updating of the person-related information. This is then available in all subsequent interactions, such that Roboy can refrain from asking questions twice, or refer to information he rememberes from earlier conversations. diff --git a/docs/Usage/4_configuration.rst b/docs/Usage/4_configuration.rst old mode 100644 new mode 100755 index cd11de00..95dd4b35 --- a/docs/Usage/4_configuration.rst +++ b/docs/Usage/4_configuration.rst @@ -30,6 +30,12 @@ Profiles | | profile includes all restrictions of NOROS and also does not | | | call DBPedia. | +--------------------+-----------------------------------------------------------------+ +| MEMORY-ONLY | To be used during Memory development, when no other ROS services| +| | are running. Only Neo4j-related ROS calls will be made. | ++--------------------+-----------------------------------------------------------------+ +| DEBUG | With this setting, DM will run like DEFAULT but not shut down | +| | when ROS failures are encountered. | ++--------------------+-----------------------------------------------------------------+ Extending --------- diff --git a/docs/Usage/5_context.rst b/docs/Usage/5_context.rst new file mode 100644 index 00000000..961e9759 --- /dev/null +++ b/docs/Usage/5_context.rst @@ -0,0 +1,55 @@ +******* +Context +******* + +The goal of Context is to collect information about Roboy's environment and state. This information can be used by the DM classes and also to react upon situations that match certain conditions, such as turning the head of Roboy when the Interlocutor moves. + +Architecture +============ + +.. figure:: ../images/context.png +:alt: Context architecture + +The Context supports storing data as a ``Value`` or ``ValueHistory``. A ``Value`` only stores the latest data object that was pushed to it. A ``ValueHistory`` stores every value it receives and assigns each a unique key, thus the values can be ordered by their adding time. + + +How to add Values? +================== + +Here we describe how a new Value can be created and added to the Context. Sample implementations can be found inside ``roboy.context.contextObjects`` packge. + +1. Consider what type of data will be stored in the Value. For this example, we chose ``String``. +2. In the ``contextObjects`` directory, create a new class which inherits from the Value class. The final signature should look similar to: ``public class SampleValue extends Value`` (replacing String with your type). +3. Add the new Value in the main class ``Context.java``: + 1. In the standard constructor, initialize the Value object and add it to the builder of the value map: ``put(SampleValue.class, sampleValue)`` + 2. Make the value available over the enum ``Values`` within the Context class by adding a new element with your class name and stored data type. For example: ``SAMPLE_VALUE(SampleValue.class, String.class);`` + +How to add ValueHistories? +========================== + +ValueHistories extend the functionality of Values by storing all data objects sent to them. Over the ``getNLastValues(int n)`` method, a map with several most recent data objects can be retrieved, including their ordering. + +Adding a ``ValueHistory`` is very much alike to adding a ``Value``, just make sure to: + +1. extend ``ValueHistory<>`` instead of ``Value<>``, + +2. in ``Context.java``, add the new object to the Builder of ``valueHistories`` instead of ``values``, and to the enum ``ValueHistories`` instead of ``Values``. + +How to add Updaters? +==================== + +New values can only be added to the Context over an ``Updater`` instance. Internal updaters can be used by DM classes to actively add new values. External updaters run in separate threads and seek out new values, for example over a ROS connections to the Vision module. + +Adding an External Updater +"""""""""""""""""""""""""" +Currently, the only implementation of an external updater is the ``IntervalUpdater`` abstract class. Usage: + +1. Create a class extending ``IntervalUpdater`` and implement its ``update()`` method. It should retrieve the values and finally add them over the ``target.updateValue(value)`` method call. +2. Add the updater to ``externalUpdaters`` in the ``Context.java`` constructor, setting its ``target`` parameter with the ``Value`` or ``ValueHistory`` object created in the same constructor. + +Adding a new Internal Updater +""""""""""""""""""""""""""""" +1. Create a class extending InternalUpdater<*targetClass*, *valueType*>. The class and data type of the target ``Value`` or ``ValueHistory`` are the generic parameters for the updater. +2. A constructor is required for the class, simply match the InternalUpdater constructor and call ``super(target)`` within. An example is in the ``DialogTopicsUpdater`` class. +3. In the ``Context`` class constructor, initialize the updater and add it to the ``internalUpdaters`` map. +4. Add an entry to the ``Updaters`` enum, similarly as discussed above for ``Values``. diff --git a/docs/Usage/6_semantic_parser.rst b/docs/Usage/6_semantic_parser.rst new file mode 100644 index 00000000..c0d06851 --- /dev/null +++ b/docs/Usage/6_semantic_parser.rst @@ -0,0 +1,76 @@ +Semantic Parser +=============== + +Semantic parser is used to translate text representation into formal language representation. The aim is to be able to process user utterances and react upon them. + +roboy_parser is based on `SEMPRE } - + diff --git a/docs/doxyxml/_abstract_value_8java.xml b/docs/doxyxml/_abstract_value_8java.xml new file mode 100644 index 00000000..396a5714 --- /dev/null +++ b/docs/doxyxml/_abstract_value_8java.xml @@ -0,0 +1,22 @@ + + + + AbstractValue.java + roboy::context::AbstractValue + roboy::context + + + + + +packageroboy.context; + +publicinterfaceAbstractValue<V>{ +VgetValue(); + +voidupdateValue(Vkey); +} + + + + diff --git a/docs/doxyxml/_abstract_value_history_8java.xml b/docs/doxyxml/_abstract_value_history_8java.xml new file mode 100644 index 00000000..0ca593a3 --- /dev/null +++ b/docs/doxyxml/_abstract_value_history_8java.xml @@ -0,0 +1,22 @@ + + + + AbstractValueHistory.java + roboy::context::AbstractValueHistory + roboy::context + + + + + +packageroboy.context; + +importjava.util.Map; + +publicinterfaceAbstractValueHistory<K,V>extendsAbstractValue<V>{ +Map<K,V>getLastNValues(intn); +} + + + + diff --git a/docs/doxyxml/_action_8java.xml b/docs/doxyxml/_action_8java.xml old mode 100644 new mode 100755 index 11a0aef5..35713174 --- a/docs/doxyxml/_action_8java.xml +++ b/docs/doxyxml/_action_8java.xml @@ -15,6 +15,6 @@ } - + diff --git a/docs/doxyxml/_analyzer_8java.xml b/docs/doxyxml/_analyzer_8java.xml old mode 100644 new mode 100755 index 43b28e33..08cdab4d --- a/docs/doxyxml/_analyzer_8java.xml +++ b/docs/doxyxml/_analyzer_8java.xml @@ -17,6 +17,6 @@ } - + diff --git a/docs/doxyxml/_anecdote_state_8java.xml b/docs/doxyxml/_anecdote_state_8java.xml old mode 100644 new mode 100755 index 521028a7..3b45bf36 --- a/docs/doxyxml/_anecdote_state_8java.xml +++ b/docs/doxyxml/_anecdote_state_8java.xml @@ -44,6 +44,6 @@ } - + diff --git a/docs/doxyxml/_answer_analyzer_8java.xml b/docs/doxyxml/_answer_analyzer_8java.xml old mode 100644 new mode 100755 index 69efc64b..230d276a --- a/docs/doxyxml/_answer_analyzer_8java.xml +++ b/docs/doxyxml/_answer_analyzer_8java.xml @@ -99,6 +99,6 @@ } - + diff --git a/docs/doxyxml/_answer_analyzer_test_8java.xml b/docs/doxyxml/_answer_analyzer_test_8java.xml old mode 100644 new mode 100755 index 43d5df66..88f3561c --- a/docs/doxyxml/_answer_analyzer_test_8java.xml +++ b/docs/doxyxml/_answer_analyzer_test_8java.xml @@ -104,6 +104,6 @@ } - + diff --git a/docs/doxyxml/_async_update_policy_8java.xml b/docs/doxyxml/_async_update_policy_8java.xml new file mode 100644 index 00000000..a4ac6e36 --- /dev/null +++ b/docs/doxyxml/_async_update_policy_8java.xml @@ -0,0 +1,20 @@ + + + + AsyncUpdatePolicy.java + roboy::context::AsyncUpdatePolicy + roboy::context + + + + + +packageroboy.context; + +publicabstractclassAsyncUpdatePolicy{ +protectedabstractvoidupdate(); +} + + + + diff --git a/docs/doxyxml/_attribute_interface_8java.xml b/docs/doxyxml/_attribute_interface_8java.xml new file mode 100644 index 00000000..18e65fd1 --- /dev/null +++ b/docs/doxyxml/_attribute_interface_8java.xml @@ -0,0 +1,24 @@ + + + + AttributeInterface.java + roboy::context::AttributeInterface + roboy::context + + + + + +packageroboy.context; + +publicinterfaceAttributeInterface{ + +ClassgetClassType(); + +ClassgetReturnType(); + +} + + + + diff --git a/docs/doxyxml/_attribute_manager_8java.xml b/docs/doxyxml/_attribute_manager_8java.xml new file mode 100644 index 00000000..0555773c --- /dev/null +++ b/docs/doxyxml/_attribute_manager_8java.xml @@ -0,0 +1,40 @@ + + + + AttributeManager.java + roboy::context::AttributeManager + roboy::context + + + + + +packageroboy.context; + +importcom.google.common.collect.ImmutableClassToInstanceMap; + +importjava.util.Map; + +publicclassAttributeManager<HextendsExternalContextInterface,VextendsExternalContextInterface>{ + +protectedImmutableClassToInstanceMap<AbstractValueHistory>valueHistories; +protectedImmutableClassToInstanceMap<AbstractValue>values; + +protected<T>TgetLastValue(ExternalContextInterfaceattribute){ +Class<T>type=attribute.getReturnType(); +returntype.cast(valueHistories.get(attribute.getClassType()).getValue()); +} + +protected<K,T>Map<K,T>getNLastValues(Hattribute,intn){ +return(Map<K,T>)valueHistories.get(attribute.getClassType()).getLastNValues(n); +} + +protected<T>TgetValue(Vattribute){ +Class<T>type=attribute.getReturnType(); +returntype.cast(values.get(attribute.getClassType()).getValue()); +} +} + + + + diff --git a/docs/doxyxml/_bing_input_8java.xml b/docs/doxyxml/_bing_input_8java.xml old mode 100644 new mode 100755 index 6675d9d2..c7130585 --- a/docs/doxyxml/_bing_input_8java.xml +++ b/docs/doxyxml/_bing_input_8java.xml @@ -30,6 +30,6 @@ } - + diff --git a/docs/doxyxml/_bing_output_8java.xml b/docs/doxyxml/_bing_output_8java.xml old mode 100644 new mode 100755 index eaae118b..245562e5 --- a/docs/doxyxml/_bing_output_8java.xml +++ b/docs/doxyxml/_bing_output_8java.xml @@ -40,6 +40,6 @@ } - + diff --git a/docs/doxyxml/_celebrity_similarity_input_8java.xml b/docs/doxyxml/_celebrity_similarity_input_8java.xml old mode 100644 new mode 100755 index db603aac..6df98549 --- a/docs/doxyxml/_celebrity_similarity_input_8java.xml +++ b/docs/doxyxml/_celebrity_similarity_input_8java.xml @@ -25,6 +25,6 @@ } - + diff --git a/docs/doxyxml/_celebrity_state_8java.xml b/docs/doxyxml/_celebrity_state_8java.xml old mode 100644 new mode 100755 index 0b24df4c..9b5b8e8b --- a/docs/doxyxml/_celebrity_state_8java.xml +++ b/docs/doxyxml/_celebrity_state_8java.xml @@ -98,6 +98,6 @@ } - + diff --git a/docs/doxyxml/_cerevoice_output_8java.xml b/docs/doxyxml/_cerevoice_output_8java.xml old mode 100644 new mode 100755 index dae593fb..8ef23d6a --- a/docs/doxyxml/_cerevoice_output_8java.xml +++ b/docs/doxyxml/_cerevoice_output_8java.xml @@ -43,6 +43,6 @@ } - + diff --git a/docs/doxyxml/_command_line_communication_8java.xml b/docs/doxyxml/_command_line_communication_8java.xml old mode 100644 new mode 100755 index 5e85b496..98f57bff --- a/docs/doxyxml/_command_line_communication_8java.xml +++ b/docs/doxyxml/_command_line_communication_8java.xml @@ -69,6 +69,6 @@ } - + diff --git a/docs/doxyxml/_command_line_input_8java.xml b/docs/doxyxml/_command_line_input_8java.xml old mode 100644 new mode 100755 index 419bd5ef..b0c09744 --- a/docs/doxyxml/_command_line_input_8java.xml +++ b/docs/doxyxml/_command_line_input_8java.xml @@ -35,6 +35,6 @@ } } - + diff --git a/docs/doxyxml/_command_line_output_8java.xml b/docs/doxyxml/_command_line_output_8java.xml old mode 100644 new mode 100755 index 8537178e..9b050edc --- a/docs/doxyxml/_command_line_output_8java.xml +++ b/docs/doxyxml/_command_line_output_8java.xml @@ -37,6 +37,6 @@ } - + diff --git a/docs/doxyxml/_communication_8java.xml b/docs/doxyxml/_communication_8java.xml old mode 100644 new mode 100755 index 2fefb65d..de296440 --- a/docs/doxyxml/_communication_8java.xml +++ b/docs/doxyxml/_communication_8java.xml @@ -21,6 +21,6 @@ publicvoidcommunicate(); } - + diff --git a/docs/doxyxml/_config_8java.xml b/docs/doxyxml/_config_8java.xml old mode 100644 new mode 100755 index e195f59b..8d002080 --- a/docs/doxyxml/_config_8java.xml +++ b/docs/doxyxml/_config_8java.xml @@ -24,102 +24,122 @@ DEFAULT("DEFAULT"), NOROS("NOROS"), STANDALONE("STANDALONE"), -DEBUG("DEBUG"); - -publicStringprofileName; - -ConfigurationProfile(Stringprofile){ -this.profileName=profile; -} -} - -/*CONFIGURATIONVARIABLES-alwaysstatic,withadefaultvalue.*/ -/*Profilescanoverwritethedefaultvalues,butdon'thaveto.*/ - -publicstaticbooleanSTANDALONE=false; -publicstaticbooleanNOROS=false; -publicstaticbooleanSHUTDOWN_ON_ROS_FAILURE=true; -publicstaticbooleanSHUTDOWN_ON_SERVICE_FAILURE=true; -publicstaticStringROS_HOSTNAME=null; - -privatestaticStringyamlConfigFile="config.properties"; -privateYAMLConfigurationyamlConfig; - -publicConfig(ConfigurationProfileprofile){ -initializeYAMLConfig(); -switch(profile){ -caseDEFAULT: -setDefaultProfile(); -break; -caseNOROS: -setNoROSProfile(); -break; -caseSTANDALONE: -setStandaloneProfile(); -break; -caseDEBUG: -setDebugProfile(); -break; -default: -setDefaultProfile(); -} -} - -publicstaticConfigurationProfilegetProfileFromEnvironment(StringprofileString){ -for(ConfigurationProfilep:ConfigurationProfile.values()){ -if(p.profileName.equals(profileString)){ -returnp; -} -} -returnConfigurationProfile.DEFAULT; +DEBUG("DEBUG"), +MEMORY("MEMORY"); + +publicStringprofileName; + +ConfigurationProfile(Stringprofile){ +this.profileName=profile; +} +} + +/*CONFIGURATIONVARIABLES-alwaysstatic,withadefaultvalue.*/ +/*Profilescanoverwritethedefaultvalues,butdon'thaveto.*/ + +publicstaticbooleanSTANDALONE=false; +publicstaticbooleanNOROS=false; +publicstaticbooleanSHUTDOWN_ON_ROS_FAILURE=true; +publicstaticbooleanSHUTDOWN_ON_SERVICE_FAILURE=true; +publicstaticStringROS_HOSTNAME=null; +publicstaticbooleanMEMORY=true; +publicstaticintPARSER_PORT=-1; +publicstaticbooleanDEMO_GUI=false; + +privatestaticStringyamlConfigFile="config.properties"; +privateYAMLConfigurationyamlConfig; + +publicConfig(ConfigurationProfileprofile){ +initializeYAMLConfig(); +//Initializesemanticparsersocketport +PARSER_PORT=yamlConfig.getInt("PARSER_PORT"); +DEMO_GUI=yamlConfig.getBoolean("DEMO_GUI"); +switch(profile){ +caseDEFAULT: +setDefaultProfile(); +break; +caseNOROS: +setNoROSProfile(); +break; +caseSTANDALONE: +setStandaloneProfile(); +break; +caseDEBUG: +setDebugProfile(); +break; +caseMEMORY: +setMemoryProfile(); +break; +default: +setDefaultProfile(); +} } -/*PROFILEDEFINITIONS*/ - -privatevoidsetDefaultProfile(){ -STANDALONE=false; -ROS_HOSTNAME=yamlConfig.getString("ROS_HOSTNAME"); -} - -privatevoidsetNoROSProfile(){ -NOROS=true; -SHUTDOWN_ON_ROS_FAILURE=false; -SHUTDOWN_ON_SERVICE_FAILURE=false; -} - -privatevoidsetStandaloneProfile(){ -STANDALONE=true; -//AlsosetNOROS,suchthatROS-basedservicecallersonlyneedtocheckforNOROSsetting. -NOROS=true; -SHUTDOWN_ON_ROS_FAILURE=false; -SHUTDOWN_ON_SERVICE_FAILURE=false; +publicstaticConfigurationProfilegetProfileFromEnvironment(StringprofileString){ +for(ConfigurationProfilep:ConfigurationProfile.values()){ +if(p.profileName.equals(profileString)){ +returnp; +} +} +returnConfigurationProfile.DEFAULT; +} + +/*PROFILEDEFINITIONS*/ + +privatevoidsetDefaultProfile(){ +STANDALONE=false; +ROS_HOSTNAME=yamlConfig.getString("ROS_HOSTNAME"); } -privatevoidsetDebugProfile(){ -SHUTDOWN_ON_ROS_FAILURE=false; -SHUTDOWN_ON_SERVICE_FAILURE=false; -} - -privatevoidinitializeYAMLConfig(){ -this.yamlConfig=newYAMLConfiguration(); -try -{ -FilepropertiesFile=newFile(yamlConfigFile); -if(propertiesFile==null){ -System.out.println("Couldnotfind"+yamlConfigFile+"fileinprojectpath!YAMLconfigurationswillbeunavailable."); -return; -} -FileReaderpropertiesReader=newFileReader(propertiesFile); -yamlConfig.read(propertiesReader); -} -catch(ConfigurationException|FileNotFoundExceptione) -{ -System.out.println("ExceptionwhilereadingYAMLconfigurationsfrom"+yamlConfigFile); -e.printStackTrace(); -} -} -} +privatevoidsetNoROSProfile(){ +NOROS=true; +SHUTDOWN_ON_ROS_FAILURE=false; +SHUTDOWN_ON_SERVICE_FAILURE=false; +MEMORY=false; +} + +privatevoidsetStandaloneProfile(){ +STANDALONE=true; +//AlsosetNOROS,suchthatROS-basedservicecallersonlyneedtocheckforNOROSsetting. +NOROS=true; +SHUTDOWN_ON_ROS_FAILURE=false; +SHUTDOWN_ON_SERVICE_FAILURE=false; +MEMORY=false; +} + +privatevoidsetDebugProfile(){ +SHUTDOWN_ON_ROS_FAILURE=false; +SHUTDOWN_ON_SERVICE_FAILURE=false; +} + +privatevoidsetMemoryProfile(){ +NOROS=true; +SHUTDOWN_ON_ROS_FAILURE=false; +SHUTDOWN_ON_SERVICE_FAILURE=false; +MEMORY=true; +ROS_HOSTNAME=yamlConfig.getString("ROS_HOSTNAME"); +} + +privatevoidinitializeYAMLConfig(){ +this.yamlConfig=newYAMLConfiguration(); +try +{ +FilepropertiesFile=newFile(yamlConfigFile); +if(!propertiesFile.exists()){//propertiesFile==nulldoesn'twork! +System.out.println("Couldnotfind"+yamlConfigFile+"fileinprojectpath!YAMLconfigurationswillbeunavailable."); +return; +} +FileReaderpropertiesReader=newFileReader(propertiesFile); +yamlConfig.read(propertiesReader); +} +catch(ConfigurationException|FileNotFoundExceptione) +{ +System.out.println("ExceptionwhilereadingYAMLconfigurationsfrom"+yamlConfigFile); +e.printStackTrace(); +} +} +} - + diff --git a/docs/doxyxml/_context_8java.xml b/docs/doxyxml/_context_8java.xml new file mode 100644 index 00000000..826c2535 --- /dev/null +++ b/docs/doxyxml/_context_8java.xml @@ -0,0 +1,130 @@ + + + + Context.java + roboy::context::Context + roboy::context::Context::ValueHistories + roboy::context::Context::Values + roboy::context::Context::Updaters + roboy::context + + + + + +packageroboy.context; + +importcom.google.common.collect.ImmutableClassToInstanceMap; +importroboy.context.contextObjects.*; + +importjava.util.ArrayList; +importjava.util.HashMap; +importjava.util.Map; + +publicclassContextextendsAttributeManager<Context.ValueHistories,Context.Values>{ +privatestaticContextcontext; + +privatefinalArrayList<ExternalUpdater>externalUpdaters=newArrayList<>(); +publicfinalHashMap<Class,InternalUpdater>internalUpdaters=newHashMap<>(); + +privateContext(){ +FaceCoordinatesfaceCoordinates=newFaceCoordinates(); +DialogTopicsdialogTopics=newDialogTopics(); + +values=newImmutableClassToInstanceMap.Builder<AbstractValue>() +//CollectallValuescentrallyrighthere. +.put(FaceCoordinates.class,faceCoordinates) +.build(); + +valueHistories=newImmutableClassToInstanceMap.Builder<AbstractValueHistory>() +//CollectallValueHistoriescentrallyrighthere. +.put(DialogTopics.class,dialogTopics) +.build(); + +//Initializeandstoretheexternalupdaters. +externalUpdaters.add(newFaceCoordinatesUpdater(faceCoordinates,1)); +//Initializedirectupdaterswiththeirtargets. +internalUpdaters.put(DialogTopicsUpdater.class,newDialogTopicsUpdater(dialogTopics)); +} + +publicstaticContextgetInstance(){ +if(context==null){ +context=newContext(); +} +returncontext; +} + +publicenumValueHistoriesimplementsExternalContextInterface{ +DIALOG_TOPICS(DialogTopics.class,String.class); + +finalClassclassType; +finalClassreturnType; + +ValueHistories(Class<?extendsAbstractValueHistory>attribute,ClassdataType){ +this.classType=attribute; +this.returnType=dataType; +} + +publicClassgetClassType(){ +returnthis.classType; +} + +publicClassgetReturnType(){ +returnthis.returnType; +} + +public<T>TgetLastValue(){ +returnContext.getInstance().getLastValue(this); +} + +public<K,T>Map<K,T>getNLastValues(intn){ +returnContext.getInstance().getNLastValues(this,n); +} +} + +publicenumValuesimplementsExternalContextInterface{ +FACE_COORDINATES(FaceCoordinates.class,CoordinateSet.class); + +finalClassclassType; +finalClassreturnType; + +Values(Class<?extendsAbstractValue>attribute,Classvalue){ +this.classType=attribute; +this.returnType=value; +} + +publicClassgetClassType(){ +returnthis.classType; +} + +publicClassgetReturnType(){ +returnthis.returnType; +} + +public<T>TgetLastValue(){ +returnContext.getInstance().getValue(this); +} +} + +publicenumUpdaters{ +DIALOG_TOPICS_UPDATER(DialogTopicsUpdater.class,String.class); + +finalClassclassType; +finalClasstargetValueType; + +Updaters(Classattribute,ClassvalueType){ +this.classType=attribute; +this.targetValueType=valueType; +} +} + +public<V>voidupdateValue(Updatersupdater,Vvalue){ +//Couldthrowexceptionifthevaluedoesnotmatchthetargetdatatype. +Classtype=updater.targetValueType; +internalUpdaters.get(updater.classType).putValue(type.cast(value)); +} +} + + + + diff --git a/docs/doxyxml/_context_g_u_i_8java.xml b/docs/doxyxml/_context_g_u_i_8java.xml new file mode 100644 index 00000000..0100b12c --- /dev/null +++ b/docs/doxyxml/_context_g_u_i_8java.xml @@ -0,0 +1,174 @@ + + + + ContextGUI.java + roboy::context::GUI::ContextGUI + roboy::context::GUI + javax::swing + java::awt + + + + + +packageroboy.context.GUI; + +importroboy.context.Context; + +importjavax.swing.*; +importjavax.swing.border.TitledBorder; +importjava.awt.*; +importjava.awt.event.WindowAdapter; +importjava.awt.event.WindowEvent; +importjava.util.HashMap; +importjava.util.Map; + +publicclassContextGUI{ +privateJFramemainFrame; + +//PaneldisplayingvalueAttributes. +privateTitledBordervalueBorder; +privateJPanelvaluePanel; +privateMap<Context.Values,JLabel>valueDisplays; +privateMap<Context.ValueHistories,JScrollPane>historyDisplays; +privatestaticintMAX_HISTORY_VALUES=10; + +//PaneldisplayinghistoryAttributes. +privateTitledBorderhistoryBorder; +privateJPanelhistoryPanel; + +//Updatebuttonpanel. +privateJPanelcontrolPanel; + +privatestaticintFULL_WIDTH=400; +privatestaticintFULL_HEIGHT=300; +privatestaticintATTR_WIDTH=390; +privatestaticintATTR_HEIGHT=50; +privatestaticintHISTORY_HEIGHT=100; + +privatestaticStringNO_VALUE="<notinitialized>"; + +publicstaticvoidrun(){ +ContextGUIgui=newContextGUI(); +gui.startFrame(); +} + +privateContextGUI(){ +prepareGUI(); +} + +privatevoidprepareGUI(){ +//Windowinitialization. +mainFrame=newJFrame("ContextGUI"); +mainFrame.setSize(FULL_WIDTH,FULL_HEIGHT); +mainFrame.setLayout(newFlowLayout()); +JPanelmainPanel=newJPanel(); +mainPanel.setLayout(newBoxLayout(mainPanel,BoxLayout.PAGE_AXIS)); + +mainFrame.add(mainPanel); + +//Attributepartinitialization. +valuePanel=newJPanel(); +valuePanel.setLayout(newGridLayout(0,2)); +valuePanel.setPreferredSize(newDimension(ATTR_WIDTH,ATTR_HEIGHT)); +valueBorder=BorderFactory.createTitledBorder("Contextvalues"); +valueBorder.setTitleJustification(TitledBorder.CENTER); +valuePanel.setBorder(valueBorder); + +valueDisplays=newHashMap<>(); +for(Context.Valuesattribute:Context.Values.values()){ +valuePanel.add(newJLabel(attribute.toString()+":",JLabel.CENTER)); +Objectval=attribute.getLastValue(); +if(val==null){ +val=NO_VALUE; +} +JLabelvalueLabel=newJLabel(val.toString(),JLabel.CENTER); +valueDisplays.put(attribute,valueLabel); +valuePanel.add(valueLabel); +} +mainPanel.add(valuePanel); + +//Historypartinitialization. +historyPanel=newJPanel(); +historyPanel.setLayout(newGridLayout(0,2)); +historyPanel.setPreferredSize(newDimension(ATTR_WIDTH,HISTORY_HEIGHT)); +historyBorder=BorderFactory.createTitledBorder("Histories"); +historyBorder.setTitleJustification(TitledBorder.CENTER); +historyPanel.setBorder(historyBorder); + +historyDisplays=newHashMap<>(); +for(Context.ValueHistoriesattribute:Context.ValueHistories.values()){ +historyPanel.add(newJLabel(attribute.toString()+":",JLabel.CENTER)); +Map<Integer,Object>vals=attribute.getNLastValues(MAX_HISTORY_VALUES); +DefaultListModel<String>sorted=newDefaultListModel<>(); +if(vals.size()==0){ +sorted.add(0,NO_VALUE); +}else{ +for(Integeri=0;i<vals.size();i++){ +sorted.add(i,vals.get(vals.size()-i-1).toString()); +} +} +JListhistoryList=newJList(sorted); +JScrollPanescrollPane=newJScrollPane(); +scrollPane.setViewportView(historyList); +historyDisplays.put(attribute,scrollPane); +historyPanel.add(scrollPane); +} +mainPanel.add(historyPanel); + +mainFrame.addWindowListener(newWindowAdapter(){ +publicvoidwindowClosing(WindowEventwindowEvent){ +mainFrame.dispose(); +} +}); + +controlPanel=newJPanel(); +controlPanel.setLayout(newFlowLayout()); + +mainPanel.add(controlPanel); +mainPanel.setVisible(true); +} + +privatevoidstartFrame(){ +JButtonupdateButton=newJButton("Update"); +updateButton.addActionListener(e->{ +updateValues(); +updateHistories(); +} +); +controlPanel.add(updateButton); +mainFrame.setVisible(true); +} + +privatevoidupdateValues(){ +for(Context.Valuesattribute:Context.Values.values()){ +Objectval=attribute.getLastValue(); +if(val==null){ +continue; +} +valueDisplays.get(attribute).setText(val.toString()); +} +valuePanel.updateUI(); +} + +privatevoidupdateHistories(){ +for(Context.ValueHistoriesattribute:Context.ValueHistories.values()){ +Map<Integer,Object>vals=attribute.getNLastValues(MAX_HISTORY_VALUES); +if(vals.size()==0){ +continue; +} +DefaultListModel<String>sorted=newDefaultListModel<>(); +for(Integeri=0;i<vals.size();i++){ +sorted.add(i,vals.get(vals.size()-i-1).toString()); +} +JListhistoryList=newJList(sorted); +JScrollPanepane=historyDisplays.get(attribute); +pane.setViewportView(historyList); +} +historyPanel.updateUI(); +} +} + + + + diff --git a/docs/doxyxml/_context_test_8java.xml b/docs/doxyxml/_context_test_8java.xml new file mode 100644 index 00000000..ceb16454 --- /dev/null +++ b/docs/doxyxml/_context_test_8java.xml @@ -0,0 +1,53 @@ + + + + ContextTest.java + roboy::context::visionContext::ContextTest + roboy::context::visionContext + + + + + +packageroboy.context.visionContext; + +importorg.junit.Test; +importroboy.context.Context; +importroboy.context.contextObjects.CoordinateSet; + +importjava.util.Map; + +importstaticorg.junit.Assert.assertEquals; +importstaticorg.junit.Assert.assertNotEquals; + +publicclassContextTest{ +@Test +publicvoidgetLastAttributeValue()throwsException{ +intupdateFrequency=1;//Assumingtheupdater'sfrequencyis1second! +intsleeptime=updateFrequency*1000*2;//Hereinmillisanddoubletheactualupdatetime. +Context.Valuesface=Context.Values.FACE_COORDINATES; +for(inti=0;i<3;i++){ +CoordinateSetset=face.getLastValue(); +Thread.sleep(sleeptime); +assertNotEquals(face.getLastValue(),set); +} +} + +@Test +publicvoidsetAndGetDialogTopics(){ +Contextct=Context.getInstance(); +Context.Updatersupdater=Context.Updaters.DIALOG_TOPICS_UPDATER; +Context.ValueHistoriestopics=Context.ValueHistories.DIALOG_TOPICS; + +ct.updateValue(updater,"test1"); +assertEquals("test1",(topics.getLastValue())); +ct.updateValue(updater,"test2"); +Map<Integer,String>values=topics.getNLastValues(2); +assertEquals("test1",values.get(0)); +assertEquals("test2",values.get(1)); +} +} + + + + diff --git a/docs/doxyxml/_converse_state_8java.xml b/docs/doxyxml/_converse_state_8java.xml old mode 100644 new mode 100755 index bc920ec8..e6a6866f --- a/docs/doxyxml/_converse_state_8java.xml +++ b/docs/doxyxml/_converse_state_8java.xml @@ -58,6 +58,6 @@ } - + diff --git a/docs/doxyxml/_coordinate_set_8java.xml b/docs/doxyxml/_coordinate_set_8java.xml new file mode 100644 index 00000000..f2cb4a96 --- /dev/null +++ b/docs/doxyxml/_coordinate_set_8java.xml @@ -0,0 +1,28 @@ + + + + CoordinateSet.java + roboy::context::contextObjects::CoordinateSet + roboy::context::contextObjects + + + + + +packageroboy.context.contextObjects; + +publicclassCoordinateSet{ +finaldoublex; +finaldoubley; +finaldoublez; + +publicCoordinateSet(doublex,doubley,doublez){ +this.x=x; +this.y=y; +this.z=z; +} +} + + + + diff --git a/docs/doxyxml/_curious_personality_8java.xml b/docs/doxyxml/_curious_personality_8java.xml old mode 100644 new mode 100755 index 6c182df7..812c7ba1 --- a/docs/doxyxml/_curious_personality_8java.xml +++ b/docs/doxyxml/_curious_personality_8java.xml @@ -103,6 +103,6 @@ } - + diff --git a/docs/doxyxml/_d_bpedia_memory_8java.xml b/docs/doxyxml/_d_bpedia_memory_8java.xml old mode 100644 new mode 100755 index 107c97b5..2c58e763 --- a/docs/doxyxml/_d_bpedia_memory_8java.xml +++ b/docs/doxyxml/_d_bpedia_memory_8java.xml @@ -231,6 +231,6 @@ } - + diff --git a/docs/doxyxml/_data_type_8java.xml b/docs/doxyxml/_data_type_8java.xml new file mode 100644 index 00000000..60bbaed9 --- /dev/null +++ b/docs/doxyxml/_data_type_8java.xml @@ -0,0 +1,19 @@ + + + + DataType.java + roboy::context::dataTypes::DataType + roboy::context::dataTypes + + + + + +packageroboy.context.dataTypes; + +publicinterfaceDataType{ +} + + + + diff --git a/docs/doxyxml/_default_personality_8java.xml b/docs/doxyxml/_default_personality_8java.xml old mode 100644 new mode 100755 index fee9022c..0ebe9023 --- a/docs/doxyxml/_default_personality_8java.xml +++ b/docs/doxyxml/_default_personality_8java.xml @@ -113,6 +113,6 @@ } - + diff --git a/docs/doxyxml/_detected_entity_8java.xml b/docs/doxyxml/_detected_entity_8java.xml old mode 100644 new mode 100755 index 924bdb2c..d664a6d1 --- a/docs/doxyxml/_detected_entity_8java.xml +++ b/docs/doxyxml/_detected_entity_8java.xml @@ -32,6 +32,6 @@ } - + diff --git a/docs/doxyxml/_dialog_state_machine_8java.xml b/docs/doxyxml/_dialog_state_machine_8java.xml new file mode 100644 index 00000000..fc7ea29b --- /dev/null +++ b/docs/doxyxml/_dialog_state_machine_8java.xml @@ -0,0 +1,346 @@ + + + + DialogStateMachine.java + roboy::newDialog::DialogStateMachine + roboy::newDialog + com::google::gson + + + + + +packageroboy.newDialog; + +importcom.google.gson.*; +importroboy.newDialog.states.State; +importroboy.newDialog.states.factories.ToyStateFactory; + +importjava.io.File; +importjava.io.FileNotFoundException; +importjava.io.FileReader; +importjava.io.PrintWriter; +importjava.util.HashMap; +importjava.util.Map; + +publicclassDialogStateMachine{ + +//mapsstringidentifierstostateobjects("Greeting"->{GreetingState}) +//allowstohavemultipleinstancesofthesamestateclasswithdifferentidentifiers("Greeting2"->{GreetingState}) +privateHashMap<String,State>identifierToState; + +privateStateactiveState; +privateStateinitalState; +privatebooleanenableDebug; + +publicDialogStateMachine(){ +this(true); +} + +publicDialogStateMachine(booleanenableDebug){ +this.enableDebug=enableDebug; +identifierToState=newHashMap<>(); +activeState=null; +} + +publicStategetInitialState(){ +returninitalState; +} +publicvoidsetInitialState(Stateinitial){ +if(initial==null)return; + +if(!identifierToState.containsValue(initial)){ +addState(initial); +} +this.initalState=initial; +if(activeState==null){ +setActiveState(initial); +} +} +publicvoidsetInitialState(Stringidentifier){ +Stateinitial=identifierToState.get(identifier); +if(initial==null){ +if(enableDebug){ +System.out.println("[!!]setInitialState:Unknownidentifier:"+identifier); +} +return; +} +setInitialState(initial); +} + + +publicStategetActiveState(){ +returnactiveState; +} +publicvoidsetActiveState(States){ +if(s==null)return; + +if(!identifierToState.containsValue(s)){ +addState(s); +} +activeState=s; +} +publicvoidsetActiveState(Stringidentifier){ +States=identifierToState.get(identifier); +if(s==null){ +if(enableDebug){ +System.out.println("[!!]setInitialState:Unknownidentifier:"+identifier); +} +return; +} +activeState=s; +} + + + +publicStategetStateByIdentifier(Stringidentifier){ +returnidentifierToState.get(identifier); +} +publicvoidaddState(States){ +identifierToState.put(s.getIdentifier(),s); +} + + + +publicvoidloadFromString(Strings){ +JsonParserparser=newJsonParser(); +JsonElementjson=parser.parse(s); +loadFromJSON(json); +} + +publicvoidloadFromFile(Filef)throwsFileNotFoundException{ +JsonParserparser=newJsonParser(); +JsonElementjson=parser.parse(newFileReader(f)); +loadFromJSON(json); +} + + +privatevoidloadFromJSON(JsonElementjson){ +identifierToState.clear(); +activeState=null; +initalState=null; + +if(!json.isJsonObject()){ +if(enableDebug){ +System.out.println("[!!]loadFromJSON:StatemachinemustbeaJSONobject!"); +} +return; +} + +JsonObjectpersonalityJson=json.getAsJsonObject(); +//System.out.println("jsonObject:"+personalityJson); + +JsonElementinitialStateJson=personalityJson.get("initialState"); +if(initialStateJson==null){ +if(enableDebug){ +System.out.println("[!!]loadFromJSON:Initialstatenotdefined!"); +} +return; +} +StringinitialStateIdentifier=initialStateJson.getAsString(); + + +JsonElementstatesJson=personalityJson.get("states"); +if(statesJson==null){ +if(enableDebug){ +System.out.println("[!!]loadFromJSON:statesnotdefined!"); +} +return; +} +JsonArraystates=statesJson.getAsJsonArray(); + +//foreachstate:createanobjectofthecorrecttype +//andaddittothehashmap +for(JsonElementstate:states){ +JsonObjects=state.getAsJsonObject(); + +Stringidentifier=s.get("identifier").getAsString(); +Stringimplementation=s.get("implementation").getAsString(); + +Stateobject=ToyStateFactory.getByClassName(implementation,identifier); +if(object!=null){ +identifierToState.put(identifier,object); +} +} + + +//nowallstateswereconvertedintoobjects +//setinitialstate +setInitialState(initialStateIdentifier);//actuallyalsosetstheactivestateinthiscase +setActiveState(initialStateIdentifier); + + +//setfallbacksandtransitions(ifdefined) +for(JsonElementstate:states){ +JsonObjects=state.getAsJsonObject(); + +Stringidentifier=s.get("identifier").getAsString(); +StatethisState=identifierToState.get(identifier); + +if(thisState==null){ +thrownewRuntimeException("Statewithidentifier"+identifier+"ismissing!"); +} + + +//checkiffallbackisdefined +JsonElementfallbackEntry=s.get("fallback"); +if(fallbackEntry!=null&&!fallbackEntry.isJsonNull()){ +StringfallbackIdentifier=fallbackEntry.getAsString(); +if(fallbackIdentifier!=null){ +StatefallbackState=identifierToState.get(fallbackIdentifier); +if(fallbackState==null){ +if(enableDebug){ +System.out.println("[!!]loadFromJSON:fallback"+fallbackIdentifier+"missing"); +} +}else{ +thisState.setFallback(fallbackState); +} +} +} + + +//setthetransitions +JsonObjecttransitions=s.getAsJsonObject("transitions"); +if(transitions!=null&&!transitions.isJsonNull()){ + +for(Map.Entry<String,JsonElement>entry:transitions.entrySet()){ +StringtransitionName=entry.getKey(); +StringtransitionTarget=entry.getValue().getAsString(); + +StatetransitionState=identifierToState.get(transitionTarget); + +if(transitionState!=null){ +thisState.setTransition(transitionName,transitionState); +} +} +} +} + + +if(enableDebug){ +//checkifallstateshaveallrequiredtransitionsinitializedcorrectly +for(States:identifierToState.values()){ +if(!s.allRequiredTransitionsAreInitialized()){ +System.out.println("[!!]loadFromJSON:Somerequiredtransitionsaremissinginthe"+ +"statewithidentifier"+s.getIdentifier()); +} +} +} + + +} + +publicvoidsaveToFile(Filef)throwsFileNotFoundException{ + +Stringjson=toJsonString(); + +try(PrintWriterout=newPrintWriter(f)){ +out.println(json); +} + +} + + + +privateJsonObjecttoJsonObject(){ +JsonObjectstateMachineJson=newJsonObject(); +if(initalState==null){ +if(enableDebug){ +System.out.println("[!!]toJsonObject:initialstateundefined!"); +} +}else{ +stateMachineJson.addProperty("initialState",initalState.getIdentifier()); +} + +//allstates +JsonArraystatesJsonArray=newJsonArray(); +for(Statestate:identifierToState.values()){ +JsonObjectstateJson=state.toJsonObject(); +statesJsonArray.add(stateJson); +} +stateMachineJson.add("states",statesJsonArray); + +returnstateMachineJson; +} + +publicStringtoJsonString(){ +Gsongson=newGsonBuilder().setPrettyPrinting().create(); +JsonObjectjson=toJsonObject(); +returngson.toJson(json); +} + + +publicStringtoString(){ +StringBuilders=newStringBuilder(); +s.append("###################################################\n"); +s.append("DialogStateMachine\n"); +s.append("###################################################\n"); + +s.append(">>Currentstate:\n"); +s.append(activeState).append("\n"); + +s.append(">>Initialstate:\n"); +s.append(initalState).append("\n"); + +s.append(">>Allstates:\n"); +for(Statestate:identifierToState.values()){ +s.append(state); +} + +s.append("###################################################\n"); + +returns.toString(); +} + + +@Override +publicbooleanequals(Objectobj){ +if(!(objinstanceofDialogStateMachine)){ +returnfalse; +} + +//Twostatemachinesareequalifandonlyif: +//-theycontainthesamestates(samenames+classes) +//-theinitialstateisidentical +//-theystatesareidenticallyconnected(transitions+fallbacks) + +//Theactivestateisnotimportantforthestructureandwillbeignoredbythischeck! + +DialogStateMachineother=(DialogStateMachine)obj; + +//checkinitialstates +if(initalState==null&&other.initalState!=null){ +returnfalse; +} +if(initalState!=null&&(!initalState.equals(other.initalState))){ +returnfalse; +} + + +//allstates+transitionsfromthismachinearepresentintheother +for(StatethisState:identifierToState.values()){ +StringstateID=thisState.getIdentifier(); +StateotherState=other.getStateByIdentifier(stateID); +if(otherState==null)returnfalse; +if(!thisState.equals(otherState))returnfalse; +} + + +//allstates+transitionsfromtheothermachinearepresentinthis +for(StateotherState:other.identifierToState.values()){ +StringstateID=otherState.getIdentifier(); +StatethisState=this.getStateByIdentifier(stateID); +if(thisState==null)returnfalse; +if(!thisState.equals(otherState))returnfalse; +} + + +returntrue; +} + + +} + + + + diff --git a/docs/doxyxml/_dialog_state_machine_test_8java.xml b/docs/doxyxml/_dialog_state_machine_test_8java.xml new file mode 100644 index 00000000..9a6605e2 --- /dev/null +++ b/docs/doxyxml/_dialog_state_machine_test_8java.xml @@ -0,0 +1,180 @@ + + + + DialogStateMachineTest.java + roboy::newDialog::DialogStateMachineTest + roboy::newDialog + + + + + +packageroboy.newDialog; + +importstaticorg.junit.Assert.assertTrue; +importstaticorg.junit.Assert.assertFalse; + +importorg.junit.Test; +importroboy.newDialog.states.State; +importroboy.newDialog.DialogStateMachine; +importroboy.newDialog.states.toyStates.ToyFarewellState; +importroboy.newDialog.states.toyStates.ToyGreetingsState; + +publicclassDialogStateMachineTest{ + + +//minimalstatemachinewith2states +privatestaticStringMINI_STATE_MACHINE="{\n"+ +"\"initialState\":\"Greetings\",\n"+ +"\"states\":[\n"+ +"{\n"+ +"\"identifier\":\"Farewell\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyFarewellState\",\n"+ +"\"transitions\":{}\n"+ +"},\n"+ +"{\n"+ +"\"identifier\":\"Greetings\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyGreetingsState\",\n"+ +"\"fallback\":\"Farewell\",\n"+ +"\"transitions\":{\n"+ +"\"next\":\"Farewell\",\n"+ +"\"noHello\":\"Farewell\"\n"+ +"}\n"+ +"}\n"+ +"]\n"+ +"}"; + +//helper,createsequivalentstatemachinefromcode +privatestaticDialogStateMachinefromCode(){ + +DialogStateMachinemachine=newDialogStateMachine(); +ToyGreetingsStategreeting=newToyGreetingsState("Greetings"); +ToyFarewellStatefarewell=newToyFarewellState("Farewell"); +greeting.setTransition("next",farewell); +greeting.setTransition("noHello",farewell); +greeting.setFallback(farewell); +machine.addState(greeting); +machine.addState(farewell); +machine.setInitialState(greeting); + +returnmachine; +} + + +//machineshouldalwaysequalitself +@Test +publicvoidmachineEqualsItself(){ +DialogStateMachinemachine=newDialogStateMachine(); +assertTrue(machine.equals(machine)); + +machine.loadFromString(MINI_STATE_MACHINE); +assertTrue(machine.equals(machine)); +} + +//minimalstringexampleshouldequalthemachinebuildfromcode +@Test +publicvoidstringEqualsCode(){ +DialogStateMachinefromString=newDialogStateMachine(); +fromString.loadFromString(MINI_STATE_MACHINE); + +DialogStateMachinefromCode=fromCode(); + +assertTrue(fromString.equals(fromCode)); +assertTrue(fromCode.equals(fromString)); +} + +//machinesarenotequalifinitialstateisdifferent +@Test +publicvoidnotEqualsNoInitialState(){ +DialogStateMachinefromString=newDialogStateMachine(); +fromString.loadFromString(MINI_STATE_MACHINE); + +DialogStateMachinefromCode=fromCode(); +//changeinitialstate +fromCode.setInitialState(fromCode.getStateByIdentifier("Farewell")); + +assertFalse(fromString.equals(fromCode)); +assertFalse(fromCode.equals(fromString)); +} + +//machinesarenotequalifonehasmorestates +@Test +publicvoidnotEqualsDifferentStates(){ +DialogStateMachinefromString=newDialogStateMachine(); +fromString.loadFromString(MINI_STATE_MACHINE); + +DialogStateMachinefromCode=fromCode(); +//addonemorestate +fromCode.addState(newToyGreetingsState("NewEvilState")); + +assertFalse(fromString.equals(fromCode)); +assertFalse(fromCode.equals(fromString)); +} + +//machinesarenotequalifonehasdifferenttransitions +@Test +publicvoidnotEqualsDifferentTransitions(){ +DialogStateMachinefromString=newDialogStateMachine(); +fromString.loadFromString(MINI_STATE_MACHINE); + +DialogStateMachinefromCode=fromCode(); +//changeTransitions +StategreetingsCode=fromCode.getStateByIdentifier("Greetings"); +greetingsCode.setTransition("evilLoopback",greetingsCode); + +assertFalse(fromString.equals(fromCode)); +assertFalse(fromCode.equals(fromString)); +} + + +//afterloading,theinitialsetequalstheactivestate +@Test +publicvoidactiveStateIsSetToInitialState(){ +DialogStateMachinemachine=newDialogStateMachine(); +machine.loadFromString(MINI_STATE_MACHINE); + +assertTrue(machine.getInitialState()==machine.getActiveState()); +} + +//allstatesfromthestringarepresentinthemachine +@Test +publicvoidmachineContainsAllStates(){ +DialogStateMachinemachine=newDialogStateMachine(); +machine.loadFromString(MINI_STATE_MACHINE); +assertTrue(machine.getStateByIdentifier("Greetings")!=null); +assertTrue(machine.getStateByIdentifier("Farewell")!=null); +} + + +//alltransitionsfromthestringarepresentinthemachine +@Test +publicvoidtransitionsAreOK(){ +DialogStateMachinemachine=newDialogStateMachine(); +machine.loadFromString(MINI_STATE_MACHINE); +Stategreetings=machine.getStateByIdentifier("Greetings"); +Statefarewell=machine.getStateByIdentifier("Farewell"); + +assertTrue(greetings.getTransition("noHello")==farewell); +assertTrue(greetings.getTransition("next")==farewell); +} + +//allfallbacksfromthestringarepresentinthemachine +@Test +publicvoidfallbackIsOK(){ +DialogStateMachinemachine=newDialogStateMachine(); +machine.loadFromString(MINI_STATE_MACHINE); +Stategreetings=machine.getStateByIdentifier("Greetings"); +Statefarewell=machine.getStateByIdentifier("Farewell"); + +assertTrue(greetings.getFallback()==farewell); +} + + + + + +} + + + + diff --git a/docs/doxyxml/_dialog_system_8java.xml b/docs/doxyxml/_dialog_system_8java.xml old mode 100644 new mode 100755 index 169bc385..cef95440 --- a/docs/doxyxml/_dialog_system_8java.xml +++ b/docs/doxyxml/_dialog_system_8java.xml @@ -18,112 +18,123 @@ importcom.google.gson.JsonIOException; -importroboy.dialog.action.Action; -importroboy.dialog.action.ShutDownAction; -importroboy.dialog.personality.Personality; -importroboy.dialog.personality.SmallTalkPersonality; - -importroboy.io.*; - -importroboy.linguistics.sentenceanalysis.*; -importroboy.talk.Verbalizer; - -importroboy.ros.RosMainNode; +importroboy.context.GUI.ContextGUI; +importroboy.dialog.action.Action; +importroboy.dialog.action.ShutDownAction; +importroboy.dialog.personality.Personality; +importroboy.dialog.personality.SmallTalkPersonality; + +importroboy.io.*; + +importroboy.linguistics.sentenceanalysis.*; +importroboy.memory.Neo4jMemory; +importroboy.talk.Verbalizer; -importstaticroboy.dialog.Config.ConfigurationProfile.*; +importroboy.ros.RosMainNode; - -publicclassDialogSystem{ - -publicstaticvoidmain(String[]args)throwsJsonIOException,IOException,InterruptedException{ +importstaticroboy.dialog.Config.ConfigurationProfile.*; + + +publicclassDialogSystem{ -//Thissetsaconfigurationprofilefortheentirerun. -//Profilescanbeaddedinroboy.dialog.Config.ConfigurationProfile -if(System.getProperty("profile")!=null){ -newConfig(Config.getProfileFromEnvironment(System.getProperty("profile"))); -}else{ -newConfig(DEFAULT); -} - -//initializeROSnode -RosMainNoderosMainNode=newRosMainNode(); - -/* -*I/OINITIALIZATION -*/ -MultiInputDevicemultiIn; -//Bydefault,alloutputisalsowrittentothecommandline. -MultiOutputDevicemultiOut=newMultiOutputDevice(newCommandLineOutput()); -if(Config.NOROS){ -multiIn=newMultiInputDevice(newCommandLineInput()); -}else{ -multiIn=newMultiInputDevice(newBingInput(rosMainNode)); -multiOut.add(newCerevoiceOutput(rosMainNode)); -} -//OPTIONALINPUTS -//DatagramSocketds=newDatagramSocket(55555); -//multiIn.add(newUdpInput(ds)); -//multiIn.add(newCelebritySimilarityInput()); -//multiIn.add(newRoboyNameDetectionInput()); -//OPTIONALOUTPUTS -//multiOut.add(newBingOutput()); -//multiOut.add(newUdpOutput(ds,"localhost",55556)); -//multiOut.add(newEmotionOutput(rosMainNode)); - -/* -*ANALYZERINITIALIZATION -*/ -List<Analyzer>analyzers=newArrayList<Analyzer>(); -analyzers.add(newPreprocessor()); -analyzers.add(newSimpleTokenizer()); -analyzers.add(newOpenNLPPPOSTagger()); -analyzers.add(newDictionaryBasedSentenceTypeDetector()); -analyzers.add(newSentenceAnalyzer()); -analyzers.add(newOpenNLPParser()); -analyzers.add(newOntologyNERAnalyzer()); -analyzers.add(newAnswerAnalyzer()); -analyzers.add(newEmotionAnalyzer()); -//if(!Config.NOROS){ -//analyzers.add(newIntentAnalyzer(rosMainNode)); -//} - -if(!rosMainNode.STARTUP_SUCCESS&&Config.SHUTDOWN_ON_ROS_FAILURE){ -thrownewRuntimeException("DialogSystemshutdowncausedbyROSmainnodeinitializationfailure."); -} - -System.out.println("DMinitialized..."); - -while(true){ - -//while(!Vision.getInstance().findFaces()){ -//emotion.act(newFaceAction("angry")); -//} -//emotion.act(newFaceAction("neutral")); -//while(!multiIn.listen().attributes.containsKey(Linguistics.ROBOYDETECTED)){ -//} +publicstaticvoidmain(String[]args)throwsJsonIOException,IOException,InterruptedException{ + +//Thissetsaconfigurationprofilefortheentirerun. +//Profilescanbeaddedinroboy.dialog.Config.ConfigurationProfile +if(System.getProperty("profile")!=null){ +newConfig(Config.getProfileFromEnvironment(System.getProperty("profile"))); +}else{ +newConfig(DEFAULT); +} + +if(Config.DEMO_GUI){ +finalRunnablegui=()->ContextGUI.run(); +Threadt=newThread(gui); +t.start(); +} + +//initializeROSnode +RosMainNoderosMainNode=newRosMainNode(); +//initializeMemorywithROS +Neo4jMemory.getInstance(rosMainNode); + +/* +*I/OINITIALIZATION +*/ +MultiInputDevicemultiIn; +//Bydefault,alloutputisalsowrittentothecommandline. +MultiOutputDevicemultiOut=newMultiOutputDevice(newCommandLineOutput()); +if(Config.NOROS){ +multiIn=newMultiInputDevice(newCommandLineInput()); +}else{ +multiIn=newMultiInputDevice(newBingInput(rosMainNode)); +multiOut.add(newCerevoiceOutput(rosMainNode)); +} +//OPTIONALINPUTS +//DatagramSocketds=newDatagramSocket(55555); +//multiIn.add(newUdpInput(ds)); +//multiIn.add(newCelebritySimilarityInput()); +//multiIn.add(newRoboyNameDetectionInput()); +//OPTIONALOUTPUTS +//multiOut.add(newBingOutput()); +//multiOut.add(newUdpOutput(ds,"localhost",55556)); +//multiOut.add(newEmotionOutput(rosMainNode)); + +/* +*ANALYZERINITIALIZATION +*/ +List<Analyzer>analyzers=newArrayList<Analyzer>(); +analyzers.add(newPreprocessor()); +analyzers.add(newSimpleTokenizer()); +analyzers.add(newOpenNLPPPOSTagger()); +analyzers.add(newDictionaryBasedSentenceTypeDetector()); +analyzers.add(newSentenceAnalyzer()); +analyzers.add(newOpenNLPParser()); +analyzers.add(newOntologyNERAnalyzer()); +analyzers.add(newAnswerAnalyzer()); +analyzers.add(newEmotionAnalyzer()); +analyzers.add(newSemanticParserAnalyzer(Config.PARSER_PORT)); +//if(!Config.NOROS){ +//analyzers.add(newIntentAnalyzer(rosMainNode)); +//} + +if(!rosMainNode.STARTUP_SUCCESS&&Config.SHUTDOWN_ON_ROS_FAILURE){ +thrownewRuntimeException("DialogSystemshutdowncausedbyROSmainnodeinitializationfailure."); +} -PersonalitysmallTalk=newSmallTalkPersonality(newVerbalizer(),rosMainNode); -Inputraw; -Interpretationinterpretation; -List<Action>actions=smallTalk.answer(newInterpretation("")); - - -while(actions.isEmpty()||!(actions.get(0)instanceofShutDownAction)){ -multiOut.act(actions); -raw=multiIn.listen(); -interpretation=newInterpretation(raw.sentence,raw.attributes);//TODO:InputdevicesshouldimmediatelyproduceInterpretationobjects -for(Analyzera:analyzers){ -interpretation=a.analyze(interpretation); -} -actions=smallTalk.answer(interpretation); -} -List<Action>lastwords=((ShutDownAction)actions.get(0)).getLastWords(); -multiOut.act(lastwords); -actions.clear(); -} -} -} +System.out.println("DMinitialized..."); + +while(true){ + +//while(!Vision.getInstance().findFaces()){ +//emotion.act(newFaceAction("angry")); +//} +//emotion.act(newFaceAction("neutral")); +//while(!multiIn.listen().lists.containsKey(Linguistics.ROBOYDETECTED)){ +//} + +PersonalitysmallTalk=newSmallTalkPersonality(newVerbalizer(),rosMainNode); +Inputraw; +Interpretationinterpretation; +List<Action>actions=smallTalk.answer(newInterpretation("")); + + +while(actions.isEmpty()||!(actions.get(0)instanceofShutDownAction)){ +multiOut.act(actions); +raw=multiIn.listen(); +interpretation=newInterpretation(raw.sentence,raw.attributes);//TODO:InputdevicesshouldimmediatelyproduceInterpretationobjects +for(Analyzera:analyzers){ +interpretation=a.analyze(interpretation); +} +actions=smallTalk.answer(interpretation); +} +List<Action>lastwords=((ShutDownAction)actions.get(0)).getLastWords(); +multiOut.act(lastwords); +actions.clear(); +} +} +} - + diff --git a/docs/doxyxml/_dialog_topics_8java.xml b/docs/doxyxml/_dialog_topics_8java.xml new file mode 100644 index 00000000..aff782ef --- /dev/null +++ b/docs/doxyxml/_dialog_topics_8java.xml @@ -0,0 +1,21 @@ + + + + DialogTopics.java + roboy::context::contextObjects::DialogTopics + roboy::context::contextObjects + + + + + +packageroboy.context.contextObjects; + +importroboy.context.ValueHistory; + +publicclassDialogTopicsextendsValueHistory<String>{ +} + + + + diff --git a/docs/doxyxml/_dialog_topics_updater_8java.xml b/docs/doxyxml/_dialog_topics_updater_8java.xml new file mode 100644 index 00000000..7ab4cf6e --- /dev/null +++ b/docs/doxyxml/_dialog_topics_updater_8java.xml @@ -0,0 +1,24 @@ + + + + DialogTopicsUpdater.java + roboy::context::contextObjects::DialogTopicsUpdater + roboy::context::contextObjects + + + + + +packageroboy.context.contextObjects; + +importroboy.context.InternalUpdater; + +publicclassDialogTopicsUpdaterextendsInternalUpdater<DialogTopics,String>{ +publicDialogTopicsUpdater(DialogTopicstarget){ +super(target); +} +} + + + + diff --git a/docs/doxyxml/_dictionary_based_sentence_type_detector_8java.xml b/docs/doxyxml/_dictionary_based_sentence_type_detector_8java.xml old mode 100644 new mode 100755 index 521466b1..b171fa1e --- a/docs/doxyxml/_dictionary_based_sentence_type_detector_8java.xml +++ b/docs/doxyxml/_dictionary_based_sentence_type_detector_8java.xml @@ -53,6 +53,6 @@ } } - + diff --git a/docs/doxyxml/_dictionary_based_sentence_type_detector_test_8java.xml b/docs/doxyxml/_dictionary_based_sentence_type_detector_test_8java.xml old mode 100644 new mode 100755 index 725a0409..cbb02096 --- a/docs/doxyxml/_dictionary_based_sentence_type_detector_test_8java.xml +++ b/docs/doxyxml/_dictionary_based_sentence_type_detector_test_8java.xml @@ -38,6 +38,6 @@ } - + diff --git a/docs/doxyxml/_direct_update_policy_8java.xml b/docs/doxyxml/_direct_update_policy_8java.xml new file mode 100644 index 00000000..cf00a486 --- /dev/null +++ b/docs/doxyxml/_direct_update_policy_8java.xml @@ -0,0 +1,22 @@ + + + + DirectUpdatePolicy.java + roboy::context::DirectUpdatePolicy + roboy::context + + + + + +packageroboy.context; + +importroboy.context.dataTypes.DataType; + +publicinterfaceDirectUpdatePolicy<VextendsDataType>{ +publicvoidputValue(Vvalue); +} + + + + diff --git a/docs/doxyxml/_double_metaphone_encoder_8java.xml b/docs/doxyxml/_double_metaphone_encoder_8java.xml old mode 100644 new mode 100755 index 92617f52..7aa342b9 --- a/docs/doxyxml/_double_metaphone_encoder_8java.xml +++ b/docs/doxyxml/_double_metaphone_encoder_8java.xml @@ -28,6 +28,6 @@ } - + diff --git a/docs/doxyxml/_emotion_analyzer_8java.xml b/docs/doxyxml/_emotion_analyzer_8java.xml old mode 100644 new mode 100755 index 4520081a..d12f14fc --- a/docs/doxyxml/_emotion_analyzer_8java.xml +++ b/docs/doxyxml/_emotion_analyzer_8java.xml @@ -39,6 +39,6 @@ } } - + diff --git a/docs/doxyxml/_emotion_output_8java.xml b/docs/doxyxml/_emotion_output_8java.xml old mode 100644 new mode 100755 index 09dfdc33..f9b6cc4d --- a/docs/doxyxml/_emotion_output_8java.xml +++ b/docs/doxyxml/_emotion_output_8java.xml @@ -48,6 +48,6 @@ } - + diff --git a/docs/doxyxml/_entity_8java.xml b/docs/doxyxml/_entity_8java.xml old mode 100644 new mode 100755 index a6acba2b..5737d3e6 --- a/docs/doxyxml/_entity_8java.xml +++ b/docs/doxyxml/_entity_8java.xml @@ -32,6 +32,6 @@ } } - + diff --git a/docs/doxyxml/_external_context_interface_8java.xml b/docs/doxyxml/_external_context_interface_8java.xml new file mode 100644 index 00000000..f60a6df2 --- /dev/null +++ b/docs/doxyxml/_external_context_interface_8java.xml @@ -0,0 +1,22 @@ + + + + ExternalContextInterface.java + roboy::context::ExternalContextInterface + roboy::context + + + + + +packageroboy.context; + +publicinterfaceExternalContextInterface{ +ClassgetClassType(); + +ClassgetReturnType(); +} + + + + diff --git a/docs/doxyxml/_external_updater_8java.xml b/docs/doxyxml/_external_updater_8java.xml new file mode 100644 index 00000000..26d932a1 --- /dev/null +++ b/docs/doxyxml/_external_updater_8java.xml @@ -0,0 +1,20 @@ + + + + ExternalUpdater.java + roboy::context::ExternalUpdater + roboy::context + + + + + +packageroboy.context; + +publicabstractclassExternalUpdater{ +protectedabstractvoidupdate(); +} + + + + diff --git a/docs/doxyxml/_face_action_8java.xml b/docs/doxyxml/_face_action_8java.xml old mode 100644 new mode 100755 index 6c90ecba..f1fedec0 --- a/docs/doxyxml/_face_action_8java.xml +++ b/docs/doxyxml/_face_action_8java.xml @@ -41,6 +41,6 @@ } - + diff --git a/docs/doxyxml/_face_coordinates_8java.xml b/docs/doxyxml/_face_coordinates_8java.xml new file mode 100644 index 00000000..08dbde32 --- /dev/null +++ b/docs/doxyxml/_face_coordinates_8java.xml @@ -0,0 +1,22 @@ + + + + FaceCoordinates.java + roboy::context::contextObjects::FaceCoordinates + roboy::context::contextObjects + + + + + +packageroboy.context.contextObjects; + +importroboy.context.Value; + +publicclassFaceCoordinatesextendsValue<CoordinateSet>{ + +} + + + + diff --git a/docs/doxyxml/_face_coordinates_updater_8java.xml b/docs/doxyxml/_face_coordinates_updater_8java.xml new file mode 100644 index 00000000..560f2697 --- /dev/null +++ b/docs/doxyxml/_face_coordinates_updater_8java.xml @@ -0,0 +1,34 @@ + + + + FaceCoordinatesUpdater.java + roboy::context::contextObjects::FaceCoordinatesUpdater + roboy::context::contextObjects + + + + + +packageroboy.context.contextObjects; + +importroboy.context.IntervalUpdater; + +importjava.util.Random; + +publicclassFaceCoordinatesUpdaterextendsIntervalUpdater<FaceCoordinates>{ +publicFaceCoordinatesUpdater(FaceCoordinatestarget,intupdateFrequencySeconds){ +super(target,updateFrequencySeconds); +} + +@Override +protectedvoidupdate(){ +Randomr=newRandom(); +//TODOreplacedummyfunctionality!(Andalsoupdatethetestaccordingly.) +CoordinateSetset=newCoordinateSet(r.nextDouble(),r.nextDouble(),r.nextDouble()); +target.updateValue(set); +} +} + + + + diff --git a/docs/doxyxml/_farewell_state_8java.xml b/docs/doxyxml/_farewell_state_8java.xml old mode 100644 new mode 100755 index c7e2b082..616da9ad --- a/docs/doxyxml/_farewell_state_8java.xml +++ b/docs/doxyxml/_farewell_state_8java.xml @@ -36,6 +36,6 @@ } - + diff --git a/docs/doxyxml/_free_t_t_s_output_8java.xml b/docs/doxyxml/_free_t_t_s_output_8java.xml old mode 100644 new mode 100755 index 9199f726..e3ed6de6 --- a/docs/doxyxml/_free_t_t_s_output_8java.xml +++ b/docs/doxyxml/_free_t_t_s_output_8java.xml @@ -48,6 +48,6 @@ } - + diff --git a/docs/doxyxml/_generative_communication_state_8java.xml b/docs/doxyxml/_generative_communication_state_8java.xml old mode 100644 new mode 100755 index c52c918d..46b7f4a4 --- a/docs/doxyxml/_generative_communication_state_8java.xml +++ b/docs/doxyxml/_generative_communication_state_8java.xml @@ -37,6 +37,6 @@ } - + diff --git a/docs/doxyxml/_greeting_state_8java.xml b/docs/doxyxml/_greeting_state_8java.xml old mode 100644 new mode 100755 index 0fdd172d..0e4591a8 --- a/docs/doxyxml/_greeting_state_8java.xml +++ b/docs/doxyxml/_greeting_state_8java.xml @@ -45,6 +45,6 @@ } - + diff --git a/docs/doxyxml/_history_attribute_8java.xml b/docs/doxyxml/_history_attribute_8java.xml new file mode 100644 index 00000000..fb2df79e --- /dev/null +++ b/docs/doxyxml/_history_attribute_8java.xml @@ -0,0 +1,29 @@ + + + + HistoryAttribute.java + roboy::context::HistoryAttribute + roboy::context + + + + + +packageroboy.context; + +importjava.util.Map; + +publicinterfaceHistoryAttribute<K,V>{ + +VgetLastValue(); + +VgetValue(Kkey); + +Map<K,V>getLastNValues(intn); + +KstoreValue(Vkey); +} + + + + diff --git a/docs/doxyxml/_i_o_8java.xml b/docs/doxyxml/_i_o_8java.xml old mode 100644 new mode 100755 index b199eb92..090af3c8 --- a/docs/doxyxml/_i_o_8java.xml +++ b/docs/doxyxml/_i_o_8java.xml @@ -53,6 +53,6 @@ } } - + diff --git a/docs/doxyxml/_idle_state_8java.xml b/docs/doxyxml/_idle_state_8java.xml old mode 100644 new mode 100755 index 3146e364..7cf5ca96 --- a/docs/doxyxml/_idle_state_8java.xml +++ b/docs/doxyxml/_idle_state_8java.xml @@ -34,6 +34,6 @@ } } - + diff --git a/docs/doxyxml/_input_8java.xml b/docs/doxyxml/_input_8java.xml old mode 100644 new mode 100755 index 516d0cc8..43971720 --- a/docs/doxyxml/_input_8java.xml +++ b/docs/doxyxml/_input_8java.xml @@ -31,6 +31,6 @@ } - + diff --git a/docs/doxyxml/_input_device_8java.xml b/docs/doxyxml/_input_device_8java.xml old mode 100644 new mode 100755 index 97c28e84..3a811c5d --- a/docs/doxyxml/_input_device_8java.xml +++ b/docs/doxyxml/_input_device_8java.xml @@ -17,6 +17,6 @@ publicInputlisten()throwsInterruptedException,IOException; } - + diff --git a/docs/doxyxml/_inquiry_state_8java.xml b/docs/doxyxml/_inquiry_state_8java.xml old mode 100644 new mode 100755 index 991f9e92..0975a09f --- a/docs/doxyxml/_inquiry_state_8java.xml +++ b/docs/doxyxml/_inquiry_state_8java.xml @@ -44,6 +44,6 @@ } - + diff --git a/docs/doxyxml/_intent_analyzer_8java.xml b/docs/doxyxml/_intent_analyzer_8java.xml old mode 100644 new mode 100755 index ffbe984c..66a7ae8c --- a/docs/doxyxml/_intent_analyzer_8java.xml +++ b/docs/doxyxml/_intent_analyzer_8java.xml @@ -36,6 +36,6 @@ } } - + diff --git a/docs/doxyxml/_intention_8java.xml b/docs/doxyxml/_intention_8java.xml old mode 100644 new mode 100755 index 0f6ae343..d0d02a35 --- a/docs/doxyxml/_intention_8java.xml +++ b/docs/doxyxml/_intention_8java.xml @@ -44,6 +44,6 @@ //Reasoning:AmIabletodoit?Isitdangerous?Immoral?Expensive?Fun? } - + diff --git a/docs/doxyxml/_intention_classifier_8java.xml b/docs/doxyxml/_intention_classifier_8java.xml old mode 100644 new mode 100755 index 228790e7..7a2793ef --- a/docs/doxyxml/_intention_classifier_8java.xml +++ b/docs/doxyxml/_intention_classifier_8java.xml @@ -42,6 +42,6 @@ } - + diff --git a/docs/doxyxml/_interlocutor_8java.xml b/docs/doxyxml/_interlocutor_8java.xml old mode 100644 new mode 100755 index 7eb4e9e9..8c95e0f4 --- a/docs/doxyxml/_interlocutor_8java.xml +++ b/docs/doxyxml/_interlocutor_8java.xml @@ -13,7 +13,7 @@ importroboy.dialog.Config; importroboy.memory.Neo4jMemory; -importroboy.memory.Neo4jRelations; +importroboy.memory.Neo4jRelationships; importjava.io.IOException; importjava.util.ArrayList; @@ -23,19 +23,19 @@ Neo4jMemorymemory; publicbooleanFAMILIAR=false; //MemoryisnotqueriedinNOROSmode. -privatebooleannoROS; +privatebooleanmemoryROS; publicInterlocutor(){ this.person=newMemoryNodeModel(true); this.memory=Neo4jMemory.getInstance(); -this.noROS=Config.NOROS; +this.memoryROS=Config.MEMORY; } publicvoidaddName(Stringname){ person.setProperty("name",name); person.setLabel("Person"); -if(!noROS){ +if(memoryROS){ ArrayList<Integer>ids=newArrayList<>(); //Querymemoryformatchingpersons. try{ @@ -73,61 +73,55 @@ return(String)person.getProperty("name"); } -publicbooleanhasRelation(Neo4jRelationstype){ -return!(person.getRelation(type.type)==null)&&(!person.getRelation(type.type).isEmpty()); +publicbooleanhasRelationship(Neo4jRelationshipstype){ +return!(person.getRelationship(type.type)==null)&&(!person.getRelationship(type.type).isEmpty()); } -publicvoidaddInformation(Stringrelation,Stringname){ -if(noROS)return; -ArrayList<Integer>ids=newArrayList<>(); -//Firstcheckifnodewithgivennameexistsbyamatchingquery. -MemoryNodeModelrelatedNode=newMemoryNodeModel(true); -relatedNode.setProperty("name",name); -//Thisaddsalabeltypetothememoryquerydependingontherelation. -relatedNode.setLabel(determineNodeType(relation)); -try{ -ids=memory.getByQuery(relatedNode); -}catch(InterruptedException|IOExceptione){ -System.out.println("Exceptionwhilequeryingmemorybytemplate."); -e.printStackTrace(); -} -//Pickfirstfromlistifmultiplematchesfound. -if(ids!=null&&!ids.isEmpty()){ -//TODOChangefromusingfirstidtospecifyingifmultiplematchesarefound. -person.setRelation(relation,ids.get(0)); -} -//Createnewnodeifmatchisnotfound. -else{ -try{ -intid=memory.create(relatedNode); -if(id!=0){//0isdefaultvalue,returnedifMemoryresponsewasFAIL. -person.setRelation(relation,id); -} -}catch(InterruptedException|IOExceptione){ -System.out.println("Unexpectedmemoryerror:creatingnodefornewrelationfailed."); -e.printStackTrace(); -} -} -//Updatethepersonnodeinmemory. -try{ -memory.save(person); -}catch(InterruptedException|IOExceptione){ -System.out.println("Unexpectedmemoryerror:updatingpersoninformationfailed."); -e.printStackTrace(); -} -} - -privateStringdetermineNodeType(Stringrelation){ -//TODOexpandlistasnewNodetypesareadded. -if(relation.equals(Neo4jRelations.HAS_HOBBY.type))return"Hobby"; -if(relation.equals(Neo4jRelations.FROM.type))return"Country"; -if(relation.equals(Neo4jRelations.WORK_FOR.type))return"Organization"; -if(relation.equals(Neo4jRelations.STUDY_AT.type))return"Organization"; -elsereturn""; -} - -} +publicArrayList<Integer>getRelationships(Neo4jRelationshipstype){ +returnperson.getRelationship(type.type); +} + +publicvoidaddInformation(Stringrelationship,Stringname){ +if(!memoryROS)return; +ArrayList<Integer>ids=newArrayList<>(); +//Firstcheckifnodewithgivennameexistsbyamatchingquery. +MemoryNodeModelrelatedNode=newMemoryNodeModel(true); +relatedNode.setProperty("name",name); +//Thisaddsalabeltypetothememoryquerydependingontherelation. +relatedNode.setLabel(memory.determineNodeType(relationship)); +try{ +ids=memory.getByQuery(relatedNode); +}catch(InterruptedException|IOExceptione){ +System.out.println("Exceptionwhilequeryingmemorybytemplate."); +e.printStackTrace(); +} +//Pickfirstfromlistifmultiplematchesfound. +if(ids!=null&&!ids.isEmpty()){ +//TODOChangefromusingfirstidtospecifyingifmultiplematchesarefound. +person.setRelationship(relationship,ids.get(0)); +} +//Createnewnodeifmatchisnotfound. +else{ +try{ +intid=memory.create(relatedNode); +if(id!=0){//0isdefaultvalue,returnedifMemoryresponsewasFAIL. +person.setRelationship(relationship,id); +} +}catch(InterruptedException|IOExceptione){ +System.out.println("Unexpectedmemoryerror:creatingnodefornewrelationfailed."); +e.printStackTrace(); +} +} +//Updatethepersonnodeinmemory. +try{ +memory.save(person); +}catch(InterruptedException|IOExceptione){ +System.out.println("Unexpectedmemoryerror:updatingpersoninformationfailed."); +e.printStackTrace(); +} +} +} - + diff --git a/docs/doxyxml/_interlocutor_node_8java.xml b/docs/doxyxml/_interlocutor_node_8java.xml new file mode 100644 index 00000000..017527dd --- /dev/null +++ b/docs/doxyxml/_interlocutor_node_8java.xml @@ -0,0 +1,29 @@ + + + + InterlocutorNode.java + roboy::context::memoryContext::InterlocutorNode + roboy::context::memoryContext + + + + + +packageroboy.context.memoryContext; + +importroboy.memory.nodes.Interlocutor; + +publicclassInterlocutorNode{ +privateInterlocutorinterlocutor; + +publicInterlocutorNode(){ +} + +publicInterlocutorgetInterlocutor(){ +returninterlocutor; +} +} + + + + diff --git a/docs/doxyxml/_interlocutor_node_updater_8java.xml b/docs/doxyxml/_interlocutor_node_updater_8java.xml new file mode 100644 index 00000000..0597bc22 --- /dev/null +++ b/docs/doxyxml/_interlocutor_node_updater_8java.xml @@ -0,0 +1,29 @@ + + + + InterlocutorNodeUpdater.java + roboy::context::memoryContext::InterlocutorNodeUpdater + roboy::context::memoryContext + + + + + +packageroboy.context.memoryContext; + +importroboy.context.IntervalUpdatePolicy; + +publicclassInterlocutorNodeUpdaterextendsIntervalUpdatePolicy<InterlocutorNode>{ +publicInterlocutorNodeUpdater(InterlocutorNodetarget,intupdateFrequencySeconds){ +super(target,updateFrequencySeconds); +} + +@Override +protectedvoidupdate(){ +//NeededonlyifMemoryupdatingisnothandledbytheInterlocutoritself. +} +} + + + + diff --git a/docs/doxyxml/_internal_updater_8java.xml b/docs/doxyxml/_internal_updater_8java.xml new file mode 100644 index 00000000..cc6feee4 --- /dev/null +++ b/docs/doxyxml/_internal_updater_8java.xml @@ -0,0 +1,28 @@ + + + + InternalUpdater.java + roboy::context::InternalUpdater + roboy::context + + + + + +packageroboy.context; + +publicclassInternalUpdater<TextendsAbstractValue<V>,V>{ +AbstractValue<V>target; + +protectedInternalUpdater(Ttarget){ +this.target=target; +} + +publicsynchronizedvoidputValue(Vvalue){ +target.updateValue(value); +} +} + + + + diff --git a/docs/doxyxml/_interpretation_8java.xml b/docs/doxyxml/_interpretation_8java.xml old mode 100644 new mode 100755 index b41cfcd1..6d8b8810 --- a/docs/doxyxml/_interpretation_8java.xml +++ b/docs/doxyxml/_interpretation_8java.xml @@ -70,6 +70,6 @@ } } - + diff --git a/docs/doxyxml/_interval_update_policy_8java.xml b/docs/doxyxml/_interval_update_policy_8java.xml new file mode 100644 index 00000000..d79c9d4d --- /dev/null +++ b/docs/doxyxml/_interval_update_policy_8java.xml @@ -0,0 +1,44 @@ + + + + IntervalUpdatePolicy.java + roboy::context::IntervalUpdatePolicy + roboy::context + + + + + +packageroboy.context; + +importjava.util.concurrent.Executors; +importjava.util.concurrent.ScheduledExecutorService; +importjava.util.concurrent.ScheduledFuture; + +importstaticjava.util.concurrent.TimeUnit.SECONDS; + +publicabstractclassIntervalUpdatePolicy<T>extendsAsyncUpdatePolicy{ +protectedfinalTtarget; +protectedfinalScheduledExecutorServicescheduler=Executors.newScheduledThreadPool(1); +publicfinalintupdateFrequency; + +publicIntervalUpdatePolicy(Ttarget,intupdateFrequencySeconds){ +this.target=target; +updateFrequency=updateFrequencySeconds; +start(); +} + +privatevoidstart(){ +finalRunnableupdater=()->update(); +//Schedulesregularupdates,starting1secondafterinitialization. +finalScheduledFuture<?>updaterHandle=scheduler.scheduleAtFixedRate( +updater,1,updateFrequency,SECONDS); +//Canceleachscheduledtaskafter30secondsofruntime-preventexcessivethreadsifthegoalisdown. +scheduler.schedule((Runnable)()->updaterHandle.cancel(true),30,SECONDS); +} + +} + + + + diff --git a/docs/doxyxml/_interval_updater_8java.xml b/docs/doxyxml/_interval_updater_8java.xml new file mode 100644 index 00000000..b3f48b0b --- /dev/null +++ b/docs/doxyxml/_interval_updater_8java.xml @@ -0,0 +1,44 @@ + + + + IntervalUpdater.java + roboy::context::IntervalUpdater + roboy::context + + + + + +packageroboy.context; + +importjava.util.concurrent.Executors; +importjava.util.concurrent.ScheduledExecutorService; +importjava.util.concurrent.ScheduledFuture; + +importstaticjava.util.concurrent.TimeUnit.SECONDS; + +publicabstractclassIntervalUpdater<T>extendsExternalUpdater{ +protectedfinalTtarget; +protectedfinalScheduledExecutorServicescheduler=Executors.newScheduledThreadPool(1); +publicfinalintupdateFrequency; + +publicIntervalUpdater(Ttarget,intupdateFrequencySeconds){ +this.target=target; +updateFrequency=updateFrequencySeconds; +start(); +} + +privatevoidstart(){ +finalRunnableupdater=()->update(); +//Schedulesregularupdates,starting1secondafterinitialization. +finalScheduledFuture<?>updaterHandle=scheduler.scheduleAtFixedRate( +updater,1,updateFrequency,SECONDS); +//Canceleachscheduledtaskafter30secondsofruntime-preventexcessivethreadsifthegoalisdown. +scheduler.schedule((Runnable)()->updaterHandle.cancel(true),30,SECONDS); +} + +} + + + + diff --git a/docs/doxyxml/_introduction_state_8java.xml b/docs/doxyxml/_introduction_state_8java.xml old mode 100644 new mode 100755 index 320ad14b..d69ddff7 --- a/docs/doxyxml/_introduction_state_8java.xml +++ b/docs/doxyxml/_introduction_state_8java.xml @@ -11,78 +11,105 @@ packageroboy.dialog.personality.states; -importjava.util.List; -importjava.util.Map; - -importroboy.linguistics.Linguistics; -importroboy.linguistics.Linguistics.SEMANTIC_ROLE; -importroboy.linguistics.sentenceanalysis.Interpretation; -importroboy.memory.nodes.Interlocutor; -importroboy.util.Lists; - -publicclassIntroductionStateextendsAbstractBooleanState{ - -Interlocutorperson=newInterlocutor(); - -privatestaticfinalList<String>introductions=Lists.stringList( -"IamRoboy.Whoareyou?", -"MynameisRoboy.Whatisyourname?" -); - -publicIntroductionState(Interlocutorperson){ -setFailureTexts(Lists.stringList( -"It'salwaysnicetomeetnewpeople.", -"Howrefreshingtoseeanewface.")); -this.person=person; -} +importjava.io.IOException; +importjava.util.ArrayList; +importjava.util.List; +importjava.util.Map; + +importroboy.linguistics.Linguistics; +importroboy.linguistics.Linguistics.SEMANTIC_ROLE; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.memory.Neo4jMemory; +importroboy.memory.Neo4jRelationships; +importroboy.memory.nodes.Interlocutor; +importroboy.memory.nodes.MemoryNodeModel; +importroboy.util.Lists; + +publicclassIntroductionStateextendsAbstractBooleanState{ + +Interlocutorperson=newInterlocutor(); +Neo4jMemorymemory; +publicNeo4jRelationshipspredicate=Neo4jRelationships.FRIEND_OF; + +privatestaticfinalList<String>introductions=Lists.stringList( +"IamRoboy.Whoareyou?", +"MynameisRoboy.Whatisyourname?" +); -@Override -publicList<Interpretation>act(){ -returnLists.interpretationList(newInterpretation(introductions.get((int)Math.random()*introductions.size()))); -} - -@SuppressWarnings("unchecked") -@Override -protectedbooleandetermineSuccess(Interpretationinput){ -String[]tokens=(String[])input.getFeatures().get(Linguistics.TOKENS); -Stringname=null; -if(tokens.length==1){ -name=tokens[0]; -}else{ -Map<SEMANTIC_ROLE,Object>pas=(Map<SEMANTIC_ROLE,Object>)input.getFeature(Linguistics.PAS); -if(pas==null||!pas.containsKey(SEMANTIC_ROLE.PREDICATE))returnfalse; -Stringpredicate=((String)pas.get(SEMANTIC_ROLE.PREDICATE)).toLowerCase(); -Stringagent=(String)pas.get(SEMANTIC_ROLE.AGENT); -Stringpatient=(String)pas.get(SEMANTIC_ROLE.PATIENT); -//if(agent==null)agent="i"; -//TODOHandlecaseswherenamecouldnotbeparsed. -//Maybesomethinglike"Ididnotquitegetyourname,couldyourepeatit." -//Whenusingadefaultvaluewithpersistentmemory,Roboywillalwaysrecognizethem. -if(patient==null)agent="laura"; -//if(!"am".equals(predicate)&&!"is".equals(predicate))returnfalse; -//if(!agent.toLowerCase().contains("i")&&!agent.toLowerCase().contains("my"))returnfalse; -name=patient; -} -if(name!=null){ -//WorkingMemory.getInstance().save(newTriple("is","name",name)); -//List<Triple>agens=PersistentKnowledge.getInstance().retrieve(newTriple(null,name,null)); -//List<Triple>patiens=PersistentKnowledge.getInstance().retrieve(newTriple(null,null,name)); -//TODOCurrentlyassumingnoduplicatenamesinmemory.Supportforlastnameadditionneeded. -person.addName(name); -if(!person.FAMILIAR){ -returnfalse; -} -setSuccessTexts(Lists.stringList( -"Ohhi,"+name+".Sorry,Ididn'trecognizeyouatfirst.Butyouknowhowthevisionguysare.", -"Hi"+name+"nicetoseeyouagain." -)); -returntrue; -} -returnfalse; -} - -} +publicIntroductionState(Interlocutorperson){ +setFailureTexts(Lists.stringList( +"It'salwaysnicetomeetnewpeople.", +"Howrefreshingtoseeanewface.")); +this.person=person; +} + +@Override +publicList<Interpretation>act(){ +returnLists.interpretationList(newInterpretation(introductions.get((int)Math.random()*introductions.size()))); +} + +@SuppressWarnings("unchecked") +@Override +protectedbooleandetermineSuccess(Interpretationinput){ +String[]tokens=(String[])input.getFeatures().get(Linguistics.TOKENS); +Stringname=null; +if(tokens.length==1){ +name=tokens[0]; +}else{ +Map<SEMANTIC_ROLE,Object>pas=(Map<SEMANTIC_ROLE,Object>)input.getFeature(Linguistics.PAS); +if(pas==null||!pas.containsKey(SEMANTIC_ROLE.PREDICATE))returnfalse; +Stringpredicate=((String)pas.get(SEMANTIC_ROLE.PREDICATE)).toLowerCase(); +Stringagent=(String)pas.get(SEMANTIC_ROLE.AGENT); +Stringpatient=(String)pas.get(SEMANTIC_ROLE.PATIENT); +//if(agent==null)agent="i"; +//TODOHandlecaseswherenamecouldnotbeparsed. +//Maybesomethinglike"Ididnotquitegetyourname,couldyourepeatit." +//Whenusingadefaultvaluewithpersistentmemory,Roboywillalwaysrecognizethem. +if(patient==null)agent="laura"; +//if(!"am".equals(predicate)&&!"is".equals(predicate))returnfalse; +//if(!agent.toLowerCase().contains("i")&&!agent.toLowerCase().contains("my"))returnfalse; +name=patient; +} +if(name!=null){ +//WorkingMemory.getInstance().save(newTriple("is","name",name)); +//List<Triple>agens=PersistentKnowledge.getInstance().retrieve(newTriple(null,name,null)); +//List<Triple>patiens=PersistentKnowledge.getInstance().retrieve(newTriple(null,null,name)); +//TODOCurrentlyassumingnoduplicatenamesinmemory.Supportforlastnameadditionneeded. +StringretrievedResult=""; +person.addName(name); +if(!person.FAMILIAR){ +returnfalse; +}else{ +ArrayList<Integer>ids=person.getRelationships(predicate); +if(ids!=null&&!ids.isEmpty()){ +memory=Neo4jMemory.getInstance(); +try{ +for(inti=0;i<ids.size()&&i<3;i++){ +MemoryNodeModelrequestedObject=memory.getById(ids.get(i)); +retrievedResult+=requestedObject.getProperties().get("name").toString(); +retrievedResult+="and"; +} +}catch(InterruptedExceptione){ +e.printStackTrace(); +}catch(IOExceptione){ +e.printStackTrace(); +} +} +if(!retrievedResult.equals("")){ +retrievedResult="BythewayIknowyouarefriendswith"+retrievedResult.substring(0,retrievedResult.length()-5); +} +} +setSuccessTexts(Lists.stringList( +"Ohhi,"+name+".Sorry,Ididn'trecognizeyouatfirst.Butyouknowhowthevisionguysare."+retrievedResult, +"Hi"+name+"nicetoseeyouagain."+retrievedResult +)); +returntrue; +} +returnfalse; +} + +} - + diff --git a/docs/doxyxml/_json_q_a_values_8java.xml b/docs/doxyxml/_json_q_a_values_8java.xml new file mode 100644 index 00000000..41b25838 --- /dev/null +++ b/docs/doxyxml/_json_q_a_values_8java.xml @@ -0,0 +1,53 @@ + + + + JsonQAValues.java + roboy::util::JsonQAValues + roboy::util + + + + + +packageroboy.util; + +importjava.util.List; +importjava.util.Map; + +publicclassJsonQAValues{ +privateMap<String,List<String>>questions; +privateMap<String,List<String>>successAnswers; +privateMap<String,List<String>>failureAnswers; +privateMap<String,List<String>>followUp; +privateMap<String,List<String>>answersFollowUp; + +publicJsonQAValues(Map<String,List<String>>questions,Map<String,List<String>>successAnswers, +Map<String,List<String>>failureAnswers,Map<String,List<String>>followUp, +Map<String,List<String>>answersFollowUp){ +this.questions=questions; +this.successAnswers=successAnswers; +this.failureAnswers=failureAnswers; +this.followUp=followUp; +this.answersFollowUp=answersFollowUp; +} + +publicMap<String,List<String>>getQuestions(){ +returnquestions; +} +publicMap<String,List<String>>getSuccessAnswers(){ +returnsuccessAnswers; +} +publicMap<String,List<String>>getFailureAnswers(){ +returnfailureAnswers; +} +publicMap<String,List<String>>getFollowUpQuestions(){ +returnfollowUp; +} +publicMap<String,List<String>>getFollowUpAnswers(){ +returnanswersFollowUp; +} +} + + + + diff --git a/docs/doxyxml/_json_utils_8java.xml b/docs/doxyxml/_json_utils_8java.xml old mode 100644 new mode 100755 index dae27de3..7723131d --- a/docs/doxyxml/_json_utils_8java.xml +++ b/docs/doxyxml/_json_utils_8java.xml @@ -2,6 +2,8 @@ JsonUtils.java + roboy::util::JsonModel + roboy::util::JsonEntryModel roboy::util::JsonUtils roboy::util @@ -18,34 +20,119 @@ importjava.io.InputStream; importjava.io.InputStreamReader; importjava.lang.reflect.Type; -importjava.util.List; -importjava.util.Map; - -publicclassJsonUtils{ - -publicstaticMap<String,List<String>>getSentencesFromJsonFile(Stringfile){ -Typet=newTypeToken<Map<String,List<String>>>(){}.getType(); - -InputStreaminput=JsonUtils.class.getClassLoader().getResourceAsStream(file); -BufferedReaderbr=newBufferedReader(newInputStreamReader(input)); -Gsongson=newGson(); - -Map<String,List<String>>q=gson.fromJson(br,t); -returnq; -} - -publicstaticMap<String,List<String[]>>getSentenceArraysFromJsonFile(Stringfile){ -Typet=newTypeToken<Map<String,List<String[]>>>(){}.getType(); - -InputStreaminput=JsonUtils.class.getClassLoader().getResourceAsStream(file); -BufferedReaderbr=newBufferedReader(newInputStreamReader(input)); -Gsongson=newGson(); - -Map<String,List<String[]>>q=gson.fromJson(br,t); -returnq; -} -} +importjava.util.*; + +classJsonModel{ +//Addthenewentry +JsonEntryModelname; +JsonEntryModelFROM; +JsonEntryModelHAS_HOBBY; +JsonEntryModelLIVE_IN; +JsonEntryModelFRIEND_OF; +JsonEntryModelSTUDY_AT; +JsonEntryModelMEMBER_OF; +JsonEntryModelWORK_FOR; +JsonEntryModelOCCUPIED_AS; +} + +classJsonEntryModel{ +List<String>Q; +Map<String,List<String>>A; +Map<String,List<String>>FUP; +} + +publicclassJsonUtils{ +publicstaticJsonQAValuesgetQuestionsAndAnswersFromJson(Stringfile){ +//TODODesignagoodandsmartwaytodothisfornewDialogSM.Needsdiscussion +InputStreaminput=JsonUtils.class.getClassLoader().getResourceAsStream(file); +BufferedReaderbr=newBufferedReader(newInputStreamReader(input)); + +Gsongson=newGson(); +JsonModeljsonObject=gson.fromJson(br,JsonModel.class); +Map<String,List<String>>questions=newHashMap<>(); +Map<String,List<String>>successAnswers=newHashMap<>(); +Map<String,List<String>>failureAnswers=newHashMap<>(); +Map<String,List<String>>followUp=newHashMap<>(); +Map<String,List<String>>answersFollowUp=newHashMap<>(); +//Questions +questions.put("name",jsonObject.name.Q); +questions.put("FROM",jsonObject.FROM.Q); +questions.put("HAS_HOBBY",jsonObject.HAS_HOBBY.Q); +questions.put("LIVE_IN",jsonObject.LIVE_IN.Q); +questions.put("FRIEND_OF",jsonObject.FRIEND_OF.Q); +questions.put("STUDY_AT",jsonObject.STUDY_AT.Q); +questions.put("MEMBER_OF",jsonObject.MEMBER_OF.Q); +questions.put("WORK_FOR",jsonObject.WORK_FOR.Q); +questions.put("OCCUPIED_AS",jsonObject.OCCUPIED_AS.Q); +//SuccessAnswer +successAnswers.put("name",jsonObject.name.A.get("SUCCESS")); +successAnswers.put("FROM",jsonObject.FROM.A.get("SUCCESS")); +successAnswers.put("HAS_HOBBY",jsonObject.HAS_HOBBY.A.get("SUCCESS")); +successAnswers.put("LIVE_IN",jsonObject.LIVE_IN.A.get("SUCCESS")); +successAnswers.put("FRIEND_OF",jsonObject.FRIEND_OF.A.get("SUCCESS")); +successAnswers.put("STUDY_AT",jsonObject.STUDY_AT.A.get("SUCCESS")); +successAnswers.put("MEMBER_OF",jsonObject.MEMBER_OF.A.get("SUCCESS")); +successAnswers.put("WORK_FOR",jsonObject.WORK_FOR.A.get("SUCCESS")); +successAnswers.put("OCCUPIED_AS",jsonObject.OCCUPIED_AS.A.get("SUCCESS")); +//FailureAnswer +failureAnswers.put("name",jsonObject.name.A.get("FAILURE")); +failureAnswers.put("FROM",jsonObject.FROM.A.get("FAILURE")); +failureAnswers.put("HAS_HOBBY",jsonObject.HAS_HOBBY.A.get("FAILURE")); +failureAnswers.put("LIVE_IN",jsonObject.LIVE_IN.A.get("FAILURE")); +failureAnswers.put("FRIEND_OF",jsonObject.FRIEND_OF.A.get("FAILURE")); +failureAnswers.put("STUDY_AT",jsonObject.STUDY_AT.A.get("FAILURE")); +failureAnswers.put("MEMBER_OF",jsonObject.MEMBER_OF.A.get("FAILURE")); +failureAnswers.put("WORK_FOR",jsonObject.WORK_FOR.A.get("FAILURE")); +failureAnswers.put("OCCUPIED_AS",jsonObject.OCCUPIED_AS.A.get("FAILURE")); +//FollowUps +followUp.put("name",jsonObject.name.FUP.get("Q")); +followUp.put("FROM",jsonObject.FROM.FUP.get("Q")); +followUp.put("HAS_HOBBY",jsonObject.HAS_HOBBY.FUP.get("Q")); +followUp.put("LIVE_IN",jsonObject.LIVE_IN.FUP.get("Q")); +followUp.put("FRIEND_OF",jsonObject.FRIEND_OF.FUP.get("Q")); +followUp.put("STUDY_AT",jsonObject.STUDY_AT.FUP.get("Q")); +followUp.put("MEMBER_OF",jsonObject.MEMBER_OF.FUP.get("Q")); +followUp.put("WORK_FOR",jsonObject.WORK_FOR.FUP.get("Q")); +followUp.put("OCCUPIED_AS",jsonObject.OCCUPIED_AS.FUP.get("Q")); +//FollowUpAnswers +answersFollowUp.put("name",jsonObject.name.FUP.get("A")); +answersFollowUp.put("FROM",jsonObject.FROM.FUP.get("A")); +answersFollowUp.put("HAS_HOBBY",jsonObject.HAS_HOBBY.FUP.get("A")); +answersFollowUp.put("LIVE_IN",jsonObject.LIVE_IN.FUP.get("A")); +answersFollowUp.put("FRIEND_OF",jsonObject.FRIEND_OF.FUP.get("A")); +answersFollowUp.put("STUDY_AT",jsonObject.STUDY_AT.FUP.get("A")); +answersFollowUp.put("MEMBER_OF",jsonObject.MEMBER_OF.FUP.get("A")); +answersFollowUp.put("WORK_FOR",jsonObject.WORK_FOR.FUP.get("A")); +answersFollowUp.put("OCCUPIED_AS",jsonObject.OCCUPIED_AS.FUP.get("A")); +//Data +JsonQAValuesq=newJsonQAValues(questions,successAnswers,failureAnswers,followUp,answersFollowUp); +returnq; +} + +publicstaticMap<String,List<String>>getSentencesFromJsonFile(Stringfile){ +Typet=newTypeToken<Map<String,List<String>>>(){}.getType(); + +InputStreaminput=JsonUtils.class.getClassLoader().getResourceAsStream(file); +BufferedReaderbr=newBufferedReader(newInputStreamReader(input)); +Gsongson=newGson(); + +Map<String,List<String>>q=gson.fromJson(br,t); +returnq; +} + +publicstaticMap<String,List<String[]>>getSentenceArraysFromJsonFile(Stringfile){ +Typet=newTypeToken<Map<String,List<String[]>>>(){}.getType(); + +InputStreaminput=JsonUtils.class.getClassLoader().getResourceAsStream(file); +BufferedReaderbr=newBufferedReader(newInputStreamReader(input)); +Gsongson=newGson(); + +Map<String,List<String[]>>q=gson.fromJson(br,t); +returnq; +} +} + - + diff --git a/docs/doxyxml/_knock_knock_personality_8java.xml b/docs/doxyxml/_knock_knock_personality_8java.xml old mode 100644 new mode 100755 index ce1d00ca..9e973f9a --- a/docs/doxyxml/_knock_knock_personality_8java.xml +++ b/docs/doxyxml/_knock_knock_personality_8java.xml @@ -112,6 +112,6 @@ } - + diff --git a/docs/doxyxml/_lexicon_8java.xml b/docs/doxyxml/_lexicon_8java.xml old mode 100644 new mode 100755 index b96353bf..f0a20d2d --- a/docs/doxyxml/_lexicon_8java.xml +++ b/docs/doxyxml/_lexicon_8java.xml @@ -379,6 +379,6 @@ } } - + diff --git a/docs/doxyxml/_lexicon_literal_8java.xml b/docs/doxyxml/_lexicon_literal_8java.xml old mode 100644 new mode 100755 index 61b2b989..89cdf73c --- a/docs/doxyxml/_lexicon_literal_8java.xml +++ b/docs/doxyxml/_lexicon_literal_8java.xml @@ -59,6 +59,6 @@ } - + diff --git a/docs/doxyxml/_lexicon_predicate_8java.xml b/docs/doxyxml/_lexicon_predicate_8java.xml old mode 100644 new mode 100755 index 9b574733..df03316a --- a/docs/doxyxml/_lexicon_predicate_8java.xml +++ b/docs/doxyxml/_lexicon_predicate_8java.xml @@ -59,6 +59,6 @@ }; } - + diff --git a/docs/doxyxml/_linguistics_8java.xml b/docs/doxyxml/_linguistics_8java.xml old mode 100644 new mode 100755 index 6dc0a484..b37bf3b3 --- a/docs/doxyxml/_linguistics_8java.xml +++ b/docs/doxyxml/_linguistics_8java.xml @@ -67,9 +67,11 @@ publicstaticfinalStringINTENT="intent"; publicstaticfinalStringINTENT_DISTANCE="intentdistance"; - -} + +publicstaticfinalStringPARSE="parse"; + +} - + diff --git a/docs/doxyxml/_lists_8java.xml b/docs/doxyxml/_lists_8java.xml old mode 100644 new mode 100755 index da094b4d..9245680d --- a/docs/doxyxml/_lists_8java.xml +++ b/docs/doxyxml/_lists_8java.xml @@ -46,6 +46,6 @@ } - + diff --git a/docs/doxyxml/_location_d_bpedia_8java.xml b/docs/doxyxml/_location_d_bpedia_8java.xml old mode 100644 new mode 100755 index 8dae8642..9b50c3df --- a/docs/doxyxml/_location_d_bpedia_8java.xml +++ b/docs/doxyxml/_location_d_bpedia_8java.xml @@ -74,6 +74,6 @@ } - + diff --git a/docs/doxyxml/_location_d_bpedia_state_test_8java.xml b/docs/doxyxml/_location_d_bpedia_state_test_8java.xml old mode 100644 new mode 100755 index fdfe32ba..0b919bda --- a/docs/doxyxml/_location_d_bpedia_state_test_8java.xml +++ b/docs/doxyxml/_location_d_bpedia_state_test_8java.xml @@ -40,6 +40,6 @@ } } - + diff --git a/docs/doxyxml/_maps_8java.xml b/docs/doxyxml/_maps_8java.xml old mode 100644 new mode 100755 index bc1bd719..c802e8ec --- a/docs/doxyxml/_maps_8java.xml +++ b/docs/doxyxml/_maps_8java.xml @@ -51,6 +51,6 @@ } } - + diff --git a/docs/doxyxml/_memory_8java.xml b/docs/doxyxml/_memory_8java.xml old mode 100644 new mode 100755 index 104bc4da..9bf91511 --- a/docs/doxyxml/_memory_8java.xml +++ b/docs/doxyxml/_memory_8java.xml @@ -22,6 +22,6 @@ publicList<T>retrieve(Tobject)throwsInterruptedException,IOException; } - + diff --git a/docs/doxyxml/_memory_node_model_8java.xml b/docs/doxyxml/_memory_node_model_8java.xml old mode 100644 new mode 100755 index 1d11f811..6e683577 --- a/docs/doxyxml/_memory_node_model_8java.xml +++ b/docs/doxyxml/_memory_node_model_8java.xml @@ -13,151 +13,152 @@ importcom.google.gson.Gson; importcom.google.gson.reflect.TypeToken; -importorg.json.JSONObject; - -importjava.lang.reflect.Type; -importjava.util.ArrayList; -importjava.util.HashMap; -importjava.util.Iterator; -importjava.util.Map; - -publicclassMemoryNodeModel{ -//UniquenodeIDsassignedbythememory. -privateintid; -//"Person"etc. -privateArrayList<String>labels; -//"Person"etc.DuplicatebecauseMemoryexpectsasingleLabelinCREATEqueries,but -//returnsanarrayoflabelsinsideGETresponses. -privateStringlabel; -//name,birthdate -privateHashMap<String,Object>properties; -//Relation:<nameasString,ArrayListofIDs(nodesrelatedtothisnodeoverthisrelation)> -privateHashMap<String,ArrayList<Integer>>relations; -//Iftrue,thenfieldswithdefaultvalueswillberemovedfromJSONformat. -//Transientasstrippinginformationisnotapartofthenodeandnotincludedinquery. -transientbooleanstripQuery=false; - -publicMemoryNodeModel(){ -this.id=0; -} - -publicMemoryNodeModel(booleanstripQuery){ -if(!stripQuery){ -id=0; -labels=newArrayList<>(); -properties=newHashMap<>(); -relations=newHashMap<>(); -}else{ -id=0; -this.stripQuery=true; -} -} - -publicintgetId(){ -returnid; -} -publicvoidsetId(intid){ -this.id=id; -} - -publicArrayList<String>getLabels(){ -returnlabels; -} -publicvoidsetLabel(Stringlabel){ -if(this.labels==null){ -this.labels=newArrayList<>(); -} -labels.add(label); -this.label=label; -} - -publicHashMap<String,Object>getProperties(){ -returnproperties; -} -publicObjectgetProperty(Stringkey){ -return(properties!=null?properties.get(key):null); -} - -publicvoidsetProperties(HashMap<String,Object>properties){ -if(this.properties==null){ -this.properties=newHashMap<>(); -} -this.properties.putAll(properties); -} -publicvoidsetProperty(Stringkey,Objectproperty){ -if(this.properties==null){ -this.properties=newHashMap<>(); -} -properties.put(key,property); -} - -publicHashMap<String,ArrayList<Integer>>getRelations(){ -returnrelations; -} -publicArrayList<Integer>getRelation(Stringkey){ -return(relations!=null?relations.get(key.toLowerCase()):null); -} -publicvoidsetRelations(HashMap<String,ArrayList<Integer>>relations){ -if(this.relations==null){ -this.relations=newHashMap<>(); -} -this.relations.putAll(relations); -} -publicvoidsetRelation(Stringkey,Integerid){ -if(this.relations==null){ -this.relations=newHashMap<>(); -} -if(relations.containsKey(key)){ -relations.get(key).add(id); -}else{ -ArrayListidList=newArrayList(); -idList.add(id); -relations.put(key,idList); -} -} - -publicvoidsetStripQuery(booleanstrip){ -this.stripQuery=strip; -} - -publicStringtoJSON(Gsongson){ -Stringjson=gson.toJson(this); -if(stripQuery){ -//Thisisbasedonhttps://stackoverflow.com/questions/23920740/remove-empty-collections-from-a-json-with-gson -Typetype=newTypeToken<Map<String,Object>>(){}.getType(); -Map<String,Object>obj=gson.fromJson(json,type); -for(Iterator<Map.Entry<String,Object>>it=obj.entrySet().iterator();it.hasNext();){ -Map.Entry<String,Object>entry=it.next(); -if(entry.getValue()==null){ -it.remove(); -}elseif(entry.getValue().getClass().equals(ArrayList.class)){ -if(((ArrayList<?>)entry.getValue()).size()==0){ -it.remove(); -} -//AsIDisparsedintoDoubleinsideGSON,usngDouble.class -}elseif(entry.getValue().getClass().equals(Double.class)){ -if(((Double)entry.getValue())==0){ -it.remove(); -} -}elseif(entry.getValue().getClass().equals(HashMap.class)){ -if(((HashMap<?,?>)entry.getValue()).size()==0){ -it.remove(); -} -}elseif(entry.getValue().getClass().equals(String.class)){ -if(((String)entry.getValue()).equals("")){ -it.remove(); -} -} -} -json=gson.toJson(obj); -} -returnjson; -} -publicMemoryNodeModelfromJSON(Stringjson,Gsongson){ -returngson.fromJson(json,this.getClass()); -} -} + +importjava.lang.reflect.Type; +importjava.util.ArrayList; +importjava.util.HashMap; +importjava.util.Iterator; +importjava.util.Map; + +publicclassMemoryNodeModel{ +//UniquenodeIDsassignedbythememory. +privateintid; +//"Person"etc. +privateArrayList<String>labels; +//"Person"etc.DuplicatebecauseMemoryexpectsasingleLabelinCREATEqueries,but +//returnsanarrayoflabelsinsideGETresponses. +privateStringlabel; +//name,birthdate +privateHashMap<String,Object>properties; +//Relation:<nameasString,ArrayListofIDs(nodesrelatedtothisnodeoverthisrelation)> +privateHashMap<String,ArrayList<Integer>>relationships; +//Iftrue,thenfieldswithdefaultvalueswillberemovedfromJSONformat. +//Transientasstrippinginformationisnotapartofthenodeandnotincludedinquery. +transientbooleanstripQuery=false; + +publicMemoryNodeModel(){ +this.id=0; +} + +publicMemoryNodeModel(booleanstripQuery){ +if(!stripQuery){ +id=0; +labels=newArrayList<>(); +properties=newHashMap<>(); +relationships=newHashMap<>(); +}else{ +id=0; +this.stripQuery=true; +} +} + +publicintgetId(){ +returnid; +} +publicvoidsetId(intid){ +this.id=id; +} + +publicArrayList<String>getLabels(){ +returnlabels; +} +publicvoidsetLabel(Stringlabel){ +if(this.labels==null){ +this.labels=newArrayList<>(); +} +labels.add(label); +this.label=label; +} + +publicHashMap<String,Object>getProperties(){ +returnproperties; +} +publicObjectgetProperty(Stringkey){ +return(properties!=null?properties.get(key):null); +} + +publicvoidsetProperties(HashMap<String,Object>properties){ +if(this.properties==null){ +this.properties=newHashMap<>(); +} +this.properties.putAll(properties); +} +publicvoidsetProperty(Stringkey,Objectproperty){ +if(this.properties==null){ +this.properties=newHashMap<>(); +} +properties.put(key,property); +} + +publicHashMap<String,ArrayList<Integer>>getRelationships(){ +returnrelationships; +} +publicArrayList<Integer>getRelationship(Stringkey){ +//TODO:Sortthisshitout +//return(relationships!=null?relationships.get(key.toLowerCase()):null); +return(relationships!=null?relationships.get(key):null); +} +publicvoidsetRelationships(HashMap<String,ArrayList<Integer>>relationships){ +if(this.relationships==null){ +this.relationships=newHashMap<>(); +} +this.relationships.putAll(relationships); +} +publicvoidsetRelationship(Stringkey,Integerid){ +if(this.relationships==null){ +this.relationships=newHashMap<>(); +} +if(relationships.containsKey(key)){ +relationships.get(key).add(id); +}else{ +ArrayListidList=newArrayList(); +idList.add(id); +relationships.put(key,idList); +} +} + +publicvoidsetStripQuery(booleanstrip){ +this.stripQuery=strip; +} + +publicStringtoJSON(Gsongson){ +Stringjson=gson.toJson(this); +if(stripQuery){ +//Thisisbasedonhttps://stackoverflow.com/questions/23920740/remove-empty-collections-from-a-json-with-gson +Typetype=newTypeToken<Map<String,Object>>(){}.getType(); +Map<String,Object>obj=gson.fromJson(json,type); +for(Iterator<Map.Entry<String,Object>>it=obj.entrySet().iterator();it.hasNext();){ +Map.Entry<String,Object>entry=it.next(); +if(entry.getValue()==null){ +it.remove(); +}elseif(entry.getValue().getClass().equals(ArrayList.class)){ +if(((ArrayList<?>)entry.getValue()).size()==0){ +it.remove(); +} +//AsIDisparsedintoDoubleinsideGSON,usngDouble.class +}elseif(entry.getValue().getClass().equals(Double.class)){ +if(((Double)entry.getValue())==0){ +it.remove(); +} +}elseif(entry.getValue().getClass().equals(HashMap.class)){ +if(((HashMap<?,?>)entry.getValue()).size()==0){ +it.remove(); +} +}elseif(entry.getValue().getClass().equals(String.class)){ +if(((String)entry.getValue()).equals("")){ +it.remove(); +} +} +} +json=gson.toJson(obj); +} +returnjson; +} +publicMemoryNodeModelfromJSON(Stringjson,Gsongson){ +returngson.fromJson(json,this.getClass()); +} +} - + diff --git a/docs/doxyxml/_metaphone_encoder_8java.xml b/docs/doxyxml/_metaphone_encoder_8java.xml old mode 100644 new mode 100755 index 28e6e235..ba8beb60 --- a/docs/doxyxml/_metaphone_encoder_8java.xml +++ b/docs/doxyxml/_metaphone_encoder_8java.xml @@ -28,6 +28,6 @@ } - + diff --git a/docs/doxyxml/_multi_input_device_8java.xml b/docs/doxyxml/_multi_input_device_8java.xml old mode 100644 new mode 100755 index ed04e37a..851a72cf --- a/docs/doxyxml/_multi_input_device_8java.xml +++ b/docs/doxyxml/_multi_input_device_8java.xml @@ -42,6 +42,6 @@ } - + diff --git a/docs/doxyxml/_multi_output_device_8java.xml b/docs/doxyxml/_multi_output_device_8java.xml old mode 100644 new mode 100755 index a178cd95..592b9e0f --- a/docs/doxyxml/_multi_output_device_8java.xml +++ b/docs/doxyxml/_multi_output_device_8java.xml @@ -40,6 +40,6 @@ } - + diff --git a/docs/doxyxml/_neo4j_memory_8java.xml b/docs/doxyxml/_neo4j_memory_8java.xml old mode 100644 new mode 100755 index ec8998bc..6c61b688 --- a/docs/doxyxml/_neo4j_memory_8java.xml +++ b/docs/doxyxml/_neo4j_memory_8java.xml @@ -28,7 +28,7 @@ privateGsongson=newGson(); privateNeo4jMemory(RosMainNodenode){ -this.rosMainNode=node; +Neo4jMemory.rosMainNode=node; } publicstaticNeo4jMemorygetInstance(RosMainNodenode) @@ -40,76 +40,79 @@ } -publicstaticNeo4jMemorygetInstance() +publicstaticNeo4jMemorygetInstance() { -try{ -returnmemory; +if(memory==null){ +System.out.println("Memorywasn'tinitializedcorrectly.UsepublicstaticNeo4jMemorygetInstance(RosMainNodenode)instead."); } -catch(NullPointerExceptione) -{ -e.printStackTrace(); -System.out.println("Memorywasn'tinitializedcorrectly.UsepublicstaticNeo4jMemorygetInstance(RosMainNodenode)instead."); -returnnull; -} - -} - -@Override -publicbooleansave(MemoryNodeModelnode)throwsInterruptedException,IOException -{ -if(Config.NOROS)returnfalse; -Stringresponse=rosMainNode.UpdateMemoryQuery(node.toJSON(gson)); -if(response==null)returnfalse; -return(response.contains("OK")); -} - -publicMemoryNodeModelgetById(intid)throwsInterruptedException,IOException -{ -if(Config.NOROS)returnnewMemoryNodeModel(); -Stringresult=rosMainNode.GetMemoryQuery("{'id':"+id+"}"); -if(result==null||result.contains("FAIL"))returnnull; -returngson.fromJson(result,MemoryNodeModel.class); -} - -publicArrayList<Integer>getByQuery(MemoryNodeModelquery)throwsInterruptedException,IOException -{ -if(Config.NOROS)returnnewArrayList<>(); -Stringresult=rosMainNode.GetMemoryQuery(query.toJSON(gson)); -if(result==null||result.contains("FAIL"))returnnull; -Typetype=newTypeToken<HashMap<String,List<Integer>>>(){}.getType(); -HashMap<String,ArrayList<Integer>>list=gson.fromJson(result,type); -returnlist.get("id"); -} - -publicintcreate(MemoryNodeModelquery)throwsInterruptedException,IOException -{ -if(Config.NOROS)return0; -Stringresult=rosMainNode.CreateMemoryQuery(query.toJSON(gson)); -//HandlepossibleMemoryerrormessage. -if(result==null||result.contains("FAIL"))return0; -Typetype=newTypeToken<Map<String,Integer>>(){}.getType(); -Map<String,Integer>list=gson.fromJson(result,type); -returnlist.get("id"); -} - -publicbooleanremove(MemoryNodeModelquery)throwsInterruptedException,IOException -{ -if(Config.NOROS)returnfalse; -//Removeallfieldswhichwerenotexplicitlyset,forsafety. -query.setStripQuery(true); -Stringresponse=rosMainNode.DeleteMemoryQuery(query.toJSON(gson)); -returnresponse==null?false:response.contains("OK"); -} - -@Override -@Deprecated -publicList<MemoryNodeModel>retrieve(MemoryNodeModelquery)throwsInterruptedException,IOException -{ -returnnull; -} - -} +returnmemory; +} + +@Override +publicbooleansave(MemoryNodeModelnode)throwsInterruptedException,IOException +{ +if(!Config.MEMORY)returnfalse; +Stringresponse=rosMainNode.UpdateMemoryQuery(node.toJSON(gson)); +returnresponse!=null&&(response.contains("OK")); +} + +publicMemoryNodeModelgetById(intid)throwsInterruptedException,IOException +{ +if(!Config.MEMORY)returnnewMemoryNodeModel(); +Stringresult=rosMainNode.GetMemoryQuery("{'id':"+id+"}"); +if(result==null||result.contains("FAIL"))returnnull; +returngson.fromJson(result,MemoryNodeModel.class); +} + +publicArrayList<Integer>getByQuery(MemoryNodeModelquery)throwsInterruptedException,IOException +{ +if(!Config.MEMORY)returnnewArrayList<>(); +Stringresult=rosMainNode.GetMemoryQuery(query.toJSON(gson)); +if(result==null||result.contains("FAIL"))returnnull; +Typetype=newTypeToken<HashMap<String,List<Integer>>>(){}.getType(); +HashMap<String,ArrayList<Integer>>list=gson.fromJson(result,type); +returnlist.get("id"); +} + +publicintcreate(MemoryNodeModelquery)throwsInterruptedException,IOException +{ +if(!Config.MEMORY)return0; +Stringresult=rosMainNode.CreateMemoryQuery(query.toJSON(gson)); +//HandlepossibleMemoryerrormessage. +if(result==null||result.contains("FAIL"))return0; +Typetype=newTypeToken<Map<String,Integer>>(){}.getType(); +Map<String,Integer>list=gson.fromJson(result,type); +returnlist.get("id"); +} + +publicbooleanremove(MemoryNodeModelquery)throwsInterruptedException,IOException +{ +if(!Config.MEMORY)returnfalse; +//Removeallfieldswhichwerenotexplicitlyset,forsafety. +query.setStripQuery(true); +Stringresponse=rosMainNode.DeleteMemoryQuery(query.toJSON(gson)); +returnresponse!=null&&response.contains("OK"); +} + +@Override +@Deprecated +publicList<MemoryNodeModel>retrieve(MemoryNodeModelquery)throwsInterruptedException,IOException +{ +returnnull; +} + +publicStringdetermineNodeType(Stringrelationship){ +//TODOexpandlistasnewNodetypesareadded. +if(relationship.equals(Neo4jRelationships.HAS_HOBBY.type))return"Hobby"; +if(relationship.equals(Neo4jRelationships.FROM.type))return"Country"; +if(relationship.equals(Neo4jRelationships.WORK_FOR.type))return"Organization"; +if(relationship.equals(Neo4jRelationships.STUDY_AT.type))return"Organization"; +if(relationship.equals(Neo4jRelationships.OCCUPIED_AS.type))return"Occupation"; +if(relationship.equals(Neo4jRelationships.OTHER.type))return"Other"; +elsereturn""; +} +} - + diff --git a/docs/doxyxml/_neo4j_relations_8java.xml b/docs/doxyxml/_neo4j_relations_8java.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/_neo4j_relationships_8java.xml b/docs/doxyxml/_neo4j_relationships_8java.xml new file mode 100755 index 00000000..5993fbbb --- /dev/null +++ b/docs/doxyxml/_neo4j_relationships_8java.xml @@ -0,0 +1,35 @@ + + + + Neo4jRelationships.java + roboy::memory::Neo4jRelationships + roboy::memory + + + + + +packageroboy.memory; + +publicenumNeo4jRelationships{ +FROM("FROM"), +HAS_HOBBY("HAS_HOBBY"), +LIVE_IN("LIVE_IN"), +STUDY_AT("STUDY_AT"), +OCCUPIED_AS("OCCUPIED_AS"), +WORK_FOR("WORK_FOR"), +FRIEND_OF("FRIEND_OF"), +MEMBER_OF("MEMBER_OF"), +OTHER("OTHER"), +IS("IS"); + +publicStringtype; + +Neo4jRelationships(Stringtype){ +this.type=type; +} +} + + + + diff --git a/docs/doxyxml/_new_dialog_system_8java.xml b/docs/doxyxml/_new_dialog_system_8java.xml new file mode 100644 index 00000000..da727c99 --- /dev/null +++ b/docs/doxyxml/_new_dialog_system_8java.xml @@ -0,0 +1,85 @@ + + + + NewDialogSystem.java + roboy::newDialog::NewDialogSystem + roboy::newDialog + + + + + +packageroboy.newDialog; + + +importorg.apache.commons.configuration2.YAMLConfiguration; +importorg.apache.commons.configuration2.ex.ConfigurationException; +importroboy.dialog.Config; +importroboy.dialog.action.Action; +importroboy.io.*; +importroboy.linguistics.sentenceanalysis.*; +importroboy.talk.Verbalizer; + +importjava.io.File; +importjava.io.FileNotFoundException; +importjava.io.FileReader; +importjava.io.IOException; +importjava.util.ArrayList; +importjava.util.List; + +importstaticroboy.dialog.Config.ConfigurationProfile.NOROS; + +publicclassNewDialogSystem{ + +privatestaticStringgetPersonalityFilePathFromConfig()throwsFileNotFoundException,ConfigurationException{ +YAMLConfigurationyamlConfig=newYAMLConfiguration(); +yamlConfig.read(newFileReader(newFile("config.properties"))); +returnyamlConfig.getString("PERSONALITY_FILE"); +} + +publicstaticvoidmain(String[]args)throwsException{ + +//TODO:catchallexceptionsormakesurenonearethrown +newConfig(NOROS); + + +MultiInputDevicemultiIn=newMultiInputDevice(newCommandLineInput()); +MultiOutputDevicemultiOut=newMultiOutputDevice(newCommandLineOutput()); +List<Analyzer>analyzers=newArrayList<>(); +analyzers.add(newPreprocessor()); +analyzers.add(newSimpleTokenizer()); + +StateBasedPersonalitypersonality=newStateBasedPersonality(newVerbalizer()); +StringpersonalityFilePath=getPersonalityFilePathFromConfig(); +personality.loadFromFile(newFile(personalityFilePath)); + + +Inputraw; +Interpretationinterpretation; + +//Repeatconversationafewtimes +for(intnumConversations=0;numConversations<2;numConversations++){ + +System.out.println("--------------newconversation--------------"); +List<Action>actions=personality.startConversation(); + +while(!actions.isEmpty()){ +multiOut.act(actions); +raw=multiIn.listen(); +interpretation=newInterpretation(raw.sentence,raw.attributes); +for(Analyzera:analyzers){ +interpretation=a.analyze(interpretation); +} +actions=personality.answer(interpretation); +} + +} +} + + + +} + + + + diff --git a/docs/doxyxml/_ontology_n_e_r_analyzer_8java.xml b/docs/doxyxml/_ontology_n_e_r_analyzer_8java.xml old mode 100644 new mode 100755 index db4796be..a72ddbbc --- a/docs/doxyxml/_ontology_n_e_r_analyzer_8java.xml +++ b/docs/doxyxml/_ontology_n_e_r_analyzer_8java.xml @@ -70,6 +70,6 @@ } - + diff --git a/docs/doxyxml/_open_n_l_p_p_p_o_s_tagger_8java.xml b/docs/doxyxml/_open_n_l_p_p_p_o_s_tagger_8java.xml old mode 100644 new mode 100755 index c64143ca..cc33c18f --- a/docs/doxyxml/_open_n_l_p_p_p_o_s_tagger_8java.xml +++ b/docs/doxyxml/_open_n_l_p_p_p_o_s_tagger_8java.xml @@ -60,6 +60,6 @@ } } - + diff --git a/docs/doxyxml/_open_n_l_p_parser_8java.xml b/docs/doxyxml/_open_n_l_p_parser_8java.xml old mode 100644 new mode 100755 index c63c6795..4d13f048 --- a/docs/doxyxml/_open_n_l_p_parser_8java.xml +++ b/docs/doxyxml/_open_n_l_p_parser_8java.xml @@ -250,6 +250,6 @@ } - + diff --git a/docs/doxyxml/_open_n_l_p_parser_test_8java.xml b/docs/doxyxml/_open_n_l_p_parser_test_8java.xml old mode 100644 new mode 100755 index 18f437ee..d9c622ca --- a/docs/doxyxml/_open_n_l_p_parser_test_8java.xml +++ b/docs/doxyxml/_open_n_l_p_parser_test_8java.xml @@ -111,6 +111,6 @@ } } - + diff --git a/docs/doxyxml/_output_device_8java.xml b/docs/doxyxml/_output_device_8java.xml old mode 100644 new mode 100755 index 11bb1afe..1a1da4d5 --- a/docs/doxyxml/_output_device_8java.xml +++ b/docs/doxyxml/_output_device_8java.xml @@ -19,6 +19,6 @@ publicvoidact(List<Action>actions); } - + diff --git a/docs/doxyxml/_p_a_s_interpreter_8java.xml b/docs/doxyxml/_p_a_s_interpreter_8java.xml old mode 100644 new mode 100755 index 08fc7dd0..1529e5e0 --- a/docs/doxyxml/_p_a_s_interpreter_8java.xml +++ b/docs/doxyxml/_p_a_s_interpreter_8java.xml @@ -156,6 +156,6 @@ } - + diff --git a/docs/doxyxml/_p_a_s_interpreter_test_8java.xml b/docs/doxyxml/_p_a_s_interpreter_test_8java.xml old mode 100644 new mode 100755 index 93e66b7d..a0567659 --- a/docs/doxyxml/_p_a_s_interpreter_test_8java.xml +++ b/docs/doxyxml/_p_a_s_interpreter_test_8java.xml @@ -243,6 +243,6 @@ } } - + diff --git a/docs/doxyxml/_parser_analyzer_8java.xml b/docs/doxyxml/_parser_analyzer_8java.xml new file mode 100644 index 00000000..4b47df37 --- /dev/null +++ b/docs/doxyxml/_parser_analyzer_8java.xml @@ -0,0 +1,79 @@ + + + + ParserAnalyzer.java + roboy::linguistics::sentenceanalysis::ParserAnalyzer + roboy::linguistics::sentenceanalysis + + + + + +packageroboy.linguistics.sentenceanalysis; + +importjdk.nashorn.internal.runtime.regexp.joni.Config; +importroboy.linguistics.Linguistics; + +importjava.io.BufferedReader; +importjava.io.IOException; +importjava.io.InputStreamReader; +importjava.io.PrintWriter; + +importjava.net.Socket; + + +publicclassParserAnalyzerimplementsAnalyzer{ + +privateSocketclientSocket; +privatePrintWriterout; +privateBufferedReaderin; +privatebooleandebug=true; +publicParserAnalyzer(intportNumber){ +this.debug=true; +try{ +//Createstring-stringsocket +this.clientSocket=newSocket("localhost",portNumber); +//Declaringinput +this.in=newBufferedReader( +newInputStreamReader(clientSocket.getInputStream())); +//Declaringoutput +this.out=newPrintWriter(clientSocket.getOutputStream(),true); +}catch(IOExceptione){ +System.err.println("SemanticParserClientError:"+e.getMessage()); +} +} + +@Override +publicInterpretationanalyze(Interpretationinterpretation){ +if(this.clientSocket!=null&&this.clientSocket.isConnected()){ +try{ +Stringresponse; +if(this.debug){System.out.println("SEMANTICPARSER:"+interpretation.getFeature("sentence"));} +this.out.println(interpretation.getFeature("sentence")); +response=this.in.readLine(); +if(this.debug){System.out.println(">Fullresponse:"+response);} +if(response!=null&&response.contains("=>")){ +try{ +if(this.debug)System.out.println(">Parse:"+response.substring(0,response.indexOf("=>"))); +if(this.debug)System.out.println(">Answer:"+response.substring(response.indexOf("=>")+3)); +interpretation.getFeatures().put(Linguistics.PARSE,response.substring(0,response.indexOf("=>"))); +interpretation.getFeatures().put(Linguistics.PRED_ANSWER,response.substring(response.indexOf("=>")+3)); +}catch(RuntimeExceptione){ +System.err.println("Exceptionwhileparsingintentresponse:"+e.getStackTrace()); +} +} +returninterpretation; +}catch(IOExceptione){ +e.printStackTrace(); +returninterpretation; +} +} +else +returninterpretation; +} + +} + + + + diff --git a/docs/doxyxml/_persistent_knowledge_8java.xml b/docs/doxyxml/_persistent_knowledge_8java.xml old mode 100644 new mode 100755 index 8d6b4985..3df80e07 --- a/docs/doxyxml/_persistent_knowledge_8java.xml +++ b/docs/doxyxml/_persistent_knowledge_8java.xml @@ -76,6 +76,6 @@ } } - + diff --git a/docs/doxyxml/_personal_follow_up_state_8java.xml b/docs/doxyxml/_personal_follow_up_state_8java.xml new file mode 100644 index 00000000..987cafa7 --- /dev/null +++ b/docs/doxyxml/_personal_follow_up_state_8java.xml @@ -0,0 +1,111 @@ + + + + PersonalFollowUpState.java + roboy::dialog::personality::states::PersonalFollowUpState + roboy::dialog::personality::states + + + + + +packageroboy.dialog.personality.states; + +importroboy.linguistics.Linguistics; +importroboy.linguistics.Linguistics.SEMANTIC_ROLE; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.memory.Neo4jMemory; +importroboy.memory.Neo4jRelationships; +importroboy.memory.nodes.Interlocutor; +importroboy.memory.nodes.MemoryNodeModel; +importroboy.util.Lists; + +importjava.io.IOException; +importjava.util.ArrayList; +importjava.util.List; +importjava.util.Map; + +publicclassPersonalFollowUpStateextendsAbstractBooleanState{ + +privateList<String>questions; +privateList<String>successTexts; +publicNeo4jRelationshipspredicate; +privateInterlocutorperson; + +publicPersonalFollowUpState(List<String>questions,List<String>failureTexts, +List<String>successTexts,Neo4jRelationshipspredicate,QuestionRandomizerStatenextState,Interlocutorperson){ +this.questions=questions; +this.successTexts=successTexts; +this.predicate=predicate; +this.person=person; +this.setNextState(nextState); +setFailureTexts(failureTexts); +} + +@Override +publicList<Interpretation>act(){ +StringretrievedResult=""; +ArrayList<Integer>ids=person.getRelationships(predicate); +Neo4jMemorymemory=Neo4jMemory.getInstance(); +try{ +MemoryNodeModelrequestedObject=memory.getById(ids.get(0)); +retrievedResult=requestedObject.getProperties().get("name").toString(); +}catch(InterruptedExceptione){ +e.printStackTrace(); +}catch(IOExceptione){ +e.printStackTrace(); +} +returnLists.interpretationList(newInterpretation(String.format(questions.get((int)Math.random()*questions.size()),retrievedResult))); +} + +@SuppressWarnings("unchecked") +@Override +protectedbooleandetermineSuccess(Interpretationinput){ +String[]tokens=(String[])input.getFeatures().get(Linguistics.TOKENS); +Stringanswer=null; +if(tokens.length==1){ +answer=tokens[0]; +} +elseif(input.getFeatures().containsKey(Linguistics.OBJ_ANSWER)) +{ +answer=(String)input.getFeature(Linguistics.OBJ_ANSWER); +} +else{ +Map<SEMANTIC_ROLE,Object>pas=(Map<SEMANTIC_ROLE,Object>)input.getFeature(Linguistics.PAS); +if(pas==null)returnfalse; +Stringpredicate=((String)pas.get(SEMANTIC_ROLE.PREDICATE)).toLowerCase(); +Stringagent=(String)pas.get(SEMANTIC_ROLE.AGENT); +Stringpatient=(String)pas.get(SEMANTIC_ROLE.PATIENT); +if(agent==null)returnfalse; +if(patient==null)returnfalse; +if(!"am".equals(predicate)&&!agent.toLowerCase().contains("i")&&!agent.toLowerCase().contains("my"))returnfalse; +answer=patient; +} +if(answer!=null){ + +//TODORemoveoldcodeaftersuccessfullyswitchingtoNeo4jmemory +//WorkingMemorymemory=WorkingMemory.getInstance(); +//List<Triple>nameTriple=memory.retrieve(newTriple("is","name",null)); +//if(nameTriple.isEmpty())returnfalse; +//Stringname=nameTriple.get(0).patiens; +//WorkingMemory.getInstance().save(newTriple(predicate,name,answer)); + +//Addthenewinformationaboutthepersontothememory. +//person.addInformation(predicate.type,answer); + + +List<String>sTexts=newArrayList<>(); +for(Strings:successTexts){ +sTexts.add(String.format(s,"")); +} +setSuccessTexts(sTexts); +returntrue; +} +returnfalse; +} + +} + + + + diff --git a/docs/doxyxml/_personal_q_a_state_8java.xml b/docs/doxyxml/_personal_q_a_state_8java.xml old mode 100644 new mode 100755 index 53cc48f3..99b33ab6 --- a/docs/doxyxml/_personal_q_a_state_8java.xml +++ b/docs/doxyxml/_personal_q_a_state_8java.xml @@ -18,19 +18,19 @@ importroboy.linguistics.Linguistics; importroboy.linguistics.Linguistics.SEMANTIC_ROLE; importroboy.linguistics.sentenceanalysis.Interpretation; -importroboy.memory.Neo4jRelations; +importroboy.memory.Neo4jRelationships; importroboy.memory.nodes.Interlocutor; importroboy.util.Lists; publicclassPersonalQAStateextendsAbstractBooleanState{ privateList<String>questions; -privateList<String[]>successTexts; -publicNeo4jRelationspredicate; +privateList<String>successTexts; +publicNeo4jRelationshipspredicate; privateInterlocutorperson; publicPersonalQAState(List<String>questions,List<String>failureTexts, -List<String[]>successTexts,Neo4jRelationspredicate,Interlocutorperson){ +List<String>successTexts,Neo4jRelationshipspredicate,Interlocutorperson){ this.questions=questions; this.successTexts=successTexts; this.predicate=predicate; @@ -40,7 +40,7 @@ @Override publicList<Interpretation>act(){ -returnLists.interpretationList(newInterpretation(questions.get((int)Math.random()*questions.size()))); +returnLists.interpretationList(newInterpretation(String.format(questions.get((int)Math.random()*questions.size())))); } @SuppressWarnings("unchecked") @@ -76,12 +76,12 @@ //WorkingMemory.getInstance().save(newTriple(predicate,name,answer)); //Addthenewinformationaboutthepersontothememory. -person.addInformation(predicate.type,answer); +person.addInformation(predicate.type,answer); List<String>sTexts=newArrayList<>(); -for(String[]s:successTexts){ -sTexts.add(s[0]+answer+s[1]); +for(Strings:successTexts){ +sTexts.add(String.format(s,answer)); } setSuccessTexts(sTexts); returntrue; @@ -91,6 +91,6 @@ } - + diff --git a/docs/doxyxml/_personality_8java.xml b/docs/doxyxml/_personality_8java.xml old mode 100644 new mode 100755 index c1c457e1..777939be --- a/docs/doxyxml/_personality_8java.xml +++ b/docs/doxyxml/_personality_8java.xml @@ -21,6 +21,6 @@ publicList<Action>answer(Interpretationinput); } - + diff --git a/docs/doxyxml/_phonetic_encoder_8java.xml b/docs/doxyxml/_phonetic_encoder_8java.xml old mode 100644 new mode 100755 index 1d4087a5..6bd67a18 --- a/docs/doxyxml/_phonetic_encoder_8java.xml +++ b/docs/doxyxml/_phonetic_encoder_8java.xml @@ -16,6 +16,6 @@ publicStringencode(Stringinput); } - + diff --git a/docs/doxyxml/_phonetics_8java.xml b/docs/doxyxml/_phonetics_8java.xml old mode 100644 new mode 100755 index 598d187f..b7a259a6 --- a/docs/doxyxml/_phonetics_8java.xml +++ b/docs/doxyxml/_phonetics_8java.xml @@ -46,6 +46,6 @@ } } - + diff --git a/docs/doxyxml/_preprocessor_8java.xml b/docs/doxyxml/_preprocessor_8java.xml old mode 100644 new mode 100755 index 33b911ce..9832ed3e --- a/docs/doxyxml/_preprocessor_8java.xml +++ b/docs/doxyxml/_preprocessor_8java.xml @@ -24,6 +24,6 @@ } } - + diff --git a/docs/doxyxml/_question_answering_state_8java.xml b/docs/doxyxml/_question_answering_state_8java.xml old mode 100644 new mode 100755 index 773c78a9..20ee94db --- a/docs/doxyxml/_question_answering_state_8java.xml +++ b/docs/doxyxml/_question_answering_state_8java.xml @@ -196,6 +196,6 @@ } } - + diff --git a/docs/doxyxml/_question_answering_state_test_8java.xml b/docs/doxyxml/_question_answering_state_test_8java.xml old mode 100644 new mode 100755 index 1a91b8b9..b0731572 --- a/docs/doxyxml/_question_answering_state_test_8java.xml +++ b/docs/doxyxml/_question_answering_state_test_8java.xml @@ -14,89 +14,93 @@ importstaticorg.junit.Assert.*; -importorg.junit.Test; - -importroboy.dialog.action.SpeechAction; -importroboy.linguistics.sentenceanalysis.Interpretation; -importroboy.linguistics.sentenceanalysis.OpenNLPParser; -importroboy.talk.Verbalizer; - -publicclassQuestionAnsweringStateTest{ - -privatestaticfinalOpenNLPParserparser=newOpenNLPParser(); -privatestaticfinalQuestionAnsweringStatestate=newQuestionAnsweringState(newIdleState()); - -@Test -publicvoidtest(){ -Interpretationinterpretation=newInterpretation("WhatistheareacodeofWashington"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("360",reaction.getReactions().get(0).getFeature("sentence")); -} - -@Test -publicvoidtestNotAnswerable(){ -Interpretationinterpretation=newInterpretation("MynameisBob"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("",reaction.getReactions().get(0).getFeature("sentence")); -} - -@Test -publicvoidtestWhenWas(){ -Interpretationinterpretation=newInterpretation("WhenwasPutinborn?"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("1953-03-30",reaction.getReactions().get(0).getFeature("sentence")); -Verbalizerverbalizer=newVerbalizer(); -SpeechActionaction=(SpeechAction)verbalizer.verbalize(reaction.getReactions().get(0)); -assertEquals("Marchthirtiestnineteenhundredfiftythree",action.getText()); -} - -@Test -publicvoidtestWhereWas(){ -Interpretationinterpretation=newInterpretation("WherewasPutinborn?"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("Ryazan",reaction.getReactions().get(0).getFeature("sentence")); -} - -@Test -publicvoidtestWhereDid(){ -Interpretationinterpretation=newInterpretation("WheredidElvisdie?"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("Memphis,Tennessee",reaction.getReactions().get(0).getFeature("sentence")); -} - -@Test -publicvoidtestWhenDid(){ -Interpretationinterpretation=newInterpretation("WhendidElvisdie?"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("1977-08-16",reaction.getReactions().get(0).getFeature("sentence")); -Verbalizerverbalizer=newVerbalizer(); -SpeechActionaction=(SpeechAction)verbalizer.verbalize(reaction.getReactions().get(0)); -assertEquals("Augustsixteenthnineteenhundredseventyseven",action.getText()); -} - -@Test -publicvoidtestHowAdjective(){ -Interpretationinterpretation=newInterpretation("HowhighisMountEverest?"); -interpretation=parser.analyze(interpretation); -Reactionreaction=state.react(interpretation); -assertEquals(1,reaction.getReactions().size()); -assertEquals("8848.0",reaction.getReactions().get(0).getFeature("sentence")); -} - -} +importorg.junit.Ignore; +importorg.junit.Test; + +importroboy.dialog.action.SpeechAction; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.linguistics.sentenceanalysis.OpenNLPParser; +importroboy.talk.Verbalizer; + +publicclassQuestionAnsweringStateTest{ + +privatestaticfinalOpenNLPParserparser=newOpenNLPParser(); +privatestaticfinalQuestionAnsweringStatestate=newQuestionAnsweringState(newIdleState()); + +@Test +publicvoidtest(){ +Interpretationinterpretation=newInterpretation("WhatistheareacodeofWashington"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("360",reaction.getReactions().get(0).getFeature("sentence")); +} + +@Test +publicvoidtestNotAnswerable(){ +Interpretationinterpretation=newInterpretation("MynameisBob"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("",reaction.getReactions().get(0).getFeature("sentence")); +} + +@Test +publicvoidtestWhenWas(){ +Interpretationinterpretation=newInterpretation("WhenwasPutinborn?"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("1953-3-30",reaction.getReactions().get(0).getFeature("sentence")); +Verbalizerverbalizer=newVerbalizer(); +SpeechActionaction=(SpeechAction)verbalizer.verbalize(reaction.getReactions().get(0)); +assertEquals("Marchthirtiestnineteenhundredfiftythree",action.getText()); +} + +@Test +publicvoidtestWhereWas(){ +Interpretationinterpretation=newInterpretation("WherewasPutinborn?"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("Russia",reaction.getReactions().get(0).getFeature("sentence")); +} + +@Test +@Ignore +publicvoidtestWhereDid(){ +Interpretationinterpretation=newInterpretation("WheredidElvisdie?"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("Greenwich,Connecticut",reaction.getReactions().get(0).getFeature("sentence")); +} + +@Test +@Ignore +publicvoidtestWhenDid(){ +Interpretationinterpretation=newInterpretation("WhendidElvisdie?"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("1977-08-16",reaction.getReactions().get(0).getFeature("sentence")); +Verbalizerverbalizer=newVerbalizer(); +SpeechActionaction=(SpeechAction)verbalizer.verbalize(reaction.getReactions().get(0)); +assertEquals("Augustsixteenthnineteenhundredseventyseven",action.getText()); +} + +@Test +@Ignore +publicvoidtestHowAdjective(){ +Interpretationinterpretation=newInterpretation("HowhighisMountEverest?"); +interpretation=parser.analyze(interpretation); +Reactionreaction=state.react(interpretation); +assertEquals(1,reaction.getReactions().size()); +assertEquals("8848.0",reaction.getReactions().get(0).getFeature("sentence")); +} + +} - + diff --git a/docs/doxyxml/_question_asking_state_8java.xml b/docs/doxyxml/_question_asking_state_8java.xml old mode 100644 new mode 100755 index cd1c8c6c..0b18062d --- a/docs/doxyxml/_question_asking_state_8java.xml +++ b/docs/doxyxml/_question_asking_state_8java.xml @@ -280,6 +280,6 @@ } - + diff --git a/docs/doxyxml/_question_randomizer_state_8java.xml b/docs/doxyxml/_question_randomizer_state_8java.xml old mode 100644 new mode 100755 index 0b1f6d2b..c0b3197a --- a/docs/doxyxml/_question_randomizer_state_8java.xml +++ b/docs/doxyxml/_question_randomizer_state_8java.xml @@ -4,7 +4,7 @@ QuestionRandomizerState.java roboy::dialog::personality::states::QuestionRandomizerState roboy::dialog::personality::states - roboy::memory::Neo4jRelations + roboy::memory::Neo4jRelationships @@ -12,17 +12,17 @@ packageroboy.dialog.personality.states; -importjava.util.ArrayList; -importjava.util.HashMap; -importjava.util.List; -importjava.util.Map; - -importroboy.linguistics.sentenceanalysis.Interpretation; -importroboy.memory.Neo4jRelations; -importroboy.memory.nodes.Interlocutor; +importjava.util.HashMap; +importjava.util.List; +importjava.util.Map; + +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.memory.Neo4jRelationships; +importroboy.memory.nodes.Interlocutor; +importroboy.util.JsonQAValues; importroboy.util.JsonUtils; -importstaticroboy.memory.Neo4jRelations.*; +importstaticroboy.memory.Neo4jRelationships.*; publicclassQuestionRandomizerStateimplementsState{ //Favoritemoviecurrentlynotrepresentedinmemory. @@ -32,101 +32,143 @@ privatePersonalQAState[]questionStates; privatePersonalQAStatelocationQuestion; -privateHashMap<Neo4jRelations,Boolean>alreadyAsked; -privateStateinner; -privateStatechosenState; -privateInterlocutorperson; - -//AllspokenphrasesforaskingquestionsarestoredintheseJSONfiles. -StringquestionsFile="sentences/questions.json"; -StringsuccessAnswersFile="sentences/successAnswers.json"; -StringfailureAnswersFile="sentences/failureAnswers.json"; -Map<String,List<String>>questions; -Map<String,List<String[]>>successAnswers; -Map<String,List<String>>failureAnswers; - -publicQuestionRandomizerState(Stateinner,Interlocutorperson){ -this.inner=inner; -this.person=person; -questions=JsonUtils.getSentencesFromJsonFile(questionsFile); -successAnswers=JsonUtils.getSentenceArraysFromJsonFile(successAnswersFile); -failureAnswers=JsonUtils.getSentencesFromJsonFile(failureAnswersFile); -//alreadyAskedisfilledautomaticallybytheinitializeQuestionmethod, -//thenupdatedtomatchalreadyexistinginformationwithcheckForAskedQuestions() -alreadyAsked=newHashMap<>(); - -locationQuestion=initializeQuestion(FROM); -LocationDBpedialocationDBpedia=newLocationDBpedia(); -locationDBpedia.setSuccess(this); -locationDBpedia.setFailure(this); -locationQuestion.setSuccess(locationDBpedia); -questionStates=newPersonalQAState[]{ -locationQuestion, -initializeQuestion(HAS_HOBBY), -initializeQuestion(WORK_FOR), -initializeQuestion(STUDY_AT) -//TODOrequestsupportforOccupationandMoviedatainthedatabase. -//initializeQuestion(OCCUPATION), -//initializeQuestion(LIKES_MOVIE), -}; -} +privatePersonalFollowUpState[]followUpStates; +privateHashMap<Neo4jRelationships,Boolean>alreadyAsked; +privateStateinner; +privateStatechosenState; +privateInterlocutorperson; +privateJsonQAValuesquestionsAndAnswers; +booleanaskFollowUp=true; + +//AllspokenphrasesforaskingquestionsarestoredintheseJSONfiles. +//StringquestionsFile="sentences/questions.json"; +//StringsuccessAnswersFile="sentences/successAnswers.json"; +//StringfailureAnswersFile="sentences/failureAnswers.json"; +//StringfollowUpFile="sentences/followUp.json"; +//StringanswersFollowUpFile="sentences/answersFollowUp.json"; + +StringQAfile="sentences/QAList.json"; + +Map<String,List<String>>questions; +Map<String,List<String>>successAnswers; +Map<String,List<String>>failureAnswers; +Map<String,List<String>>followUp; +Map<String,List<String>>answersFollowUp; + +publicQuestionRandomizerState(Stateinner,Interlocutorperson){ +this.inner=inner; +this.person=person; +//questions=JsonUtils.getSentencesFromJsonFile(questionsFile); +//successAnswers=JsonUtils.getSentenceArraysFromJsonFile(successAnswersFile); +//failureAnswers=JsonUtils.getSentencesFromJsonFile(failureAnswersFile); +//followUp=JsonUtils.getSentencesFromJsonFile(followUpFile); +//answersFollowUp=JsonUtils.getSentenceArraysFromJsonFile(answersFollowUpFile); +questionsAndAnswers=JsonUtils.getQuestionsAndAnswersFromJson(QAfile); + +questions=questionsAndAnswers.getQuestions(); +successAnswers=questionsAndAnswers.getSuccessAnswers(); +failureAnswers=questionsAndAnswers.getFailureAnswers(); +followUp=questionsAndAnswers.getFollowUpQuestions(); +answersFollowUp=questionsAndAnswers.getFollowUpAnswers(); -@Override -publicList<Interpretation>act(){ -checkForAskedQuestions(); -//TODORemoveoldcodeaftersuccessfullyswitchingtoNeo4jmemory -//WorkingMemorymemory=WorkingMemory.getInstance(); - -//chosenStatereferstothequestiontobeasked. -chosenState=null; -//List<Triple>nameTriples=memory.retrieve(newTriple("is","name",null)); -//if(nameTriples.isEmpty())returninner.act(); -//Stringname=nameTriples.get(0).patiens; -//List<Triple>infos=memory.retrieve(newTriple(null,name,null)); -//infos.addAll(memory.retrieve(newTriple(null,null,name))); -//TODOwhythisifstatement? -if(Math.random()<1){ -intindex=(int)(Math.random()*questionStates.length); -if(!alreadyAsked.get(questionStates[index].predicate)){ -alreadyAsked.put(questionStates[index].predicate,true); -chosenState=questionStates[index]; -returnchosenState.act(); -} -} -returninner.act(); -} - -@Override -publicReactionreact(Interpretationinput){ -if(chosenState==null){ -returninner.react(input); -} -returnchosenState.react(input); -} - -publicvoidsetTop(Statetop){ -for(inti=1;i<questionStates.length;i++){ -questionStates[i].setNextState(top); -} -} - -privatePersonalQAStateinitializeQuestion(Neo4jRelationsrelation){ -alreadyAsked.put(relation,false); -returnnewPersonalQAState( -questions.get(relation.type), -failureAnswers.get(relation.type), -successAnswers.get(relation.type), -relation,person); -} - -privatevoidcheckForAskedQuestions(){ -for(Neo4jRelationsrelation:alreadyAsked.keySet()){ -if(person.hasRelation(relation))alreadyAsked.put(relation,true); -} -} - -} +//alreadyAskedisfilledautomaticallybytheinitializeQuestionmethod, +//thenupdatedtomatchalreadyexistinginformationwithcheckForAskedQuestions() +alreadyAsked=newHashMap<>(); + +locationQuestion=initializeQuestion(FROM); +LocationDBpedialocationDBpedia=newLocationDBpedia(); +locationDBpedia.setSuccess(this); +locationDBpedia.setFailure(this); +locationQuestion.setSuccess(locationDBpedia); +questionStates=newPersonalQAState[]{ +locationQuestion, +initializeQuestion(HAS_HOBBY), +initializeQuestion(WORK_FOR), +initializeQuestion(STUDY_AT) +//TODOrequestsupportforOccupationandMoviedatainthedatabase. +//initializeQuestion(OTHER), +//initializeQuestion(LIKES_MOVIE), +}; +followUpStates=newPersonalFollowUpState[]{ +initializeFollowUpQuestion(FROM), +initializeFollowUpQuestion(HAS_HOBBY), +initializeFollowUpQuestion(WORK_FOR), +initializeFollowUpQuestion(STUDY_AT) +}; +} + +@Override +publicList<Interpretation>act(){ +checkForAskedQuestions(); +//TODORemoveoldcodeaftersuccessfullyswitchingtoNeo4jmemory +//WorkingMemorymemory=WorkingMemory.getInstance(); + +//chosenStatereferstothequestiontobeasked. +chosenState=null; +//List<Triple>nameTriples=memory.retrieve(newTriple("is","name",null)); +//if(nameTriples.isEmpty())returninner.act(); +//Stringname=nameTriples.get(0).patiens; +//List<Triple>infos=memory.retrieve(newTriple(null,name,null)); +//infos.addAll(memory.retrieve(newTriple(null,null,name))); +//TODOwhythisifstatement? +if(Math.random()<1){ +intindex=(int)(Math.random()*questionStates.length); +if(!alreadyAsked.get(questionStates[index].predicate)){ +alreadyAsked.put(questionStates[index].predicate,true); +chosenState=questionStates[index]; +returnchosenState.act(); +}elseif(askFollowUp){ +//TODOProbablytothinkaboutbetterfixthenequalamountofthequestions +//index=(int)(Math.random()*followUpStates.length); +chosenState=followUpStates[index]; +askFollowUp=false; +returnchosenState.act(); +} +} +returninner.act(); +} + +@Override +publicReactionreact(Interpretationinput){ +if(chosenState==null){ +returninner.react(input); +} +returnchosenState.react(input); +} + +publicvoidsetTop(Statetop){ +for(inti=1;i<questionStates.length;i++){ +questionStates[i].setNextState(top); +} +} + +privatePersonalQAStateinitializeQuestion(Neo4jRelationshipsrelationship){ +alreadyAsked.put(relationship,false); +returnnewPersonalQAState( +questions.get(relationship.type), +failureAnswers.get(relationship.type), +successAnswers.get(relationship.type), +relationship,person); +} + +privatePersonalFollowUpStateinitializeFollowUpQuestion(Neo4jRelationshipsrelationship){ +returnnewPersonalFollowUpState( +followUp.get(relationship.type), +failureAnswers.get(relationship.type), +answersFollowUp.get(relationship.type), +relationship,this,person); +} + +privatevoidcheckForAskedQuestions(){ +for(Neo4jRelationshipsrelationship:alreadyAsked.keySet()){ +if(person.hasRelationship(relationship)){ +alreadyAsked.put(relationship,true); +} +} +} + +} - + diff --git a/docs/doxyxml/_reaction_8java.xml b/docs/doxyxml/_reaction_8java.xml old mode 100644 new mode 100755 index 78cc0441..8efefaae --- a/docs/doxyxml/_reaction_8java.xml +++ b/docs/doxyxml/_reaction_8java.xml @@ -45,6 +45,6 @@ } - + diff --git a/docs/doxyxml/_relation_8java.xml b/docs/doxyxml/_relation_8java.xml old mode 100644 new mode 100755 index 005e5988..1a09959a --- a/docs/doxyxml/_relation_8java.xml +++ b/docs/doxyxml/_relation_8java.xml @@ -36,6 +36,6 @@ } - + diff --git a/docs/doxyxml/_roboy_8java.xml b/docs/doxyxml/_roboy_8java.xml new file mode 100644 index 00000000..8adbb6b3 --- /dev/null +++ b/docs/doxyxml/_roboy_8java.xml @@ -0,0 +1,110 @@ + + + + Roboy.java + roboy::memory::nodes::Roboy + roboy::memory::nodes + + + + + +packageroboy.memory.nodes; + +importroboy.dialog.Config; +importroboy.memory.Neo4jMemory; +importroboy.memory.Neo4jRelationships; + +importjava.io.IOException; +importjava.util.ArrayList; + +publicclassRoboy{ +privateMemoryNodeModelroboy; +Neo4jMemorymemory; +//MemoryisnotqueriedinNOROSmode. +privatebooleanmemoryROS; + +publicRoboy(Stringname){ +this.roboy=newMemoryNodeModel(true); +this.memory=Neo4jMemory.getInstance(); +this.memoryROS=Config.MEMORY; +this.InitializeRoboy(name);//Maybeeg"roboyjunior" +} + +//TODOconsiderafallbackfortheamnesiamode +privatevoidInitializeRoboy(Stringname){ +roboy.setProperty("name",name); +roboy.setLabel("Robot"); + +// +if(memoryROS){ +ArrayList<Integer>ids=newArrayList<>(); +try{ +ids=memory.getByQuery(roboy); +}catch(InterruptedException|IOExceptione){ +System.out.println("CannotretrieveorfindRoboyintheMemory.Gotheamnesiamode"); +e.printStackTrace(); +} +//Pickfirstifmatchesfound. +if(ids!=null&&!ids.isEmpty()){ +try{ +this.roboy=memory.getById(ids.get(0)); +}catch(InterruptedException|IOExceptione){ +System.out.println("Unexpectedmemoryerror:providedIDnotfounduponquerying.Gotheamnesiamode"); +e.printStackTrace(); +} +} +} +} + +publicStringgetName(){ +return(String)roboy.getProperty("name"); +} + +publicArrayList<Integer>getRelationships(Neo4jRelationshipstype){ +returnroboy.getRelationship(type.type); +} + +publicvoidaddInformation(Stringrelationship,Stringname){ +if(!memoryROS)return; +ArrayList<Integer>ids=newArrayList<>(); +//Firstcheckifnodewithgivennameexistsbyamatchingquery. +MemoryNodeModelrelatedNode=newMemoryNodeModel(true); +relatedNode.setProperty("name",name); +//Thisaddsalabeltypetothememoryquerydependingontherelation. +relatedNode.setLabel(memory.determineNodeType(relationship)); +try{ +ids=memory.getByQuery(relatedNode); +}catch(InterruptedException|IOExceptione){ +System.out.println("Exceptionwhilequeryingmemorybytemplate."); +e.printStackTrace(); +} +//Pickfirstfromlistifmultiplematchesfound. +if(ids!=null&&!ids.isEmpty()){ +roboy.setRelationship(relationship,ids.get(0)); +} +//Createnewnodeifmatchisnotfound. +else{ +try{ +intid=memory.create(relatedNode); +if(id!=0){//0isdefaultvalue,returnedifMemoryresponsewasFAIL. +roboy.setRelationship(relationship,id); +} +}catch(InterruptedException|IOExceptione){ +System.out.println("Unexpectedmemoryerror:creatingnodefornewrelationfailed."); +e.printStackTrace(); +} +} +//UpdatetheRoboynodeinmemory. +try{ +memory.save(roboy); +}catch(InterruptedException|IOExceptione){ +System.out.println("Unexpectedmemoryerror:updatingpersoninformationfailed."); +e.printStackTrace(); +} +} +} + + + + diff --git a/docs/doxyxml/_roboy_mind_8java.xml b/docs/doxyxml/_roboy_mind_8java.xml old mode 100644 new mode 100755 index 5f6b55b3..1f5a3b01 --- a/docs/doxyxml/_roboy_mind_8java.xml +++ b/docs/doxyxml/_roboy_mind_8java.xml @@ -87,7 +87,7 @@ List<Concept>result=newArrayList(); -//gettheseobjects'attributes +//gettheseobjects'lists for(JsonValuei:response) { JsonObjectattributes=ListAttributes(i.toString()); @@ -205,7 +205,7 @@ @Override publicList<Concept>retrieve(Conceptobject) { -//getobjectsmatchingtherequestedattributes +//getobjectsmatchingtherequestedlists Stringproperties="id"; Stringvalues=object.getAttribute("id").toString(); @@ -214,7 +214,7 @@ returnresult; } -publicbooleanupdate(Conceptobject)//requireshavingattributesidandclass_name +publicbooleanupdate(Conceptobject)//requireshavinglistsidandclass_name { Stringobject_name=object.getAttribute("class_name").toString()+"_"+object.getAttribute("id"); List<Concept>saved_objects=RoboyMind.getInstance().retrieve(object); @@ -285,6 +285,6 @@ } - + diff --git a/docs/doxyxml/_roboy_name_detection_input_8java.xml b/docs/doxyxml/_roboy_name_detection_input_8java.xml old mode 100644 new mode 100755 index 8dfdbc16..499f817d --- a/docs/doxyxml/_roboy_name_detection_input_8java.xml +++ b/docs/doxyxml/_roboy_name_detection_input_8java.xml @@ -83,6 +83,6 @@ } } - + diff --git a/docs/doxyxml/_ros_8java.xml b/docs/doxyxml/_ros_8java.xml old mode 100644 new mode 100755 index cd977b66..bac74b77 --- a/docs/doxyxml/_ros_8java.xml +++ b/docs/doxyxml/_ros_8java.xml @@ -35,6 +35,6 @@ } } - + diff --git a/docs/doxyxml/_ros_clients_8java.xml b/docs/doxyxml/_ros_clients_8java.xml old mode 100644 new mode 100755 index 1b7b131f..90b2696a --- a/docs/doxyxml/_ros_clients_8java.xml +++ b/docs/doxyxml/_ros_clients_8java.xml @@ -38,6 +38,6 @@ } } - + diff --git a/docs/doxyxml/_ros_communication_test_8java.xml b/docs/doxyxml/_ros_communication_test_8java.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/_ros_main_node_8java.xml b/docs/doxyxml/_ros_main_node_8java.xml old mode 100644 new mode 100755 index ff4711b8..53d0a124 --- a/docs/doxyxml/_ros_main_node_8java.xml +++ b/docs/doxyxml/_ros_main_node_8java.xml @@ -41,7 +41,7 @@ publicRosMainNode(){ //Ctoriscalledbutshouldnotbeinitializedoffline. -if(Config.NOROS)return; +if(Config.NOROS&&!Config.MEMORY)return; clients=newRosManager(); @@ -385,6 +385,6 @@ } - + diff --git a/docs/doxyxml/_ros_manager_8java.xml b/docs/doxyxml/_ros_manager_8java.xml old mode 100644 new mode 100755 index 97abf2b9..6f6a5f8f --- a/docs/doxyxml/_ros_manager_8java.xml +++ b/docs/doxyxml/_ros_manager_8java.xml @@ -25,36 +25,42 @@ booleansuccess=true; //IteratethroughtheRosClientsenum,mappingaclientforeach. for(RosClientsc:RosClients.values()){ -try{ -clientMap.put(c,node.newServiceClient(c.address,c.type)); -System.out.println(c.toString()+"initializationSUCCESS!"); -}catch(Exceptione){ -success=false; -System.out.println(c.toString()+"initializationFAILED,couldnotreachROSservice!"); -} -} -if(Config.SHUTDOWN_ON_SERVICE_FAILURE&&!success){ -thrownewRuntimeException("DialogSystemshutdowncausedbyROSserviceinitializationfailure."); -} -returnsuccess; -} - -booleannotInitialized(RosClientsc){ -if(clientMap==null){ -if(Config.SHUTDOWN_ON_SERVICE_FAILURE){ -thrownewRuntimeException("ROSclientshavenotbeeninitialized!StoppingDMexecution."); -} -System.out.println("ROSclientshavenotbeeninitialized!IstheROShostrunning?"); -returntrue; -} -return!clientMap.containsKey(c); -} - -ServiceClientgetServiceClient(RosClientsc){ -returnclientMap.get(c); -} -} +//Donotinitializenon-memoryservicesifNOROS,butMemory! +if(Config.NOROS&&Config.MEMORY){ +if(!c.address.contains("memory")){ +continue; +} +} +try{ +clientMap.put(c,node.newServiceClient(c.address,c.type)); +System.out.println(c.toString()+"initializationSUCCESS!"); +}catch(Exceptione){ +success=false; +System.out.println(c.toString()+"initializationFAILED,couldnotreachROSservice!"); +} +} +if(Config.SHUTDOWN_ON_SERVICE_FAILURE&&!success){ +thrownewRuntimeException("DialogSystemshutdowncausedbyROSserviceinitializationfailure."); +} +returnsuccess; +} + +booleannotInitialized(RosClientsc){ +if(clientMap==null){ +if(Config.SHUTDOWN_ON_SERVICE_FAILURE){ +thrownewRuntimeException("ROSclientshavenotbeeninitialized!StoppingDMexecution."); +} +System.out.println("ROSclientshavenotbeeninitialized!IstheROShostrunning?"); +returntrue; +} +return!clientMap.containsKey(c); +} + +ServiceClientgetServiceClient(RosClientsc){ +returnclientMap.get(c); +} +} - + diff --git a/docs/doxyxml/_ros_node_8java.xml b/docs/doxyxml/_ros_node_8java.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/_segue_state_8java.xml b/docs/doxyxml/_segue_state_8java.xml old mode 100644 new mode 100755 index bedd6d7f..83f42aeb --- a/docs/doxyxml/_segue_state_8java.xml +++ b/docs/doxyxml/_segue_state_8java.xml @@ -108,6 +108,6 @@ } - + diff --git a/docs/doxyxml/_semantic_parser_analyzer_8java.xml b/docs/doxyxml/_semantic_parser_analyzer_8java.xml new file mode 100644 index 00000000..3c24dbe2 --- /dev/null +++ b/docs/doxyxml/_semantic_parser_analyzer_8java.xml @@ -0,0 +1,88 @@ + + + + SemanticParserAnalyzer.java + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzer + roboy::linguistics::sentenceanalysis + + + + + +packageroboy.linguistics.sentenceanalysis; + +importjdk.nashorn.internal.runtime.regexp.joni.Config; +importroboy.linguistics.Linguistics; + +importjava.io.BufferedReader; +importjava.io.IOException; +importjava.io.InputStreamReader; +importjava.io.PrintWriter; + +importjava.net.Socket; +importjava.net.ConnectException; + + +publicclassSemanticParserAnalyzerimplementsAnalyzer{ + +privateSocketclientSocket; +privatePrintWriterout; +privateBufferedReaderin; +privatebooleandebug=true; +publicSemanticParserAnalyzer(intportNumber){ +this.debug=true; +try{ +//Createstring-stringsocket +this.clientSocket=newSocket("localhost",portNumber); +//Declaringinput +this.in=newBufferedReader( +newInputStreamReader(clientSocket.getInputStream())); +//Declaringoutput +this.out=newPrintWriter(clientSocket.getOutputStream(),true); +}catch(IOExceptione){ +System.err.println("SemanticParserClientError:"+e.getMessage()); +} +} + +@Override +publicInterpretationanalyze(Interpretationinterpretation){ +if(this.clientSocket!=null&&this.clientSocket.isConnected()){ +try{ +Stringresponse; +if(this.debug){System.out.println("SEMANTICPARSER:"+interpretation.getFeature("sentence"));} +this.out.println(interpretation.getFeature("sentence")); +response=this.in.readLine(); +if(this.debug){ +System.out.println(">Fullresponse:"+response); +} +if(response!=null&&response.contains("=>")){ +try{ +if(this.debug){ +System.out.println(">Parse:"+response.substring(0,response.indexOf("=>"))); +} +if(this.debug){ +System.out.println(">Answer:"+response.substring(response.indexOf("=>")+3)); +} +interpretation.getFeatures().put(Linguistics.PARSE,response.substring(0,response.indexOf("=>"))); +interpretation.getFeatures().put(Linguistics.PRED_ANSWER,response.substring(response.indexOf("=>")+3)); +} +catch(Exceptione){ +System.err.println("Exceptionwhileparsingintentresponse:"+e.getStackTrace()); +} +} +returninterpretation; +} +catch(IOExceptione){ +e.printStackTrace(); +returninterpretation; +} +} +else +returninterpretation; +} + +} + + + + diff --git a/docs/doxyxml/_sentence_analyzer_8java.xml b/docs/doxyxml/_sentence_analyzer_8java.xml old mode 100644 new mode 100755 index fbcdb483..fde6e8ad --- a/docs/doxyxml/_sentence_analyzer_8java.xml +++ b/docs/doxyxml/_sentence_analyzer_8java.xml @@ -204,6 +204,6 @@ //} } - + diff --git a/docs/doxyxml/_shut_down_action_8java.xml b/docs/doxyxml/_shut_down_action_8java.xml old mode 100644 new mode 100755 index 1cf15f64..b1cf5a5a --- a/docs/doxyxml/_shut_down_action_8java.xml +++ b/docs/doxyxml/_shut_down_action_8java.xml @@ -27,6 +27,6 @@ } - + diff --git a/docs/doxyxml/_simple_history_attribute_8java.xml b/docs/doxyxml/_simple_history_attribute_8java.xml new file mode 100644 index 00000000..8759f969 --- /dev/null +++ b/docs/doxyxml/_simple_history_attribute_8java.xml @@ -0,0 +1,70 @@ + + + + SimpleHistoryAttribute.java + roboy::context::SimpleHistoryAttribute + roboy::context + + + + + +packageroboy.context; + +importroboy.context.dataTypes.DataType; + +importjava.util.HashMap; +publicclassSimpleHistoryAttribute<KextendsInteger,VextendsDataType>implementsHistoryAttribute<K,V>{ +protectedintcounter; +privateHashMap<K,V>data; + +publicSimpleHistoryAttribute(){ +data=newHashMap<>(); +counter=0; +} + +@Override +publicVgetLastValue(){ +if(counter==0){ +returnnull; +}else{ +returngetValue((K)newInteger(counter-1)); +} +} + +@Override +publicsynchronizedVgetValue(Kkey){ +if(data.containsKey(key)){ +returndata.get(key); +}else{ +returnnull; +} +} + +@Override +publicHashMap<K,V>getLastNValues(intn){ +Integerlimit=Math.min(n,counter); +HashMapmap=newHashMap(); +//Limitisthenumberofvalues,sowedecrementitbeforeusingasindex. +while(--limit>=0){ +map.put(limit,getValue((K)limit)); +} +returnmap; +} + +@Override +publicsynchronizedKstoreValue(Vvalue){ +Integerkey=generateKey(); +data.put((K)key,value); +return(K)key; +} + +protectedsynchronizedintgenerateKey(){ +returncounter++; +}; + +} + + + + diff --git a/docs/doxyxml/_simple_tokenizer_8java.xml b/docs/doxyxml/_simple_tokenizer_8java.xml old mode 100644 new mode 100755 index fe361ef0..ac234e42 --- a/docs/doxyxml/_simple_tokenizer_8java.xml +++ b/docs/doxyxml/_simple_tokenizer_8java.xml @@ -28,6 +28,6 @@ } } - + diff --git a/docs/doxyxml/_simple_value_attribute_8java.xml b/docs/doxyxml/_simple_value_attribute_8java.xml new file mode 100644 index 00000000..bdbf90f8 --- /dev/null +++ b/docs/doxyxml/_simple_value_attribute_8java.xml @@ -0,0 +1,33 @@ + + + + SimpleValueAttribute.java + roboy::context::SimpleValueAttribute + roboy::context + + + + + +packageroboy.context; + +importroboy.context.dataTypes.DataType; + +publicclassSimpleValueAttribute<VextendsDataType>implementsValueAttribute<V>{ +Vvalue=null; + +@Override +publicVgetValue(){ +returnvalue; +} + +@Override +publicvoidupdateValue(Vvalue){ +this.value=value; +} + +} + + + + diff --git a/docs/doxyxml/_small_talk_personality_8java.xml b/docs/doxyxml/_small_talk_personality_8java.xml old mode 100644 new mode 100755 index 7904de78..b6945dce --- a/docs/doxyxml/_small_talk_personality_8java.xml +++ b/docs/doxyxml/_small_talk_personality_8java.xml @@ -126,7 +126,7 @@ returnname; } -publicvoidsetName(Stringname){ +publicvoidsetName(Stringname){ this.name=name; } @@ -153,6 +153,6 @@ } } - + diff --git a/docs/doxyxml/_soundex_encoder_8java.xml b/docs/doxyxml/_soundex_encoder_8java.xml old mode 100644 new mode 100755 index 5853b83d..7d0aaee9 --- a/docs/doxyxml/_soundex_encoder_8java.xml +++ b/docs/doxyxml/_soundex_encoder_8java.xml @@ -29,6 +29,6 @@ } - + diff --git a/docs/doxyxml/_speech_action_8java.xml b/docs/doxyxml/_speech_action_8java.xml old mode 100644 new mode 100755 index 1d32e094..11dfb64e --- a/docs/doxyxml/_speech_action_8java.xml +++ b/docs/doxyxml/_speech_action_8java.xml @@ -24,6 +24,6 @@ } } - + diff --git a/docs/doxyxml/_state_8java.xml b/docs/doxyxml/_state_8java.xml old mode 100644 new mode 100755 index fd4e8ea1..71a6ecb0 --- a/docs/doxyxml/_state_8java.xml +++ b/docs/doxyxml/_state_8java.xml @@ -1,5 +1,5 @@ - + State.java roboy::dialog::personality::states::State @@ -22,6 +22,6 @@ publicReactionreact(Interpretationinput); } - + diff --git a/docs/doxyxml/_state_based_personality_8java.xml b/docs/doxyxml/_state_based_personality_8java.xml new file mode 100644 index 00000000..1bd09dba --- /dev/null +++ b/docs/doxyxml/_state_based_personality_8java.xml @@ -0,0 +1,145 @@ + + + + StateBasedPersonality.java + roboy::newDialog::StateBasedPersonality + roboy::newDialog + + + + + +packageroboy.newDialog; + +importroboy.dialog.action.Action; +importroboy.dialog.action.FaceAction; +importroboy.dialog.personality.Personality; +importroboy.linguistics.Linguistics; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.newDialog.states.State; +importroboy.talk.Verbalizer; + +importjava.util.ArrayList; +importjava.util.List; + +publicclassStateBasedPersonalityextendsDialogStateMachineimplementsPersonality{ + + +privatefinalVerbalizerverbalizer; + + +publicStateBasedPersonality(Verbalizerverb){ +verbalizer=verb; +reset(); +} + + +privatevoidreset(){ +//gobacktoinitialstate +setActiveState(getInitialState()); +} + +publicList<Action>startConversation(){ +StateactiveState=getActiveState(); +if(activeState==null){ +System.out.println("[!!]ERROR:Thispersonalitystatemachinehasnotbeeninitialized!"); +returnnewArrayList<>(); +} +if(!activeState.equals(getInitialState())){ +System.out.println("[!!]WARNING:Theactivestateisdifferentfromtheinitialstate"+ +"atthebeginningofconversation!"); +} + + +returnstateAct(activeState); +} + + +@Override +publicList<Action>answer(Interpretationinput){ + +StateactiveState=getActiveState(); +if(activeState==null){ +System.out.println("[!!]ERROR:Thispersonalitystatemachinehasnotbeeninitialized!"); +returnnewArrayList<>(); +} +List<Action>answerActions=newArrayList<>(); + + +//SPECIALNON-STATEBASEDBEHAVIOUR +//TODO:specialtreatmentforprofanity,farewellphrasesetc. +if(input.getFeatures().containsKey(Linguistics.EMOTION)){ +//changefacialexpressionbasedoninput +answerActions.add(newFaceAction((String)input.getFeatures().get(Linguistics.EMOTION))); +} + + +//ACTIVESTATEREACTSTOINPUT +List<Action>react=stateReact(activeState,input); +answerActions.addAll(react); + + +//MOVETOTHENEXTSTATE +Statenext=activeState.getNextState(); +if(next==null){ +reset();//gobacktoinitialstate +returnanswerActions; +} +setActiveState(next); + + +//NEXTSTATEACTS +List<Action>act=stateAct(next); +answerActions.addAll(act); + +returnanswerActions; +} + + +privateList<Action>stateAct(Statestate){ +List<Interpretation>stateActIntepretations=state.act(); +returnverbalizeInterpretations(stateActIntepretations); +} + + +privateList<Action>stateReact(Statestate,Interpretationinput){ + +List<Interpretation>reaction=state.react(input); +Statefallback=state.getFallback(); + +//fallbacks +intfallbackCount=0,maxFallbackCount=1000;//limittopreventinfiniteloops +while(reaction==null&&fallback!=null&&fallbackCount<maxFallbackCount){ +//activestatedoesn'tknowhowtoreact +//askfallbacksrecursivelyuntil +//-thereisareaction +//-thereisnofallback +reaction=fallback.react(input); +fallback=fallback.getFallback(); + +//preventinfiniteloops +fallbackCount++; +} +if(fallbackCount>=maxFallbackCount)System.out.println("[!!]WARNING:possiblyinfinitefallbackloop"); + +returnverbalizeInterpretations(reaction); +} + + +privateList<Action>verbalizeInterpretations(List<Interpretation>interpretations){ +List<Action>listOfActions=newArrayList<>(); +if(interpretations!=null){ +//verbalizeallactinterpretations +for(Interpretationi:interpretations){ +listOfActions.add(verbalizer.verbalize(i)); +} +} +returnlistOfActions; +} + + +} + + + + diff --git a/docs/doxyxml/_state_machine_examples_8java.xml b/docs/doxyxml/_state_machine_examples_8java.xml new file mode 100644 index 00000000..c233594a --- /dev/null +++ b/docs/doxyxml/_state_machine_examples_8java.xml @@ -0,0 +1,136 @@ + + + + StateMachineExamples.java + roboy::newDialog::examples::StateMachineExamples + roboy::newDialog::examples + + + + + +packageroboy.newDialog.examples; + +importroboy.newDialog.DialogStateMachine; +importroboy.newDialog.states.toyStates.*; + +importjava.io.File; + +publicclassStateMachineExamples{ + +publicstaticvoidmain(String[]args)throwsException{ +//createallstatesandsetallconnectionsfromcodedirectly +DialogStateMachinecode=fromCode(); + +//loadstatesandconnectionsfromfile +DialogStateMachinefile=fromFile(); + +//loadstatesandconnectionsfromstring(notreadable,mainlyusedforunittests) +DialogStateMachinestring=fromString(); + +System.out.println(file); + +System.out.println("JSONrepresentation:"); +System.out.println(file.toJsonString()); + + +System.out.println("Dialogmachinefromcode,fileandstringareequal:" ++(code.equals(file)&& +code.equals(string)&& +string.equals(code)&& +string.equals(file)&& +file.equals(string)&& +file.equals(code) +) +); + + +//System.out.println("Savingtoresources/personalityFiles/ExamplePersonality2.json"); +//file.saveToFile(newFile("resources/personalityFiles/ExamplePersonality2.json")); + +} + +privatestaticDialogStateMachinefromCode(){ + +//createstates +ToyGreetingsStategreetings=newToyGreetingsState("Greetings"); +ToyIntroStateintro=newToyIntroState("Intro"); +ToyFarewellStatefarewell=newToyFarewellState("Farewell"); +ToyRandomAnswerStaterandomAnswer=newToyRandomAnswerState("RandomAnswer"); + +//setfallbacksandtransitions +greetings.setFallback(randomAnswer); +greetings.setTransition("next",intro); +greetings.setTransition("noHello",farewell); +intro.setTransition("next",farewell); +randomAnswer.setTransition("next",farewell); + +//createthedialogmachineanregisterstates +DialogStateMachinestateMachine=newDialogStateMachine(); +stateMachine.addState(greetings); +stateMachine.addState(intro); +stateMachine.addState(farewell); +stateMachine.addState(randomAnswer); +stateMachine.setInitialState(greetings); + +returnstateMachine; + +} + +privatestaticDialogStateMachinefromFile()throwsException{ +DialogStateMachinestateMachine=newDialogStateMachine(); +stateMachine.loadFromFile(newFile("resources/personalityFiles/ExamplePersonality.json")); +returnstateMachine; +} + +privatestaticDialogStateMachinefromString(){ +DialogStateMachinestateMachine=newDialogStateMachine(); +stateMachine.loadFromString(toyPersonality); +returnstateMachine; +} + + + +privatestaticfinalStringtoyPersonality="{\n"+ +"\"initialState\":\"Greetings\",\n"+ +"\"states\":[\n"+ +"{\n"+ +"\"identifier\":\"Greetings\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyGreetingsState\",\n"+ +"\"fallback\":\"RandomAnswer\",\n"+ +"\"transitions\":{\n"+ +"\"next\":\"Intro\",\n"+ +"\"noHello\":\"Farewell\"\n"+ +"}\n"+ +"},\n"+ +"{\n"+ +"\"identifier\":\"Intro\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyIntroState\",\n"+ +"\"fallback\":null,\n"+ +"\"transitions\":{\n"+ +"\"next\":\"Farewell\"\n"+ +"}\n"+ +"},\n"+ +"{\n"+ +"\"identifier\":\"Farewell\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyFarewellState\",\n"+ +"\"fallback\":null,\n"+ +"\"transitions\":{}\n"+ +"},\n"+ +"{\n"+ +"\"identifier\":\"RandomAnswer\",\n"+ +"\"implementation\":\"roboy.newDialog.states.toyStates.ToyRandomAnswerState\",\n"+ +"\"fallback\":null,\n"+ +"\"transitions\":{\n"+ +"\"next\":\"Farewell\"\n"+ +"}\n"+ +"}\n"+ +"]\n"+ +"}"; + + +} + + + + diff --git a/docs/doxyxml/_statement_builder_8java.xml b/docs/doxyxml/_statement_builder_8java.xml old mode 100644 new mode 100755 index 0546a472..c1d93a29 --- a/docs/doxyxml/_statement_builder_8java.xml +++ b/docs/doxyxml/_statement_builder_8java.xml @@ -20,6 +20,6 @@ } } - + diff --git a/docs/doxyxml/_statement_interpreter_8java.xml b/docs/doxyxml/_statement_interpreter_8java.xml old mode 100644 new mode 100755 index 49df4014..576d00ab --- a/docs/doxyxml/_statement_interpreter_8java.xml +++ b/docs/doxyxml/_statement_interpreter_8java.xml @@ -23,6 +23,6 @@ } } - + diff --git a/docs/doxyxml/_term_8java.xml b/docs/doxyxml/_term_8java.xml old mode 100644 new mode 100755 index 8b0070c7..1773e1f4 --- a/docs/doxyxml/_term_8java.xml +++ b/docs/doxyxml/_term_8java.xml @@ -24,6 +24,6 @@ } } - + diff --git a/docs/doxyxml/_test_vision_8java.xml b/docs/doxyxml/_test_vision_8java.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/_topic_8java.xml b/docs/doxyxml/_topic_8java.xml new file mode 100644 index 00000000..be6af284 --- /dev/null +++ b/docs/doxyxml/_topic_8java.xml @@ -0,0 +1,24 @@ + + + + Topic.java + roboy::context::dataTypes::Topic + roboy::context::dataTypes + + + + + +packageroboy.context.dataTypes; + +publicclassTopicimplementsDataType{ +publicfinalStringtopic; + +publicTopic(Stringtopic){ +this.topic=topic; +} +} + + + + diff --git a/docs/doxyxml/_toy_data_getter_8java.xml b/docs/doxyxml/_toy_data_getter_8java.xml new file mode 100644 index 00000000..93a05f72 --- /dev/null +++ b/docs/doxyxml/_toy_data_getter_8java.xml @@ -0,0 +1,87 @@ + + + + ToyDataGetter.java + roboy::linguistics::word2vec::examples::ToyDataGetter + roboy::linguistics::word2vec::examples + + + + + +packageroboy.linguistics.word2vec.examples; + +importjava.io.File; +importjava.io.FileOutputStream; +importjava.io.IOException; +importjava.net.URL; +importjava.nio.channels.Channels; +importjava.nio.channels.ReadableByteChannel; + +publicclassToyDataGetter{ + +privatefinalbooleanverbose; +privatefinalStringtoyDataDirectory="./resources/word2vec_toy_data_and_model/"; +privatefinalStringtoyDataFilePath="./resources/word2vec_toy_data_and_model/raw_sentences.txt"; +privatefinalStringtoyDataInetURL="https://raw.githubusercontent.com/deeplearning4j/dl4j-examples/master/dl4j-examples/src/main/resources/raw_sentences.txt"; + + +publicToyDataGetter(booleanverbose){ +this.verbose=verbose; +} + + +publicStringgetToyDataFilePath(){ +returntoyDataFilePath; +} + +publicvoidensureToyDataIsPresent(){ + +//checkifalreadydownloaded +if(fileExists(toyDataFilePath)){ +if(verbose)System.out.println("Founddatafile("+toyDataFilePath+")"); +return; +} + +//needtodownload +try{ +if(verbose)System.out.println("Datafileismissingandwillbedownloadedto"+toyDataFilePath); + +//makesuredirectoryexists +Filedir=newFile(toyDataDirectory); +dir.mkdirs(); + +downloadData(toyDataInetURL,toyDataFilePath); + +}catch(IOExceptione){ +System.err.println("Sorry,couldn'tdownloadtoydata!Exception:"+e.getMessage()); +if(verbose){ +e.printStackTrace(); +} +} + +} + + +privatevoiddownloadData(StringfromURL,StringtoFilePath)throwsIOException{ +URLwebsite=newURL(fromURL); +ReadableByteChannelrbc=Channels.newChannel(website.openStream()); +FileOutputStreamfos=newFileOutputStream(toFilePath); +longbytesTransferred=fos.getChannel().transferFrom(rbc,0,Long.MAX_VALUE); + +if(verbose){ +System.out.println("Downloadcomplete,saved"+bytesTransferred+"bytesto"+toFilePath); +} + +} + +privatebooleanfileExists(StringfilePath){ +Filedata=newFile(filePath); +returndata.exists(); +} + +} + + + + diff --git a/docs/doxyxml/_toy_farewell_state_8java.xml b/docs/doxyxml/_toy_farewell_state_8java.xml new file mode 100644 index 00000000..22bd3b38 --- /dev/null +++ b/docs/doxyxml/_toy_farewell_state_8java.xml @@ -0,0 +1,45 @@ + + + + ToyFarewellState.java + roboy::newDialog::states::toyStates::ToyFarewellState + roboy::newDialog::states::toyStates + + + + + +packageroboy.newDialog.states.toyStates; + +importroboy.newDialog.states.State; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.util.Lists; + +importjava.util.List; + +publicclassToyFarewellStateextendsState{ + +publicToyFarewellState(StringstateIdentifier){ +super(stateIdentifier); +} + +@Override +publicList<Interpretation>act(){ +returnLists.interpretationList(newInterpretation("Byebye![sayanything,willendconversation]")); +} + +@Override +publicList<Interpretation>react(Interpretationinput){ +returnnull;//noreaction,wearedone(fallbackshouldalsobesettonull) +} + +@Override +publicStategetNextState(){ +returnnull;//nonextstate,wearedone +} + +} + + + + diff --git a/docs/doxyxml/_toy_greetings_state_8java.xml b/docs/doxyxml/_toy_greetings_state_8java.xml new file mode 100644 index 00000000..41f30ac1 --- /dev/null +++ b/docs/doxyxml/_toy_greetings_state_8java.xml @@ -0,0 +1,73 @@ + + + + ToyGreetingsState.java + roboy::newDialog::states::toyStates::ToyGreetingsState + roboy::newDialog::states::toyStates + + + + + +packageroboy.newDialog.states.toyStates; + +importroboy.newDialog.states.State; +importroboy.linguistics.Linguistics; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.logic.StatementInterpreter; +importroboy.talk.Verbalizer; +importroboy.util.Lists; + +importjava.util.*; + +publicclassToyGreetingsStateextendsState{ + +privatebooleaninputOK=true; + +publicToyGreetingsState(StringstateIdentifier){ +super(stateIdentifier); +} + +@Override +publicList<Interpretation>act(){ +returnLists.interpretationList(newInterpretation("Hello![expectinggreeting]")); +} + +@Override +publicList<Interpretation>react(Interpretationinput){ +Stringsentence=(String)input.getFeatures().get(Linguistics.SENTENCE); +inputOK=StatementInterpreter.isFromList(sentence,Verbalizer.greetings); + +if(inputOK){ +returnLists.interpretationList(newInterpretation("Ilikeitwhenyougreetme![greetingdetected,nextstate]")); + +}else{ +returnnull;//->fallbackstatewillbeused +//alternatively:returnLists.interpretationList(newInterpretation("Gotnogreeting:(")); +} +} + + +@Override +publicStategetNextState(){ +if(inputOK){ +returngetTransition("next"); + +}else{ +returngetTransition("noHello"); +//alternatively:returnthistorepeat +} +} + + + +@Override +protectedSet<String>getRequiredTransitionNames(){ +//optional:defineallrequiredtransitionshere: +returnnewSet("next","noHello"); +} +} + + + + diff --git a/docs/doxyxml/_toy_intro_state_8java.xml b/docs/doxyxml/_toy_intro_state_8java.xml new file mode 100644 index 00000000..f4065338 --- /dev/null +++ b/docs/doxyxml/_toy_intro_state_8java.xml @@ -0,0 +1,52 @@ + + + + ToyIntroState.java + roboy::newDialog::states::toyStates::ToyIntroState + roboy::newDialog::states::toyStates + + + + + +packageroboy.newDialog.states.toyStates; + +importroboy.newDialog.states.State; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.util.Lists; + +importjava.util.*; + +publicclassToyIntroStateextendsState{ + + +publicToyIntroState(StringstateIdentifier){ +super(stateIdentifier); +} + +@Override +publicList<Interpretation>act(){ +returnLists.interpretationList(newInterpretation("MynameisRoboy!Whoareyou?[sayanything]")); +} + +@Override +publicList<Interpretation>react(Interpretationinput){ +returnLists.interpretationList(newInterpretation("Nicetomeetyou![movingtonextstate]")); +} + +@Override +publicStategetNextState(){ +returngetTransition("next"); +} + +@Override +protectedSet<String>getRequiredTransitionNames(){ +//optional:defineallrequiredtransitionshere: +returnnewSet("next"); +} + +} + + + + diff --git a/docs/doxyxml/_toy_random_answer_state_8java.xml b/docs/doxyxml/_toy_random_answer_state_8java.xml new file mode 100644 index 00000000..88a7dd02 --- /dev/null +++ b/docs/doxyxml/_toy_random_answer_state_8java.xml @@ -0,0 +1,44 @@ + + + + ToyRandomAnswerState.java + roboy::newDialog::states::toyStates::ToyRandomAnswerState + roboy::newDialog::states::toyStates + + + + + +packageroboy.newDialog.states.toyStates; + +importroboy.newDialog.states.State; +importroboy.linguistics.sentenceanalysis.Interpretation; +importroboy.util.Lists; + +importjava.util.List; + +publicclassToyRandomAnswerStateextendsState{ + +publicToyRandomAnswerState(StringstateIdentifier){ +super(stateIdentifier); +} + +@Override +publicList<Interpretation>act(){ +returnnull;//thisstateisonlyusedasfallback,noactneeded +} + +@Override +publicList<Interpretation>react(Interpretationinput){ +returnLists.interpretationList(newInterpretation("I'mRoboy!I'mawesome![randomanswer]")); +} + +@Override +publicStategetNextState(){ +returnnull;//thisstateisonlyusedasfallback,notransitionsneeded +} +} + + + + diff --git a/docs/doxyxml/_toy_state_factory_8java.xml b/docs/doxyxml/_toy_state_factory_8java.xml new file mode 100644 index 00000000..1bf819cf --- /dev/null +++ b/docs/doxyxml/_toy_state_factory_8java.xml @@ -0,0 +1,39 @@ + + + + ToyStateFactory.java + roboy::newDialog::states::factories::ToyStateFactory + roboy::newDialog::states::factories + + + + + +packageroboy.newDialog.states.factories; + + +importroboy.newDialog.states.State; + +publicclassToyStateFactory{ + +publicstaticStategetByClassName(StringclassName,StringinstanceName){ +switch(className){ +case"roboy.newDialog.states.toyStates.ToyFarewellState": +returnnewroboy.newDialog.states.toyStates.ToyFarewellState(instanceName); +case"roboy.newDialog.states.toyStates.ToyGreetingsState": +returnnewroboy.newDialog.states.toyStates.ToyGreetingsState(instanceName); +case"roboy.newDialog.states.toyStates.ToyIntroState": +returnnewroboy.newDialog.states.toyStates.ToyIntroState(instanceName); +case"roboy.newDialog.states.toyStates.ToyRandomAnswerState": +returnnewroboy.newDialog.states.toyStates.ToyRandomAnswerState(instanceName); +default: +System.out.println("Unknownclassname:"+className); +returnnull; +} +} + +} + + + + diff --git a/docs/doxyxml/_triple_8java.xml b/docs/doxyxml/_triple_8java.xml old mode 100644 new mode 100755 index c526af9c..310ca7fa --- a/docs/doxyxml/_triple_8java.xml +++ b/docs/doxyxml/_triple_8java.xml @@ -32,6 +32,6 @@ //} } - + diff --git a/docs/doxyxml/_udp_input_8java.xml b/docs/doxyxml/_udp_input_8java.xml old mode 100644 new mode 100755 index ef8c2747..174bdd6e --- a/docs/doxyxml/_udp_input_8java.xml +++ b/docs/doxyxml/_udp_input_8java.xml @@ -46,6 +46,6 @@ - + diff --git a/docs/doxyxml/_udp_output_8java.xml b/docs/doxyxml/_udp_output_8java.xml old mode 100644 new mode 100755 index 2478902f..b235cb24 --- a/docs/doxyxml/_udp_output_8java.xml +++ b/docs/doxyxml/_udp_output_8java.xml @@ -53,6 +53,6 @@ } } - + diff --git a/docs/doxyxml/_util_8java.xml b/docs/doxyxml/_util_8java.xml old mode 100644 new mode 100755 index fd8aebc1..6084d63c --- a/docs/doxyxml/_util_8java.xml +++ b/docs/doxyxml/_util_8java.xml @@ -64,6 +64,6 @@ } } - + diff --git a/docs/doxyxml/_value_8java.xml b/docs/doxyxml/_value_8java.xml new file mode 100644 index 00000000..2b06647f --- /dev/null +++ b/docs/doxyxml/_value_8java.xml @@ -0,0 +1,31 @@ + + + + Value.java + roboy::context::Value + roboy::context + + + + + +packageroboy.context; + +publicclassValue<V>implementsAbstractValue<V>{ +privatevolatileVvalue=null; + +@Override +publicVgetValue(){ +returnvalue; +} + +@Override +publicvoidupdateValue(Vvalue){ +this.value=value; +} + +} + + + + diff --git a/docs/doxyxml/_value_attribute_8java.xml b/docs/doxyxml/_value_attribute_8java.xml new file mode 100644 index 00000000..a6cba854 --- /dev/null +++ b/docs/doxyxml/_value_attribute_8java.xml @@ -0,0 +1,23 @@ + + + + ValueAttribute.java + roboy::context::ValueAttribute + roboy::context + + + + + +packageroboy.context; + +publicinterfaceValueAttribute<V>{ + +VgetValue(); + +voidupdateValue(Vkey); +} + + + + diff --git a/docs/doxyxml/_value_history_8java.xml b/docs/doxyxml/_value_history_8java.xml new file mode 100644 index 00000000..707a4e79 --- /dev/null +++ b/docs/doxyxml/_value_history_8java.xml @@ -0,0 +1,62 @@ + + + + ValueHistory.java + roboy::context::ValueHistory + roboy::context + + + + + +packageroboy.context; + +importjava.util.HashMap; + +publicclassValueHistory<V>implementsAbstractValueHistory<Integer,V>{ +privatevolatileintcounter; +privateHashMap<Integer,V>data; + +publicValueHistory(){ +data=newHashMap<>(); +counter=0; +} + +@Override +publicVgetValue(){ +if(counter==0){ +returnnull; +}else{ +returngetValue(counter-1); +} +} + +@Override +publicHashMap<Integer,V>getLastNValues(intn){ +HashMap<Integer,V>reponse=newHashMap<>(); +intlastToRetrieve=counter-Math.min(n,counter); +for(inti=counter-1;i>=lastToRetrieve;i--){ +reponse.put(i-lastToRetrieve,getValue(i)); +} +returnreponse; +} + +@Override +publicsynchronizedvoidupdateValue(Vvalue){ +Integerkey=generateKey(); +data.put(key,value); +} + +privatesynchronizedintgenerateKey(){ +returncounter++; +} + +privatesynchronizedVgetValue(intkey){ +returndata.getOrDefault(key,null); +} + +} + + + + diff --git a/docs/doxyxml/_verbalizer_8java.xml b/docs/doxyxml/_verbalizer_8java.xml old mode 100644 new mode 100755 index beeb113d..6f3a2e48 --- a/docs/doxyxml/_verbalizer_8java.xml +++ b/docs/doxyxml/_verbalizer_8java.xml @@ -49,7 +49,7 @@ "farewell","bye-bye"); privateShutDownActionfarewell(Interpretationinterpretation){ -returnnewShutDownAction(Arrays.<Action>asList(newSpeechAction(StatementBuilder.random(farewells)))); +returnnewShutDownAction(Arrays.asList(newSpeechAction(StatementBuilder.random(farewells)))); } privatestaticfinalList<String>segues= @@ -136,7 +136,7 @@ "09","ninth", "10","tenth", "11","eleventh", -"12","twelveth", +"12","twelfth", "13","thirteenth", "14","fourteenth", "16","sixteenth", @@ -153,8 +153,8 @@ "27","twentyseventh", "28","twentyeighth", "29","twentyninth", -"30","thirtiest", -"31","thiryfirst" +"30","thirtieth", +"31","thirtyfirst" ); privatestaticfinalMap<Integer,String>lowNumberMap=Maps.intStringMap( @@ -207,7 +207,7 @@ 1,"ten", 2,"twenty", 3,"thirty", -4,"fourty", +4,"forty", 5,"fifty", 6,"sixty", 7,"seventy", @@ -221,6 +221,6 @@ } - + diff --git a/docs/doxyxml/_verbalizer_test_8java.xml b/docs/doxyxml/_verbalizer_test_8java.xml old mode 100644 new mode 100755 index cd1f0f7d..49923b6c --- a/docs/doxyxml/_verbalizer_test_8java.xml +++ b/docs/doxyxml/_verbalizer_test_8java.xml @@ -37,6 +37,6 @@ } - + diff --git a/docs/doxyxml/_vision_8java.xml b/docs/doxyxml/_vision_8java.xml old mode 100644 new mode 100755 index aaa2d42a..3dcee423 --- a/docs/doxyxml/_vision_8java.xml +++ b/docs/doxyxml/_vision_8java.xml @@ -82,6 +82,6 @@ } - + diff --git a/docs/doxyxml/_wild_talk_state_8java.xml b/docs/doxyxml/_wild_talk_state_8java.xml old mode 100644 new mode 100755 index 3c2c13eb..489934f4 --- a/docs/doxyxml/_wild_talk_state_8java.xml +++ b/docs/doxyxml/_wild_talk_state_8java.xml @@ -60,6 +60,6 @@ } } - + diff --git a/docs/doxyxml/_word2vec_training_example_8java.xml b/docs/doxyxml/_word2vec_training_example_8java.xml new file mode 100644 index 00000000..f724ee96 --- /dev/null +++ b/docs/doxyxml/_word2vec_training_example_8java.xml @@ -0,0 +1,73 @@ + + + + Word2vecTrainingExample.java + roboy::linguistics::word2vec::examples::Word2vecTrainingExample + roboy::linguistics::word2vec::examples + + + + + +packageroboy.linguistics.word2vec.examples; + +importorg.deeplearning4j.models.word2vec.Word2Vec; +importorg.deeplearning4j.text.sentenceiterator.BasicLineIterator; +importorg.deeplearning4j.text.sentenceiterator.SentenceIterator; +importorg.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor; +importorg.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory; +importorg.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory; + +importjava.util.Collection; + + +publicclassWord2vecTrainingExample{ + +publicstaticvoidmain(String[]args)throwsException{ + +ToyDataGetterdataGetter=newToyDataGetter(true); +dataGetter.ensureToyDataIsPresent(); +StringdataPath=dataGetter.getToyDataFilePath(); + +//loadandpreprocessdata + +System.out.println("Load&VectorizeSentences...."); +//Stripwhitespacebeforeandafterforeachline +SentenceIteratoriter=newBasicLineIterator(dataPath); +//Splitonwhitespacesinthelinetogetwords +TokenizerFactoryt=newDefaultTokenizerFactory(); + +/* +CommonPreprocessorwillapplythefollowingregextoeachtoken:[\d\.:,"'\(\)\[\]|/?!;]+ +So,effectivelyallnumbers,punctuationsymbolsandsomespecialsymbolsarestrippedoff. +Additionallyitforceslowercaseforalltokens. +*/ +t.setTokenPreProcessor(newCommonPreprocessor()); + + +System.out.println("Buildingmodel...."); +Word2Vecvec=newWord2Vec.Builder() +.minWordFrequency(5) +.iterations(1) +.layerSize(100) +.seed(42) +.windowSize(5) +.iterate(iter) +.tokenizerFactory(t) +.build(); + +System.out.println("FittingWord2Vecmodel...."); +vec.fit(); + +//Printsouttheclosest10wordsto"day".AnexampleonwhattodowiththeseWordVectors. +Collection<String>lst=vec.wordsNearest("day",10); +System.out.println("10Wordsclosestto'day':"+lst); + +} + + +} + + + + diff --git a/docs/doxyxml/_word2vec_uptraining_example_8java.xml b/docs/doxyxml/_word2vec_uptraining_example_8java.xml new file mode 100644 index 00000000..04f1620d --- /dev/null +++ b/docs/doxyxml/_word2vec_uptraining_example_8java.xml @@ -0,0 +1,117 @@ + + + + Word2vecUptrainingExample.java + roboy::linguistics::word2vec::examples::Word2vecUptrainingExample + roboy::linguistics::word2vec::examples + + + + + +packageroboy.linguistics.word2vec.examples; + +importorg.deeplearning4j.models.embeddings.WeightLookupTable; +importorg.deeplearning4j.models.embeddings.inmemory.InMemoryLookupTable; +importorg.deeplearning4j.models.embeddings.loader.WordVectorSerializer; +importorg.deeplearning4j.models.word2vec.VocabWord; +importorg.deeplearning4j.models.word2vec.Word2Vec; +importorg.deeplearning4j.models.word2vec.wordstore.VocabCache; +importorg.deeplearning4j.models.word2vec.wordstore.inmemory.AbstractCache; +importorg.deeplearning4j.text.sentenceiterator.BasicLineIterator; +importorg.deeplearning4j.text.sentenceiterator.SentenceIterator; +importorg.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor; +importorg.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory; +importorg.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory; + +importjava.util.Collection; + + +publicclassWord2vecUptrainingExample{ + +publicstaticvoidmain(String[]args)throwsException{ + + +StringmodelPath="./resources/word2vec_toy_data_and_model/raw_sentences.model"; + +ToyDataGetterdataGetter=newToyDataGetter(true); +dataGetter.ensureToyDataIsPresent(); +StringdataPath=dataGetter.getToyDataFilePath(); + +//loadandpreprocessdata +System.out.println("Load&VectorizeSentences...."); +//Stripwhitespacebeforeandafterforeachline +SentenceIteratoriter=newBasicLineIterator(dataPath); +//Splitonwhitespacesinthelinetogetwords +TokenizerFactoryt=newDefaultTokenizerFactory(); +t.setTokenPreProcessor(newCommonPreprocessor()); + +//manualcreationofVocabCacheandWeightLookupTableusuallyisn'tnecessary +//butinthiscasewe'llneedthem +VocabCache<VocabWord>cache=newAbstractCache<>(); +WeightLookupTable<VocabWord>table=newInMemoryLookupTable.Builder<VocabWord>() +.vectorLength(100) +.useAdaGrad(false) +.cache(cache).build(); + +System.out.println("Buildingmodel...."); +Word2Vecvec=newWord2Vec.Builder() +.minWordFrequency(5) +.iterations(1) +.epochs(1) +.layerSize(100) +.seed(42) +.windowSize(5) +.iterate(iter) +.tokenizerFactory(t) +.lookupTable(table) +.vocabCache(cache) +.build(); + +System.out.println("FittingWord2Vecmodel...."); +vec.fit(); + + +Collection<String>lst=vec.wordsNearest("day",10); +System.out.println("Closestwordsto'day'on1strun:"+lst); + +/* +atthismomentwe'resupposedtohavemodelbuilt,anditcanbesavedforfutureuse. +*/ + +WordVectorSerializer.writeWord2VecModel(vec,modelPath); + +/* +Let'sassumethatsometimepassed,andnowwehavenewcorpustobeusedtoweightsupdate. +Insteadofbuildingnewmodeloverjointcorpus,wecanuseweightsupdatemode. +*/ +Word2Vecword2Vec=WordVectorSerializer.readWord2VecModel(modelPath); + +/* +PLEASENOTE:aftermodelisrestored,it'sstillrequiredtosetSentenceIteratorandTokenizerFactory,ifyou'regoingtotrainthismodel +*/ +SentenceIteratoriterator=newBasicLineIterator(dataPath); +TokenizerFactorytokenizerFactory=newDefaultTokenizerFactory(); +tokenizerFactory.setTokenPreProcessor(newCommonPreprocessor()); + +word2Vec.setTokenizerFactory(tokenizerFactory); +word2Vec.setSentenceIterator(iterator); + + +System.out.println("Word2vecuptraining..."); + +word2Vec.fit(); + +lst=word2Vec.wordsNearest("day",10); +System.out.println("Closestwordsto'day'on2ndrun:"+lst); + +/* +Modelcanbesavedforfutureusenow +*/ + +} +} + + + + diff --git a/docs/doxyxml/_working_memory_8java.xml b/docs/doxyxml/_working_memory_8java.xml old mode 100644 new mode 100755 index 9450f79d..0a320795 --- a/docs/doxyxml/_working_memory_8java.xml +++ b/docs/doxyxml/_working_memory_8java.xml @@ -107,6 +107,6 @@ } - + diff --git a/docs/doxyxml/class_nutshell.xml b/docs/doxyxml/class_nutshell.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/classroboy_1_1context_1_1_async_update_policy.xml b/docs/doxyxml/classroboy_1_1context_1_1_async_update_policy.xml new file mode 100644 index 00000000..7ed1c621 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_async_update_policy.xml @@ -0,0 +1,54 @@ + + + + roboy::context::AsyncUpdatePolicy + roboy.context.IntervalUpdatePolicy< T > + + + abstract void + abstract void roboy.context.ExternalUpdater.update + () + update + + + + + + + + + + +For Attributes and Objects which should be updated on-the-fly (or at regular intervals), this class should take care of fetching and passing the values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::AsyncUpdatePolicyupdate + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_attribute_manager.xml b/docs/doxyxml/classroboy_1_1context_1_1_attribute_manager.xml new file mode 100644 index 00000000..f451bace --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_attribute_manager.xml @@ -0,0 +1,131 @@ + + + + roboy::context::AttributeManager + + + H + ExternalContextInterface + + + V + ExternalContextInterface + + + + + ImmutableClassToInstanceMap< AbstractValueHistory > + ImmutableClassToInstanceMap<AbstractValueHistory> roboy.context.AttributeManager< H extends ExternalContextInterface, V extends ExternalContextInterface >.valueHistories + + valueHistories + + + + + + + + + + ImmutableClassToInstanceMap< AbstractValue > + ImmutableClassToInstanceMap<AbstractValue> roboy.context.AttributeManager< H extends ExternalContextInterface, V extends ExternalContextInterface >.values + + values + + + + + + + + + + + + protected< T > T + protected<T> T roboy.context.AttributeManager< H extends ExternalContextInterface, V extends ExternalContextInterface >.getLastValue + (ExternalContextInterface attribute) + getLastValue + + ExternalContextInterface + attribute + + + + + + + + + + + protected< K, T > Map< K, T > + protected<K, T> Map<K, T> roboy.context.AttributeManager< H extends ExternalContextInterface, V extends ExternalContextInterface >.getNLastValues + (H attribute, int n) + getNLastValues + + H + attribute + + + int + n + + + + + + + + + + + protected< T > T + protected<T> T roboy.context.AttributeManager< H extends ExternalContextInterface, V extends ExternalContextInterface >.getValue + (V attribute) + getValue + + V + attribute + + + + + + + + + + + +The collection of values, split into valueHistories (H) and single values (V). + + + + + + + + + + + + + + valueHistories + + + values + + + + + + roboy::context::AttributeManagergetLastValue + roboy::context::AttributeManagergetNLastValues + roboy::context::AttributeManagergetValue + roboy::context::AttributeManagervalueHistories + roboy::context::AttributeManagervalues + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_context.xml b/docs/doxyxml/classroboy_1_1context_1_1_context.xml new file mode 100644 index 00000000..d3741700 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_context.xml @@ -0,0 +1,182 @@ + + + + roboy::context::Context + roboy.context.AttributeManager< Context.ValueHistories, Context.Values > + roboy::context::Context::Updaters + roboy::context::Context::ValueHistories + roboy::context::Context::Values + + + Context + Context roboy.context.Context.context + + context + + + + + + + + + + + + final ArrayList< ExternalUpdater > + final ArrayList<ExternalUpdater> roboy.context.Context.externalUpdaters + + externalUpdaters + = new ArrayList<>() + + + + + + + + + + + + final HashMap< Class, InternalUpdater > + final HashMap<Class, InternalUpdater> roboy.context.Context.internalUpdaters + + internalUpdaters + = new HashMap<>() + + + + + + + + + + + + + roboy.context.Context.Context + () + Context + + + + + + + + + + + + Context + static Context roboy.context.Context.getInstance + () + getInstance + + + + + + + + + + + + public< V > void + public<V> void roboy.context.Context.updateValue + (Updaters updater, V value) + updateValue + + Updaters + updater + + + V + value + + +Directly update an attribute. + + + +updater + + +The name of the Value or ValueHistory object. + + + +value + + +Data to put into the Value or ValueHistory object. + + + + + + + + + +Singleton class serving as an interface to access all context objects. + +Takes care of correct initialization of attribute histories and updaters. Queries to values are handled through the inherited AttributeManager methods. For usage examples, check out ContextTest.java + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + internalUpdaters + + + externalUpdaters + + + context + + + + + + roboy::context::Contextcontext + roboy::context::ContextContext + roboy::context::ContextexternalUpdaters + roboy::context::ContextgetInstance + roboy::context::ContextgetLastValue + roboy::context::ContextgetNLastValues + roboy::context::ContextgetValue + roboy::context::ContextinternalUpdaters + roboy::context::ContextupdateValue + roboy::context::ContextvalueHistories + roboy::context::Contextvalues + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_external_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1_external_updater.xml new file mode 100644 index 00000000..6d2274c6 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_external_updater.xml @@ -0,0 +1,48 @@ + + + + roboy::context::ExternalUpdater + roboy.context.IntervalUpdater< T > + + + abstract void + abstract void roboy.context.ExternalUpdater.update + () + update + + + + + + + + + + +For Values which should be updated upon incoming data or at regular intervals, this class fetches and passes the values. + + + + + + + + + + + + + + + + + + + + + + + roboy::context::ExternalUpdaterupdate + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_g_u_i_1_1_context_g_u_i.xml b/docs/doxyxml/classroboy_1_1context_1_1_g_u_i_1_1_context_g_u_i.xml new file mode 100644 index 00000000..5c75be83 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_g_u_i_1_1_context_g_u_i.xml @@ -0,0 +1,347 @@ + + + + roboy::context::GUI::ContextGUI + + + JFrame + JFrame roboy.context.GUI.ContextGUI.mainFrame + + mainFrame + + + + + + + + + + TitledBorder + TitledBorder roboy.context.GUI.ContextGUI.valueBorder + + valueBorder + + + + + + + + + + JPanel + JPanel roboy.context.GUI.ContextGUI.valuePanel + + valuePanel + + + + + + + + + + Map< Context.Values, JLabel > + Map<Context.Values, JLabel> roboy.context.GUI.ContextGUI.valueDisplays + + valueDisplays + + + + + + + + + + Map< Context.ValueHistories, JScrollPane > + Map<Context.ValueHistories, JScrollPane> roboy.context.GUI.ContextGUI.historyDisplays + + historyDisplays + + + + + + + + + + TitledBorder + TitledBorder roboy.context.GUI.ContextGUI.historyBorder + + historyBorder + + + + + + + + + + JPanel + JPanel roboy.context.GUI.ContextGUI.historyPanel + + historyPanel + + + + + + + + + + JPanel + JPanel roboy.context.GUI.ContextGUI.controlPanel + + controlPanel + + + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.MAX_HISTORY_VALUES + + MAX_HISTORY_VALUES + = 10 + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.FULL_WIDTH + + FULL_WIDTH + = 400 + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.FULL_HEIGHT + + FULL_HEIGHT + = 300 + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.ATTR_WIDTH + + ATTR_WIDTH + = 390 + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.ATTR_HEIGHT + + ATTR_HEIGHT + = 50 + + + + + + + + + + int + int roboy.context.GUI.ContextGUI.HISTORY_HEIGHT + + HISTORY_HEIGHT + = 100 + + + + + + + + + + String + String roboy.context.GUI.ContextGUI.NO_VALUE + + NO_VALUE + = "<not initialized>" + + + + + + + + + + + + void + static void roboy.context.GUI.ContextGUI.run + () + run + + + + + + + + + + + + + roboy.context.GUI.ContextGUI.ContextGUI + () + ContextGUI + + + + + + + + + + void + void roboy.context.GUI.ContextGUI.prepareGUI + () + prepareGUI + + + + + + + + + + void + void roboy.context.GUI.ContextGUI.startFrame + () + startFrame + + + + + + + + + + void + void roboy.context.GUI.ContextGUI.updateValues + () + updateValues + + + + + + + + + + void + void roboy.context.GUI.ContextGUI.updateHistories + () + updateHistories + + + + + + + + + + +A simple GUI with the goal of showing the attribute values and histories in the Context. + + + + + + + + valueDisplays + + + historyDisplays + + + valueBorder + historyBorder + + + + + + + + + + + + + + + roboy::context::GUI::ContextGUIATTR_HEIGHT + roboy::context::GUI::ContextGUIATTR_WIDTH + roboy::context::GUI::ContextGUIContextGUI + roboy::context::GUI::ContextGUIcontrolPanel + roboy::context::GUI::ContextGUIFULL_HEIGHT + roboy::context::GUI::ContextGUIFULL_WIDTH + roboy::context::GUI::ContextGUIHISTORY_HEIGHT + roboy::context::GUI::ContextGUIhistoryBorder + roboy::context::GUI::ContextGUIhistoryDisplays + roboy::context::GUI::ContextGUIhistoryPanel + roboy::context::GUI::ContextGUImainFrame + roboy::context::GUI::ContextGUIMAX_HISTORY_VALUES + roboy::context::GUI::ContextGUINO_VALUE + roboy::context::GUI::ContextGUIprepareGUI + roboy::context::GUI::ContextGUIrun + roboy::context::GUI::ContextGUIstartFrame + roboy::context::GUI::ContextGUIupdateHistories + roboy::context::GUI::ContextGUIupdateValues + roboy::context::GUI::ContextGUIvalueBorder + roboy::context::GUI::ContextGUIvalueDisplays + roboy::context::GUI::ContextGUIvaluePanel + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_internal_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1_internal_updater.xml new file mode 100644 index 00000000..93ac871c --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_internal_updater.xml @@ -0,0 +1,106 @@ + + + + roboy::context::InternalUpdater + roboy.context.contextObjects.DialogTopicsUpdater + + + T + AbstractValue< V + + + V + + + + + AbstractValue< V > + AbstractValue<V> roboy.context.InternalUpdater< T extends AbstractValue< V, V >.target + + target + + + + + + + + + + + + + roboy.context.InternalUpdater< T extends AbstractValue< V, V >.InternalUpdater + (T target) + InternalUpdater + + T + target + + + + + + + + + + + + + synchronized void + synchronized void roboy.context.InternalUpdater< T extends AbstractValue< V, V >.putValue + (V value) + putValue + + V + value + + + + + + + + + + + +An updater which can be called from inside DM to update a Value or ValueHistory. + + + +<T> + + +The target Value or ValueHistory. + + + +<V> + + +The data type stored in the target. + + + + + + + + + + + + + + + + + + roboy::context::InternalUpdaterInternalUpdater + roboy::context::InternalUpdaterputValue + roboy::context::InternalUpdatertarget + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_interval_update_policy.xml b/docs/doxyxml/classroboy_1_1context_1_1_interval_update_policy.xml new file mode 100644 index 00000000..ac8abf50 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_interval_update_policy.xml @@ -0,0 +1,174 @@ + + + + roboy::context::IntervalUpdatePolicy + roboy.context.ExternalUpdater + roboy.context.memoryContext.InterlocutorNodeUpdater + roboy.context.contextObjects.FaceCoordinatesUpdater + + + T + + + + + final T + final T roboy.context.IntervalUpdatePolicy< T >.target + + target + + + + + + + + + + final ScheduledExecutorService + final ScheduledExecutorService roboy.context.IntervalUpdatePolicy< T >.scheduler + + scheduler + = Executors.newScheduledThreadPool(1) + + + + + + + + + + + + final int + final int roboy.context.IntervalUpdatePolicy< T >.updateFrequency + + updateFrequency + + + + + + + + + + + + + roboy.context.IntervalUpdatePolicy< T >.IntervalUpdatePolicy + (T target, int updateFrequencySeconds) + IntervalUpdatePolicy + + T + target + + + int + updateFrequencySeconds + + +Create a new updater service, executing the update() method at regular time intervals. + + + +target + + +The target attribute of the update() method. + + + +updateFrequencySeconds + + +Delay between calls to the update() method. + + + + + + + + + + + void + void roboy.context.IntervalUpdatePolicy< T >.start + () + start + +Starts the ScheduledExecutorService of the updating thread. + + + + + + + + +An implementation of the UpdatePolicy which performs regular updates on a target object. + +The method update() needs to be implemented in the subclass. + +<T> + + +The class of the target object. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + scheduler + + + + + + + + + roboy::context::IntervalUpdatePolicyIntervalUpdatePolicy + roboy::context::IntervalUpdatePolicyscheduler + roboy::context::IntervalUpdatePolicystart + roboy::context::IntervalUpdatePolicytarget + roboy::context::IntervalUpdatePolicyupdate + roboy::context::IntervalUpdatePolicyupdateFrequency + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_interval_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1_interval_updater.xml new file mode 100644 index 00000000..7a84bb93 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_interval_updater.xml @@ -0,0 +1,167 @@ + + + + roboy::context::IntervalUpdater + roboy.context.ExternalUpdater + roboy.context.contextObjects.FaceCoordinatesUpdater + + + T + + + + + final T + final T roboy.context.IntervalUpdater< T >.target + + target + + + + + + + + + + final ScheduledExecutorService + final ScheduledExecutorService roboy.context.IntervalUpdater< T >.scheduler + + scheduler + = Executors.newScheduledThreadPool(1) + + + + + + + + + + + + final int + final int roboy.context.IntervalUpdater< T >.updateFrequency + + updateFrequency + + + + + + + + + + + + + roboy.context.IntervalUpdater< T >.IntervalUpdater + (T target, int updateFrequencySeconds) + IntervalUpdater + + T + target + + + int + updateFrequencySeconds + + +Create a new updater service, executing the update() method at regular time intervals. + + + +target + + +The target attribute of the update() method. + + + +updateFrequencySeconds + + +Delay in seconds between calls to the update() method. + + + + + + + + + + + void + void roboy.context.IntervalUpdater< T >.start + () + start + +Starts the ScheduledExecutorService of the updating thread. + + + + + + + + +An implementation of the UpdatePolicy which performs regular updates on a target object. + +The method update() needs to be implemented in the subclass. + +<T> + + +The class of the target object. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + scheduler + + + + + + roboy::context::IntervalUpdaterIntervalUpdater + roboy::context::IntervalUpdaterscheduler + roboy::context::IntervalUpdaterstart + roboy::context::IntervalUpdatertarget + roboy::context::IntervalUpdaterupdate + roboy::context::IntervalUpdaterupdateFrequency + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_simple_history_attribute.xml b/docs/doxyxml/classroboy_1_1context_1_1_simple_history_attribute.xml new file mode 100644 index 00000000..e4ca0271 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_simple_history_attribute.xml @@ -0,0 +1,226 @@ + + + + roboy::context::SimpleHistoryAttribute + roboy::context::HistoryAttribute< K, V > + roboy.context.contextObjects.DialogTopics + + + K + Integer + + + V + DataType + + + + + int + int roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.counter + + counter + +This counter tracks the number of items in the History, indices still start from 0. + +Reading is allowed without synchronization, modifications only through generateKey(). + + + + + + + + HashMap< K, V > + HashMap<K,V> roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.data + + data + + + + + + + + + + + + + roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.SimpleHistoryAttribute + () + SimpleHistoryAttribute + + + + + + + + + + V + V roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.getLastValue + () + getLastValue + getLastValue + + + +The last element added to this History. + + + + + + + synchronized V + synchronized V roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.getValue + (K key) + getValue + getValue + + K + key + + +In a History, only getValue() and storeValue() directly access the HashMap data. + +Setting these methods to be synchronous avoids concurrency issues. + +key + + +The Integer-valued key of the object in history. + + +A DataType object corresponding to the key, or null if not found. + + + + + + + HashMap< K, V > + HashMap<K, V> roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.getLastNValues + (int n) + getLastNValues + getLastNValues + + int + n + + +Get a copy of the last n entries added to the History. + +Less values may be added if there are not enough values in this History. In case of no values, an empty array is returned. + +n + + +The number of instances to retrieve. + + +A hashmap of n last values added to the History. + + + + + + + synchronized K + synchronized K roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.storeValue + (V value) + storeValue + storeValue + + V + value + + +Puts a value into History and returns the Integer key assigned to it. + + + +value + + +The DataType value to be added. + + +The key of the newly added value. + + + + + + + + + synchronized int + synchronized int roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType >.generateKey + () + generateKey + +Generates a key that is unique to the history through incrementing an internal counter. + +(Note: the uniqueness constraint is only satisfied if access is synchronous.) A key unique to this History instance. + + + + + + + +Simplistic HashMap history with unique Integer keys. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + + + + + roboy::context::SimpleHistoryAttributecounter + roboy::context::SimpleHistoryAttributedata + roboy::context::SimpleHistoryAttributegenerateKey + roboy::context::SimpleHistoryAttributegetLastNValues + roboy::context::SimpleHistoryAttributegetLastValue + roboy::context::SimpleHistoryAttributegetValue + roboy::context::SimpleHistoryAttributeSimpleHistoryAttribute + roboy::context::SimpleHistoryAttributestoreValue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_simple_value_attribute.xml b/docs/doxyxml/classroboy_1_1context_1_1_simple_value_attribute.xml new file mode 100644 index 00000000..b57c5940 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_simple_value_attribute.xml @@ -0,0 +1,104 @@ + + + + roboy::context::SimpleValueAttribute + roboy::context::ValueAttribute< V > + roboy.context.contextObjects.FaceCoordinates + + + V + DataType + + + + + V + V roboy.context.SimpleValueAttribute< V extends DataType >.value + + value + = null + + + + + + + + + + + + V + V roboy.context.SimpleValueAttribute< V extends DataType >.getValue + () + getValue + getValue + + + + + + + + + + void + void roboy.context.SimpleValueAttribute< V extends DataType >.updateValue + (V value) + updateValue + updateValue + + V + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::SimpleValueAttributegetValue + roboy::context::SimpleValueAttributeupdateValue + roboy::context::SimpleValueAttributevalue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_value.xml b/docs/doxyxml/classroboy_1_1context_1_1_value.xml new file mode 100644 index 00000000..9dfa6ee6 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_value.xml @@ -0,0 +1,103 @@ + + + + roboy::context::Value + roboy::context::AbstractValue< V > + roboy.context.contextObjects.FaceCoordinates + + + V + + + + + V + volatile V roboy.context.Value< V >.value + + value + = null + + + + + + + + + + + + V + V roboy.context.Value< V >.getValue + () + getValue + getValue + + + + + + + + + + void + void roboy.context.Value< V >.updateValue + (V value) + updateValue + updateValue + + V + value + + + + + + + + + + + +Stores a single value of type V. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::ValuegetValue + roboy::context::ValueupdateValue + roboy::context::Valuevalue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1_value_history.xml b/docs/doxyxml/classroboy_1_1context_1_1_value_history.xml new file mode 100644 index 00000000..4da6cd27 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1_value_history.xml @@ -0,0 +1,214 @@ + + + + roboy::context::ValueHistory + roboy.context.AbstractValueHistory< Integer, V > + roboy.context.contextObjects.DialogTopics + + + V + + + + + int + volatile int roboy.context.ValueHistory< V >.counter + + counter + +This counter tracks the number of values, indices still start from 0. + +Reading is allowed without synchronization, modifications only through generateKey(). + + + + + + HashMap< Integer, V > + HashMap<Integer, V> roboy.context.ValueHistory< V >.data + + data + + + + + + + + + + + + + roboy.context.ValueHistory< V >.ValueHistory + () + ValueHistory + + + + + + + + + + V + V roboy.context.ValueHistory< V >.getValue + () + getValue + + + +The last element added to this list. + + + + + + + HashMap< Integer, V > + HashMap<Integer, V> roboy.context.ValueHistory< V >.getLastNValues + (int n) + getLastNValues + + int + n + + +Get a copy of the last n entries added to the list. + +Less values may be returned if there are not enough values in this list. In case of no values, an empty array is returned. + +n + + +The number of instances to retrieve. + + +A hashmap of n last values added to the list. + + + + + + + synchronized void + synchronized void roboy.context.ValueHistory< V >.updateValue + (V value) + updateValue + + V + value + + +Puts a value into the list in the last place. + + + +value + + +The value to be added. + + + + + + + + + + + synchronized int + synchronized int roboy.context.ValueHistory< V >.generateKey + () + generateKey + +Generates a key that is unique through incrementing an internal counter. + +A key which is unique in this list instance. + + + + + + + synchronized V + synchronized V roboy.context.ValueHistory< V >.getValue + (int key) + getValue + + int + key + + +In a ValueList, only getValue() and updateValue() directly access the HashMap data. + +Setting these methods to be synchronous avoids concurrency issues. + +key + + +The key of the value. + + +The value, or null if not found. + + + + + + + +HashMap implementation of a value history with unique Integer keys. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + roboy::context::ValueHistorycounter + roboy::context::ValueHistorydata + roboy::context::ValueHistorygenerateKey + roboy::context::ValueHistorygetLastNValues + roboy::context::ValueHistorygetValue + roboy::context::ValueHistorygetValue + roboy::context::ValueHistoryupdateValue + roboy::context::ValueHistoryValueHistory + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_coordinate_set.xml b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_coordinate_set.xml new file mode 100644 index 00000000..630490a6 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_coordinate_set.xml @@ -0,0 +1,85 @@ + + + + roboy::context::contextObjects::CoordinateSet + + + final double + final double roboy.context.contextObjects.CoordinateSet.x + + x + + + + + + + + + + final double + final double roboy.context.contextObjects.CoordinateSet.y + + y + + + + + + + + + + final double + final double roboy.context.contextObjects.CoordinateSet.z + + z + + + + + + + + + + + + + roboy.context.contextObjects.CoordinateSet.CoordinateSet + (double x, double y, double z) + CoordinateSet + + double + x + + + double + y + + + double + z + + + + + + + + + + + +A coordinate set data structure for the interlocutor face. + + + + + roboy::context::contextObjects::CoordinateSetCoordinateSet + roboy::context::contextObjects::CoordinateSetx + roboy::context::contextObjects::CoordinateSety + roboy::context::contextObjects::CoordinateSetz + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics.xml b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics.xml new file mode 100644 index 00000000..e54a7f10 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics.xml @@ -0,0 +1,60 @@ + + + + roboy::context::contextObjects::DialogTopics + roboy::context::ValueHistory< String > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + roboy::context::contextObjects::DialogTopicsgetLastNValues + roboy::context::contextObjects::DialogTopicsgetValue + roboy::context::contextObjects::DialogTopicsupdateValue + roboy::context::contextObjects::DialogTopicsValueHistory + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics_updater.xml new file mode 100644 index 00000000..5811e711 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_dialog_topics_updater.xml @@ -0,0 +1,61 @@ + + + + roboy::context::contextObjects::DialogTopicsUpdater + roboy::context::InternalUpdater< DialogTopics, String > + + + + roboy.context.contextObjects.DialogTopicsUpdater.DialogTopicsUpdater + (DialogTopics target) + DialogTopicsUpdater + + DialogTopics + target + + + + + + + + + + + +Updater available to all DM for adding new values to the DialogTopics attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::contextObjects::DialogTopicsUpdaterDialogTopicsUpdater + roboy::context::contextObjects::DialogTopicsUpdaterInternalUpdater + roboy::context::contextObjects::DialogTopicsUpdaterputValue + roboy::context::contextObjects::DialogTopicsUpdatertarget + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates.xml b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates.xml new file mode 100644 index 00000000..4c10bdee --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates.xml @@ -0,0 +1,52 @@ + + + + roboy::context::contextObjects::FaceCoordinates + roboy::context::Value< CoordinateSet > + +xzy-coordinates of a person in the field of vision. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::contextObjects::FaceCoordinatesgetValue + roboy::context::contextObjects::FaceCoordinatesupdateValue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates_updater.xml new file mode 100644 index 00000000..be2d24b6 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1context_objects_1_1_face_coordinates_updater.xml @@ -0,0 +1,100 @@ + + + + roboy::context::contextObjects::FaceCoordinatesUpdater + roboy::context::IntervalUpdater< FaceCoordinates > + + + + roboy.context.contextObjects.FaceCoordinatesUpdater.FaceCoordinatesUpdater + (FaceCoordinates target, int updateFrequencySeconds) + FaceCoordinatesUpdater + + FaceCoordinates + target + + + int + updateFrequencySeconds + + + + + + + + + + + + + void + void roboy.context.contextObjects.FaceCoordinatesUpdater.update + () + update + + + + + + + + + + +Asynchronously triggers ROS queries for face coordinates (in the future). + + + + + + + + + + + + + + + + + + + + + + + + + + + + scheduler + + + + + + + + + + + + + + + + + + + roboy::context::contextObjects::FaceCoordinatesUpdaterFaceCoordinatesUpdater + roboy::context::contextObjects::FaceCoordinatesUpdaterIntervalUpdater + roboy::context::contextObjects::FaceCoordinatesUpdaterscheduler + roboy::context::contextObjects::FaceCoordinatesUpdatertarget + roboy::context::contextObjects::FaceCoordinatesUpdaterupdate + roboy::context::contextObjects::FaceCoordinatesUpdaterupdateFrequency + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_coordinate_set.xml b/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_coordinate_set.xml new file mode 100644 index 00000000..9b321497 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_coordinate_set.xml @@ -0,0 +1,110 @@ + + + + roboy::context::dataTypes::CoordinateSet + roboy.context.dataTypes.DataType + + + final double + final double roboy.context.contextObjects.CoordinateSet.x + + x + + + + + + + + + + final double + final double roboy.context.contextObjects.CoordinateSet.y + + y + + + + + + + + + + final double + final double roboy.context.contextObjects.CoordinateSet.z + + z + + + + + + + + + + + + + roboy.context.contextObjects.CoordinateSet.CoordinateSet + (double x, double y, double z) + CoordinateSet + + double + x + + + double + y + + + double + z + + + + + + + + + + + +A coordinate set data structure for the interlocutor face. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::dataTypes::CoordinateSetCoordinateSet + roboy::context::dataTypes::CoordinateSetx + roboy::context::dataTypes::CoordinateSety + roboy::context::dataTypes::CoordinateSetz + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_topic.xml b/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_topic.xml new file mode 100644 index 00000000..74a85aa6 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1data_types_1_1_topic.xml @@ -0,0 +1,74 @@ + + + + roboy::context::dataTypes::Topic + roboy.context.dataTypes.DataType + + + final String + final String roboy.context.dataTypes.Topic.topic + + topic + + + + + + + + + + + + + roboy.context.dataTypes.Topic.Topic + (String topic) + Topic + + String + topic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::dataTypes::Topictopic + roboy::context::dataTypes::TopicTopic + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics.xml b/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics.xml new file mode 100644 index 00000000..1c51ac77 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics.xml @@ -0,0 +1,63 @@ + + + + roboy::context::dialogContext::DialogTopics + roboy::context::SimpleHistoryAttribute< Integer, Topic > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + + + + + + + + + + + + + + roboy::context::dialogContext::DialogTopicscounter + roboy::context::dialogContext::DialogTopicsgenerateKey + roboy::context::dialogContext::DialogTopicsgetLastNValues + roboy::context::dialogContext::DialogTopicsgetLastValue + roboy::context::dialogContext::DialogTopicsgetValue + roboy::context::dialogContext::DialogTopicsSimpleHistoryAttribute + roboy::context::dialogContext::DialogTopicsstoreValue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics_updater.xml new file mode 100644 index 00000000..56dfe224 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1dialog_context_1_1_dialog_topics_updater.xml @@ -0,0 +1,126 @@ + + + + roboy::context::dialogContext::DialogTopicsUpdater + roboy::context::DirectUpdatePolicy< Topic > + + + DialogTopics + DialogTopics roboy.context.contextObjects.DialogTopicsUpdater.target + + target + + + + + + + + + + + + + roboy.context.contextObjects.DialogTopicsUpdater.DialogTopicsUpdater + (DialogTopics target) + DialogTopicsUpdater + + DialogTopics + target + + + + + + + + + + + void + void roboy.context.contextObjects.DialogTopicsUpdater.putValue + (Topic value) + putValue + + Topic + value + + +Put a new Topic value to the DialogTopics history. + + + +value + + +The topic object to add. + + + + + + + + + +Updater available to all DM for adding new values to the DialogTopics attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + data + + + + + + + + + + + + target + + + + + + + + + + + + + + + + roboy::context::dialogContext::DialogTopicsUpdaterDialogTopicsUpdater + roboy::context::dialogContext::DialogTopicsUpdaterputValue + roboy::context::dialogContext::DialogTopicsUpdaterputValue + roboy::context::dialogContext::DialogTopicsUpdatertarget + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node.xml b/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node.xml new file mode 100644 index 00000000..060990db --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node.xml @@ -0,0 +1,150 @@ + + + + roboy::context::memoryContext::InterlocutorNode + + + Interlocutor + Interlocutor roboy.context.memoryContext.InterlocutorNode.interlocutor + + interlocutor + + + + + + + + + + + + + roboy.context.memoryContext.InterlocutorNode.InterlocutorNode + () + InterlocutorNode + + + + + + + + + + Interlocutor + Interlocutor roboy.context.memoryContext.InterlocutorNode.getInterlocutor + () + getInterlocutor + + + + + + + + + + +Stores the Memory node of Interlocutor. + +Do not store a reference to the instance for reuse over multiple actions. + + + + + + + + + + + + properties + + + labels + + + relationships + + + + + + + + + + + person + + + memory + + + + + + + interlocutor + + + + + + + + + + + + + + + clients + + + rosConnectionLatch + + + + + + + + + + clientMap + + + + + + + + + + + + + + + gson + + + rosMainNode + + + memory + + + + + + roboy::context::memoryContext::InterlocutorNodegetInterlocutor + roboy::context::memoryContext::InterlocutorNodeinterlocutor + roboy::context::memoryContext::InterlocutorNodeInterlocutorNode + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node_updater.xml new file mode 100644 index 00000000..9ef4c02d --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1memory_context_1_1_interlocutor_node_updater.xml @@ -0,0 +1,100 @@ + + + + roboy::context::memoryContext::InterlocutorNodeUpdater + roboy::context::IntervalUpdatePolicy< InterlocutorNode > + + + + roboy.context.memoryContext.InterlocutorNodeUpdater.InterlocutorNodeUpdater + (InterlocutorNode target, int updateFrequencySeconds) + InterlocutorNodeUpdater + + InterlocutorNode + target + + + int + updateFrequencySeconds + + + + + + + + + + + + + void + void roboy.context.memoryContext.InterlocutorNodeUpdater.update + () + update + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + scheduler + + + + + + + + + + + + + + + + + + + roboy::context::memoryContext::InterlocutorNodeUpdaterInterlocutorNodeUpdater + roboy::context::memoryContext::InterlocutorNodeUpdaterIntervalUpdatePolicy + roboy::context::memoryContext::InterlocutorNodeUpdaterscheduler + roboy::context::memoryContext::InterlocutorNodeUpdatertarget + roboy::context::memoryContext::InterlocutorNodeUpdaterupdate + roboy::context::memoryContext::InterlocutorNodeUpdaterupdateFrequency + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_context_test.xml b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_context_test.xml new file mode 100644 index 00000000..5c4532a1 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_context_test.xml @@ -0,0 +1,44 @@ + + + + roboy::context::visionContext::ContextTest + + + void + void roboy.context.visionContext.ContextTest.getLastAttributeValue + () + getLastAttributeValue + throws Exception + +Checks that the values of FACE_COORDINATES get automatically updated. + + + + + + + + void + void roboy.context.visionContext.ContextTest.setAndGetDialogTopics + () + setAndGetDialogTopics + + + + + + + + + + + + + + + + roboy::context::visionContext::ContextTestgetLastAttributeValue + roboy::context::visionContext::ContextTestsetAndGetDialogTopics + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates.xml b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates.xml new file mode 100644 index 00000000..517d6d46 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates.xml @@ -0,0 +1,53 @@ + + + + roboy::context::visionContext::FaceCoordinates + roboy::context::SimpleValueAttribute< CoordinateSet > + +xzy-coordinates of a person in the field of vision. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::visionContext::FaceCoordinatesgetValue + roboy::context::visionContext::FaceCoordinatesupdateValue + roboy::context::visionContext::FaceCoordinatesvalue + + + diff --git a/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates_updater.xml b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates_updater.xml new file mode 100644 index 00000000..1b98d9c9 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1context_1_1vision_context_1_1_face_coordinates_updater.xml @@ -0,0 +1,100 @@ + + + + roboy::context::visionContext::FaceCoordinatesUpdater + roboy::context::IntervalUpdatePolicy< FaceCoordinates > + + + + roboy.context.contextObjects.FaceCoordinatesUpdater.FaceCoordinatesUpdater + (FaceCoordinates target, int updateFrequencySeconds) + FaceCoordinatesUpdater + + FaceCoordinates + target + + + int + updateFrequencySeconds + + + + + + + + + + + + + void + void roboy.context.contextObjects.FaceCoordinatesUpdater.update + () + update + + + + + + + + + + +Asynchronously triggers ROS queries for face coordinates (in the future). + + + + + + + + + + + + + + + + + + + + + + + + + + + + scheduler + + + + + + + + + + + + + + + + + + + roboy::context::visionContext::FaceCoordinatesUpdaterFaceCoordinatesUpdater + roboy::context::visionContext::FaceCoordinatesUpdaterIntervalUpdatePolicy + roboy::context::visionContext::FaceCoordinatesUpdaterscheduler + roboy::context::visionContext::FaceCoordinatesUpdatertarget + roboy::context::visionContext::FaceCoordinatesUpdaterupdate + roboy::context::visionContext::FaceCoordinatesUpdaterupdateFrequency + + + diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1_config.xml b/docs/doxyxml/classroboy_1_1dialog_1_1_config.xml old mode 100644 new mode 100755 index ebf2fada..93391ffe --- a/docs/doxyxml/classroboy_1_1dialog_1_1_config.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1_config.xml @@ -16,7 +16,7 @@ - + boolean @@ -30,7 +30,7 @@ - + boolean @@ -44,7 +44,7 @@ - + boolean @@ -58,7 +58,7 @@ - + String @@ -72,7 +72,49 @@ - + + + + boolean + boolean roboy.dialog.Config.MEMORY + + MEMORY + = true + +If true, memory will be queried. + +Ensure that if NOROS=false, then MEMORY=true. When NOROS=true, MEMORY can be either true or false. + + + + + + int + int roboy.dialog.Config.PARSER_PORT + + PARSER_PORT + = -1 + +Semantic parser socket port. + + + + + + + + boolean + boolean roboy.dialog.Config.DEMO_GUI + + DEMO_GUI + = false + +Context GUI demo trigger. + +Set manually, if wanted. + + + @@ -88,7 +130,7 @@ - + @@ -103,7 +145,7 @@ - + @@ -122,7 +164,7 @@ - + @@ -150,7 +192,7 @@ - + @@ -165,7 +207,7 @@ - + void @@ -178,7 +220,7 @@ - + void @@ -191,7 +233,7 @@ - + void @@ -204,7 +246,20 @@ - + + + + void + void roboy.dialog.Config.setMemoryProfile + () + setMemoryProfile + + + + + + + void @@ -217,7 +272,7 @@ - + @@ -225,26 +280,30 @@ 1) Configuration variables define alternating behaviors. 2) To create a combination of configurations, add a new profile to Configurations and implement its setProfile method. - + - + - + yamlConfig - + roboy::dialog::ConfigConfig + roboy::dialog::ConfigDEMO_GUI roboy::dialog::ConfiggetProfileFromEnvironment roboy::dialog::ConfiginitializeYAMLConfig + roboy::dialog::ConfigMEMORY roboy::dialog::ConfigNOROS + roboy::dialog::ConfigPARSER_PORT roboy::dialog::ConfigROS_HOSTNAME roboy::dialog::ConfigsetDebugProfile roboy::dialog::ConfigsetDefaultProfile + roboy::dialog::ConfigsetMemoryProfile roboy::dialog::ConfigsetNoROSProfile roboy::dialog::ConfigsetStandaloneProfile roboy::dialog::ConfigSHUTDOWN_ON_ROS_FAILURE diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1_dialog_system.xml b/docs/doxyxml/classroboy_1_1dialog_1_1_dialog_system.xml old mode 100644 new mode 100755 index 9e900522..9ce8cdf1 --- a/docs/doxyxml/classroboy_1_1dialog_1_1_dialog_system.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1_dialog_system.xml @@ -19,14 +19,14 @@ - + The dialog manager's main class. Here, the used components are put together and executed using the main method. In the future, the different combinations of components should probably be transfered to configuration files.The workflow in the dialog manager is the following: -Input devices produce an Input objectThe Input object is transformed into an Interpretation object containing the input sentence in the Linguistics.SENTENCE attribute and all other attributes of the Input object in the corresponding fieldsLinguistic Analyzers are used on the Interpretation object to add additional informationThe Personality class takes the Interpretation object and decides how to answer to this inputThe list of actions returned by Personality.answer is performed by the Output devicesIf one of these actions is a ShutDownAction the program terminatesOtherwise repeat +Input devices produce an Input objectThe Input object is transformed into an Interpretation object containing the input sentence in the Linguistics.SENTENCE attribute and all other lists of the Input object in the corresponding fieldsLinguistic Analyzers are used on the Interpretation object to add additional informationThe Personality class takes the Interpretation object and decides how to answer to this inputThe list of actions returned by Personality.answer is performed by the Output devicesIf one of these actions is a ShutDownAction the program terminatesOtherwise repeat Input devices: For testing from command line: CommandLineInputFor speech to text: BingInput (requires internet)For combining multiple inputs: MultiInputDeviceOthers for specific tasks Analyzers: @@ -36,7 +36,7 @@ Output devices: For testing with command line: CommandLineOutputFor text to speech: BingOutput (requires internet)For combining multiple outputs: MultiOutputDeviceFor text to speech + facial expressions: CerevoiceOutputFor facial expressions: EmotionOutputFor text to speech (worse quality): FreeTTSOutput The easiest way to create ones own Roboy communication application is to pick the input and output devices provided here, use the tokenization, POS tagging and possibly semantic role labeling (though still under development) if needed and write an own personality. If one wants to use the DBpedia, Protege, generative model or state machine stuff, one has to dig deeper into the small talk personality and see how it is used there. - + roboy::dialog::DialogSystemmain diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_face_action.xml b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_face_action.xml old mode 100644 new mode 100755 index 681072b1..65c3de9e --- a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_face_action.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_face_action.xml @@ -15,7 +15,7 @@ - + int @@ -28,7 +28,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -91,7 +91,7 @@ - + String @@ -104,7 +104,7 @@ - + int @@ -117,7 +117,7 @@ - + @@ -125,30 +125,30 @@ - + - + - + - + - + - + - + roboy::dialog::action::FaceActionduration roboy::dialog::action::FaceActionFaceAction diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_shut_down_action.xml b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_shut_down_action.xml old mode 100644 new mode 100755 index d945b594..80ae05b3 --- a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_shut_down_action.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_shut_down_action.xml @@ -15,7 +15,7 @@ - + @@ -42,7 +42,7 @@ - + List< Action > @@ -55,7 +55,7 @@ - + @@ -63,36 +63,36 @@ Sending a ShutDownAction leads the dialog manager to leave the communication loop in the DialogManager class and quit the program after uttering the given last words. - + - + - + - + - + - + - + lastwords - + - + roboy::dialog::action::ShutDownActiongetLastWords roboy::dialog::action::ShutDownActionlastwords diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_speech_action.xml b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_speech_action.xml old mode 100644 new mode 100755 index 0d42d383..69f65f3a --- a/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_speech_action.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1action_1_1_speech_action.xml @@ -15,7 +15,7 @@ - + @@ -42,7 +42,7 @@ - + String @@ -55,7 +55,7 @@ - + @@ -63,30 +63,30 @@ - + - + - + - + - + - + - + roboy::dialog::action::SpeechActiongetText roboy::dialog::action::SpeechActionSpeechAction diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_curious_personality.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_curious_personality.xml old mode 100644 new mode 100755 index 5e28042d..23e54c4e --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_curious_personality.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_curious_personality.xml @@ -15,7 +15,7 @@ - + @@ -31,7 +31,7 @@ - + List< Action > @@ -58,7 +58,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -113,36 +113,36 @@ - + - + - + - + - + - + - + - + memory - + roboy::dialog::personality::CuriousPersonalityanswer roboy::dialog::personality::CuriousPersonalityCuriousPersonality diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_default_personality.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_default_personality.xml old mode 100644 new mode 100755 index 9c4afa28..1839433e --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_default_personality.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_default_personality.xml @@ -19,7 +19,7 @@ - + final List< String > @@ -35,7 +35,7 @@ - + final List< String > @@ -51,7 +51,7 @@ - + final List< String > @@ -66,7 +66,7 @@ - + final List< String > @@ -81,7 +81,7 @@ - + final List< String > @@ -96,7 +96,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -164,7 +164,7 @@ - + String @@ -181,7 +181,7 @@ - + boolean @@ -202,7 +202,7 @@ - + @@ -210,35 +210,35 @@ - + - + - + - + - + - + - + - + - + introduction farewells positive @@ -246,12 +246,12 @@ greetings agreement - + state - + roboy::dialog::personality::DefaultPersonalityagreement roboy::dialog::personality::DefaultPersonalityanswer diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_knock_knock_personality.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_knock_knock_personality.xml old mode 100644 new mode 100755 index 7cc3c093..9962c18d --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_knock_knock_personality.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_knock_knock_personality.xml @@ -17,7 +17,7 @@ - + String[] @@ -30,7 +30,7 @@ - + String[][] @@ -72,7 +72,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -115,37 +115,37 @@ This should later be include in sensible states and used in the normal small talk personality. - + - + - + - + - + - + - + - + state - + roboy::dialog::personality::KnockKnockPersonalityanswer roboy::dialog::personality::KnockKnockPersonalityjoke diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_small_talk_personality.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_small_talk_personality.xml old mode 100644 new mode 100755 index a874ed98..95e1febf --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_small_talk_personality.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1_small_talk_personality.xml @@ -15,7 +15,7 @@ - + State @@ -28,7 +28,7 @@ - + Verbalizer @@ -41,7 +41,7 @@ - + RosMainNode @@ -54,7 +54,7 @@ - + Interlocutor @@ -67,7 +67,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -108,7 +108,7 @@ - + List< Action > @@ -126,7 +126,7 @@ Each state returns a reaction to what was said and then proactively takes an action of its own. Both are combined to return the list of output actions. - + String @@ -139,7 +139,7 @@ - + void @@ -156,7 +156,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -179,159 +179,159 @@ It tries to engage with people in a general small talk, remembers what was said and answers questions. The small talk personality is based on a state machine, where each input is interpreted in the context of the state Roboy is currently in to determine respective answers.The current state machine looks like this:Greeting state | V Introduction state | V Question Randomizer state |_Question Answering state |_Segue state |_Wild talk stateThe Question Randomizer, Question Answering, Segue and Wilk talk states are stacked. If one cannot give an appropriate reaction to the given utterance, the utterance is passed on to the next one. The Wild talk state will always answer.If a farewell is uttered the personality re-initializes to the Greeting state.What the states do: Greeting: Utters a greating Introduction: Introduces himself and asks for the others name. Reacts differently depending on whether the other person is known. Question Randomizer: Asks the other one questions about himself and stores the answers in Roboy's memory. Question Answering: Answers questions if they are asked and Roboy knows the answer. Segue: Tells anecdotes from Today-I-Learneds from Reddit if corresponding keywords are mentioned. Wild talk: Talks according to a neural network model trained on chat logs. - + - + - + - + - + - + - + - + - + - + properties - + labels - - relations + + relationships - + - + - + preAnecdotes farewells greetings anecdotes segues - + tenthNumberMap lowNumberMap - + dayNumberMap monthNumberMap - + - + person - + memory - + - + - + - + - + - + clients - + rosConnectionLatch - + - + - + person - + state - + positive - + rosMainNode - + verbalizer - + - + - + - + clientMap - + - + - + - + - + gson - + rosMainNode - + memory - + roboy::dialog::personality::SmallTalkPersonalityanswer roboy::dialog::personality::SmallTalkPersonalitygetName diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_abstract_boolean_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_abstract_boolean_state.xml old mode 100644 new mode 100755 index 1337bbda..cbc97921 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_abstract_boolean_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_abstract_boolean_state.xml @@ -10,6 +10,7 @@ roboy.dialog.personality.states.InquiryState roboy.dialog.personality.states.IntroductionState roboy.dialog.personality.states.LocationDBpedia + roboy.dialog.personality.states.PersonalFollowUpState roboy.dialog.personality.states.PersonalQAState @@ -23,7 +24,7 @@ - + State @@ -36,7 +37,7 @@ - + @@ -52,7 +53,7 @@ - + List< String > @@ -66,7 +67,7 @@ - + @@ -81,7 +82,7 @@ - + void @@ -106,7 +107,7 @@ - + State @@ -119,7 +120,7 @@ - + void @@ -144,7 +145,7 @@ - + void @@ -161,7 +162,7 @@ - + void @@ -178,7 +179,7 @@ - + void @@ -195,7 +196,7 @@ - + Reaction @@ -213,7 +214,7 @@ - + @@ -241,7 +242,7 @@ - + @@ -249,89 +250,95 @@ The determineSuccess method needs to be implemented by subclass to determine if the success or failure state should be moved into next. - + - + - + - + - + - + - + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::AbstractBooleanStateact roboy::dialog::personality::states::AbstractBooleanStatedetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_anecdote_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_anecdote_state.xml old mode 100644 new mode 100755 index a601e42c..741bd88d --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_anecdote_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_anecdote_state.xml @@ -15,7 +15,7 @@ - + String @@ -28,7 +28,7 @@ - + @@ -51,7 +51,7 @@ - + List< Interpretation > @@ -65,7 +65,7 @@ - + Reaction @@ -83,7 +83,7 @@ - + @@ -91,33 +91,33 @@ Used for telling anecdotes. - + - + - + - + - + - + nextState - + - + roboy::dialog::personality::states::AnecdoteStateact roboy::dialog::personality::states::AnecdoteStateanecdote diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_celebrity_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_celebrity_state.xml old mode 100644 new mode 100755 index 890a091c..66a8ec82 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_celebrity_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_celebrity_state.xml @@ -30,7 +30,7 @@ - + final List< String > @@ -68,7 +68,7 @@ - + @@ -83,7 +83,7 @@ - + State @@ -96,7 +96,7 @@ - + @@ -115,7 +115,7 @@ - + void @@ -132,7 +132,7 @@ - + List< Interpretation > @@ -146,7 +146,7 @@ - + Reaction @@ -164,7 +164,7 @@ - + @@ -172,41 +172,41 @@ If no trigger sentence was used, the given inner state is executed instead. - + - + - + - + - + - + - + - + top inner - + formulations triggerSentences - + roboy::dialog::personality::states::CelebrityStateact roboy::dialog::personality::states::CelebrityStateCelebrityState diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_converse_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_converse_state.xml old mode 100644 new mode 100755 index 2693f84e..d0c6c096 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_converse_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_converse_state.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + List< Interpretation > @@ -44,7 +44,7 @@ - + Reaction @@ -62,7 +62,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,56 +89,56 @@ - + - + - + - + - + - + - + - + inner - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::ConverseStateact roboy::dialog::personality::states::ConverseStateConverseState diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_farewell_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_farewell_state.xml old mode 100644 new mode 100755 index 7e443bff..88ec61de --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_farewell_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_farewell_state.xml @@ -15,7 +15,7 @@ - + List< Interpretation > @@ -29,7 +29,7 @@ - + Reaction @@ -47,7 +47,7 @@ - + @@ -55,30 +55,30 @@ - + - + - + - + - + - + - + roboy::dialog::personality::states::FarewellStateact roboy::dialog::personality::states::FarewellStateFarewellState diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_generative_communication_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_generative_communication_state.xml old mode 100644 new mode 100755 index d5a0910a..ececf9de --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_generative_communication_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_generative_communication_state.xml @@ -16,7 +16,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -59,53 +59,53 @@ - + - + - + - + - + - + - + - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::GenerativeCommunicationStateact roboy::dialog::personality::states::GenerativeCommunicationStatedetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_greeting_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_greeting_state.xml old mode 100644 new mode 100755 index b0d7c917..c97620d2 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_greeting_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_greeting_state.xml @@ -16,7 +16,7 @@ - + Reaction @@ -34,7 +34,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -61,53 +61,53 @@ - + - + - + - + - + - + - + - + success failure - + failureTexts successTexts - + - + - + - + - + roboy::dialog::personality::states::GreetingStateact roboy::dialog::personality::states::GreetingStatedetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_idle_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_idle_state.xml old mode 100644 new mode 100755 index d35115dd..fa2e45d3 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_idle_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_idle_state.xml @@ -16,7 +16,7 @@ - + @@ -35,7 +35,7 @@ - + @@ -43,53 +43,53 @@ - + - + - + - + - + - + - + - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::IdleStateact roboy::dialog::personality::states::IdleStatedetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_inquiry_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_inquiry_state.xml old mode 100644 new mode 100755 index e5c76fb1..deb3b716 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_inquiry_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_inquiry_state.xml @@ -15,7 +15,7 @@ - + List< String > @@ -28,7 +28,7 @@ - + String @@ -41,7 +41,7 @@ - + @@ -90,7 +90,7 @@ - + List< Interpretation > @@ -104,7 +104,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -131,56 +131,56 @@ Moves to the success state if the answer consists one of these terms and to the failure state if not. - + - + - + - + - + - + - + - + successTerms - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::InquiryStateact roboy::dialog::personality::states::InquiryStatedetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_introduction_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_introduction_state.xml old mode 100644 new mode 100755 index f6907108..9706fbc3 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_introduction_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_introduction_state.xml @@ -16,7 +16,36 @@ - + + + + Neo4jMemory + Neo4jMemory roboy.dialog.personality.states.IntroductionState.memory + + memory + + + + + + + + + + + + Neo4jRelationships + Neo4jRelationships roboy.dialog.personality.states.IntroductionState.predicate + + predicate + = Neo4jRelationships.FRIEND_OF + + + + + + + @@ -35,7 +64,7 @@ - + @@ -54,7 +83,7 @@ - + List< Interpretation > @@ -68,7 +97,7 @@ - + @@ -87,7 +116,7 @@ - + @@ -95,141 +124,151 @@ Moves to success state if the answer is at most 2 words. - + - + - + - + - + - + + + + + - + - + - + success failure - + failureTexts successTexts - + - + - + - + properties - + labels - - relations + + relationships - + - + - + person - + memory - + - + - + - + - + - + clients - + rosConnectionLatch - + - + - + - + person - + introductions + + predicate + + + memory + - + - + clientMap - + - + - + - + - + gson - + rosMainNode - + memory - + roboy::dialog::personality::states::IntroductionStateact roboy::dialog::personality::states::IntroductionStatedetermineSuccess @@ -238,7 +277,9 @@ roboy::dialog::personality::states::IntroductionStategetSuccess roboy::dialog::personality::states::IntroductionStateintroductions roboy::dialog::personality::states::IntroductionStateIntroductionState + roboy::dialog::personality::states::IntroductionStatememory roboy::dialog::personality::states::IntroductionStateperson + roboy::dialog::personality::states::IntroductionStatepredicate roboy::dialog::personality::states::IntroductionStatereact roboy::dialog::personality::states::IntroductionStatesetFailure roboy::dialog::personality::states::IntroductionStatesetFailureTexts diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia.xml old mode 100644 new mode 100755 index 68d7b6ee..cef7b006 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia.xml @@ -16,7 +16,7 @@ - + boolean @@ -33,7 +33,7 @@ - + Reaction @@ -51,7 +51,7 @@ - + @@ -59,53 +59,53 @@ - + - + - + - + - + - + - + - + - + - + success failure - + failureTexts successTexts - + - + - + roboy::dialog::personality::states::LocationDBpediaact roboy::dialog::personality::states::LocationDBpediadetermineSuccess diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia_state_test.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia_state_test.xml old mode 100644 new mode 100755 index e36c07a5..21257637 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia_state_test.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_location_d_bpedia_state_test.xml @@ -14,7 +14,7 @@ - + void @@ -27,14 +27,14 @@ - + Created by roboy on 7/5/17. - + roboy::dialog::personality::states::LocationDBpediaStateTesttestCity roboy::dialog::personality::states::LocationDBpediaStateTesttestCountry diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_follow_up_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_follow_up_state.xml new file mode 100644 index 00000000..36bf123c --- /dev/null +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_follow_up_state.xml @@ -0,0 +1,302 @@ + + + + roboy::dialog::personality::states::PersonalFollowUpState + roboy.dialog.personality.states.AbstractBooleanState + + + List< String > + List<String> roboy.dialog.personality.states.PersonalFollowUpState.questions + + questions + + + + + + + + + + List< String > + List<String> roboy.dialog.personality.states.PersonalFollowUpState.successTexts + + successTexts + + + + + + + + + + Interlocutor + Interlocutor roboy.dialog.personality.states.PersonalFollowUpState.person + + person + + + + + + + + + + + + Neo4jRelationships + Neo4jRelationships roboy.dialog.personality.states.PersonalFollowUpState.predicate + + predicate + + + + + + + + + + + + + roboy.dialog.personality.states.PersonalFollowUpState.PersonalFollowUpState + (List< String > questions, List< String > failureTexts, List< String > successTexts, Neo4jRelationships predicate, QuestionRandomizerState nextState, Interlocutor person) + PersonalFollowUpState + + List< String > + questions + + + List< String > + failureTexts + + + List< String > + successTexts + + + Neo4jRelationships + predicate + + + QuestionRandomizerState + nextState + + + Interlocutor + person + + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.dialog.personality.states.PersonalFollowUpState.act + () + act + act + +Ask the question. + +Using Neo4jRelationships predicate + + + + + + + + boolean + boolean roboy.dialog.personality.states.PersonalFollowUpState.determineSuccess + (Interpretation input) + determineSuccess + + Interpretation + input + + +Retrieve the answer and add it to the memory, if needed. + +As locations, hobbies, workplaces etc are individual nodes in memory, those will be retrieved or created if necessary. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + person + + + questions + successTexts + + + predicate + + + + + + + + + + + + success + failure + + + failureTexts + successTexts + + + + + + + + + + + + + properties + + + labels + + + relationships + + + + + + + + + + + person + + + memory + + + + + + + + + + + + + + + + + + + clients + + + rosConnectionLatch + + + + + + + + + + clientMap + + + + + + + + + + + + + + + gson + + + rosMainNode + + + memory + + + + + + roboy::dialog::personality::states::PersonalFollowUpStateact + roboy::dialog::personality::states::PersonalFollowUpStatedetermineSuccess + roboy::dialog::personality::states::PersonalFollowUpStatefailure + roboy::dialog::personality::states::PersonalFollowUpStategetFailure + roboy::dialog::personality::states::PersonalFollowUpStategetSuccess + roboy::dialog::personality::states::PersonalFollowUpStateperson + roboy::dialog::personality::states::PersonalFollowUpStatePersonalFollowUpState + roboy::dialog::personality::states::PersonalFollowUpStatepredicate + roboy::dialog::personality::states::PersonalFollowUpStatequestions + roboy::dialog::personality::states::PersonalFollowUpStatereact + roboy::dialog::personality::states::PersonalFollowUpStatesetFailure + roboy::dialog::personality::states::PersonalFollowUpStatesetFailureTexts + roboy::dialog::personality::states::PersonalFollowUpStatesetNextState + roboy::dialog::personality::states::PersonalFollowUpStatesetSuccess + roboy::dialog::personality::states::PersonalFollowUpStatesetSuccessTexts + roboy::dialog::personality::states::PersonalFollowUpStatesuccess + roboy::dialog::personality::states::PersonalFollowUpStatesuccessTexts + + + diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_q_a_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_q_a_state.xml old mode 100644 new mode 100755 index 016280be..22dda1b2 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_q_a_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_personal_q_a_state.xml @@ -15,11 +15,11 @@ - + - - List< String[]> - List<String[]> roboy.dialog.personality.states.PersonalQAState.successTexts + + List< String > + List<String> roboy.dialog.personality.states.PersonalQAState.successTexts successTexts @@ -28,7 +28,7 @@ - + Interlocutor @@ -41,13 +41,13 @@ - + - - Neo4jRelations - Neo4jRelations roboy.dialog.personality.states.PersonalQAState.predicate + + Neo4jRelationships + Neo4jRelationships roboy.dialog.personality.states.PersonalQAState.predicate predicate @@ -56,14 +56,14 @@ - + - + roboy.dialog.personality.states.PersonalQAState.PersonalQAState - (List< String > questions, List< String > failureTexts, List< String[]> successTexts, Neo4jRelations predicate, Interlocutor person) + (List< String > questions, List< String > failureTexts, List< String > successTexts, Neo4jRelationships predicate, Interlocutor person) PersonalQAState List< String > @@ -74,11 +74,11 @@ failureTexts - List< String[]> + List< String > successTexts - Neo4jRelations + Neo4jRelationships predicate @@ -91,7 +91,7 @@ - + List< Interpretation > @@ -105,7 +105,7 @@ - + @@ -124,7 +124,7 @@ As locations, hobbies, workplaces etc are individual nodes in memory, those will be retrieved or created if necessary. - + @@ -132,154 +132,149 @@ - + - + - + - + - + - - - - - - + + + - + - + - + - + success failure - + failureTexts successTexts - + - + - + - + properties - + labels - - relations + + relationships - + - + - + person - + memory - + - + - + - + - + - + clients - + rosConnectionLatch - + - + - + - + person - - successTexts - - + questions + successTexts - + predicate - + - + clientMap - + - + - + - + - + gson - + rosMainNode - + memory - + roboy::dialog::personality::states::PersonalQAStateact roboy::dialog::personality::states::PersonalQAStatedetermineSuccess @@ -287,8 +282,8 @@ roboy::dialog::personality::states::PersonalQAStategetFailure roboy::dialog::personality::states::PersonalQAStategetSuccess roboy::dialog::personality::states::PersonalQAStateperson - roboy::dialog::personality::states::PersonalQAStatePersonalQAState - roboy::dialog::personality::states::PersonalQAStatepredicate + roboy::dialog::personality::states::PersonalQAStatePersonalQAState + roboy::dialog::personality::states::PersonalQAStatepredicate roboy::dialog::personality::states::PersonalQAStatequestions roboy::dialog::personality::states::PersonalQAStatereact roboy::dialog::personality::states::PersonalQAStatesetFailure @@ -297,7 +292,7 @@ roboy::dialog::personality::states::PersonalQAStatesetSuccess roboy::dialog::personality::states::PersonalQAStatesetSuccessTexts roboy::dialog::personality::states::PersonalQAStatesuccess - roboy::dialog::personality::states::PersonalQAStatesuccessTexts + roboy::dialog::personality::states::PersonalQAStatesuccessTexts diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state.xml old mode 100644 new mode 100755 index 54a940a2..ffcf5d80 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state.xml @@ -16,7 +16,7 @@ - + List< Triple > @@ -29,7 +29,7 @@ - + State @@ -42,7 +42,7 @@ - + State @@ -55,7 +55,7 @@ - + List< Memory< Relation > > @@ -68,7 +68,7 @@ - + @@ -87,7 +87,7 @@ - + void @@ -104,7 +104,7 @@ - + List< Interpretation > @@ -118,7 +118,7 @@ - + Reaction @@ -136,7 +136,7 @@ Then checks its knowledge base to come up with an answer. - + @@ -159,7 +159,7 @@ - + List< Triple > @@ -184,7 +184,7 @@ - + @@ -192,46 +192,46 @@ - + - + - + - + - + - + - + memories - + top inner - + memory - + - + - + roboy::dialog::personality::states::QuestionAnsweringStateact roboy::dialog::personality::states::QuestionAnsweringStatefirst diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state_test.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state_test.xml old mode 100644 new mode 100755 index bb36d1f1..20423919 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state_test.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_answering_state_test.xml @@ -15,7 +15,7 @@ - + final QuestionAnsweringState @@ -29,7 +29,7 @@ - + @@ -44,7 +44,7 @@ - + void @@ -57,7 +57,7 @@ - + void @@ -70,7 +70,7 @@ - + void @@ -83,7 +83,7 @@ - + void @@ -96,7 +96,7 @@ - + void @@ -109,7 +109,7 @@ - + void @@ -122,7 +122,7 @@ - + @@ -130,60 +130,60 @@ - + - + - + - + memories - + top inner - + memory - + - + parser - + state - + - + - + - + - + - + - + parser - + roboy::dialog::personality::states::QuestionAnsweringStateTestparser roboy::dialog::personality::states::QuestionAnsweringStateTeststate diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_asking_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_asking_state.xml old mode 100644 new mode 100755 index 4d36103d..2ecbaa7f --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_asking_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_asking_state.xml @@ -15,7 +15,7 @@ - + String @@ -28,7 +28,7 @@ - + int @@ -41,7 +41,7 @@ - + Map< String, List< String > > @@ -54,7 +54,7 @@ - + Random @@ -67,7 +67,7 @@ - + Map< String, State > @@ -80,7 +80,7 @@ - + SmallTalkPersonality @@ -93,7 +93,7 @@ - + @@ -109,7 +109,7 @@ - + final SimpleTokenizer @@ -123,7 +123,7 @@ - + final OpenNLPPPOSTagger @@ -137,7 +137,7 @@ - + final OpenNLPParser @@ -151,7 +151,7 @@ - + final AnswerAnalyzer @@ -165,7 +165,7 @@ - + @@ -192,7 +192,7 @@ - + List< Interpretation > @@ -206,7 +206,7 @@ - + Reaction @@ -224,7 +224,7 @@ - + @@ -243,7 +243,7 @@ - + @@ -258,7 +258,7 @@ - + Interpretation @@ -272,7 +272,7 @@ - + List< Interpretation > @@ -289,7 +289,7 @@ - + String @@ -306,7 +306,7 @@ - + String @@ -323,7 +323,7 @@ - + @@ -331,245 +331,251 @@ - + - + - + - + - + - + - + - + - + - + - + - + tagger - + - + - + + + + - + properties - + labels - - relations + + relationships - + - + - + preAnecdotes farewells greetings anecdotes segues - + tenthNumberMap lowNumberMap - + dayNumberMap monthNumberMap - + - + person - + memory - + - + - + - + - + - + - + - + clients - + rosConnectionLatch - + - + - + person - + state - + positive - + rosMainNode - + verbalizer - + - + - + - + attributes - + - + - + - + - + - + - + clientMap - + - + - + - + parser - + - + - + - + gson - + rosMainNode - + memory - + - + - + answer - + parser - + pos - + personality - + tokenizer - + questions - + objectOfFocus - + + generator + + children - + roboy::dialog::personality::states::QuestionAskingStateact roboy::dialog::personality::states::QuestionAskingStateanalyzeObject diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_randomizer_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_randomizer_state.xml old mode 100644 new mode 100755 index 5e8f765e..e37362c3 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_randomizer_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_question_randomizer_state.xml @@ -15,7 +15,7 @@ - + PersonalQAState @@ -28,11 +28,24 @@ - + - - HashMap< Neo4jRelations, Boolean > - HashMap<Neo4jRelations, Boolean> roboy.dialog.personality.states.QuestionRandomizerState.alreadyAsked + + PersonalFollowUpState[] + PersonalFollowUpState [] roboy.dialog.personality.states.QuestionRandomizerState.followUpStates + + followUpStates + + + + + + + + + + HashMap< Neo4jRelationships, Boolean > + HashMap<Neo4jRelationships, Boolean> roboy.dialog.personality.states.QuestionRandomizerState.alreadyAsked alreadyAsked @@ -41,7 +54,7 @@ - + State @@ -54,7 +67,7 @@ - + State @@ -67,7 +80,7 @@ - + Interlocutor @@ -80,51 +93,50 @@ - + - - - - String - String roboy.dialog.personality.states.QuestionRandomizerState.questionsFile + + JsonQAValues + JsonQAValues roboy.dialog.personality.states.QuestionRandomizerState.questionsAndAnswers - questionsFile - = "sentences/questions.json" + questionsAndAnswers - + - - String - String roboy.dialog.personality.states.QuestionRandomizerState.successAnswersFile + + + + boolean + boolean roboy.dialog.personality.states.QuestionRandomizerState.askFollowUp - successAnswersFile - = "sentences/successAnswers.json" + askFollowUp + = true - + - + String - String roboy.dialog.personality.states.QuestionRandomizerState.failureAnswersFile + String roboy.dialog.personality.states.QuestionRandomizerState.QAfile - failureAnswersFile - = "sentences/failureAnswers.json" + QAfile + = "sentences/QAList.json" - + Map< String, List< String > > @@ -137,11 +149,11 @@ - + - - Map< String, List< String[]> > - Map<String, List<String[]> > roboy.dialog.personality.states.QuestionRandomizerState.successAnswers + + Map< String, List< String > > + Map<String, List<String> > roboy.dialog.personality.states.QuestionRandomizerState.successAnswers successAnswers @@ -150,7 +162,7 @@ - + Map< String, List< String > > @@ -163,7 +175,33 @@ - + + + + Map< String, List< String > > + Map<String, List<String> > roboy.dialog.personality.states.QuestionRandomizerState.followUp + + followUp + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.dialog.personality.states.QuestionRandomizerState.answersFollowUp + + answersFollowUp + + + + + + + @@ -186,7 +224,7 @@ - + List< Interpretation > @@ -200,7 +238,7 @@ - + Reaction @@ -218,7 +256,7 @@ - + void @@ -235,18 +273,35 @@ - + - + PersonalQAState PersonalQAState roboy.dialog.personality.states.QuestionRandomizerState.initializeQuestion - (Neo4jRelations relation) + (Neo4jRelationships relationship) initializeQuestion - Neo4jRelations - relation + Neo4jRelationships + relationship + + + + + + + + + + + PersonalFollowUpState + PersonalFollowUpState roboy.dialog.personality.states.QuestionRandomizerState.initializeFollowUpQuestion + (Neo4jRelationships relationship) + initializeFollowUpQuestion + + Neo4jRelationships + relationship @@ -254,7 +309,7 @@ - + void @@ -267,7 +322,7 @@ - + @@ -275,203 +330,232 @@ Coupled with Neo4j information about the person to prevent duplicates. - + - + - + - - - - - + - - - - alreadyAsked + - + person - + chosenState inner - + questionStates locationQuestion - + + answersFollowUp successAnswers - - questions + followUp failureAnswers + + questionsAndAnswers + + + alreadyAsked + + + followUpStates + - - + + + - + + + + + + + person + + + questions + successTexts + + + predicate + + + - + - + - + success failure - + failureTexts successTexts - + - + - + - + properties - + labels - - relations + + relationships - - - - + - + - + person - + memory - + - + - - - - + - + - + - + - + clients - + rosConnectionLatch - + + + + - + + + + + answersFollowUp + successAnswers + questions + followUp + failureAnswers + + + - + - + person - - successTexts - - + questions + successTexts - + predicate - + - + clientMap - + - + - + - + - + gson - + rosMainNode - + memory - + roboy::dialog::personality::states::QuestionRandomizerStateact - roboy::dialog::personality::states::QuestionRandomizerStatealreadyAsked + roboy::dialog::personality::states::QuestionRandomizerStatealreadyAsked + roboy::dialog::personality::states::QuestionRandomizerStateanswersFollowUp + roboy::dialog::personality::states::QuestionRandomizerStateaskFollowUp roboy::dialog::personality::states::QuestionRandomizerStatecheckForAskedQuestions roboy::dialog::personality::states::QuestionRandomizerStatechosenState roboy::dialog::personality::states::QuestionRandomizerStatefailureAnswers - roboy::dialog::personality::states::QuestionRandomizerStatefailureAnswersFile - roboy::dialog::personality::states::QuestionRandomizerStateinitializeQuestion + roboy::dialog::personality::states::QuestionRandomizerStatefollowUp + roboy::dialog::personality::states::QuestionRandomizerStatefollowUpStates + roboy::dialog::personality::states::QuestionRandomizerStateinitializeFollowUpQuestion + roboy::dialog::personality::states::QuestionRandomizerStateinitializeQuestion roboy::dialog::personality::states::QuestionRandomizerStateinner roboy::dialog::personality::states::QuestionRandomizerStatelocationQuestion roboy::dialog::personality::states::QuestionRandomizerStateperson + roboy::dialog::personality::states::QuestionRandomizerStateQAfile roboy::dialog::personality::states::QuestionRandomizerStateQuestionRandomizerState roboy::dialog::personality::states::QuestionRandomizerStatequestions - roboy::dialog::personality::states::QuestionRandomizerStatequestionsFile + roboy::dialog::personality::states::QuestionRandomizerStatequestionsAndAnswers roboy::dialog::personality::states::QuestionRandomizerStatequestionStates roboy::dialog::personality::states::QuestionRandomizerStatereact roboy::dialog::personality::states::QuestionRandomizerStatesetTop - roboy::dialog::personality::states::QuestionRandomizerStatesuccessAnswers - roboy::dialog::personality::states::QuestionRandomizerStatesuccessAnswersFile + roboy::dialog::personality::states::QuestionRandomizerStatesuccessAnswers diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_reaction.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_reaction.xml old mode 100644 new mode 100755 index 468c2d84..93cecfa0 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_reaction.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_reaction.xml @@ -14,7 +14,7 @@ - + State @@ -27,7 +27,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -67,7 +67,7 @@ - + List< Interpretation > @@ -80,7 +80,7 @@ - + State @@ -93,7 +93,7 @@ - + void @@ -110,7 +110,7 @@ - + @@ -118,25 +118,25 @@ - + - + state - + reactions - + - + - + roboy::dialog::personality::states::ReactiongetReactions roboy::dialog::personality::states::ReactiongetState diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_segue_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_segue_state.xml old mode 100644 new mode 100755 index ba52b032..1e8d46d3 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_segue_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_segue_state.xml @@ -16,7 +16,7 @@ - + @@ -31,7 +31,7 @@ - + State @@ -44,7 +44,7 @@ - + Map< String, String > @@ -57,7 +57,7 @@ - + @@ -76,7 +76,7 @@ - + void @@ -93,7 +93,7 @@ - + List< Interpretation > @@ -107,7 +107,7 @@ - + Reaction @@ -125,7 +125,7 @@ - + @@ -148,7 +148,7 @@ - + @@ -156,46 +156,46 @@ Tells the anecdote if a word matches, executes its inner state instead, if not. - + - + - + - + - + - + - + - + - + top inner - + redditTIL - + sentenceTypeAssociations - + roboy::dialog::personality::states::SegueStateact roboy::dialog::personality::states::SegueStateinner diff --git a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_wild_talk_state.xml b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_wild_talk_state.xml old mode 100644 new mode 100755 index bb82c97a..07da3807 --- a/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_wild_talk_state.xml +++ b/docs/doxyxml/classroboy_1_1dialog_1_1personality_1_1states_1_1_wild_talk_state.xml @@ -16,7 +16,7 @@ - + RosMainNode @@ -29,7 +29,7 @@ - + @@ -48,7 +48,7 @@ - + List< Interpretation > @@ -62,7 +62,7 @@ - + Reaction @@ -80,7 +80,7 @@ - + void @@ -97,7 +97,7 @@ - + @@ -105,64 +105,64 @@ - + - + - + - + - + - + - + - + - + clients - + rosConnectionLatch - + - + - + next - + rosMainNode - + - + clientMap - + - + roboy::dialog::personality::states::WildTalkStateact roboy::dialog::personality::states::WildTalkStatenext diff --git a/docs/doxyxml/classroboy_1_1io_1_1_bing_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_bing_input.xml old mode 100644 new mode 100755 index 2d15c6df..1b9eac53 --- a/docs/doxyxml/classroboy_1_1io_1_1_bing_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_bing_input.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + Input @@ -49,7 +49,7 @@ - + @@ -57,61 +57,61 @@ Requires internet connection. - + - + - + - + - + - + - + rosMainNode - + - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + roboy::io::BingInputBingInput roboy::io::BingInputlisten diff --git a/docs/doxyxml/classroboy_1_1io_1_1_bing_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_bing_output.xml old mode 100644 new mode 100755 index 2ba18569..d0821686 --- a/docs/doxyxml/classroboy_1_1io_1_1_bing_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_bing_output.xml @@ -20,7 +20,7 @@ - + void @@ -37,7 +37,7 @@ - + @@ -45,30 +45,30 @@ Requires internet connection. - + - + - + - + - + - + - + roboy::io::BingOutputact roboy::io::BingOutputsay diff --git a/docs/doxyxml/classroboy_1_1io_1_1_celebrity_similarity_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_celebrity_similarity_input.xml old mode 100644 new mode 100755 index 1e95fa08..b726ba35 --- a/docs/doxyxml/classroboy_1_1io_1_1_celebrity_similarity_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_celebrity_similarity_input.xml @@ -17,7 +17,7 @@ - + @@ -25,30 +25,30 @@ Isn't implemented yet. - + - + - + - + - + - + - + roboy::io::CelebritySimilarityInputlisten diff --git a/docs/doxyxml/classroboy_1_1io_1_1_cerevoice_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_cerevoice_output.xml old mode 100644 new mode 100755 index d4f69395..0a4b3489 --- a/docs/doxyxml/classroboy_1_1io_1_1_cerevoice_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_cerevoice_output.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + void @@ -52,7 +52,7 @@ - + void @@ -69,7 +69,7 @@ - + @@ -77,61 +77,61 @@ - + - + - + - + - + - + - + rosMainNode - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + - + roboy::io::CerevoiceOutputact roboy::io::CerevoiceOutputCerevoiceOutput diff --git a/docs/doxyxml/classroboy_1_1io_1_1_command_line_communication.xml b/docs/doxyxml/classroboy_1_1io_1_1_command_line_communication.xml old mode 100644 new mode 100755 index 40c04770..c4dd50a4 --- a/docs/doxyxml/classroboy_1_1io_1_1_command_line_communication.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_command_line_communication.xml @@ -15,7 +15,7 @@ - + SentenceAnalyzer @@ -28,7 +28,7 @@ - + @@ -48,7 +48,7 @@ - + void @@ -62,7 +62,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -89,56 +89,56 @@ - + - + - + - + - + - + - + - + personality - + analyzer - + - + - + meanings - + - + - + roboy::io::CommandLineCommunicationanalyzer roboy::io::CommandLineCommunicationcommunicate diff --git a/docs/doxyxml/classroboy_1_1io_1_1_command_line_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_command_line_input.xml old mode 100644 new mode 100755 index 1b3e4680..26135714 --- a/docs/doxyxml/classroboy_1_1io_1_1_command_line_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_command_line_input.xml @@ -16,7 +16,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -55,36 +55,36 @@ - + - + - + - + - + - + - + sc - + - + roboy::io::CommandLineInputfinalize roboy::io::CommandLineInputlisten diff --git a/docs/doxyxml/classroboy_1_1io_1_1_command_line_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_command_line_output.xml old mode 100644 new mode 100755 index 9284a2fd..c0dcb151 --- a/docs/doxyxml/classroboy_1_1io_1_1_command_line_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_command_line_output.xml @@ -20,7 +20,7 @@ - + @@ -28,30 +28,30 @@ - + - + - + - + - + - + - + roboy::io::CommandLineOutputact diff --git a/docs/doxyxml/classroboy_1_1io_1_1_emotion_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_emotion_output.xml old mode 100644 new mode 100755 index 579e47b4..20a9f7e9 --- a/docs/doxyxml/classroboy_1_1io_1_1_emotion_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_emotion_output.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + void @@ -52,7 +52,7 @@ - + void @@ -69,7 +69,7 @@ - + @@ -77,61 +77,61 @@ - + - + - + - + - + - + - + rosMainNode - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + - + roboy::io::EmotionOutputact roboy::io::EmotionOutputact diff --git a/docs/doxyxml/classroboy_1_1io_1_1_free_t_t_s_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_free_t_t_s_output.xml old mode 100644 new mode 100755 index 5d092771..43f73e86 --- a/docs/doxyxml/classroboy_1_1io_1_1_free_t_t_s_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_free_t_t_s_output.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + void @@ -48,7 +48,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -75,36 +75,36 @@ - + - + - + - + - + - + voice - + - + - + roboy::io::FreeTTSOutputact roboy::io::FreeTTSOutputFreeTTSOutput diff --git a/docs/doxyxml/classroboy_1_1io_1_1_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_input.xml old mode 100644 new mode 100755 index b6033924..0cbd5933 --- a/docs/doxyxml/classroboy_1_1io_1_1_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_input.xml @@ -14,7 +14,7 @@ - + Map< String, Object > @@ -27,7 +27,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -67,26 +67,26 @@ - + -The result of an input device consists of a sentence, if it is an audio device, and an arbitrary map of attributes. +The result of an input device consists of a sentence, if it is an audio device, and an arbitrary map of lists. - + - + attributes - + - + roboy::io::Inputattributes roboy::io::InputInput diff --git a/docs/doxyxml/classroboy_1_1io_1_1_multi_input_device.xml b/docs/doxyxml/classroboy_1_1io_1_1_multi_input_device.xml old mode 100644 new mode 100755 index 888b74bf..e4f4a1cc --- a/docs/doxyxml/classroboy_1_1io_1_1_multi_input_device.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_multi_input_device.xml @@ -15,7 +15,7 @@ - + ArrayList< InputDevice > @@ -28,7 +28,7 @@ - + @@ -47,7 +47,7 @@ - + void @@ -64,7 +64,7 @@ - + Input @@ -79,7 +79,7 @@ - + @@ -87,39 +87,39 @@ - + - + - + - + - + - + - + - + additionalInputs - + mainInput - + roboy::io::MultiInputDeviceaddInputDevice roboy::io::MultiInputDeviceadditionalInputs diff --git a/docs/doxyxml/classroboy_1_1io_1_1_multi_output_device.xml b/docs/doxyxml/classroboy_1_1io_1_1_multi_output_device.xml old mode 100644 new mode 100755 index 16ab5291..65e37e19 --- a/docs/doxyxml/classroboy_1_1io_1_1_multi_output_device.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_multi_output_device.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + void @@ -51,7 +51,7 @@ - + void @@ -69,7 +69,7 @@ - + @@ -77,36 +77,36 @@ - + - + - + - + - + - + devices - + - + - + roboy::io::MultiOutputDeviceact roboy::io::MultiOutputDeviceadd diff --git a/docs/doxyxml/classroboy_1_1io_1_1_roboy_name_detection_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_roboy_name_detection_input.xml old mode 100644 new mode 100755 index 34306f2e..2098b521 --- a/docs/doxyxml/classroboy_1_1io_1_1_roboy_name_detection_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_roboy_name_detection_input.xml @@ -15,7 +15,7 @@ - + @@ -31,7 +31,7 @@ - + void @@ -44,7 +44,7 @@ - + Input @@ -60,7 +60,7 @@ - + @@ -71,30 +71,30 @@ 21.04.2017 Initiates native sphinx function of live speech analysis and checks the stream - + - + - + - + - + - + - + roboy::io::RoboyNameDetectionInputlisten roboy::io::RoboyNameDetectionInputrecog_copy diff --git a/docs/doxyxml/classroboy_1_1io_1_1_test_vision.xml b/docs/doxyxml/classroboy_1_1io_1_1_test_vision.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/classroboy_1_1io_1_1_udp_input.xml b/docs/doxyxml/classroboy_1_1io_1_1_udp_input.xml old mode 100644 new mode 100755 index c5718df6..34718661 --- a/docs/doxyxml/classroboy_1_1io_1_1_udp_input.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_udp_input.xml @@ -15,7 +15,7 @@ - + @@ -35,7 +35,7 @@ - + Input @@ -49,7 +49,7 @@ - + @@ -57,36 +57,36 @@ - + - + - + - + - + - + - + serverSocket - + - + roboy::io::UdpInputlisten roboy::io::UdpInputserverSocket diff --git a/docs/doxyxml/classroboy_1_1io_1_1_udp_output.xml b/docs/doxyxml/classroboy_1_1io_1_1_udp_output.xml old mode 100644 new mode 100755 index da51c99f..e6349325 --- a/docs/doxyxml/classroboy_1_1io_1_1_udp_output.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_udp_output.xml @@ -15,7 +15,7 @@ - + InetAddress @@ -28,7 +28,7 @@ - + int @@ -41,7 +41,7 @@ - + @@ -69,7 +69,7 @@ - + void @@ -87,7 +87,7 @@ - + @@ -95,42 +95,42 @@ - + - + - + - + - + - + serverSocket - + udpEndpointAddress - + - + - + - + roboy::io::UdpOutputact roboy::io::UdpOutputserverSocket diff --git a/docs/doxyxml/classroboy_1_1io_1_1_vision.xml b/docs/doxyxml/classroboy_1_1io_1_1_vision.xml old mode 100644 new mode 100755 index 32933a27..bcc29be3 --- a/docs/doxyxml/classroboy_1_1io_1_1_vision.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_vision.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -60,7 +60,7 @@ - + boolean @@ -73,7 +73,7 @@ - + @@ -81,15 +81,15 @@ - + - + roboyVision - + roboy::io::VisionfindFaces roboy::io::VisiongetInstance diff --git a/docs/doxyxml/classroboy_1_1io_1_1_vision_1_1_vision_callback.xml b/docs/doxyxml/classroboy_1_1io_1_1_vision_1_1_vision_callback.xml old mode 100644 new mode 100755 index c65f4ddf..c322cc58 --- a/docs/doxyxml/classroboy_1_1io_1_1_vision_1_1_vision_callback.xml +++ b/docs/doxyxml/classroboy_1_1io_1_1_vision_1_1_vision_callback.xml @@ -16,7 +16,7 @@ - + boolean @@ -30,7 +30,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -57,28 +57,28 @@ - + - + - + - + - + - + - + roboy::io::Vision::VisionCallbackfaceDetected roboy::io::Vision::VisionCallbackhandleMessage diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_concept.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_concept.xml old mode 100644 new mode 100755 index cd16c896..509b9942 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_concept.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_concept.xml @@ -14,14 +14,14 @@ - + - + roboy::linguistics::Conceptid diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_detected_entity.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_detected_entity.xml old mode 100644 new mode 100755 index 91575869..00b9540d --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_detected_entity.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_detected_entity.xml @@ -14,7 +14,7 @@ - + int @@ -27,7 +27,7 @@ - + @@ -50,7 +50,7 @@ - + Entity @@ -63,7 +63,7 @@ - + int @@ -76,7 +76,7 @@ - + @@ -84,25 +84,25 @@ - + - + - + entity - + - + forms - + roboy::linguistics::DetectedEntityDetectedEntity roboy::linguistics::DetectedEntityentity diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_entity.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_entity.xml old mode 100644 new mode 100755 index 97cc4b04..c2d30034 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_entity.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_entity.xml @@ -14,7 +14,7 @@ - + @@ -33,7 +33,7 @@ - + String @@ -50,7 +50,7 @@ - + Map< String, String > @@ -63,7 +63,7 @@ - + @@ -71,18 +71,18 @@ - + - + - + forms - + roboy::linguistics::EntityEntity roboy::linguistics::Entityforms diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_linguistics.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_linguistics.xml old mode 100644 new mode 100755 index 5954c9c1..906eb0e1 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_linguistics.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_linguistics.xml @@ -17,7 +17,7 @@ - + final List< String > @@ -31,7 +31,7 @@ - + final String @@ -45,7 +45,7 @@ - + final String @@ -59,7 +59,7 @@ - + final String @@ -73,7 +73,7 @@ - + final String @@ -87,7 +87,7 @@ - + final String @@ -101,7 +101,7 @@ - + final String @@ -115,7 +115,7 @@ - + final String @@ -129,7 +129,7 @@ - + final String @@ -143,7 +143,7 @@ - + final String @@ -157,7 +157,7 @@ - + final String @@ -171,7 +171,7 @@ - + final String @@ -185,7 +185,7 @@ - + final String @@ -200,7 +200,7 @@ for a living?". - + final String @@ -214,7 +214,7 @@ for a living?". - + final String @@ -228,7 +228,7 @@ for a living?". - + final String @@ -242,7 +242,21 @@ for a living?". - + + + + final String + final String roboy.linguistics.Linguistics.PARSE + + PARSE + = "parse" + +The confidence score of the machine learning intent classification in the IntentAnalyzer. + + + + + @@ -250,19 +264,19 @@ for a living?". related to linguistics.Most importantly it contains the names of the results of the Analyzer that are stored in an Interpretation object and can be retrieved by the getFeature(String featureName) method. These feature names include: SENTENCE TRIPLE TOKENS POSTAGS KEYWORDS ASSOCIATION PAS NAME CELEBRITY OBJ_ANSWER PRED_ANSWER EMOTION INTENT INTENT_DISTANCE - + - + beMod tobe - + - + roboy::linguistics::LinguisticsASSOCIATION roboy::linguistics::LinguisticsbeMod @@ -273,6 +287,7 @@ for a living?". roboy::linguistics::LinguisticsKEYWORDS roboy::linguistics::LinguisticsNAME roboy::linguistics::LinguisticsOBJ_ANSWER + roboy::linguistics::LinguisticsPARSE roboy::linguistics::LinguisticsPAS roboy::linguistics::LinguisticsPOSTAGS roboy::linguistics::LinguisticsPRED_ANSWER diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_term.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_term.xml old mode 100644 new mode 100755 index 96da158e..c7979c98 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_term.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_term.xml @@ -14,7 +14,7 @@ - + float @@ -27,7 +27,7 @@ - + String @@ -40,7 +40,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -63,18 +63,18 @@ - + - + pos - + - + roboy::linguistics::Termconcept roboy::linguistics::Termpos diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1_triple.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1_triple.xml old mode 100644 new mode 100755 index fa304678..0e766f97 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1_triple.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1_triple.xml @@ -14,7 +14,7 @@ - + String @@ -27,7 +27,7 @@ - + String @@ -40,7 +40,7 @@ - + @@ -67,7 +67,7 @@ - + String @@ -80,14 +80,14 @@ - + Represents a simple who(agens) does what(predicate) to whom(patiens) relation. - + roboy::linguistics::Tripleagens roboy::linguistics::Triplepatiens diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_double_metaphone_encoder.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_double_metaphone_encoder.xml old mode 100644 new mode 100755 index f3ed88bd..fce881e2 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_double_metaphone_encoder.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_double_metaphone_encoder.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + String @@ -52,7 +52,7 @@ - + @@ -60,36 +60,36 @@ This is intended to be used to correct terms that Roboy misunderstood, but currently is not is use. - + - + - + - + - + - + doubleMetaphone - + - + - + roboy::linguistics::phonetics::DoubleMetaphoneEncoderdoubleMetaphone roboy::linguistics::phonetics::DoubleMetaphoneEncoderDoubleMetaphoneEncoder diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_metaphone_encoder.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_metaphone_encoder.xml old mode 100644 new mode 100755 index c6f8c152..cf4bd898 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_metaphone_encoder.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_metaphone_encoder.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + String @@ -52,7 +52,7 @@ - + @@ -60,36 +60,36 @@ This is intended to be used to correct terms that Roboy misunderstood, but currently is not is use. - + - + - + - + - + - + metaphone - + - + - + roboy::linguistics::phonetics::MetaphoneEncoderencode roboy::linguistics::phonetics::MetaphoneEncodermetaphone diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_phonetics.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_phonetics.xml old mode 100644 new mode 100755 index e610bc2e..ef5d7b1d --- a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_phonetics.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_phonetics.xml @@ -15,7 +15,7 @@ - + Map< String, List< String > > @@ -28,7 +28,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -74,24 +74,24 @@ - + - + - + soundex - + codecToWords - + - + roboy::linguistics::phonetics::PhoneticscodecToWords roboy::linguistics::phonetics::Phoneticsmain diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_soundex_encoder.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_soundex_encoder.xml old mode 100644 new mode 100755 index 7903f9d3..684dd3be --- a/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_soundex_encoder.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1phonetics_1_1_soundex_encoder.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + String @@ -52,7 +52,7 @@ - + @@ -60,36 +60,36 @@ This is intended to be used to correct terms that Roboy misunderstood, but currently is not is use. - + - + - + - + - + - + - + soundex - + - + roboy::linguistics::phonetics::SoundexEncoderencode roboy::linguistics::phonetics::SoundexEncodersoundex diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer.xml old mode 100644 new mode 100755 index faff73db..4b1ea1f8 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer.xml @@ -20,7 +20,7 @@ - + @@ -28,30 +28,30 @@ It creates the outputs Linguistics.OBJ_ANSWER for situations where the answer to the question is in the object of the sentence (e.g. "Frank" in the sentence "I am Frank" to the question "Who are you?") and Linguistics.PRED_ANSWER if it is in the predicate or in the predicate and the object combined (e.g. "swimming" in the answer "I like swimming" to the question "What is your hobby?"). - + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::AnswerAnalyzeranalyze diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer_test.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer_test.xml old mode 100644 new mode 100755 index cd78eb6a..7dc934b9 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer_test.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_answer_analyzer_test.xml @@ -15,7 +15,7 @@ - + final OpenNLPPPOSTagger @@ -29,7 +29,7 @@ - + final OpenNLPParser @@ -43,7 +43,7 @@ - + final AnswerAnalyzer @@ -57,7 +57,7 @@ - + @@ -72,7 +72,7 @@ - + void @@ -85,7 +85,7 @@ - + void @@ -98,7 +98,7 @@ - + void @@ -111,7 +111,7 @@ - + void @@ -124,7 +124,7 @@ - + @@ -143,7 +143,7 @@ - + String @@ -160,7 +160,7 @@ - + @@ -168,64 +168,64 @@ - + - + - + - + - + tagger - + - + - + - + - + - + - + answer - + parser - + pos - + tokenizer - + - + - + parser - + roboy::linguistics::sentenceanalysis::AnswerAnalyzerTestanalyze roboy::linguistics::sentenceanalysis::AnswerAnalyzerTestanalyzePred diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector.xml old mode 100644 new mode 100755 index a6f6355e..2c971e04 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector.xml @@ -20,7 +20,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -51,30 +51,30 @@ Puts the answer in the sentenceType variable of the Interpretation object. - + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::DictionaryBasedSentenceTypeDetectoranalyze roboy::linguistics::sentenceanalysis::DictionaryBasedSentenceTypeDetectordetermineSentenceType diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector_test.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector_test.xml old mode 100644 new mode 100755 index 154771b9..0354c040 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector_test.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_dictionary_based_sentence_type_detector_test.xml @@ -15,7 +15,7 @@ - + SimpleTokenizer @@ -29,7 +29,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -52,34 +52,34 @@ - + - + - + - + - + detector - + tokenizer - + - + - + roboy::linguistics::sentenceanalysis::DictionaryBasedSentenceTypeDetectorTestdetector roboy::linguistics::sentenceanalysis::DictionaryBasedSentenceTypeDetectorTesttestWhatIs diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_emotion_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_emotion_analyzer.xml old mode 100644 new mode 100755 index 9187b12d..3cbf6f89 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_emotion_analyzer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_emotion_analyzer.xml @@ -20,7 +20,7 @@ - + @@ -28,30 +28,30 @@ - + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::EmotionAnalyzeranalyze diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_intent_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_intent_analyzer.xml old mode 100644 new mode 100755 index 19267f33..f362bc5f --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_intent_analyzer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_intent_analyzer.xml @@ -15,7 +15,7 @@ - + @@ -34,7 +34,7 @@ - + Interpretation @@ -52,7 +52,7 @@ - + @@ -60,61 +60,61 @@ Stores the highest scoring intent in the Linguistics.INTENT feature and the score in the Linguistics.INTENT_DISTANCE feature. - + - + - + - + - + - + - + ros - + - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + roboy::linguistics::sentenceanalysis::IntentAnalyzeranalyze roboy::linguistics::sentenceanalysis::IntentAnalyzerIntentAnalyzer diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_interpretation.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_interpretation.xml old mode 100644 new mode 100755 index c0350a64..9a179205 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_interpretation.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_interpretation.xml @@ -14,7 +14,7 @@ - + SENTENCE_TYPE @@ -27,7 +27,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -105,7 +105,7 @@ - + Map< String, Object > @@ -118,7 +118,7 @@ - + Object @@ -135,7 +135,7 @@ - + void @@ -152,7 +152,7 @@ - + SENTENCE_TYPE @@ -165,7 +165,7 @@ - + void @@ -182,7 +182,7 @@ - + String @@ -195,7 +195,7 @@ - + @@ -203,25 +203,25 @@ Feature names are listed and documented in the class roboy.linguistics.Linguistics.The interpretation class is also used to pass the output information from the states to the verbalizer class. - + - + sentenceType - + features - + - + - + roboy::linguistics::sentenceanalysis::Interpretationfeatures roboy::linguistics::sentenceanalysis::InterpretationgetFeature diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_ontology_n_e_r_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_ontology_n_e_r_analyzer.xml old mode 100644 new mode 100755 index fe34c179..e8606281 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_ontology_n_e_r_analyzer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_ontology_n_e_r_analyzer.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + Interpretation @@ -48,7 +48,7 @@ - + @@ -56,36 +56,36 @@ - + - + - + - + - + - + entities - + - + - + roboy::linguistics::sentenceanalysis::OntologyNERAnalyzeranalyze roboy::linguistics::sentenceanalysis::OntologyNERAnalyzerentities diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_p_p_o_s_tagger.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_p_p_o_s_tagger.xml old mode 100644 new mode 100755 index 297e6b85..bb405219 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_p_p_o_s_tagger.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_p_p_o_s_tagger.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + Interpretation @@ -48,7 +48,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -75,36 +75,36 @@ - + - + - + - + - + - + tagger - + - + - + roboy::linguistics::sentenceanalysis::OpenNLPPPOSTaggeranalyze roboy::linguistics::sentenceanalysis::OpenNLPPPOSTaggerOpenNLPPPOSTagger diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser.xml old mode 100644 new mode 100755 index 2306dae3..ebfdabda --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + Interpretation @@ -48,7 +48,7 @@ - + StringBuilder @@ -69,7 +69,7 @@ - + @@ -92,7 +92,7 @@ - + Map< SEMANTIC_ROLE, Object > @@ -113,7 +113,7 @@ - + Map< SEMANTIC_ROLE, Object > @@ -134,7 +134,7 @@ - + Map< SEMANTIC_ROLE, Object > @@ -155,7 +155,7 @@ - + @@ -174,7 +174,7 @@ - + @@ -182,36 +182,36 @@ - + - + - + - + - + - + - + - + parser - + roboy::linguistics::sentenceanalysis::OpenNLPParseranalyze roboy::linguistics::sentenceanalysis::OpenNLPParserextractPAS diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser_test.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser_test.xml old mode 100644 new mode 100755 index 8bd963cb..94bb8175 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser_test.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_open_n_l_p_parser_test.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + void @@ -43,7 +43,7 @@ - + void @@ -56,7 +56,7 @@ - + void @@ -69,7 +69,7 @@ - + void @@ -82,7 +82,7 @@ - + void @@ -95,7 +95,7 @@ - + @@ -103,31 +103,31 @@ - + - + - + - + parser - + - + - + parser - + roboy::linguistics::sentenceanalysis::OpenNLPParserTestparser roboy::linguistics::sentenceanalysis::OpenNLPParserTesttestHowAdjective diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_parser_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_parser_analyzer.xml new file mode 100644 index 00000000..554df06c --- /dev/null +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_parser_analyzer.xml @@ -0,0 +1,163 @@ + + + + roboy::linguistics::sentenceanalysis::ParserAnalyzer + roboy.linguistics.sentenceanalysis.Analyzer + + + Socket + Socket roboy.linguistics.sentenceanalysis.ParserAnalyzer.clientSocket + + clientSocket + +Client socket for the parser. + + + + + + + + PrintWriter + PrintWriter roboy.linguistics.sentenceanalysis.ParserAnalyzer.out + + out + +Output stream for the parser. + + + + + + + + BufferedReader + BufferedReader roboy.linguistics.sentenceanalysis.ParserAnalyzer.in + + in + +Input stream from the parser. + + + + + + + + boolean + boolean roboy.linguistics.sentenceanalysis.ParserAnalyzer.debug + + debug + = true + +Boolean variable for debugging purpose. + + + + + + + + + + + roboy.linguistics.sentenceanalysis.ParserAnalyzer.ParserAnalyzer + (int portNumber) + ParserAnalyzer + + int + portNumber + + +A constructor. + +Creates ParserAnalyzer class and connects the parser to DM using a socket. + + + + + + Interpretation + Interpretation roboy.linguistics.sentenceanalysis.ParserAnalyzer.analyze + (Interpretation interpretation) + analyze + analyze + + Interpretation + interpretation + + +An analyzer function. + +Sends input sentence to the parser and saves its response in output interpretation. + +interpretation + + +Input interpretation with currently processed sentence and results from previous analysis. + + +Input interpretation with semantic parser result. + + + + + + + +Semantic parser class. + +Connects DM to Roboy parser and adds its result to interpretation class. + + + + + + + + + + + + + + + + + + + + + + + + + + in + + + clientSocket + + + out + + + + + + + + + + + + + roboy::linguistics::sentenceanalysis::ParserAnalyzeranalyze + roboy::linguistics::sentenceanalysis::ParserAnalyzerclientSocket + roboy::linguistics::sentenceanalysis::ParserAnalyzerdebug + roboy::linguistics::sentenceanalysis::ParserAnalyzerin + roboy::linguistics::sentenceanalysis::ParserAnalyzerout + roboy::linguistics::sentenceanalysis::ParserAnalyzerParserAnalyzer + + + diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_preprocessor.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_preprocessor.xml old mode 100644 new mode 100755 index 8fec6ca6..291a49cc --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_preprocessor.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_preprocessor.xml @@ -20,7 +20,7 @@ - + @@ -28,30 +28,30 @@ - + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::Preprocessoranalyze diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_semantic_parser_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_semantic_parser_analyzer.xml new file mode 100644 index 00000000..3cc5ba5c --- /dev/null +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_semantic_parser_analyzer.xml @@ -0,0 +1,163 @@ + + + + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzer + roboy.linguistics.sentenceanalysis.Analyzer + + + Socket + Socket roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.clientSocket + + clientSocket + +Client socket for the parser. + + + + + + + + PrintWriter + PrintWriter roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.out + + out + +Output stream for the parser. + + + + + + + + BufferedReader + BufferedReader roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.in + + in + +Input stream from the parser. + + + + + + + + boolean + boolean roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.debug + + debug + = true + +Boolean variable for debugging purpose. + + + + + + + + + + + roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.SemanticParserAnalyzer + (int portNumber) + SemanticParserAnalyzer + + int + portNumber + + +A constructor. + +Creates ParserAnalyzer class and connects the parser to DM using a socket. + + + + + + Interpretation + Interpretation roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer.analyze + (Interpretation interpretation) + analyze + analyze + + Interpretation + interpretation + + +An analyzer function. + +Sends input sentence to the parser and saves its response in output interpretation. + +interpretation + + +Input interpretation with currently processed sentence and results from previous analysis. + + +Input interpretation with semantic parser result. + + + + + + + +Semantic parser class. + +Connects DM to Roboy parser and adds its result to interpretation class. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + in + + + clientSocket + + + out + + + + + + + + + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzeranalyze + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzerclientSocket + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzerdebug + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzerin + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzerout + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzerSemanticParserAnalyzer + + + diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_sentence_analyzer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_sentence_analyzer.xml old mode 100644 new mode 100755 index fc43adb2..4a943734 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_sentence_analyzer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_sentence_analyzer.xml @@ -15,7 +15,7 @@ - + @@ -31,7 +31,7 @@ - + Interpretation @@ -49,7 +49,7 @@ - + @@ -80,7 +80,7 @@ - + Triple @@ -101,7 +101,7 @@ - + Triple @@ -122,7 +122,7 @@ - + Triple @@ -143,7 +143,7 @@ - + Triple @@ -164,7 +164,7 @@ - + Triple @@ -185,7 +185,7 @@ - + Triple @@ -206,7 +206,7 @@ - + Triple @@ -227,7 +227,7 @@ - + @@ -235,36 +235,36 @@ - + - + - + - + - + - + - + meanings - + - + roboy::linguistics::sentenceanalysis::SentenceAnalyzeranalyze roboy::linguistics::sentenceanalysis::SentenceAnalyzeranalyzeDoesIt diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_simple_tokenizer.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_simple_tokenizer.xml old mode 100644 new mode 100755 index 953cfba3..d3414b94 --- a/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_simple_tokenizer.xml +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1sentenceanalysis_1_1_simple_tokenizer.xml @@ -20,7 +20,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -47,30 +47,30 @@ - + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::SimpleTokenizeranalyze roboy::linguistics::sentenceanalysis::SimpleTokenizertokenize diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_toy_data_getter.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_toy_data_getter.xml new file mode 100644 index 00000000..3b58207e --- /dev/null +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_toy_data_getter.xml @@ -0,0 +1,165 @@ + + + + roboy::linguistics::word2vec::examples::ToyDataGetter + + + final boolean + final boolean roboy.linguistics.word2vec.examples.ToyDataGetter.verbose + + verbose + + + + + + + + + + final String + final String roboy.linguistics.word2vec.examples.ToyDataGetter.toyDataDirectory + + toyDataDirectory + = "./resources/word2vec_toy_data_and_model/" + + + + + + + + + + final String + final String roboy.linguistics.word2vec.examples.ToyDataGetter.toyDataFilePath + + toyDataFilePath + = "./resources/word2vec_toy_data_and_model/raw_sentences.txt" + + + + + + + + + + final String + final String roboy.linguistics.word2vec.examples.ToyDataGetter.toyDataInetURL + + toyDataInetURL + = "https://raw.githubusercontent.com/deeplearning4j/dl4j-examples/master/dl4j-examples/src/main/resources/raw_sentences.txt" + + + + + + + + + + + + + roboy.linguistics.word2vec.examples.ToyDataGetter.ToyDataGetter + (boolean verbose) + ToyDataGetter + + boolean + verbose + + + + + + + + + + + String + String roboy.linguistics.word2vec.examples.ToyDataGetter.getToyDataFilePath + () + getToyDataFilePath + + + + + + + + + + void + void roboy.linguistics.word2vec.examples.ToyDataGetter.ensureToyDataIsPresent + () + ensureToyDataIsPresent + +Checks if toy data is present on the hard drive. + +It will be downloaded if necessary. + + + + + + + + void + void roboy.linguistics.word2vec.examples.ToyDataGetter.downloadData + (String fromURL, String toFilePath) + downloadData + + String + fromURL + + + String + toFilePath + + throws IOException + + + + + + + + + + boolean + boolean roboy.linguistics.word2vec.examples.ToyDataGetter.fileExists + (String filePath) + fileExists + + String + filePath + + + + + + + + + + + +Utility class to load toy data from the internet if necessary. + +May be refactored into something bigger and more useful later. + + + roboy::linguistics::word2vec::examples::ToyDataGetterdownloadData + roboy::linguistics::word2vec::examples::ToyDataGetterensureToyDataIsPresent + roboy::linguistics::word2vec::examples::ToyDataGetterfileExists + roboy::linguistics::word2vec::examples::ToyDataGettergetToyDataFilePath + roboy::linguistics::word2vec::examples::ToyDataGettertoyDataDirectory + roboy::linguistics::word2vec::examples::ToyDataGettertoyDataFilePath + roboy::linguistics::word2vec::examples::ToyDataGetterToyDataGetter + roboy::linguistics::word2vec::examples::ToyDataGettertoyDataInetURL + roboy::linguistics::word2vec::examples::ToyDataGetterverbose + + + diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_training_example.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_training_example.xml new file mode 100644 index 00000000..8adb593d --- /dev/null +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_training_example.xml @@ -0,0 +1,34 @@ + + + + roboy::linguistics::word2vec::examples::Word2vecTrainingExample + + + void + static void roboy.linguistics.word2vec.examples.Word2vecTrainingExample.main + (String[] args) + main + + String[] + args + + throws Exception + + + + + + + + + + +Neural net that processes text into word-vectors. + +Adapted from org.deeplearning4j.examples.nlp.word2vec.Word2VecRawTextExample + + + roboy::linguistics::word2vec::examples::Word2vecTrainingExamplemain + + + diff --git a/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_uptraining_example.xml b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_uptraining_example.xml new file mode 100644 index 00000000..33f4c924 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1linguistics_1_1word2vec_1_1examples_1_1_word2vec_uptraining_example.xml @@ -0,0 +1,34 @@ + + + + roboy::linguistics::word2vec::examples::Word2vecUptrainingExample + + + void + static void roboy.linguistics.word2vec.examples.Word2vecUptrainingExample.main + (String[] args) + main + + String[] + args + + throws Exception + + + + + + + + + + +Neural net that processes text into word-vectors. + +This example shows how to save/load and train the model.Adapted from org.deeplearning4j.examples.nlp.word2vec.Word2VecUptrainingExample + + + roboy::linguistics::word2vec::examples::Word2vecUptrainingExamplemain + + + diff --git a/docs/doxyxml/classroboy_1_1logic_1_1_intention_classifier.xml b/docs/doxyxml/classroboy_1_1logic_1_1_intention_classifier.xml old mode 100644 new mode 100755 index 8273a95a..1bc763b3 --- a/docs/doxyxml/classroboy_1_1logic_1_1_intention_classifier.xml +++ b/docs/doxyxml/classroboy_1_1logic_1_1_intention_classifier.xml @@ -14,7 +14,7 @@ - + @@ -33,7 +33,7 @@ - + String @@ -50,7 +50,7 @@ - + @@ -58,18 +58,18 @@ - + - + ros - + - + roboy::logic::IntentionClassifierclassify roboy::logic::IntentionClassifierIntentionClassifier diff --git a/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter.xml b/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter.xml old mode 100644 new mode 100755 index 7dcdde17..64b0f60e --- a/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter.xml +++ b/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter.xml @@ -14,7 +14,7 @@ - + @@ -42,7 +42,7 @@ - + @@ -50,18 +50,18 @@ Maps the predicates to the predicate keys of DBpedia and picks the elements of the relation from different arguments of the PAS depending on the relation type. - + - + - + dbpediaRelations - + roboy::logic::PASInterpreterdbpediaRelations roboy::logic::PASInterpreterpas2DBpediaRelation diff --git a/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter_test.xml b/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter_test.xml old mode 100644 new mode 100755 index 71e4c7d3..5739d82d --- a/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter_test.xml +++ b/docs/doxyxml/classroboy_1_1logic_1_1_p_a_s_interpreter_test.xml @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + void @@ -43,7 +43,7 @@ - + void @@ -56,7 +56,7 @@ - + void @@ -69,7 +69,7 @@ - + void @@ -82,7 +82,7 @@ - + void @@ -95,7 +95,7 @@ - + void @@ -108,7 +108,7 @@ - + void @@ -121,7 +121,7 @@ - + void @@ -134,7 +134,7 @@ - + void @@ -147,7 +147,7 @@ - + @@ -155,31 +155,31 @@ - + - + parser - + - + - + - + - + parser - + roboy::logic::PASInterpreterTestparser roboy::logic::PASInterpreterTesttestHowAdjective diff --git a/docs/doxyxml/classroboy_1_1logic_1_1_statement_interpreter.xml b/docs/doxyxml/classroboy_1_1logic_1_1_statement_interpreter.xml old mode 100644 new mode 100755 index 8867cd64..62a80568 --- a/docs/doxyxml/classroboy_1_1logic_1_1_statement_interpreter.xml +++ b/docs/doxyxml/classroboy_1_1logic_1_1_statement_interpreter.xml @@ -38,14 +38,14 @@ - + - + roboy::logic::StatementInterpreterisFromList diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_d_bpedia_memory.xml b/docs/doxyxml/classroboy_1_1memory_1_1_d_bpedia_memory.xml old mode 100644 new mode 100755 index a67aec58..06d9cdfc --- a/docs/doxyxml/classroboy_1_1memory_1_1_d_bpedia_memory.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_d_bpedia_memory.xml @@ -15,7 +15,7 @@ - + final Map< String, String > @@ -28,7 +28,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -74,7 +74,7 @@ - + LinkedHashSet< String > @@ -92,7 +92,7 @@ - + @@ -112,7 +112,7 @@ - + List< Relation > @@ -130,7 +130,7 @@ - + @@ -138,40 +138,40 @@ - + - + - + - + - + - + - + - + dbpediaMemory - + supportedRelations forms - + roboy::memory::DBpediaMemorybuildQueries roboy::memory::DBpediaMemorydbpediaMemory diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon.xml b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon.xml old mode 100644 new mode 100755 index 37c4b0d7..cccc8be4 --- a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon.xml @@ -14,7 +14,7 @@ - + List< LexiconLiteral > @@ -27,7 +27,7 @@ - + Boolean @@ -40,7 +40,7 @@ - + Boolean @@ -53,7 +53,7 @@ - + List< String > @@ -66,7 +66,7 @@ - + @@ -81,7 +81,7 @@ - + List< LexiconLiteral > @@ -111,7 +111,7 @@ - + List< LexiconPredicate > @@ -133,7 +133,7 @@ - + List< LexiconLiteral > @@ -150,7 +150,7 @@ - + List< LexiconLiteral > @@ -171,7 +171,7 @@ - + List< String > @@ -189,7 +189,7 @@ - + @@ -208,7 +208,7 @@ - + @@ -235,7 +235,7 @@ - + @@ -243,30 +243,30 @@ - + - + - + - + - + permutationList - + literalList - + predicateList - + roboy::memory::LexiconaddDomainAndRange roboy::memory::LexiconaddTypeOfOwner diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_literal.xml b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_literal.xml old mode 100644 new mode 100755 index e68c0a3e..024a845f --- a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_literal.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_literal.xml @@ -15,7 +15,7 @@ - + String @@ -28,7 +28,7 @@ - + String @@ -41,7 +41,7 @@ - + String @@ -54,7 +54,7 @@ - + int @@ -67,7 +67,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -133,7 +133,7 @@ - + @@ -162,7 +162,7 @@ - + int @@ -179,7 +179,7 @@ - + @@ -187,40 +187,40 @@ - + - + - + - + - + - + - + typeOfOwner - + scoreComparator - + - + - + roboy::memory::LexiconLiteralcompareTo roboy::memory::LexiconLiterallabel diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_predicate.xml b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_predicate.xml old mode 100644 new mode 100755 index 96f9b81c..cb1c180f --- a/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_predicate.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_lexicon_predicate.xml @@ -15,7 +15,7 @@ - + List< String > @@ -28,7 +28,7 @@ - + String @@ -41,7 +41,7 @@ - + String @@ -54,7 +54,7 @@ - + String @@ -67,7 +67,7 @@ - + String @@ -80,7 +80,7 @@ - + int @@ -93,7 +93,7 @@ - + @@ -117,7 +117,7 @@ - + @@ -132,7 +132,7 @@ - + @@ -153,7 +153,7 @@ - + int @@ -170,7 +170,7 @@ - + @@ -178,41 +178,41 @@ - + - + - + - + - + - + - + - + scoreComparator - + domains ranges - + - + roboy::memory::LexiconPredicatecompareTo roboy::memory::LexiconPredicatedomains diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_neo4j_memory.xml b/docs/doxyxml/classroboy_1_1memory_1_1_neo4j_memory.xml old mode 100644 new mode 100755 index 89b01008..e63f37ec --- a/docs/doxyxml/classroboy_1_1memory_1_1_neo4j_memory.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_neo4j_memory.xml @@ -15,7 +15,7 @@ - + RosMainNode @@ -28,7 +28,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -82,7 +82,7 @@ - + Neo4jMemory @@ -95,7 +95,7 @@ - + @@ -124,7 +124,7 @@ - + MemoryNodeModel @@ -151,7 +151,7 @@ - + ArrayList< Integer > @@ -178,7 +178,7 @@ - + int @@ -196,7 +196,7 @@ - + boolean @@ -222,7 +222,7 @@ - + List< MemoryNodeModel > @@ -249,7 +249,24 @@ - + + + + String + String roboy.memory.Neo4jMemory.determineNodeType + (String relationship) + determineNodeType + + String + relationship + + + + + + + + @@ -257,72 +274,73 @@ - + - + - + - + - + - + - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + - + - + gson - + rosMainNode - + memory - + roboy::memory::Neo4jMemorycreate + roboy::memory::Neo4jMemorydetermineNodeType roboy::memory::Neo4jMemorygetById roboy::memory::Neo4jMemorygetByQuery roboy::memory::Neo4jMemorygetInstance diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_persistent_knowledge.xml b/docs/doxyxml/classroboy_1_1memory_1_1_persistent_knowledge.xml old mode 100644 new mode 100755 index 411dbdb0..81c46488 --- a/docs/doxyxml/classroboy_1_1memory_1_1_persistent_knowledge.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_persistent_knowledge.xml @@ -15,7 +15,7 @@ - + List< Triple > @@ -28,7 +28,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -77,7 +77,7 @@ - + boolean @@ -94,7 +94,7 @@ - + @@ -102,39 +102,39 @@ Can only be used for retrieving and not for storing. - + - + - + - + - + - + - + persistentKnowledge - + memory - + - + roboy::memory::PersistentKnowledgegetInstance roboy::memory::PersistentKnowledgememory diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_roboy_mind.xml b/docs/doxyxml/classroboy_1_1memory_1_1_roboy_mind.xml old mode 100644 new mode 100755 index 1e746f73..acd78bfc --- a/docs/doxyxml/classroboy_1_1memory_1_1_roboy_mind.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_roboy_mind.xml @@ -15,7 +15,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -46,7 +46,7 @@ - + ServiceResponse @@ -67,7 +67,7 @@ - + boolean @@ -92,7 +92,7 @@ - + List< Concept > @@ -113,7 +113,7 @@ - + JsonObject @@ -130,7 +130,7 @@ - + ServiceResponse @@ -159,7 +159,7 @@ - + Concept @@ -180,7 +180,7 @@ - + ServiceResponse @@ -197,7 +197,7 @@ - + @@ -212,7 +212,7 @@ - + @@ -232,7 +232,7 @@ - + List< Concept > @@ -249,7 +249,7 @@ - + boolean @@ -266,7 +266,7 @@ - + Map< String, List< Concept > > @@ -283,7 +283,7 @@ - + @@ -291,33 +291,33 @@ - + - + - + - + - + - + roboyMemory - + - + roboy::memory::RoboyMindAssertProperty roboy::memory::RoboyMindCreateInstance diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_util.xml b/docs/doxyxml/classroboy_1_1memory_1_1_util.xml old mode 100644 new mode 100755 index 59966cb3..8d9bf52e --- a/docs/doxyxml/classroboy_1_1memory_1_1_util.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_util.xml @@ -19,7 +19,7 @@ - + List< String > @@ -37,7 +37,7 @@ - + int @@ -58,7 +58,7 @@ - + int @@ -83,7 +83,7 @@ - + @@ -91,28 +91,28 @@ - + - + - + - + - + - + - + roboy::memory::UtilcalculateLevenshteinDistance roboy::memory::UtilgetPartURI diff --git a/docs/doxyxml/classroboy_1_1memory_1_1_working_memory.xml b/docs/doxyxml/classroboy_1_1memory_1_1_working_memory.xml old mode 100644 new mode 100755 index 5326a6f6..fb5ac94d --- a/docs/doxyxml/classroboy_1_1memory_1_1_working_memory.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1_working_memory.xml @@ -15,7 +15,7 @@ - + @@ -31,7 +31,7 @@ - + Map< String, List< Triple > > @@ -45,7 +45,7 @@ - + Map< String, List< Triple > > @@ -59,7 +59,7 @@ - + @@ -74,7 +74,7 @@ - + @@ -89,7 +89,7 @@ - + void @@ -114,7 +114,7 @@ - + @@ -133,7 +133,7 @@ - + String @@ -146,7 +146,7 @@ - + List< Triple > @@ -163,7 +163,7 @@ - + @@ -171,41 +171,41 @@ - + - + - + - + - + - + - + memory - + patiensTripleMap agensTripleMap predicateTripleMap - + - + roboy::memory::WorkingMemoryaddToMap roboy::memory::WorkingMemoryagensTripleMap diff --git a/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_interlocutor.xml b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_interlocutor.xml old mode 100644 new mode 100755 index 9784cf46..884cae48 --- a/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_interlocutor.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_interlocutor.xml @@ -14,20 +14,20 @@ - + - + boolean - boolean roboy.memory.nodes.Interlocutor.noROS + boolean roboy.memory.nodes.Interlocutor.memoryROS - noROS + memoryROS - + @@ -42,7 +42,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -73,7 +73,7 @@ - + void @@ -90,7 +90,7 @@ Unless something goes wrong during querying, which would affect the following communication severely. - + String @@ -103,15 +103,15 @@ - + - + boolean - boolean roboy.memory.nodes.Interlocutor.hasRelation - (Neo4jRelations type) - hasRelation + boolean roboy.memory.nodes.Interlocutor.hasRelationship + (Neo4jRelationships type) + hasRelationship - Neo4jRelations + Neo4jRelationships type @@ -120,47 +120,45 @@ - + - - void - void roboy.memory.nodes.Interlocutor.addInformation - (String relation, String name) - addInformation - - String - relation - + + ArrayList< Integer > + ArrayList<Integer> roboy.memory.nodes.Interlocutor.getRelationships + (Neo4jRelationships type) + getRelationships - String - name + Neo4jRelationships + type -Adds a new relation to the person node, updating memory. + - + - - - - String - String roboy.memory.nodes.Interlocutor.determineNodeType - (String relation) - determineNodeType + + void + void roboy.memory.nodes.Interlocutor.addInformation + (String relationship, String name) + addInformation String - relation + relationship + + + String + name - +Adds a new relation to the person node, updating memory. - + @@ -168,100 +166,100 @@ - + - + - + - + properties - + labels - - relations + + relationships - + - + - + person - + memory - + - + - + - + - + clients - + rosConnectionLatch - + - + - + clientMap - + - + - + - + - + gson - + rosMainNode - + memory - + - roboy::memory::nodes::InterlocutoraddInformation + roboy::memory::nodes::InterlocutoraddInformation roboy::memory::nodes::InterlocutoraddName - roboy::memory::nodes::InterlocutordetermineNodeType roboy::memory::nodes::InterlocutorFAMILIAR roboy::memory::nodes::InterlocutorgetName - roboy::memory::nodes::InterlocutorhasRelation + roboy::memory::nodes::InterlocutorgetRelationships + roboy::memory::nodes::InterlocutorhasRelationship roboy::memory::nodes::InterlocutorInterlocutor roboy::memory::nodes::Interlocutormemory - roboy::memory::nodes::InterlocutornoROS + roboy::memory::nodes::InterlocutormemoryROS roboy::memory::nodes::Interlocutorperson diff --git a/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_memory_node_model.xml b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_memory_node_model.xml old mode 100644 new mode 100755 index 71be31d6..ef82b12e --- a/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_memory_node_model.xml +++ b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_memory_node_model.xml @@ -14,7 +14,7 @@ - + ArrayList< String > @@ -27,7 +27,7 @@ - + String @@ -40,7 +40,7 @@ - + HashMap< String, Object > @@ -53,20 +53,20 @@ - + - + HashMap< String, ArrayList< Integer > > - HashMap<String, ArrayList<Integer> > roboy.memory.nodes.MemoryNodeModel.relations + HashMap<String, ArrayList<Integer> > roboy.memory.nodes.MemoryNodeModel.relationships - relations + relationships - + @@ -82,7 +82,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -114,7 +114,7 @@ - + int @@ -127,7 +127,7 @@ - + void @@ -144,7 +144,7 @@ - + ArrayList< String > @@ -157,7 +157,7 @@ - + void @@ -174,7 +174,7 @@ - + HashMap< String, Object > @@ -187,7 +187,7 @@ - + Object @@ -204,7 +204,7 @@ - + void @@ -221,7 +221,7 @@ - + void @@ -242,26 +242,26 @@ - + - + HashMap< String, ArrayList< Integer > > - HashMap<String, ArrayList<Integer> > roboy.memory.nodes.MemoryNodeModel.getRelations + HashMap<String, ArrayList<Integer> > roboy.memory.nodes.MemoryNodeModel.getRelationships () - getRelations + getRelationships - + - + ArrayList< Integer > - ArrayList<Integer> roboy.memory.nodes.MemoryNodeModel.getRelation + ArrayList<Integer> roboy.memory.nodes.MemoryNodeModel.getRelationship (String key) - getRelation + getRelationship String key @@ -272,16 +272,16 @@ - + - + void - void roboy.memory.nodes.MemoryNodeModel.setRelations - (HashMap< String, ArrayList< Integer >> relations) - setRelations + void roboy.memory.nodes.MemoryNodeModel.setRelationships + (HashMap< String, ArrayList< Integer >> relationships) + setRelationships HashMap< String, ArrayList< Integer >> - relations + relationships @@ -289,13 +289,13 @@ - + - + void - void roboy.memory.nodes.MemoryNodeModel.setRelation + void roboy.memory.nodes.MemoryNodeModel.setRelationship (String key, Integer id) - setRelation + setRelationship String key @@ -310,7 +310,7 @@ - + void @@ -327,7 +327,7 @@ - + String @@ -344,7 +344,7 @@ - + MemoryNodeModel @@ -365,7 +365,7 @@ - + @@ -373,51 +373,51 @@ - + - + properties - + labels - - relations + + relationships - + - + - + - + roboy::memory::nodes::MemoryNodeModelfromJSON roboy::memory::nodes::MemoryNodeModelgetId roboy::memory::nodes::MemoryNodeModelgetLabels roboy::memory::nodes::MemoryNodeModelgetProperties roboy::memory::nodes::MemoryNodeModelgetProperty - roboy::memory::nodes::MemoryNodeModelgetRelation - roboy::memory::nodes::MemoryNodeModelgetRelations + roboy::memory::nodes::MemoryNodeModelgetRelationship + roboy::memory::nodes::MemoryNodeModelgetRelationships roboy::memory::nodes::MemoryNodeModelid roboy::memory::nodes::MemoryNodeModellabel roboy::memory::nodes::MemoryNodeModellabels roboy::memory::nodes::MemoryNodeModelMemoryNodeModel roboy::memory::nodes::MemoryNodeModelMemoryNodeModel roboy::memory::nodes::MemoryNodeModelproperties - roboy::memory::nodes::MemoryNodeModelrelations + roboy::memory::nodes::MemoryNodeModelrelationships roboy::memory::nodes::MemoryNodeModelsetId roboy::memory::nodes::MemoryNodeModelsetLabel roboy::memory::nodes::MemoryNodeModelsetProperties roboy::memory::nodes::MemoryNodeModelsetProperty - roboy::memory::nodes::MemoryNodeModelsetRelation - roboy::memory::nodes::MemoryNodeModelsetRelations + roboy::memory::nodes::MemoryNodeModelsetRelationship + roboy::memory::nodes::MemoryNodeModelsetRelationships roboy::memory::nodes::MemoryNodeModelsetStripQuery roboy::memory::nodes::MemoryNodeModelstripQuery roboy::memory::nodes::MemoryNodeModeltoJSON diff --git a/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_roboy.xml b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_roboy.xml new file mode 100644 index 00000000..a38edbbe --- /dev/null +++ b/docs/doxyxml/classroboy_1_1memory_1_1nodes_1_1_roboy.xml @@ -0,0 +1,239 @@ + + + + roboy::memory::nodes::Roboy + + + MemoryNodeModel + MemoryNodeModel roboy.memory.nodes.Roboy.roboy + + roboy + + + + + + + + + + boolean + boolean roboy.memory.nodes.Roboy.memoryROS + + memoryROS + + + + + + + + + + + + Neo4jMemory + Neo4jMemory roboy.memory.nodes.Roboy.memory + + memory + + + + + + + + + + + + + roboy.memory.nodes.Roboy.Roboy + (String name) + Roboy + + String + name + + +Initializer for the Roboy node. + + + + + + + + String + String roboy.memory.nodes.Roboy.getName + () + getName + +Method to obtain the name of the Roboy node. + +String name - text containing the name as in the Memory + + + + + + + ArrayList< Integer > + ArrayList<Integer> roboy.memory.nodes.Roboy.getRelationships + (Neo4jRelationships type) + getRelationships + + Neo4jRelationships + type + + +Method to obtain the specific type relationships of the Roboy node. + +ArrayList<Integer> ids - list containing integer IDs of the nodes related to the Roboy by specific relationship type as in the Memory + + + + + + + void + void roboy.memory.nodes.Roboy.addInformation + (String relationship, String name) + addInformation + + String + relationship + + + String + name + + +Adds a new relation to the Roboy node, updating memory. + + + + + + + + + + void + void roboy.memory.nodes.Roboy.InitializeRoboy + (String name) + InitializeRoboy + + String + name + + +This method initializes the roboy property as a node that is in sync with memory and represents the Roboy itself. + +If something goes wrong during querying, Roboy stays empty and soulless, and has to fallback + + + + + + +Encapsulates a MemoryNodeModel and enables dialog states to easily store and retrieve information about Roboy. + + + + + + + + + + + + + + properties + + + labels + + + relationships + + + + + + + roboy + + + memory + + + + + + + + + + + + + + + + + + + clients + + + rosConnectionLatch + + + + + + + + + + clientMap + + + + + + + + + + + + + + + gson + + + rosMainNode + + + memory + + + + + + roboy::memory::nodes::RoboyaddInformation + roboy::memory::nodes::RoboygetName + roboy::memory::nodes::RoboygetRelationships + roboy::memory::nodes::RoboyInitializeRoboy + roboy::memory::nodes::Roboymemory + roboy::memory::nodes::RoboymemoryROS + roboy::memory::nodes::RoboyRoboy + roboy::memory::nodes::Roboyroboy + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine.xml new file mode 100644 index 00000000..231e04e3 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine.xml @@ -0,0 +1,424 @@ + + + + roboy::newDialog::DialogStateMachine + roboy.newDialog.StateBasedPersonality + + + HashMap< String, State > + HashMap<String, State> roboy.newDialog.DialogStateMachine.identifierToState + + identifierToState + + + + + + + + + + State + State roboy.newDialog.DialogStateMachine.activeState + + activeState + + + + + + + + + + State + State roboy.newDialog.DialogStateMachine.initalState + + initalState + + + + + + + + + + boolean + boolean roboy.newDialog.DialogStateMachine.enableDebug + + enableDebug + + + + + + + + + + + + + roboy.newDialog.DialogStateMachine.DialogStateMachine + () + DialogStateMachine + + + + + + + + + + + roboy.newDialog.DialogStateMachine.DialogStateMachine + (boolean enableDebug) + DialogStateMachine + + boolean + enableDebug + + + + + + + + + + + State + State roboy.newDialog.DialogStateMachine.getInitialState + () + getInitialState + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.setInitialState + (State initial) + setInitialState + + State + initial + + +Set the initial state of this state machine. + +The state will be automatically added to the machine. If active state was null, it will be set to the new initial state. + +initial + + +initial state + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.setInitialState + (String identifier) + setInitialState + + String + identifier + + + + + + + + + + + State + State roboy.newDialog.DialogStateMachine.getActiveState + () + getActiveState + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.setActiveState + (State s) + setActiveState + + State + s + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.setActiveState + (String identifier) + setActiveState + + String + identifier + + + + + + + + + + + State + State roboy.newDialog.DialogStateMachine.getStateByIdentifier + (String identifier) + getStateByIdentifier + + String + identifier + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.addState + (State s) + addState + + State + s + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.loadFromString + (String s) + loadFromString + + String + s + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.loadFromFile + (File f) + loadFromFile + + File + f + + throws FileNotFoundException + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.saveToFile + (File f) + saveToFile + + File + f + + throws FileNotFoundException + + + + + + + + + + String + String roboy.newDialog.DialogStateMachine.toJsonString + () + toJsonString + + + + + + + + + + String + String roboy.newDialog.DialogStateMachine.toString + () + toString + + + + + + + + + + boolean + boolean roboy.newDialog.DialogStateMachine.equals + (Object obj) + equals + + Object + obj + + + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachine.loadFromJSON + (JsonElement json) + loadFromJSON + + JsonElement + json + + + + + + + + + + + JsonObject + JsonObject roboy.newDialog.DialogStateMachine.toJsonObject + () + toJsonObject + + + + + + + + + + +State machine to manage dialog states. + +Dialog state machines can be written to files and loaded from them later.Personalities can be implemented using a dialog state machine. + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + + identifierToState + + + initalState + activeState + + + + + + roboy::newDialog::DialogStateMachineactiveState + roboy::newDialog::DialogStateMachineaddState + roboy::newDialog::DialogStateMachineDialogStateMachine + roboy::newDialog::DialogStateMachineDialogStateMachine + roboy::newDialog::DialogStateMachineenableDebug + roboy::newDialog::DialogStateMachineequals + roboy::newDialog::DialogStateMachinegetActiveState + roboy::newDialog::DialogStateMachinegetInitialState + roboy::newDialog::DialogStateMachinegetStateByIdentifier + roboy::newDialog::DialogStateMachineidentifierToState + roboy::newDialog::DialogStateMachineinitalState + roboy::newDialog::DialogStateMachineloadFromFile + roboy::newDialog::DialogStateMachineloadFromJSON + roboy::newDialog::DialogStateMachineloadFromString + roboy::newDialog::DialogStateMachinesaveToFile + roboy::newDialog::DialogStateMachinesetActiveState + roboy::newDialog::DialogStateMachinesetActiveState + roboy::newDialog::DialogStateMachinesetInitialState + roboy::newDialog::DialogStateMachinesetInitialState + roboy::newDialog::DialogStateMachinetoJsonObject + roboy::newDialog::DialogStateMachinetoJsonString + roboy::newDialog::DialogStateMachinetoString + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine_test.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine_test.xml new file mode 100644 index 00000000..40ac16f3 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1_dialog_state_machine_test.xml @@ -0,0 +1,192 @@ + + + + roboy::newDialog::DialogStateMachineTest + + + String + String roboy.newDialog.DialogStateMachineTest.MINI_STATE_MACHINE + + MINI_STATE_MACHINE + = "{\n" + + " \"initialState\": \"Greetings\",\n" + + " \"states\": [\n" + + " {\n" + + " \"identifier\": \"Farewell\",\n" + + " \"implementation\": \"roboy.newDialog.states.toyStates.ToyFarewellState\",\n" + + " \"transitions\": {}\n" + + " },\n" + + " {\n" + + " \"identifier\": \"Greetings\",\n" + + " \"implementation\": \"roboy.newDialog.states.toyStates.ToyGreetingsState\",\n" + + " \"fallback\": \"Farewell\",\n" + + " \"transitions\": {\n" + + " \"next\": \"Farewell\",\n" + + " \"noHello\": \"Farewell\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}" + + + + + + + + + + + + DialogStateMachine + static DialogStateMachine roboy.newDialog.DialogStateMachineTest.fromCode + () + fromCode + + + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.machineEqualsItself + () + machineEqualsItself + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.stringEqualsCode + () + stringEqualsCode + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.notEqualsNoInitialState + () + notEqualsNoInitialState + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.notEqualsDifferentStates + () + notEqualsDifferentStates + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.notEqualsDifferentTransitions + () + notEqualsDifferentTransitions + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.activeStateIsSetToInitialState + () + activeStateIsSetToInitialState + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.machineContainsAllStates + () + machineContainsAllStates + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.transitionsAreOK + () + transitionsAreOK + + + + + + + + + + void + void roboy.newDialog.DialogStateMachineTest.fallbackIsOK + () + fallbackIsOK + + + + + + + + + + + + + + + + roboy::newDialog::DialogStateMachineTestactiveStateIsSetToInitialState + roboy::newDialog::DialogStateMachineTestfallbackIsOK + roboy::newDialog::DialogStateMachineTestfromCode + roboy::newDialog::DialogStateMachineTestmachineContainsAllStates + roboy::newDialog::DialogStateMachineTestmachineEqualsItself + roboy::newDialog::DialogStateMachineTestMINI_STATE_MACHINE + roboy::newDialog::DialogStateMachineTestnotEqualsDifferentStates + roboy::newDialog::DialogStateMachineTestnotEqualsDifferentTransitions + roboy::newDialog::DialogStateMachineTestnotEqualsNoInitialState + roboy::newDialog::DialogStateMachineTeststringEqualsCode + roboy::newDialog::DialogStateMachineTesttransitionsAreOK + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1_new_dialog_system.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1_new_dialog_system.xml new file mode 100644 index 00000000..bd39828e --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1_new_dialog_system.xml @@ -0,0 +1,51 @@ + + + + roboy::newDialog::NewDialogSystem + + + String + static String roboy.newDialog.NewDialogSystem.getPersonalityFilePathFromConfig + () + getPersonalityFilePathFromConfig + throws FileNotFoundException, ConfigurationException + + + + + + + + + + + + void + static void roboy.newDialog.NewDialogSystem.main + (String[] args) + main + + String[] + args + + throws Exception + + + + + + + + + + +Temporary class to test new state based personality. + +Will be be extended and might replace the old DialogSystem in the future. + + + roboy::newDialog::NewDialogSystemgetPersonalityFilePathFromConfig + roboy::newDialog::NewDialogSystemmain + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1_state_based_personality.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1_state_based_personality.xml new file mode 100644 index 00000000..5577209a --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1_state_based_personality.xml @@ -0,0 +1,305 @@ + + + + roboy::newDialog::StateBasedPersonality + roboy.newDialog.DialogStateMachine + roboy.dialog.personality.Personality + + + final Verbalizer + final Verbalizer roboy.newDialog.StateBasedPersonality.verbalizer + + verbalizer + + + + + + + + + + + + + roboy.newDialog.StateBasedPersonality.StateBasedPersonality + (Verbalizer verb) + StateBasedPersonality + + Verbalizer + verb + + + + + + + + + + + List< Action > + List<Action> roboy.newDialog.StateBasedPersonality.startConversation + () + startConversation + +Always called once by the (new) DialogSystem at the beginning of every new conversation. + +list of actions based on act() of the initial/active state + + + + + + + List< Action > + List<Action> roboy.newDialog.StateBasedPersonality.answer + (Interpretation input) + answer + answer + + Interpretation + input + + +The central method of a personality. + +Given an interpretation of all inputs (audio, visual, ...) to Roboy, this method decides which actions to perform in response. + +input + + +The interpretation of the inputs + + +A list of actions to perform in response + + + + + + + + + void + void roboy.newDialog.StateBasedPersonality.reset + () + reset + + + + + + + + + + List< Action > + List<Action> roboy.newDialog.StateBasedPersonality.stateAct + (State state) + stateAct + + State + state + + +Call the act function of the state and verbalize all interpretations into actions. + + + +state + + +state to call ACT on + + +list of actions + + + + + + + List< Action > + List<Action> roboy.newDialog.StateBasedPersonality.stateReact + (State state, Interpretation input) + stateReact + + State + state + + + Interpretation + input + + +Call the react function of the state. + +If the state can't react, recursively ask fallbacks. Verbalize the resulting reaction interpretation into actions. + +state + + +state to call REact on + + + +input + + +input from the person Roboy speaks to + + +list of actions + + + + + + + List< Action > + List<Action> roboy.newDialog.StateBasedPersonality.verbalizeInterpretations + (List< Interpretation > interpretations) + verbalizeInterpretations + + List< Interpretation > + interpretations + + +Verbalizes all interpretations into actions using the verbalizer. + + + +interpretations + + +list of interpretations. + + +list of actions + + + + + + + +Implementation of Personality based on a DialogStateMachine. + +In contrast to previous Personality implementations, this one is more generic as it loads the dialog from a file. Additionally, it is still possible to define the dialog structure directly from code (as it was done in previous implementations).Instead of using nested states that will pass an utterance to each other if a state cannot give an appropriate reaction, we use a fallback concept. If a state doesn't know how to react, it simply doesn't react at all. If a fallback (with is another state) is attached to it, the personality will pass the utterance to the fallback automatically. This concept helps to decouple the states and reduce the dependencies between them. + + + + + + + + + + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + + + verbalizer + + + + + + + + + + + + + + + + + preAnecdotes + farewells + greetings + anecdotes + segues + + + tenthNumberMap + lowNumberMap + + + dayNumberMap + monthNumberMap + + + + + + + identifierToState + + + initalState + activeState + + + + + + + + + roboy::newDialog::StateBasedPersonalityaddState + roboy::newDialog::StateBasedPersonalityanswer + roboy::newDialog::StateBasedPersonalityDialogStateMachine + roboy::newDialog::StateBasedPersonalityDialogStateMachine + roboy::newDialog::StateBasedPersonalityequals + roboy::newDialog::StateBasedPersonalitygetActiveState + roboy::newDialog::StateBasedPersonalitygetInitialState + roboy::newDialog::StateBasedPersonalitygetStateByIdentifier + roboy::newDialog::StateBasedPersonalityloadFromFile + roboy::newDialog::StateBasedPersonalityloadFromString + roboy::newDialog::StateBasedPersonalityreset + roboy::newDialog::StateBasedPersonalitysaveToFile + roboy::newDialog::StateBasedPersonalitysetActiveState + roboy::newDialog::StateBasedPersonalitysetActiveState + roboy::newDialog::StateBasedPersonalitysetInitialState + roboy::newDialog::StateBasedPersonalitysetInitialState + roboy::newDialog::StateBasedPersonalitystartConversation + roboy::newDialog::StateBasedPersonalitystateAct + roboy::newDialog::StateBasedPersonalityStateBasedPersonality + roboy::newDialog::StateBasedPersonalitystateReact + roboy::newDialog::StateBasedPersonalitytoJsonString + roboy::newDialog::StateBasedPersonalitytoString + roboy::newDialog::StateBasedPersonalityverbalizeInterpretations + roboy::newDialog::StateBasedPersonalityverbalizer + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1examples_1_1_state_machine_examples.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1examples_1_1_state_machine_examples.xml new file mode 100644 index 00000000..426f6d61 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1examples_1_1_state_machine_examples.xml @@ -0,0 +1,95 @@ + + + + roboy::newDialog::examples::StateMachineExamples + + + final String + final String roboy.newDialog.examples.StateMachineExamples.toyPersonality + + toyPersonality + + + + + + + + + + + + void + static void roboy.newDialog.examples.StateMachineExamples.main + (String[] args) + main + + String[] + args + + throws Exception + + + + + + + + + + + + DialogStateMachine + static DialogStateMachine roboy.newDialog.examples.StateMachineExamples.fromCode + () + fromCode + + + + + + + + + + DialogStateMachine + static DialogStateMachine roboy.newDialog.examples.StateMachineExamples.fromFile + () + fromFile + throws Exception + + + + + + + + + + DialogStateMachine + static DialogStateMachine roboy.newDialog.examples.StateMachineExamples.fromString + () + fromString + + + + + + + + + + +This class provides examples how to load state machines from files or create them from code directly. + + + + + roboy::newDialog::examples::StateMachineExamplesfromCode + roboy::newDialog::examples::StateMachineExamplesfromFile + roboy::newDialog::examples::StateMachineExamplesfromString + roboy::newDialog::examples::StateMachineExamplesmain + roboy::newDialog::examples::StateMachineExamplestoyPersonality + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1_state.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1_state.xml new file mode 100644 index 00000000..cdfa348b --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1_state.xml @@ -0,0 +1,459 @@ + + + + roboy::newDialog::states::State + roboy.newDialog.states.toyStates.ToyFarewellState + roboy.newDialog.states.toyStates.ToyGreetingsState + roboy.newDialog.states.toyStates.ToyIntroState + roboy.newDialog.states.toyStates.ToyRandomAnswerState + + + String + String roboy.newDialog.states.State.stateIdentifier + + stateIdentifier + + + + + + + + + + State + State roboy.newDialog.states.State.fallback + + fallback + + + + + + + + + + HashMap< String, State > + HashMap<String, State> roboy.newDialog.states.State.transitions + + transitions + + + + + + + + + + + + + roboy.newDialog.states.State.State + (String stateIdentifier) + State + + String + stateIdentifier + + + + + + + + + + + String + String roboy.newDialog.states.State.getIdentifier + () + getIdentifier + + + + + + + + + + void + void roboy.newDialog.states.State.setIdentifier + (String stateIdentifier) + setIdentifier + + String + stateIdentifier + + + + + + + + + + + final State + final State roboy.newDialog.states.State.getFallback + () + getFallback + +If this state can't react to the input, the Personality state machine will ask the fallback state to react to the input. + +This state still remains active. fallback state + + + + + + + final void + final void roboy.newDialog.states.State.setFallback + (State fallback) + setFallback + + State + fallback + + +Set the fallback state. + +The Personality state machine will ask the fallback state if this one has no answer. + +fallback + + +fallback state + + + + + + + + + final void + final void roboy.newDialog.states.State.setTransition + (String name, State goToState) + setTransition + + String + name + + + State + goToState + + +Define a possible transition from this state to another. + +Something like: "next" -> {GreetingState} "rudeInput" -> {EvilState} The next active state will be selected in getNextState() based on internal conditions. + +name + + +name of the transition + + + +goToState + + +state to transit to + + + + + + + + + final State + final State roboy.newDialog.states.State.getTransition + (String name) + getTransition + + String + name + + + + + + + + + + + final HashMap< String, State > + final HashMap<String, State> roboy.newDialog.states.State.getAllTransitions + () + getAllTransitions + + + + + + + + + + abstract List< Interpretation > + abstract List<Interpretation> roboy.newDialog.states.State.act + () + act + +A state always acts after the reaction. + +Both, the reaction of the last and the action of the next state, are combined to give the answer of Roboy. interpretations + + + + + + + abstract List< Interpretation > + abstract List<Interpretation> roboy.newDialog.states.State.react + (Interpretation input) + react + + Interpretation + input + + +Defines how to react to an input. + +This is usually the answer to the incoming question or some other statement. If this state can't react, it can return 'null' to trigger the fallback state for the answer.Note: In the new architecture, react() does not define the next state anymore! Reaction and state transitions are now decoupled. State transitions are defined in getNextState() + +input + + +input from the person we talk to + + +reaction to the input OR null (will trigger the fallback state) + + + + + + + abstract State + abstract State roboy.newDialog.states.State.getNextState + () + getNextState + +After this state has reacted, the personality state machine will ask this state to which state to go next. + +If this state is not ready, it will return itself. Otherwise, depending on internal conditions, this state will select one of the states defined in transitions to be the next one.next actie state after this one has reacted + + + + + + + final boolean + final boolean roboy.newDialog.states.State.allRequiredTransitionsAreInitialized + () + allRequiredTransitionsAreInitialized + +Checks if all required transitions were initialized correctly. + +Required transitions are defined in getRequiredTransitionNames().true if this state was initialized correctly + + + + + + + JsonObject + JsonObject roboy.newDialog.states.State.toJsonObject + () + toJsonObject + + + + + + + + + + String + String roboy.newDialog.states.State.toString + () + toString + + + + + + + + + + boolean + boolean roboy.newDialog.states.State.equals + (Object obj) + equals + + Object + obj + + + + + + + + + + + + + Set< String > + Set<String> roboy.newDialog.states.State.getRequiredTransitionNames + () + getRequiredTransitionNames + +Defines the names of all transition that HAVE to be defined for this state. + +This function is used by allRequiredTransitionsAreInitialized() to make sure this state was initialized correctly. Default implementation requires no transitions to be defined.Override this function in sub classes. a set of transition names that have to be defined + + + + + + + Set< String > + Set<String> roboy.newDialog.states.State.newSet + (String...tNames) + newSet + + String... + tNames + + +Utility function to create and initialize string sets in just one code line. + + + +tNames + + +names of the required transitions + + +set initialized with inputs + + + + + + + + + boolean + boolean roboy.newDialog.states.State.equalsHelper_compareTransitions + (State other) + equalsHelper_compareTransitions + + State + other + + +check if every transition of this is present in the other and points to the same ID + + + +other + + +other state to compare transitions + + +true if all transitions of this state are present in the other state + + + + + + + +Central class of the dialog state system. + +Every dialog state should extend this class. A state always acts when it is entered and reacts when its left. Both, the reaction of the last and the action of the next state, are combined to give the answer of Roboy.A state can have any number of transitions to other states. Every transition has a name (like "next" or "errorState"). When designing a new state, only the transition names are known. At run time the transitions will point to other states. You can get the attached state by the transition name using getTransition(transitionName).A fallback can be attached to a state. In the case this state doesn't know how to react to an utterance, it can return null from the react() function. The state machine will query the fallback in this case. More details on the fallback concept can be found in the description of the StateBasedPersonality and in comments below. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + roboy::newDialog::states::Stateact + roboy::newDialog::states::StateallRequiredTransitionsAreInitialized + roboy::newDialog::states::Stateequals + roboy::newDialog::states::StateequalsHelper_compareTransitions + roboy::newDialog::states::Statefallback + roboy::newDialog::states::StategetAllTransitions + roboy::newDialog::states::StategetFallback + roboy::newDialog::states::StategetIdentifier + roboy::newDialog::states::StategetNextState + roboy::newDialog::states::StategetRequiredTransitionNames + roboy::newDialog::states::StategetTransition + roboy::newDialog::states::StatenewSet + roboy::newDialog::states::Statereact + roboy::newDialog::states::StatesetFallback + roboy::newDialog::states::StatesetIdentifier + roboy::newDialog::states::StatesetTransition + roboy::newDialog::states::StateState + roboy::newDialog::states::StatestateIdentifier + roboy::newDialog::states::StatetoJsonObject + roboy::newDialog::states::StatetoString + roboy::newDialog::states::Statetransitions + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1factories_1_1_toy_state_factory.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1factories_1_1_toy_state_factory.xml new file mode 100644 index 00000000..cd9fdc0e --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1factories_1_1_toy_state_factory.xml @@ -0,0 +1,37 @@ + + + + roboy::newDialog::states::factories::ToyStateFactory + + + State + static State roboy.newDialog.states.factories.ToyStateFactory.getByClassName + (String className, String instanceName) + getByClassName + + String + className + + + String + instanceName + + + + + + + + + + + +Temporary factory to create State objects based on class name. + +May be replaced with something more generic later. + + + roboy::newDialog::states::factories::ToyStateFactorygetByClassName + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_farewell_state.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_farewell_state.xml new file mode 100644 index 00000000..09f449bf --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_farewell_state.xml @@ -0,0 +1,127 @@ + + + + roboy::newDialog::states::toyStates::ToyFarewellState + roboy.newDialog.states.State + + + + roboy.newDialog.states.toyStates.ToyFarewellState.ToyFarewellState + (String stateIdentifier) + ToyFarewellState + + String + stateIdentifier + + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyFarewellState.act + () + act + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyFarewellState.react + (Interpretation input) + react + + Interpretation + input + + + + + + + + + + + State + State roboy.newDialog.states.toyStates.ToyFarewellState.getNextState + () + getNextState + + + + + + + + + + +ToyFarewellState always acts with "Bye bye". + +The Interlocutor answer is ignored and there is no reaction. This ends the conversation.Fallback is not required. This state has no outgoing transitions. + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + + + + + + + roboy::newDialog::states::toyStates::ToyFarewellStateact + roboy::newDialog::states::toyStates::ToyFarewellStateallRequiredTransitionsAreInitialized + roboy::newDialog::states::toyStates::ToyFarewellStateequals + roboy::newDialog::states::toyStates::ToyFarewellStategetAllTransitions + roboy::newDialog::states::toyStates::ToyFarewellStategetFallback + roboy::newDialog::states::toyStates::ToyFarewellStategetIdentifier + roboy::newDialog::states::toyStates::ToyFarewellStategetNextState + roboy::newDialog::states::toyStates::ToyFarewellStategetRequiredTransitionNames + roboy::newDialog::states::toyStates::ToyFarewellStategetTransition + roboy::newDialog::states::toyStates::ToyFarewellStatenewSet + roboy::newDialog::states::toyStates::ToyFarewellStatereact + roboy::newDialog::states::toyStates::ToyFarewellStatesetFallback + roboy::newDialog::states::toyStates::ToyFarewellStatesetIdentifier + roboy::newDialog::states::toyStates::ToyFarewellStatesetTransition + roboy::newDialog::states::toyStates::ToyFarewellStateState + roboy::newDialog::states::toyStates::ToyFarewellStatetoJsonObject + roboy::newDialog::states::toyStates::ToyFarewellStatetoString + roboy::newDialog::states::toyStates::ToyFarewellStateToyFarewellState + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_greetings_state.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_greetings_state.xml new file mode 100644 index 00000000..fa5bc3c9 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_greetings_state.xml @@ -0,0 +1,161 @@ + + + + roboy::newDialog::states::toyStates::ToyGreetingsState + roboy.newDialog.states.State + + + boolean + boolean roboy.newDialog.states.toyStates.ToyGreetingsState.inputOK + + inputOK + = true + + + + + + + + + + + + + roboy.newDialog.states.toyStates.ToyGreetingsState.ToyGreetingsState + (String stateIdentifier) + ToyGreetingsState + + String + stateIdentifier + + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyGreetingsState.act + () + act + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyGreetingsState.react + (Interpretation input) + react + + Interpretation + input + + + + + + + + + + + State + State roboy.newDialog.states.toyStates.ToyGreetingsState.getNextState + () + getNextState + + + + + + + + + + + + Set< String > + Set<String> roboy.newDialog.states.toyStates.ToyGreetingsState.getRequiredTransitionNames + () + getRequiredTransitionNames + + + + + + + + + + +ToyGreetingsState can be used as the initial state. + +Roboy will greet the Interlocutor with "Hello".If the response is a greeting, the "next" transition is taken. Otherwise the fallback will be triggered and the "noHello" transition is taken.Fallback is required. Outgoing transitions that have to be defined: +next: following state if there was a greetingnoHello: following state if there was NO greeting + + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + + + + + + + roboy::newDialog::states::toyStates::ToyGreetingsStateact + roboy::newDialog::states::toyStates::ToyGreetingsStateallRequiredTransitionsAreInitialized + roboy::newDialog::states::toyStates::ToyGreetingsStateequals + roboy::newDialog::states::toyStates::ToyGreetingsStategetAllTransitions + roboy::newDialog::states::toyStates::ToyGreetingsStategetFallback + roboy::newDialog::states::toyStates::ToyGreetingsStategetIdentifier + roboy::newDialog::states::toyStates::ToyGreetingsStategetNextState + roboy::newDialog::states::toyStates::ToyGreetingsStategetRequiredTransitionNames + roboy::newDialog::states::toyStates::ToyGreetingsStategetTransition + roboy::newDialog::states::toyStates::ToyGreetingsStateinputOK + roboy::newDialog::states::toyStates::ToyGreetingsStatenewSet + roboy::newDialog::states::toyStates::ToyGreetingsStatereact + roboy::newDialog::states::toyStates::ToyGreetingsStatesetFallback + roboy::newDialog::states::toyStates::ToyGreetingsStatesetIdentifier + roboy::newDialog::states::toyStates::ToyGreetingsStatesetTransition + roboy::newDialog::states::toyStates::ToyGreetingsStateState + roboy::newDialog::states::toyStates::ToyGreetingsStatetoJsonObject + roboy::newDialog::states::toyStates::ToyGreetingsStatetoString + roboy::newDialog::states::toyStates::ToyGreetingsStateToyGreetingsState + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_intro_state.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_intro_state.xml new file mode 100644 index 00000000..868dee6c --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_intro_state.xml @@ -0,0 +1,144 @@ + + + + roboy::newDialog::states::toyStates::ToyIntroState + roboy.newDialog.states.State + + + + roboy.newDialog.states.toyStates.ToyIntroState.ToyIntroState + (String stateIdentifier) + ToyIntroState + + String + stateIdentifier + + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyIntroState.act + () + act + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyIntroState.react + (Interpretation input) + react + + Interpretation + input + + + + + + + + + + + State + State roboy.newDialog.states.toyStates.ToyIntroState.getNextState + () + getNextState + + + + + + + + + + + + Set< String > + Set<String> roboy.newDialog.states.toyStates.ToyIntroState.getRequiredTransitionNames + () + getRequiredTransitionNames + + + + + + + + + + +ToyIntroState demonstrates a simple introduction. + +Roboy will tell the Interlocutor his name and ask for the Interlocutor's name. The reply is ignored.Fallback is not required. Outgoing transitions that have to be defined: +next: following state + + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + + + + + + + roboy::newDialog::states::toyStates::ToyIntroStateact + roboy::newDialog::states::toyStates::ToyIntroStateallRequiredTransitionsAreInitialized + roboy::newDialog::states::toyStates::ToyIntroStateequals + roboy::newDialog::states::toyStates::ToyIntroStategetAllTransitions + roboy::newDialog::states::toyStates::ToyIntroStategetFallback + roboy::newDialog::states::toyStates::ToyIntroStategetIdentifier + roboy::newDialog::states::toyStates::ToyIntroStategetNextState + roboy::newDialog::states::toyStates::ToyIntroStategetRequiredTransitionNames + roboy::newDialog::states::toyStates::ToyIntroStategetTransition + roboy::newDialog::states::toyStates::ToyIntroStatenewSet + roboy::newDialog::states::toyStates::ToyIntroStatereact + roboy::newDialog::states::toyStates::ToyIntroStatesetFallback + roboy::newDialog::states::toyStates::ToyIntroStatesetIdentifier + roboy::newDialog::states::toyStates::ToyIntroStatesetTransition + roboy::newDialog::states::toyStates::ToyIntroStateState + roboy::newDialog::states::toyStates::ToyIntroStatetoJsonObject + roboy::newDialog::states::toyStates::ToyIntroStatetoString + roboy::newDialog::states::toyStates::ToyIntroStateToyIntroState + + + diff --git a/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_random_answer_state.xml b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_random_answer_state.xml new file mode 100644 index 00000000..d8ac8ef2 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1new_dialog_1_1states_1_1toy_states_1_1_toy_random_answer_state.xml @@ -0,0 +1,127 @@ + + + + roboy::newDialog::states::toyStates::ToyRandomAnswerState + roboy.newDialog.states.State + + + + roboy.newDialog.states.toyStates.ToyRandomAnswerState.ToyRandomAnswerState + (String stateIdentifier) + ToyRandomAnswerState + + String + stateIdentifier + + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyRandomAnswerState.act + () + act + + + + + + + + + + List< Interpretation > + List<Interpretation> roboy.newDialog.states.toyStates.ToyRandomAnswerState.react + (Interpretation input) + react + + Interpretation + input + + + + + + + + + + + State + State roboy.newDialog.states.toyStates.ToyRandomAnswerState.getNextState + () + getNextState + + + + + + + + + + +ToyRandomAnswerState is meant to be used as a fallback state. + +It only implements the react() function returning a hardcoded random answer. This state should never become active (meaning that no transition should point to it.)Fallback is not required (this state should be the fallback). This state has no outgoing transitions. + + + + + + + + + + + + + + + + + + + + + + + + transitions + + + fallback + + + + + + + + + roboy::newDialog::states::toyStates::ToyRandomAnswerStateact + roboy::newDialog::states::toyStates::ToyRandomAnswerStateallRequiredTransitionsAreInitialized + roboy::newDialog::states::toyStates::ToyRandomAnswerStateequals + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetAllTransitions + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetFallback + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetIdentifier + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetNextState + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetRequiredTransitionNames + roboy::newDialog::states::toyStates::ToyRandomAnswerStategetTransition + roboy::newDialog::states::toyStates::ToyRandomAnswerStatenewSet + roboy::newDialog::states::toyStates::ToyRandomAnswerStatereact + roboy::newDialog::states::toyStates::ToyRandomAnswerStatesetFallback + roboy::newDialog::states::toyStates::ToyRandomAnswerStatesetIdentifier + roboy::newDialog::states::toyStates::ToyRandomAnswerStatesetTransition + roboy::newDialog::states::toyStates::ToyRandomAnswerStateState + roboy::newDialog::states::toyStates::ToyRandomAnswerStatetoJsonObject + roboy::newDialog::states::toyStates::ToyRandomAnswerStatetoString + roboy::newDialog::states::toyStates::ToyRandomAnswerStateToyRandomAnswerState + + + diff --git a/docs/doxyxml/classroboy_1_1ros_1_1_ros.xml b/docs/doxyxml/classroboy_1_1ros_1_1_ros.xml old mode 100644 new mode 100755 index 78e1cab8..a38dbbf9 --- a/docs/doxyxml/classroboy_1_1ros_1_1_ros.xml +++ b/docs/doxyxml/classroboy_1_1ros_1_1_ros.xml @@ -14,7 +14,7 @@ - + final String @@ -28,7 +28,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -58,7 +58,7 @@ - + void @@ -71,7 +71,7 @@ - + @@ -79,15 +79,15 @@ - + - + ros - + roboy::ros::Rosclose roboy::ros::RosgetInstance diff --git a/docs/doxyxml/classroboy_1_1ros_1_1_ros_main_node.xml b/docs/doxyxml/classroboy_1_1ros_1_1_ros_main_node.xml old mode 100644 new mode 100755 index bd3b24c2..1280d0e3 --- a/docs/doxyxml/classroboy_1_1ros_1_1_ros_main_node.xml +++ b/docs/doxyxml/classroboy_1_1ros_1_1_ros_main_node.xml @@ -15,7 +15,7 @@ - + RosManager @@ -29,7 +29,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -94,7 +94,7 @@ - + GraphName @@ -107,7 +107,7 @@ - + void @@ -124,7 +124,7 @@ - + boolean @@ -141,7 +141,7 @@ - + String @@ -154,7 +154,7 @@ - + String @@ -171,7 +171,7 @@ - + boolean @@ -188,7 +188,7 @@ - + String @@ -205,7 +205,7 @@ - + String @@ -222,7 +222,7 @@ - + String @@ -239,7 +239,7 @@ - + String @@ -256,7 +256,7 @@ - + String @@ -273,7 +273,7 @@ - + Object @@ -290,7 +290,7 @@ - + @@ -328,7 +328,7 @@ - + @@ -336,47 +336,47 @@ - + - + - + - + - + - + - + - + clients - + rosConnectionLatch - + - + clientMap - + - + roboy::ros::RosMainNodeclients roboy::ros::RosMainNodeCreateMemoryQuery diff --git a/docs/doxyxml/classroboy_1_1ros_1_1_ros_manager.xml b/docs/doxyxml/classroboy_1_1ros_1_1_ros_manager.xml old mode 100644 new mode 100755 index 0fdf8f97..d2a08bed --- a/docs/doxyxml/classroboy_1_1ros_1_1_ros_manager.xml +++ b/docs/doxyxml/classroboy_1_1ros_1_1_ros_manager.xml @@ -14,7 +14,7 @@ - + @@ -33,7 +33,7 @@ - + boolean @@ -50,7 +50,7 @@ Important if SHUTDOWN_ON_ROS_FAILURE is false. - + ServiceClient @@ -67,7 +67,7 @@ the return might need casting before further use. - + @@ -75,18 +75,18 @@ If SHUTDOWN_ON_ROS_FAILURE is set, throws a runtime exception if any of the clients failed to initialize. - + - + - + clientMap - + roboy::ros::RosManagerclientMap roboy::ros::RosManagergetServiceClient diff --git a/docs/doxyxml/classroboy_1_1ros_1_1_ros_node.xml b/docs/doxyxml/classroboy_1_1ros_1_1_ros_node.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/classroboy_1_1talk_1_1_statement_builder.xml b/docs/doxyxml/classroboy_1_1talk_1_1_statement_builder.xml old mode 100644 new mode 100755 index 9d0b2e37..766de40e --- a/docs/doxyxml/classroboy_1_1talk_1_1_statement_builder.xml +++ b/docs/doxyxml/classroboy_1_1talk_1_1_statement_builder.xml @@ -27,14 +27,14 @@ - + - + roboy::talk::StatementBuilderrandom diff --git a/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer.xml b/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer.xml old mode 100644 new mode 100755 index 5d9641b1..47a117c7 --- a/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer.xml +++ b/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer.xml @@ -16,7 +16,7 @@ - + final List< String > @@ -32,7 +32,7 @@ - + @@ -49,7 +49,7 @@ - + final List< String > @@ -64,7 +64,7 @@ - + final List< String > @@ -80,7 +80,7 @@ - + final Map< String, String > @@ -93,7 +93,7 @@ - + final Map< Integer, String > @@ -127,7 +127,7 @@ - + final Map< String, String > @@ -163,7 +163,7 @@ - + final Map< Integer, String > @@ -174,7 +174,7 @@ 1,"ten", 2,"twenty", 3,"thirty", - 4,"fourty", + 4,"forty", 5,"fifty", 6,"sixty", 7,"seventy", @@ -187,7 +187,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -234,7 +234,7 @@ - + ShutDownAction @@ -251,7 +251,7 @@ - + SpeechAction @@ -268,7 +268,7 @@ - + SpeechAction @@ -285,7 +285,7 @@ - + Interpretation @@ -302,7 +302,7 @@ - + String @@ -319,7 +319,7 @@ - + SpeechAction @@ -336,7 +336,7 @@ - + @@ -344,36 +344,36 @@ This should in the future lead to diversifying the ways Roboy is expressing information. - + - + - + - + preAnecdotes farewells greetings anecdotes segues - + tenthNumberMap lowNumberMap - + dayNumberMap monthNumberMap - + - + roboy::talk::Verbalizeranecdote roboy::talk::Verbalizeranecdotes diff --git a/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer_test.xml b/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer_test.xml old mode 100644 new mode 100755 index 2a93bb3e..2fb8515d --- a/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer_test.xml +++ b/docs/doxyxml/classroboy_1_1talk_1_1_verbalizer_test.xml @@ -14,14 +14,14 @@ - + - + roboy::talk::VerbalizerTesttestDates diff --git a/docs/doxyxml/classroboy_1_1util_1_1_concept.xml b/docs/doxyxml/classroboy_1_1util_1_1_concept.xml old mode 100644 new mode 100755 index 10129d8e..7dd5721e --- a/docs/doxyxml/classroboy_1_1util_1_1_concept.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_concept.xml @@ -14,7 +14,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -63,7 +63,7 @@ - + void @@ -84,7 +84,7 @@ - + void @@ -101,7 +101,7 @@ - + Map< String, Object > @@ -114,7 +114,7 @@ - + Object @@ -131,7 +131,7 @@ - + String @@ -144,7 +144,7 @@ - + String @@ -157,7 +157,7 @@ - + boolean @@ -174,7 +174,7 @@ - + Object @@ -187,7 +187,7 @@ - + boolean @@ -200,7 +200,7 @@ - + int @@ -213,7 +213,7 @@ - + @@ -221,18 +221,18 @@ - + - + attributes - + - + roboy::util::ConceptaddAttribute roboy::util::ConceptaddAttributes diff --git a/docs/doxyxml/classroboy_1_1util_1_1_i_o.xml b/docs/doxyxml/classroboy_1_1util_1_1_i_o.xml old mode 100644 new mode 100755 index 1d74a856..98ff1a3b --- a/docs/doxyxml/classroboy_1_1util_1_1_i_o.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_i_o.xml @@ -18,7 +18,7 @@ - + String @@ -35,7 +35,7 @@ - + List< String > @@ -52,7 +52,7 @@ - + List< String > @@ -69,14 +69,14 @@ - + Helper class for IO related tasks. - + roboy::util::IOreadFile roboy::util::IOreadFile diff --git a/docs/doxyxml/classroboy_1_1util_1_1_json_entry_model.xml b/docs/doxyxml/classroboy_1_1util_1_1_json_entry_model.xml new file mode 100644 index 00000000..b65b7e68 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1util_1_1_json_entry_model.xml @@ -0,0 +1,76 @@ + + + + roboy::util::JsonEntryModel + + + List< String > + List<String> roboy.util.JsonEntryModel.Q + + Q + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonEntryModel.A + + A + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonEntryModel.FUP + + FUP + + + + + + + + + + + + + + + + + + + + + + + + + Q + + + FUP + A + + + + + + roboy::util::JsonEntryModelA + roboy::util::JsonEntryModelFUP + roboy::util::JsonEntryModelQ + + + diff --git a/docs/doxyxml/classroboy_1_1util_1_1_json_model.xml b/docs/doxyxml/classroboy_1_1util_1_1_json_model.xml new file mode 100644 index 00000000..ca0e91f1 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1util_1_1_json_model.xml @@ -0,0 +1,175 @@ + + + + roboy::util::JsonModel + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.name + + name + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.FROM + + FROM + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.HAS_HOBBY + + HAS_HOBBY + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.LIVE_IN + + LIVE_IN + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.FRIEND_OF + + FRIEND_OF + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.STUDY_AT + + STUDY_AT + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.MEMBER_OF + + MEMBER_OF + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.WORK_FOR + + WORK_FOR + + + + + + + + + + JsonEntryModel + JsonEntryModel roboy.util.JsonModel.OCCUPIED_AS + + OCCUPIED_AS + + + + + + + + + + + + + + + + + + + + + + + + + FRIEND_OF + MEMBER_OF + WORK_FOR + STUDY_AT + OCCUPIED_AS + FROM + LIVE_IN + HAS_HOBBY + name + + + + + + + Q + + + FUP + A + + + + + + roboy::util::JsonModelFRIEND_OF + roboy::util::JsonModelFROM + roboy::util::JsonModelHAS_HOBBY + roboy::util::JsonModelLIVE_IN + roboy::util::JsonModelMEMBER_OF + roboy::util::JsonModelname + roboy::util::JsonModelOCCUPIED_AS + roboy::util::JsonModelSTUDY_AT + roboy::util::JsonModelWORK_FOR + + + diff --git a/docs/doxyxml/classroboy_1_1util_1_1_json_q_a_values.xml b/docs/doxyxml/classroboy_1_1util_1_1_json_q_a_values.xml new file mode 100644 index 00000000..ebaa64f5 --- /dev/null +++ b/docs/doxyxml/classroboy_1_1util_1_1_json_q_a_values.xml @@ -0,0 +1,207 @@ + + + + roboy::util::JsonQAValues + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.questions + + questions + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.successAnswers + + successAnswers + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.failureAnswers + + failureAnswers + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.followUp + + followUp + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.answersFollowUp + + answersFollowUp + + + + + + + + + + + + + roboy.util.JsonQAValues.JsonQAValues + (Map< String, List< String >> questions, Map< String, List< String >> successAnswers, Map< String, List< String >> failureAnswers, Map< String, List< String >> followUp, Map< String, List< String >> answersFollowUp) + JsonQAValues + + Map< String, List< String >> + questions + + + Map< String, List< String >> + successAnswers + + + Map< String, List< String >> + failureAnswers + + + Map< String, List< String >> + followUp + + + Map< String, List< String >> + answersFollowUp + + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.getQuestions + () + getQuestions + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.getSuccessAnswers + () + getSuccessAnswers + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.getFailureAnswers + () + getFailureAnswers + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.getFollowUpQuestions + () + getFollowUpQuestions + + + + + + + + + + Map< String, List< String > > + Map<String, List<String> > roboy.util.JsonQAValues.getFollowUpAnswers + () + getFollowUpAnswers + + + + + + + + + + + + + + + + + + + + + + answersFollowUp + successAnswers + questions + followUp + failureAnswers + + + + + + roboy::util::JsonQAValuesanswersFollowUp + roboy::util::JsonQAValuesfailureAnswers + roboy::util::JsonQAValuesfollowUp + roboy::util::JsonQAValuesgetFailureAnswers + roboy::util::JsonQAValuesgetFollowUpAnswers + roboy::util::JsonQAValuesgetFollowUpQuestions + roboy::util::JsonQAValuesgetQuestions + roboy::util::JsonQAValuesgetSuccessAnswers + roboy::util::JsonQAValuesJsonQAValues + roboy::util::JsonQAValuesquestions + roboy::util::JsonQAValuessuccessAnswers + + + diff --git a/docs/doxyxml/classroboy_1_1util_1_1_json_utils.xml b/docs/doxyxml/classroboy_1_1util_1_1_json_utils.xml old mode 100644 new mode 100755 index d47fb43a..59d6a059 --- a/docs/doxyxml/classroboy_1_1util_1_1_json_utils.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_json_utils.xml @@ -3,6 +3,23 @@ roboy::util::JsonUtils + + JsonQAValues + static JsonQAValues roboy.util.JsonUtils.getQuestionsAndAnswersFromJson + (String file) + getQuestionsAndAnswersFromJson + + String + file + + +Fetches the complite JSON string, splits and converts the most straightforward way into backward-compatible Map<> entries initializing a backward-compatible JsonQAValues class. + + + + + + Map< String, List< String > > static Map<String, List<String> > roboy.util.JsonUtils.getSentencesFromJsonFile @@ -18,7 +35,7 @@ - + Map< String, List< String[]> > @@ -35,15 +52,16 @@ - + - + + roboy::util::JsonUtilsgetQuestionsAndAnswersFromJson roboy::util::JsonUtilsgetSentenceArraysFromJsonFile roboy::util::JsonUtilsgetSentencesFromJsonFile diff --git a/docs/doxyxml/classroboy_1_1util_1_1_lists.xml b/docs/doxyxml/classroboy_1_1util_1_1_lists.xml old mode 100644 new mode 100755 index ad97c016..1ea55028 --- a/docs/doxyxml/classroboy_1_1util_1_1_lists.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_lists.xml @@ -18,7 +18,7 @@ - + List< Interpretation > @@ -35,7 +35,7 @@ - + List< String > @@ -52,7 +52,7 @@ - + List< String[]> @@ -69,14 +69,14 @@ - + Helper class for list related tasks. - + roboy::util::ListsactionList roboy::util::ListsinterpretationList diff --git a/docs/doxyxml/classroboy_1_1util_1_1_maps.xml b/docs/doxyxml/classroboy_1_1util_1_1_maps.xml old mode 100644 new mode 100755 index beabd653..635e49b1 --- a/docs/doxyxml/classroboy_1_1util_1_1_maps.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_maps.xml @@ -18,7 +18,7 @@ - + Map< String, Object > @@ -35,7 +35,7 @@ - + Map< String, Reaction > @@ -52,7 +52,7 @@ - + Map< Integer, String > @@ -69,14 +69,14 @@ - + Helper class for map related tasks. - + roboy::util::MapsintStringMap roboy::util::MapsstringMap diff --git a/docs/doxyxml/classroboy_1_1util_1_1_relation.xml b/docs/doxyxml/classroboy_1_1util_1_1_relation.xml old mode 100644 new mode 100755 index 67ee6ff0..cbc669f7 --- a/docs/doxyxml/classroboy_1_1util_1_1_relation.xml +++ b/docs/doxyxml/classroboy_1_1util_1_1_relation.xml @@ -14,7 +14,7 @@ - + Concept @@ -27,7 +27,7 @@ - + String @@ -40,7 +40,7 @@ - + @@ -67,7 +67,7 @@ - + String @@ -80,7 +80,7 @@ - + String @@ -93,7 +93,7 @@ - + @@ -101,26 +101,26 @@ - + - + subject object - + - + attributes - + - + roboy::util::RelationgetObject roboy::util::RelationgetSubject diff --git a/docs/doxyxml/classroboy_1_1util_1_1_ros.xml b/docs/doxyxml/classroboy_1_1util_1_1_ros.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/classroboy_1_1util_1_1ros_1_1_ros_communication_test.xml b/docs/doxyxml/classroboy_1_1util_1_1ros_1_1_ros_communication_test.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/combine.xslt b/docs/doxyxml/combine.xslt old mode 100644 new mode 100755 diff --git a/docs/doxyxml/compound.xsd b/docs/doxyxml/compound.xsd old mode 100644 new mode 100755 diff --git a/docs/doxyxml/dialog_2personality_2states_2_state_8java.xml b/docs/doxyxml/dialog_2personality_2states_2_state_8java.xml new file mode 100644 index 00000000..c4729131 --- /dev/null +++ b/docs/doxyxml/dialog_2personality_2states_2_state_8java.xml @@ -0,0 +1,27 @@ + + + + State.java + roboy::dialog::personality::states::State + roboy::dialog::personality::states + + + + + +packageroboy.dialog.personality.states; + +importjava.util.List; + +importroboy.linguistics.sentenceanalysis.Interpretation; + +publicinterfaceState{ + +publicList<Interpretation>act(); + +publicReactionreact(Interpretationinput); +} + + + + diff --git a/docs/doxyxml/dir_029141a1c7d6ffd5a4e073b2543b9713.xml b/docs/doxyxml/dir_029141a1c7d6ffd5a4e073b2543b9713.xml old mode 100644 new mode 100755 index 7712cff8..d53a7f31 --- a/docs/doxyxml/dir_029141a1c7d6ffd5a4e073b2543b9713.xml +++ b/docs/doxyxml/dir_029141a1c7d6ffd5a4e073b2543b9713.xml @@ -1,15 +1,15 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory/nodes + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory/nodes DBpediaMemory.java Lexicon.java LexiconLiteral.java LexiconPredicate.java Memory.java Neo4jMemory.java - Neo4jRelations.java + Neo4jRelationships.java PersistentKnowledge.java RoboyMind.java Util.java @@ -18,6 +18,6 @@ - + diff --git a/docs/doxyxml/dir_05a62ed24bb3a48fbffd2a25ac3c5a5e.xml b/docs/doxyxml/dir_05a62ed24bb3a48fbffd2a25ac3c5a5e.xml new file mode 100644 index 00000000..99e1bd90 --- /dev/null +++ b/docs/doxyxml/dir_05a62ed24bb3a48fbffd2a25ac3c5a5e.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec/examples + + + + + + + diff --git a/docs/doxyxml/dir_09caee689121350b0881c362a3662a4d.xml b/docs/doxyxml/dir_09caee689121350b0881c362a3662a4d.xml old mode 100644 new mode 100755 index a55b0204..617671a2 --- a/docs/doxyxml/dir_09caee689121350b0881c362a3662a4d.xml +++ b/docs/doxyxml/dir_09caee689121350b0881c362a3662a4d.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality - + diff --git a/docs/doxyxml/dir_0f4c97c7389bb8a061b6dec9af63e7cb.xml b/docs/doxyxml/dir_0f4c97c7389bb8a061b6dec9af63e7cb.xml old mode 100644 new mode 100755 index ee84b2fb..86d485d3 --- a/docs/doxyxml/dir_0f4c97c7389bb8a061b6dec9af63e7cb.xml +++ b/docs/doxyxml/dir_0f4c97c7389bb8a061b6dec9af63e7cb.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/io + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/io BingInput.java BingOutput.java CelebritySimilarityInput.java @@ -25,6 +25,6 @@ - + diff --git a/docs/doxyxml/dir_1165a482e1bd283bdfb030bc1d41c8fb.xml b/docs/doxyxml/dir_1165a482e1bd283bdfb030bc1d41c8fb.xml old mode 100644 new mode 100755 index 007737e6..68300bd5 --- a/docs/doxyxml/dir_1165a482e1bd283bdfb030bc1d41c8fb.xml +++ b/docs/doxyxml/dir_1165a482e1bd283bdfb030bc1d41c8fb.xml @@ -1,13 +1,14 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory/nodes + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory/nodes Interlocutor.java MemoryNodeModel.java + Roboy.java - + diff --git a/docs/doxyxml/dir_120ed4da3e3217b1e7fc0b4f48568e79.xml b/docs/doxyxml/dir_120ed4da3e3217b1e7fc0b4f48568e79.xml old mode 100644 new mode 100755 index 49e0372c..3ca53d1f --- a/docs/doxyxml/dir_120ed4da3e3217b1e7fc0b4f48568e79.xml +++ b/docs/doxyxml/dir_120ed4da3e3217b1e7fc0b4f48568e79.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java - + diff --git a/docs/doxyxml/dir_1ab976347033ac022fed23b8deb25d44.xml b/docs/doxyxml/dir_1ab976347033ac022fed23b8deb25d44.xml new file mode 100644 index 00000000..e9f678ae --- /dev/null +++ b/docs/doxyxml/dir_1ab976347033ac022fed23b8deb25d44.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/examples + StateMachineExamples.java + + + + + + + diff --git a/docs/doxyxml/dir_21f74d8a5ca33ec014bca3d1e7f834db.xml b/docs/doxyxml/dir_21f74d8a5ca33ec014bca3d1e7f834db.xml new file mode 100644 index 00000000..c5ff59d4 --- /dev/null +++ b/docs/doxyxml/dir_21f74d8a5ca33ec014bca3d1e7f834db.xml @@ -0,0 +1,13 @@ + + + + /Users/wagram/Roboy/roboy_dialog/src/main/java/roboy/context/memoryContext + InterlocutorNode.java + InterlocutorNodeUpdater.java + + + + + + + diff --git a/docs/doxyxml/dir_2b9136678cbc7c985d98384a060ef73e.xml b/docs/doxyxml/dir_2b9136678cbc7c985d98384a060ef73e.xml old mode 100644 new mode 100755 index 21e46862..02caff69 --- a/docs/doxyxml/dir_2b9136678cbc7c985d98384a060ef73e.xml +++ b/docs/doxyxml/dir_2b9136678cbc7c985d98384a060ef73e.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/sentenceanalysis Analyzer.java AnswerAnalyzer.java DictionaryBasedSentenceTypeDetector.java @@ -12,12 +12,13 @@ OpenNLPParser.java OpenNLPPPOSTagger.java Preprocessor.java + SemanticParserAnalyzer.java SentenceAnalyzer.java SimpleTokenizer.java - + diff --git a/docs/doxyxml/dir_2ee74114d792069c15448944a9bb6a63.xml b/docs/doxyxml/dir_2ee74114d792069c15448944a9bb6a63.xml old mode 100644 new mode 100755 index e8eaa33f..1c80da44 --- a/docs/doxyxml/dir_2ee74114d792069c15448944a9bb6a63.xml +++ b/docs/doxyxml/dir_2ee74114d792069c15448944a9bb6a63.xml @@ -1,13 +1,13 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/talk + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/talk StatementBuilder.java Verbalizer.java - + diff --git a/docs/doxyxml/dir_309ae92be9f26a3d782e391154c61beb.xml b/docs/doxyxml/dir_309ae92be9f26a3d782e391154c61beb.xml old mode 100644 new mode 100755 index f857f26f..269642d1 --- a/docs/doxyxml/dir_309ae92be9f26a3d782e391154c61beb.xml +++ b/docs/doxyxml/dir_309ae92be9f26a3d782e391154c61beb.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/phonetics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/phonetics DoubleMetaphoneEncoder.java MetaphoneEncoder.java PhoneticEncoder.java @@ -11,6 +11,6 @@ - + diff --git a/docs/doxyxml/dir_367c5385ebc5b1806d01f0d86a421678.xml b/docs/doxyxml/dir_367c5385ebc5b1806d01f0d86a421678.xml new file mode 100644 index 00000000..b13414ad --- /dev/null +++ b/docs/doxyxml/dir_367c5385ebc5b1806d01f0d86a421678.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context/visionContext + + + + + + + diff --git a/docs/doxyxml/dir_3d3a7bb632f3a6251fe99b04aead1544.xml b/docs/doxyxml/dir_3d3a7bb632f3a6251fe99b04aead1544.xml old mode 100644 new mode 100755 index 997ec3b6..1a8257a5 --- a/docs/doxyxml/dir_3d3a7bb632f3a6251fe99b04aead1544.xml +++ b/docs/doxyxml/dir_3d3a7bb632f3a6251fe99b04aead1544.xml @@ -1,13 +1,13 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality/states LocationDBpediaStateTest.java QuestionAnsweringStateTest.java - + diff --git a/docs/doxyxml/dir_41a6017a7c28145a6e1c56d312c40a75.xml b/docs/doxyxml/dir_41a6017a7c28145a6e1c56d312c40a75.xml new file mode 100644 index 00000000..579ca013 --- /dev/null +++ b/docs/doxyxml/dir_41a6017a7c28145a6e1c56d312c40a75.xml @@ -0,0 +1,15 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/toyStates + ToyFarewellState.java + ToyGreetingsState.java + ToyIntroState.java + ToyRandomAnswerState.java + + + + + + + diff --git a/docs/doxyxml/dir_4b89141a263e6cbfc376c96d63372b80.xml b/docs/doxyxml/dir_4b89141a263e6cbfc376c96d63372b80.xml old mode 100644 new mode 100755 index 2a01dbf6..d53511bf --- a/docs/doxyxml/dir_4b89141a263e6cbfc376c96d63372b80.xml +++ b/docs/doxyxml/dir_4b89141a263e6cbfc376c96d63372b80.xml @@ -1,8 +1,8 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality/states CuriousPersonality.java DefaultPersonality.java KnockKnockPersonality.java @@ -12,6 +12,6 @@ - + diff --git a/docs/doxyxml/dir_5056205ae6881344b3d426f1b5089dae.xml b/docs/doxyxml/dir_5056205ae6881344b3d426f1b5089dae.xml new file mode 100644 index 00000000..9ae2fe71 --- /dev/null +++ b/docs/doxyxml/dir_5056205ae6881344b3d426f1b5089dae.xml @@ -0,0 +1,14 @@ + + + + /Users/wagram/Roboy/roboy_dialog/src/main/java/roboy/context/dataTypes + CoordinateSet.java + DataType.java + Topic.java + + + + + + + diff --git a/docs/doxyxml/dir_51b61a932f360ff8dfb5e9ed4f901118.xml b/docs/doxyxml/dir_51b61a932f360ff8dfb5e9ed4f901118.xml old mode 100644 new mode 100755 index 1cdf7ace..6225d71f --- a/docs/doxyxml/dir_51b61a932f360ff8dfb5e9ed4f901118.xml +++ b/docs/doxyxml/dir_51b61a932f360ff8dfb5e9ed4f901118.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality/states - + diff --git a/docs/doxyxml/dir_5e840a829dcbeed20ff665424891ad0f.xml b/docs/doxyxml/dir_5e840a829dcbeed20ff665424891ad0f.xml new file mode 100644 index 00000000..964998d3 --- /dev/null +++ b/docs/doxyxml/dir_5e840a829dcbeed20ff665424891ad0f.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/newDialog + DialogStateMachineTest.java + + + + + + + diff --git a/docs/doxyxml/dir_5eb159725f84c66aafd839904a4acdd0.xml b/docs/doxyxml/dir_5eb159725f84c66aafd839904a4acdd0.xml old mode 100644 new mode 100755 index 7bd17e87..0593112c --- a/docs/doxyxml/dir_5eb159725f84c66aafd839904a4acdd0.xml +++ b/docs/doxyxml/dir_5eb159725f84c66aafd839904a4acdd0.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java - + diff --git a/docs/doxyxml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml b/docs/doxyxml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml old mode 100644 new mode 100755 index eba3ee1b..459358fb --- a/docs/doxyxml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml +++ b/docs/doxyxml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml @@ -1,13 +1,13 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test - + diff --git a/docs/doxyxml/dir_6d5869451a9be3e6ce21b31fee7870de.xml b/docs/doxyxml/dir_6d5869451a9be3e6ce21b31fee7870de.xml old mode 100644 new mode 100755 index ec18d7f9..02c2c669 --- a/docs/doxyxml/dir_6d5869451a9be3e6ce21b31fee7870de.xml +++ b/docs/doxyxml/dir_6d5869451a9be3e6ce21b31fee7870de.xml @@ -1,19 +1,21 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/io - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/logic - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/ros - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/talk - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/util + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/io + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/ros + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/talk + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/util - + diff --git a/docs/doxyxml/dir_6e452d7417803070272de08db6f5594a.xml b/docs/doxyxml/dir_6e452d7417803070272de08db6f5594a.xml old mode 100644 new mode 100755 index d19ec0a6..0b89cca3 --- a/docs/doxyxml/dir_6e452d7417803070272de08db6f5594a.xml +++ b/docs/doxyxml/dir_6e452d7417803070272de08db6f5594a.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality/states AbstractBooleanState.java AnecdoteState.java CelebrityState.java @@ -13,18 +13,19 @@ InquiryState.java IntroductionState.java LocationDBpedia.java + PersonalFollowUpState.java PersonalQAState.java QuestionAnsweringState.java QuestionAskingState.java QuestionRandomizerState.java Reaction.java SegueState.java - State.java + State.java WildTalkState.java - + diff --git a/docs/doxyxml/dir_780de310a3259b561df66063ee52af20.xml b/docs/doxyxml/dir_780de310a3259b561df66063ee52af20.xml new file mode 100644 index 00000000..f52f29be --- /dev/null +++ b/docs/doxyxml/dir_780de310a3259b561df66063ee52af20.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/GUI + ContextGUI.java + + + + + + + diff --git a/docs/doxyxml/dir_8548ac48c61d494e9afd946956351f00.xml b/docs/doxyxml/dir_8548ac48c61d494e9afd946956351f00.xml old mode 100644 new mode 100755 index d2b23d27..d1ab0e07 --- a/docs/doxyxml/dir_8548ac48c61d494e9afd946956351f00.xml +++ b/docs/doxyxml/dir_8548ac48c61d494e9afd946956351f00.xml @@ -1,16 +1,15 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/ros + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/ros Ros.java RosClients.java RosMainNode.java RosManager.java - RosNode.java - + diff --git a/docs/doxyxml/dir_870da1f0b478f7ca881b221c68d88b01.xml b/docs/doxyxml/dir_870da1f0b478f7ca881b221c68d88b01.xml old mode 100644 new mode 100755 index 5a4bc196..dd16e151 --- a/docs/doxyxml/dir_870da1f0b478f7ca881b221c68d88b01.xml +++ b/docs/doxyxml/dir_870da1f0b478f7ca881b221c68d88b01.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/logic PASInterpreterTest.java - + diff --git a/docs/doxyxml/dir_8e320bad33e03d0371febb4f7e229dc4.xml b/docs/doxyxml/dir_8e320bad33e03d0371febb4f7e229dc4.xml new file mode 100644 index 00000000..cf48c1d3 --- /dev/null +++ b/docs/doxyxml/dir_8e320bad33e03d0371febb4f7e229dc4.xml @@ -0,0 +1,23 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/contextObjects + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/GUI + AbstractValue.java + AbstractValueHistory.java + AttributeManager.java + Context.java + ExternalContextInterface.java + ExternalUpdater.java + InternalUpdater.java + IntervalUpdater.java + Value.java + ValueHistory.java + + + + + + + diff --git a/docs/doxyxml/dir_97debbc39e3b917fca663601bb2b0709.xml b/docs/doxyxml/dir_97debbc39e3b917fca663601bb2b0709.xml old mode 100644 new mode 100755 index 96331ced..78ddb56f --- a/docs/doxyxml/dir_97debbc39e3b917fca663601bb2b0709.xml +++ b/docs/doxyxml/dir_97debbc39e3b917fca663601bb2b0709.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy - + diff --git a/docs/doxyxml/dir_99a73bddd3718e5715d839342deccec9.xml b/docs/doxyxml/dir_99a73bddd3718e5715d839342deccec9.xml old mode 100644 new mode 100755 index 5c2e3fd4..143d90b1 --- a/docs/doxyxml/dir_99a73bddd3718e5715d839342deccec9.xml +++ b/docs/doxyxml/dir_99a73bddd3718e5715d839342deccec9.xml @@ -1,9 +1,10 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/util + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/util Concept.java IO.java + JsonQAValues.java JsonUtils.java Lists.java Maps.java @@ -12,6 +13,6 @@ - + diff --git a/docs/doxyxml/dir_a37d8f862945072f307b1c1259356272.xml b/docs/doxyxml/dir_a37d8f862945072f307b1c1259356272.xml new file mode 100644 index 00000000..fb8ff5a6 --- /dev/null +++ b/docs/doxyxml/dir_a37d8f862945072f307b1c1259356272.xml @@ -0,0 +1,14 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/factories + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/toyStates + State.java + + + + + + + diff --git a/docs/doxyxml/dir_a3da221ea67796dde15c58826f020edb.xml b/docs/doxyxml/dir_a3da221ea67796dde15c58826f020edb.xml old mode 100644 new mode 100755 index de40a60d..35c3bbdc --- a/docs/doxyxml/dir_a3da221ea67796dde15c58826f020edb.xml +++ b/docs/doxyxml/dir_a3da221ea67796dde15c58826f020edb.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/talk + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/talk VerbalizerTest.java - + diff --git a/docs/doxyxml/dir_aa33eed7840580a6cabd7b23373e97f6.xml b/docs/doxyxml/dir_aa33eed7840580a6cabd7b23373e97f6.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/dir_aff77cbfcfec117c44351fba403c7d81.xml b/docs/doxyxml/dir_aff77cbfcfec117c44351fba403c7d81.xml new file mode 100644 index 00000000..60811f59 --- /dev/null +++ b/docs/doxyxml/dir_aff77cbfcfec117c44351fba403c7d81.xml @@ -0,0 +1,13 @@ + + + + /Users/wagram/Roboy/roboy_dialog/src/main/java/roboy/context/visionContext + FaceCoordinates.java + FaceCoordinatesUpdater.java + + + + + + + diff --git a/docs/doxyxml/dir_b28721f10b488d8d23b9ce8585fe312f.xml b/docs/doxyxml/dir_b28721f10b488d8d23b9ce8585fe312f.xml new file mode 100644 index 00000000..07996e18 --- /dev/null +++ b/docs/doxyxml/dir_b28721f10b488d8d23b9ce8585fe312f.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/factories + ToyStateFactory.java + + + + + + + diff --git a/docs/doxyxml/dir_b7748b3f53905c24013e2b431e631225.xml b/docs/doxyxml/dir_b7748b3f53905c24013e2b431e631225.xml old mode 100644 new mode 100755 index a5ab4ae4..54538aaa --- a/docs/doxyxml/dir_b7748b3f53905c24013e2b431e631225.xml +++ b/docs/doxyxml/dir_b7748b3f53905c24013e2b431e631225.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/action + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/action Action.java FaceAction.java ShutDownAction.java @@ -10,6 +10,6 @@ - + diff --git a/docs/doxyxml/dir_bd3690cddefd3747010feed6ae64d650.xml b/docs/doxyxml/dir_bd3690cddefd3747010feed6ae64d650.xml new file mode 100644 index 00000000..0829f70f --- /dev/null +++ b/docs/doxyxml/dir_bd3690cddefd3747010feed6ae64d650.xml @@ -0,0 +1,16 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/contextObjects + CoordinateSet.java + DialogTopics.java + DialogTopicsUpdater.java + FaceCoordinates.java + FaceCoordinatesUpdater.java + + + + + + + diff --git a/docs/doxyxml/dir_bebef46689f592554f5a6861599272c3.xml b/docs/doxyxml/dir_bebef46689f592554f5a6861599272c3.xml new file mode 100644 index 00000000..8fd0ac89 --- /dev/null +++ b/docs/doxyxml/dir_bebef46689f592554f5a6861599272c3.xml @@ -0,0 +1,14 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec/examples + ToyDataGetter.java + Word2vecTrainingExample.java + Word2vecUptrainingExample.java + + + + + + + diff --git a/docs/doxyxml/dir_bedbe0196ed4e3ea490265c56ba398f8.xml b/docs/doxyxml/dir_bedbe0196ed4e3ea490265c56ba398f8.xml old mode 100644 new mode 100755 index b458f973..64d881f6 --- a/docs/doxyxml/dir_bedbe0196ed4e3ea490265c56ba398f8.xml +++ b/docs/doxyxml/dir_bedbe0196ed4e3ea490265c56ba398f8.xml @@ -1,15 +1,15 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/action - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/action + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality Config.java DialogSystem.java - + diff --git a/docs/doxyxml/dir_ce0225499bce8c86db7a47ed5138c18d.xml b/docs/doxyxml/dir_ce0225499bce8c86db7a47ed5138c18d.xml new file mode 100644 index 00000000..ae61fd07 --- /dev/null +++ b/docs/doxyxml/dir_ce0225499bce8c86db7a47ed5138c18d.xml @@ -0,0 +1,12 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context/visionContext + ContextTest.java + + + + + + + diff --git a/docs/doxyxml/dir_d36b90f3756773ad1cfe7d8701cbf226.xml b/docs/doxyxml/dir_d36b90f3756773ad1cfe7d8701cbf226.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/dir_e3b706f0da88f09db6283663af2a234d.xml b/docs/doxyxml/dir_e3b706f0da88f09db6283663af2a234d.xml old mode 100644 new mode 100755 index 9f8db2ef..6ea9efd5 --- a/docs/doxyxml/dir_e3b706f0da88f09db6283663af2a234d.xml +++ b/docs/doxyxml/dir_e3b706f0da88f09db6283663af2a234d.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics/sentenceanalysis - + diff --git a/docs/doxyxml/dir_e66165e7b281758ce9f1532451fea886.xml b/docs/doxyxml/dir_e66165e7b281758ce9f1532451fea886.xml new file mode 100644 index 00000000..50990a6a --- /dev/null +++ b/docs/doxyxml/dir_e66165e7b281758ce9f1532451fea886.xml @@ -0,0 +1,16 @@ + + + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/examples + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states + DialogStateMachine.java + NewDialogSystem.java + StateBasedPersonality.java + + + + + + + diff --git a/docs/doxyxml/dir_ed0fca50c3b44d5fff0fa276d178b23b.xml b/docs/doxyxml/dir_ed0fca50c3b44d5fff0fa276d178b23b.xml old mode 100644 new mode 100755 index 6533720d..1a3d3a90 --- a/docs/doxyxml/dir_ed0fca50c3b44d5fff0fa276d178b23b.xml +++ b/docs/doxyxml/dir_ed0fca50c3b44d5fff0fa276d178b23b.xml @@ -1,9 +1,10 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/phonetics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/phonetics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec Concept.java DetectedEntity.java Entity.java @@ -14,6 +15,6 @@ - + diff --git a/docs/doxyxml/dir_ef15ac377452d427e784ef3ffdafddbf.xml b/docs/doxyxml/dir_ef15ac377452d427e784ef3ffdafddbf.xml old mode 100644 new mode 100755 index 952d131b..9847c679 --- a/docs/doxyxml/dir_ef15ac377452d427e784ef3ffdafddbf.xml +++ b/docs/doxyxml/dir_ef15ac377452d427e784ef3ffdafddbf.xml @@ -1,16 +1,17 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/logic - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/talk - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/util + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/newDialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/talk - + diff --git a/docs/doxyxml/dir_f4181fe68facb23b91192854446ad923.xml b/docs/doxyxml/dir_f4181fe68facb23b91192854446ad923.xml old mode 100644 new mode 100755 index f99397e0..2392c189 --- a/docs/doxyxml/dir_f4181fe68facb23b91192854446ad923.xml +++ b/docs/doxyxml/dir_f4181fe68facb23b91192854446ad923.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics/sentenceanalysis AnswerAnalyzerTest.java DictionaryBasedSentenceTypeDetectorTest.java OpenNLPParserTest.java @@ -9,6 +9,6 @@ - + diff --git a/docs/doxyxml/dir_f463a36265e380b34f6d16fc91d3e13d.xml b/docs/doxyxml/dir_f463a36265e380b34f6d16fc91d3e13d.xml new file mode 100644 index 00000000..8d47b2cd --- /dev/null +++ b/docs/doxyxml/dir_f463a36265e380b34f6d16fc91d3e13d.xml @@ -0,0 +1,13 @@ + + + + /Users/wagram/Roboy/roboy_dialog/src/main/java/roboy/context/dialogContext + DialogTopics.java + DialogTopicsUpdater.java + + + + + + + diff --git a/docs/doxyxml/dir_fc501c632ab2a1a6d6d30ee369f70e27.xml b/docs/doxyxml/dir_fc501c632ab2a1a6d6d30ee369f70e27.xml old mode 100644 new mode 100755 index f0d73d2e..7eab17c4 --- a/docs/doxyxml/dir_fc501c632ab2a1a6d6d30ee369f70e27.xml +++ b/docs/doxyxml/dir_fc501c632ab2a1a6d6d30ee369f70e27.xml @@ -1,7 +1,7 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/logic Intention.java IntentionClassifier.java PASInterpreter.java @@ -10,6 +10,6 @@ - + diff --git a/docs/doxyxml/dir_fd3f6763802dee1ad875f6c80eac0bda.xml b/docs/doxyxml/dir_fd3f6763802dee1ad875f6c80eac0bda.xml old mode 100644 new mode 100755 index da7fde17..ebf070a2 --- a/docs/doxyxml/dir_fd3f6763802dee1ad875f6c80eac0bda.xml +++ b/docs/doxyxml/dir_fd3f6763802dee1ad875f6c80eac0bda.xml @@ -1,12 +1,12 @@ - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy - + diff --git a/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_history_attributes.xml b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_history_attributes.xml new file mode 100644 index 00000000..b5369d04 --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_history_attributes.xml @@ -0,0 +1,187 @@ + + + + roboy::context::Context::HistoryAttributes + roboy.context.ExternalContextInterface + + + + roboy.context.Context.HistoryAttributes.DIALOG_TOPICS + + DIALOG_TOPICS + =(DialogTopics.class, Topic.class) + + + + + + + + + + final Class + final Class roboy.context.Context.HistoryAttributes.classType + + classType + + + + + + + + + + final Class + final Class roboy.context.Context.HistoryAttributes.returnType + + returnType + + + + + + + + + + + + + roboy.context.Context.HistoryAttributes.HistoryAttributes + (Class<? extends HistoryAttribute > attribute, Class<?extends DataType > value) + HistoryAttributes + + Class<? extends HistoryAttribute > + attribute + + + Class<?extends DataType > + value + + + + + + + + + + + Class + Class roboy.context.Context.HistoryAttributes.getClassType + () + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.Context.HistoryAttributes.getReturnType + () + getReturnType + getReturnType + + + + + + + + + + public< T extends DataType > T + public<T extends DataType> T roboy.context.Context.HistoryAttributes.getLastValue + () + getLastValue + + + + + + + + + + public< T extends DataType > Map< Integer, T > + public<T extends DataType> Map<Integer, T> roboy.context.Context.HistoryAttributes.getNLastValues + (int n) + getNLastValues + + int + n + + + + + + + + + + + public< T extends DataType > T + public<T extends DataType> T roboy.context.Context.HistoryAttributes.getValue + (int key) + getValue + + int + key + + + + + + + + + + + +A listing of available attributes with a history of values. + +AttributeManager methods take an Attribute as parameter. + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::Context::HistoryAttributesclassType + roboy::context::Context::HistoryAttributesDIALOG_TOPICS + roboy::context::Context::HistoryAttributesgetClassType + roboy::context::Context::HistoryAttributesgetLastValue + roboy::context::Context::HistoryAttributesgetNLastValues + roboy::context::Context::HistoryAttributesgetReturnType + roboy::context::Context::HistoryAttributesgetValue + roboy::context::Context::HistoryAttributesHistoryAttributes + roboy::context::Context::HistoryAttributesreturnType + + + diff --git a/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_updaters.xml b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_updaters.xml new file mode 100644 index 00000000..2ef3d463 --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_updaters.xml @@ -0,0 +1,82 @@ + + + + roboy::context::Context::Updaters + + + + roboy.context.Context.Updaters.DIALOG_TOPICS_UPDATER + + DIALOG_TOPICS_UPDATER + =(DialogTopicsUpdater.class, String.class) + + + + + + + + + + final Class + final Class roboy.context.Context.Updaters.classType + + classType + + + + + + + + + + final Class + final Class roboy.context.Context.Updaters.targetValueType + + targetValueType + + + + + + + + + + + + + roboy.context.Context.Updaters.Updaters + (Class attribute, Class valueType) + Updaters + + Class + attribute + + + Class + valueType + + + + + + + + + + + +All available updaters by their class and their target's value type. + + + + + roboy::context::Context::UpdatersclassType + roboy::context::Context::UpdatersDIALOG_TOPICS_UPDATER + roboy::context::Context::UpdaterstargetValueType + roboy::context::Context::UpdatersUpdaters + + + diff --git a/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_attributes.xml b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_attributes.xml new file mode 100644 index 00000000..543d059a --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_attributes.xml @@ -0,0 +1,151 @@ + + + + roboy::context::Context::ValueAttributes + roboy.context.ExternalContextInterface + + + + roboy.context.Context.ValueAttributes.FACE_COORDINATES + + FACE_COORDINATES + =(FaceCoordinates.class, CoordinateSet.class) + + + + + + + + + + final Class + final Class roboy.context.Context.ValueAttributes.classType + + classType + + + + + + + + + + final Class + final Class roboy.context.Context.ValueAttributes.returnType + + returnType + + + + + + + + + + + + + roboy.context.Context.ValueAttributes.ValueAttributes + (Class<? extends ValueAttribute > attribute, Class<?extends DataType > value) + ValueAttributes + + Class<? extends ValueAttribute > + attribute + + + Class<?extends DataType > + value + + + + + + + + + + + Class + Class roboy.context.Context.ValueAttributes.getClassType + () + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.Context.ValueAttributes.getReturnType + () + getReturnType + getReturnType + + + + + + + + + + public< T extends DataType > T + public<T extends DataType> T roboy.context.Context.ValueAttributes.getLastValue + () + getLastValue + + + + + + + + + + +A listing of available single-value attributes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::Context::ValueAttributesclassType + roboy::context::Context::ValueAttributesFACE_COORDINATES + roboy::context::Context::ValueAttributesgetClassType + roboy::context::Context::ValueAttributesgetLastValue + roboy::context::Context::ValueAttributesgetReturnType + roboy::context::Context::ValueAttributesreturnType + roboy::context::Context::ValueAttributesValueAttributes + + + diff --git a/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_histories.xml b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_histories.xml new file mode 100644 index 00000000..9dc58742 --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_value_histories.xml @@ -0,0 +1,169 @@ + + + + roboy::context::Context::ValueHistories + roboy.context.ExternalContextInterface + + + + roboy.context.Context.ValueHistories.DIALOG_TOPICS + + DIALOG_TOPICS + =(DialogTopics.class, String.class) + + + + + + + + + + final Class + final Class roboy.context.Context.ValueHistories.classType + + classType + + + + + + + + + + final Class + final Class roboy.context.Context.ValueHistories.returnType + + returnType + + + + + + + + + + + + + roboy.context.Context.ValueHistories.ValueHistories + (Class<?extends AbstractValueHistory > attribute, Class dataType) + ValueHistories + + Class<?extends AbstractValueHistory > + attribute + + + Class + dataType + + + + + + + + + + + Class + Class roboy.context.Context.ValueHistories.getClassType + () + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.Context.ValueHistories.getReturnType + () + getReturnType + getReturnType + + + + + + + + + + public< T > T + public<T> T roboy.context.Context.ValueHistories.getLastValue + () + getLastValue + + + + + + + + + + public< K, T > Map< K, T > + public<K, T> Map<K, T> roboy.context.Context.ValueHistories.getNLastValues + (int n) + getNLastValues + + int + n + + + + + + + + + + + +All available valueHistories. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::Context::ValueHistoriesclassType + roboy::context::Context::ValueHistoriesDIALOG_TOPICS + roboy::context::Context::ValueHistoriesgetClassType + roboy::context::Context::ValueHistoriesgetLastValue + roboy::context::Context::ValueHistoriesgetNLastValues + roboy::context::Context::ValueHistoriesgetReturnType + roboy::context::Context::ValueHistoriesreturnType + roboy::context::Context::ValueHistoriesValueHistories + + + diff --git a/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_values.xml b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_values.xml new file mode 100644 index 00000000..00f8e643 --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1context_1_1_context_1_1_values.xml @@ -0,0 +1,151 @@ + + + + roboy::context::Context::Values + roboy.context.ExternalContextInterface + + + + roboy.context.Context.Values.FACE_COORDINATES + + FACE_COORDINATES + =(FaceCoordinates.class, CoordinateSet.class) + + + + + + + + + + final Class + final Class roboy.context.Context.Values.classType + + classType + + + + + + + + + + final Class + final Class roboy.context.Context.Values.returnType + + returnType + + + + + + + + + + + + + roboy.context.Context.Values.Values + (Class<?extends AbstractValue > attribute, Class value) + Values + + Class<?extends AbstractValue > + attribute + + + Class + value + + + + + + + + + + + Class + Class roboy.context.Context.Values.getClassType + () + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.Context.Values.getReturnType + () + getReturnType + getReturnType + + + + + + + + + + public< T > T + public<T> T roboy.context.Context.Values.getLastValue + () + getLastValue + + + + + + + + + + +All available values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::Context::ValuesclassType + roboy::context::Context::ValuesFACE_COORDINATES + roboy::context::Context::ValuesgetClassType + roboy::context::Context::ValuesgetLastValue + roboy::context::Context::ValuesgetReturnType + roboy::context::Context::ValuesreturnType + roboy::context::Context::ValuesValues + + + diff --git a/docs/doxyxml/enumroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml b/docs/doxyxml/enumroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml old mode 100644 new mode 100755 index 6206c74f..0f81eded --- a/docs/doxyxml/enumroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml +++ b/docs/doxyxml/enumroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml @@ -15,7 +15,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -57,7 +57,21 @@ - + + + + + roboy.dialog.Config.ConfigurationProfile.MEMORY + + MEMORY + =("MEMORY") + + + + + + + String @@ -70,7 +84,7 @@ - + @@ -89,18 +103,19 @@ - + List of profile names. The variables are set in the corresponding set<name>Profile() method. String values make it possible to define the profile in start command with: -Dprofile=<profileString> - + roboy::dialog::Config::ConfigurationProfileConfigurationProfile roboy::dialog::Config::ConfigurationProfileDEBUG roboy::dialog::Config::ConfigurationProfileDEFAULT + roboy::dialog::Config::ConfigurationProfileMEMORY roboy::dialog::Config::ConfigurationProfileNOROS roboy::dialog::Config::ConfigurationProfileprofileName roboy::dialog::Config::ConfigurationProfileSTANDALONE diff --git a/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_default_personality_1_1_c_o_n_v_e_r_s_a_t_i_o_n_a_l___s_t_a_t_e.xml b/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_default_personality_1_1_c_o_n_v_e_r_s_a_t_i_o_n_a_l___s_t_a_t_e.xml old mode 100644 new mode 100755 index 6fee446a..45d5ea33 --- a/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_default_personality_1_1_c_o_n_v_e_r_s_a_t_i_o_n_a_l___s_t_a_t_e.xml +++ b/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_default_personality_1_1_c_o_n_v_e_r_s_a_t_i_o_n_a_l___s_t_a_t_e.xml @@ -14,7 +14,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -53,14 +53,14 @@ - + - + roboy::dialog::personality::DefaultPersonality::CONVERSATIONAL_STATEFAREWELL roboy::dialog::personality::DefaultPersonality::CONVERSATIONAL_STATEGREETING diff --git a/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_knock_knock_personality_1_1_knock_knock_state.xml b/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_knock_knock_personality_1_1_knock_knock_state.xml old mode 100644 new mode 100755 index 5463c981..2369edc4 --- a/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_knock_knock_personality_1_1_knock_knock_state.xml +++ b/docs/doxyxml/enumroboy_1_1dialog_1_1personality_1_1_knock_knock_personality_1_1_knock_knock_state.xml @@ -14,7 +14,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -53,14 +53,14 @@ - + - + roboy::dialog::personality::KnockKnockPersonality::KnockKnockStateKNOCKKNOCK roboy::dialog::personality::KnockKnockPersonality::KnockKnockStatePUNCHLINE diff --git a/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_m_a_n_t_i_c___r_o_l_e.xml b/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_m_a_n_t_i_c___r_o_l_e.xml old mode 100644 new mode 100755 index dd654131..37c86e5c --- a/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_m_a_n_t_i_c___r_o_l_e.xml +++ b/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_m_a_n_t_i_c___r_o_l_e.xml @@ -14,7 +14,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -118,7 +118,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -170,14 +170,14 @@ - + - + roboy::linguistics::Linguistics::SEMANTIC_ROLEAGENT roboy::linguistics::Linguistics::SEMANTIC_ROLEBENEFICIARY diff --git a/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_n_t_e_n_c_e___t_y_p_e.xml b/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_n_t_e_n_c_e___t_y_p_e.xml old mode 100644 new mode 100755 index b7273b84..80dc4b6f --- a/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_n_t_e_n_c_e___t_y_p_e.xml +++ b/docs/doxyxml/enumroboy_1_1linguistics_1_1_linguistics_1_1_s_e_n_t_e_n_c_e___t_y_p_e.xml @@ -14,7 +14,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -118,7 +118,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -183,7 +183,7 @@ - + @@ -196,14 +196,14 @@ - + - + roboy::linguistics::Linguistics::SENTENCE_TYPEANECDOTE roboy::linguistics::Linguistics::SENTENCE_TYPEDOES_IT diff --git a/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relations.xml b/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relations.xml old mode 100644 new mode 100755 index bbe55511..3deff4c4 --- a/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relations.xml +++ b/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relations.xml @@ -5,7 +5,7 @@ - roboy.memory.Neo4jRelations.FROM + roboy.memory.Neo4jRelationships.FROM FROM =("FROM") @@ -19,7 +19,7 @@ - roboy.memory.Neo4jRelations.HAS_HOBBY + roboy.memory.Neo4jRelationships.HAS_HOBBY HAS_HOBBY =("HAS_HOBBY") @@ -33,7 +33,7 @@ - roboy.memory.Neo4jRelations.LIVE_IN + roboy.memory.Neo4jRelationships.LIVE_IN LIVE_IN =("LIVE_IN") @@ -47,7 +47,7 @@ - roboy.memory.Neo4jRelations.STUDY_AT + roboy.memory.Neo4jRelationships.STUDY_AT STUDY_AT =("STUDY_AT") @@ -61,7 +61,7 @@ - roboy.memory.Neo4jRelations.OCCUPATION + roboy.memory.Neo4jRelationships.OCCUPATION OCCUPATION =("OCCUPATION") @@ -75,7 +75,7 @@ - roboy.memory.Neo4jRelations.WORK_FOR + roboy.memory.Neo4jRelationships.WORK_FOR WORK_FOR =("WORK_FOR") @@ -89,7 +89,7 @@ - roboy.memory.Neo4jRelations.FRIEND_OF + roboy.memory.Neo4jRelationships.FRIEND_OF FRIEND_OF =("FRIEND_OF") @@ -103,7 +103,7 @@ - roboy.memory.Neo4jRelations.MEMBER_OF + roboy.memory.Neo4jRelationships.MEMBER_OF MEMBER_OF =("MEMBER_OF") @@ -117,7 +117,7 @@ String - String roboy.memory.Neo4jRelations.type + String roboy.memory.Neo4jRelationships.type type @@ -132,7 +132,7 @@ - roboy.memory.Neo4jRelations.Neo4jRelations + Neo4jRelationships (String type) Neo4jRelations @@ -149,7 +149,7 @@ -Contains the relations available in Neo4j database. +Contains the relationships available in Neo4j database. Respective questions should be added to the questions.json file and used in the QuestionRandomizerState. diff --git a/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relationships.xml b/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relationships.xml new file mode 100755 index 00000000..589278bd --- /dev/null +++ b/docs/doxyxml/enumroboy_1_1memory_1_1_neo4j_relationships.xml @@ -0,0 +1,199 @@ + + + + roboy::memory::Neo4jRelationships + + + + roboy.memory.Neo4jRelationships.FROM + + FROM + =("FROM") + + + + + + + + + + + roboy.memory.Neo4jRelationships.HAS_HOBBY + + HAS_HOBBY + =("HAS_HOBBY") + + + + + + + + + + + roboy.memory.Neo4jRelationships.LIVE_IN + + LIVE_IN + =("LIVE_IN") + + + + + + + + + + + roboy.memory.Neo4jRelationships.STUDY_AT + + STUDY_AT + =("STUDY_AT") + + + + + + + + + + + roboy.memory.Neo4jRelationships.OCCUPIED_AS + + OCCUPIED_AS + =("OCCUPIED_AS") + + + + + + + + + + + roboy.memory.Neo4jRelationships.WORK_FOR + + WORK_FOR + =("WORK_FOR") + + + + + + + + + + + roboy.memory.Neo4jRelationships.FRIEND_OF + + FRIEND_OF + =("FRIEND_OF") + + + + + + + + + + + roboy.memory.Neo4jRelationships.MEMBER_OF + + MEMBER_OF + =("MEMBER_OF") + + + + + + + + + + + roboy.memory.Neo4jRelationships.OTHER + + OTHER + =("OTHER") + + + + + + + + + + + roboy.memory.Neo4jRelationships.IS + + IS + =("IS") + + + + + + + + + + String + String roboy.memory.Neo4jRelationships.type + + type + + + + + + + + + + + + + roboy.memory.Neo4jRelationships.Neo4jRelationships + (String type) + Neo4jRelationships + + String + type + + + + + + + + + + + +Contains the relations available in Neo4j database. + +Respective questions should be added to the questions.json file and used in the QuestionRandomizerState. + + + roboy::memory::Neo4jRelationshipsFRIEND_OF + roboy::memory::Neo4jRelationshipsFROM + roboy::memory::Neo4jRelationshipsHAS_HOBBY + roboy::memory::Neo4jRelationshipsIS + roboy::memory::Neo4jRelationshipsLIVE_IN + roboy::memory::Neo4jRelationshipsMEMBER_OF + roboy::memory::Neo4jRelationshipsNeo4jRelationships + roboy::memory::Neo4jRelationshipsOCCUPIED_AS + roboy::memory::Neo4jRelationshipsOTHER + roboy::memory::Neo4jRelationshipsSTUDY_AT + roboy::memory::Neo4jRelationshipstype + roboy::memory::Neo4jRelationshipsWORK_FOR + + + diff --git a/docs/doxyxml/enumroboy_1_1ros_1_1_ros_clients.xml b/docs/doxyxml/enumroboy_1_1ros_1_1_ros_clients.xml old mode 100644 new mode 100755 index 66ef8bdd..3d1b3e70 --- a/docs/doxyxml/enumroboy_1_1ros_1_1_ros_clients.xml +++ b/docs/doxyxml/enumroboy_1_1ros_1_1_ros_clients.xml @@ -15,7 +15,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -99,7 +99,7 @@ - + @@ -113,7 +113,7 @@ - + @@ -127,7 +127,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -169,7 +169,7 @@ - + String @@ -182,7 +182,7 @@ - + String @@ -195,7 +195,7 @@ - + @@ -218,14 +218,14 @@ - + Stores the different client addresses and corresponding ROS message types. - + roboy::ros::RosClientsaddress roboy::ros::RosClientsCREATEMEMORY diff --git a/docs/doxyxml/group__nuttygroup.xml b/docs/doxyxml/group__nuttygroup.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/group__nuttygroup2.xml b/docs/doxyxml/group__nuttygroup2.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/index.xml b/docs/doxyxml/index.xml old mode 100644 new mode 100755 index 0822ca03..53cb2136 --- a/docs/doxyxml/index.xml +++ b/docs/doxyxml/index.xml @@ -15,6 +15,13 @@ react determineSuccess + roboy::context::AbstractValue + getValue + updateValue + + roboy::context::AbstractValueHistory + getLastNValues + roboy::dialog::action::Action roboy::linguistics::sentenceanalysis::Analyzer @@ -43,6 +50,13 @@ analyze analyzePred + roboy::context::AttributeManager + valueHistories + values + getLastValue + getNLastValues + getValue + roboy::io::BingInput rosMainNode BingInput @@ -115,6 +129,9 @@ SHUTDOWN_ON_ROS_FAILURE SHUTDOWN_ON_SERVICE_FAILURE ROS_HOSTNAME + MEMORY + PARSER_PORT + DEMO_GUI yamlConfigFile yamlConfig Config @@ -123,6 +140,7 @@ setNoROSProfile setStandaloneProfile setDebugProfile + setMemoryProfile initializeYAMLConfig roboy::dialog::Config::ConfigurationProfile @@ -130,9 +148,45 @@ NOROS STANDALONE DEBUG + MEMORY profileName ConfigurationProfile + roboy::context::Context + context + externalUpdaters + internalUpdaters + Context + getInstance + updateValue + + roboy::context::GUI::ContextGUI + mainFrame + valueBorder + valuePanel + valueDisplays + historyDisplays + historyBorder + historyPanel + controlPanel + MAX_HISTORY_VALUES + FULL_WIDTH + FULL_HEIGHT + ATTR_WIDTH + ATTR_HEIGHT + HISTORY_HEIGHT + NO_VALUE + run + ContextGUI + prepareGUI + startFrame + updateValues + updateHistories + + roboy::context::visionContext::ContextTest + getLastAttributeValue + setAndGetDialogTopics + roboy::dialog::personality::DefaultPersonality::CONVERSATIONAL_STATE GREETING INTRODUCTION @@ -146,6 +200,12 @@ react determineSuccess + roboy::context::contextObjects::CoordinateSet + x + y + z + CoordinateSet + roboy::dialog::personality::CuriousPersonality memory CuriousPersonality @@ -183,9 +243,51 @@ getEntity getTokenIndex + roboy::newDialog::DialogStateMachine + identifierToState + activeState + initalState + enableDebug + DialogStateMachine + DialogStateMachine + getInitialState + setInitialState + setInitialState + getActiveState + setActiveState + setActiveState + getStateByIdentifier + addState + loadFromString + loadFromFile + saveToFile + toJsonString + toString + equals + loadFromJSON + toJsonObject + + roboy::newDialog::DialogStateMachineTest + MINI_STATE_MACHINE + fromCode + machineEqualsItself + stringEqualsCode + notEqualsNoInitialState + notEqualsDifferentStates + notEqualsDifferentTransitions + activeStateIsSetToInitialState + machineContainsAllStates + transitionsAreOK + fallbackIsOK + roboy::dialog::DialogSystem main + roboy::context::contextObjects::DialogTopics + + roboy::context::contextObjects::DialogTopicsUpdater + DialogTopicsUpdater + roboy::linguistics::sentenceanalysis::DictionaryBasedSentenceTypeDetector analyze determineSentenceType @@ -215,6 +317,13 @@ getForm getForms + roboy::context::ExternalContextInterface + getClassType + getReturnType + + roboy::context::ExternalUpdater + update + roboy::dialog::action::FaceAction state duration @@ -223,6 +332,12 @@ getState getDuration + roboy::context::contextObjects::FaceCoordinates + + roboy::context::contextObjects::FaceCoordinatesUpdater + FaceCoordinatesUpdater + update + roboy::dialog::personality::states::FarewellState FarewellState act @@ -279,15 +394,20 @@ roboy::memory::nodes::Interlocutor person - noROS + memoryROS memory FAMILIAR Interlocutor addName getName - hasRelation - addInformation - determineNodeType + hasRelationship + getRelationships + addInformation + + roboy::context::InternalUpdater + target + InternalUpdater + putValue roboy::linguistics::sentenceanalysis::Interpretation features @@ -303,8 +423,17 @@ setSentenceType toString + roboy::context::IntervalUpdater + target + scheduler + updateFrequency + IntervalUpdater + start + roboy::dialog::personality::states::IntroductionState person + memory + predicate introductions IntroductionState act @@ -316,7 +445,37 @@ readLines readLines + roboy::util::JsonEntryModel + Q + A + FUP + + roboy::util::JsonModel + name + FROM + HAS_HOBBY + LIVE_IN + FRIEND_OF + STUDY_AT + MEMBER_OF + WORK_FOR + OCCUPIED_AS + + roboy::util::JsonQAValues + questions + successAnswers + failureAnswers + followUp + answersFollowUp + JsonQAValues + getQuestions + getSuccessAnswers + getFailureAnswers + getFollowUpQuestions + getFollowUpAnswers + roboy::util::JsonUtils + getQuestionsAndAnswersFromJson getSentencesFromJsonFile getSentenceArraysFromJsonFile @@ -391,6 +550,7 @@ EMOTION INTENT INTENT_DISTANCE + PARSE roboy::util::Lists actionList @@ -422,7 +582,7 @@ labels label properties - relations + relationships stripQuery MemoryNodeModel MemoryNodeModel @@ -434,10 +594,10 @@ getProperty setProperties setProperty - getRelations - getRelation - setRelations - setRelation + getRelationships + getRelationship + setRelationships + setRelationship setStripQuery toJSON fromJSON @@ -473,18 +633,25 @@ create remove retrieve - - roboy::memory::Neo4jRelations - FROM - HAS_HOBBY - LIVE_IN - STUDY_AT - OCCUPATION - WORK_FOR - FRIEND_OF - MEMBER_OF - type - Neo4jRelations + determineNodeType + + roboy::memory::Neo4jRelationships + FROM + HAS_HOBBY + LIVE_IN + STUDY_AT + OCCUPIED_AS + WORK_FOR + FRIEND_OF + MEMBER_OF + OTHER + IS + type + Neo4jRelationships + + roboy::newDialog::NewDialogSystem + getPersonalityFilePathFromConfig + main roboy::linguistics::sentenceanalysis::OntologyNERAnalyzer entities @@ -545,15 +712,24 @@ retrieve save + roboy::dialog::personality::states::PersonalFollowUpState + questions + successTexts + person + predicate + PersonalFollowUpState + act + determineSuccess + roboy::dialog::personality::Personality answer roboy::dialog::personality::states::PersonalQAState questions - successTexts + successTexts person - predicate - PersonalQAState + predicate + PersonalQAState act determineSuccess @@ -619,21 +795,25 @@ roboy::dialog::personality::states::QuestionRandomizerState questionStates locationQuestion - alreadyAsked + followUpStates + alreadyAsked inner chosenState person - questionsFile - successAnswersFile - failureAnswersFile + questionsAndAnswers + askFollowUp + QAfile questions - successAnswers + successAnswers failureAnswers + followUp + answersFollowUp QuestionRandomizerState act react setTop - initializeQuestion + initializeQuestion + initializeFollowUpQuestion checkForAskedQuestions roboy::dialog::personality::states::Reaction @@ -653,6 +833,16 @@ getSubject getObject + roboy::memory::nodes::Roboy + roboy + memoryROS + memory + Roboy + getName + getRelationships + addInformation + InitializeRoboy + roboy::memory::RoboyMind roboyMemory object_id @@ -700,9 +890,6 @@ type RosClients - roboy::util::ros::RosCommunicationTest - TestGenerativeModel - roboy::ros::RosMainNode rosConnectionLatch clients @@ -730,11 +917,6 @@ notInitialized getServiceClient - roboy::ros::RosNode - cerevoiceServiceClient - getDefaultNodeName - onStart - roboy::dialog::personality::states::SegueState sentenceTypeAssociations inner @@ -761,6 +943,14 @@ PURPOSE CAUSE + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzer + clientSocket + out + in + debug + SemanticParserAnalyzer + analyze + roboy::linguistics::Linguistics::SENTENCE_TYPE GREETING FAREWELL @@ -827,6 +1017,46 @@ act react + roboy::newDialog::states::State + stateIdentifier + fallback + transitions + State + getIdentifier + setIdentifier + getFallback + setFallback + setTransition + getTransition + getAllTransitions + act + react + getNextState + allRequiredTransitionsAreInitialized + toJsonObject + toString + equals + getRequiredTransitionNames + newSet + equalsHelper_compareTransitions + + roboy::newDialog::StateBasedPersonality + verbalizer + StateBasedPersonality + startConversation + answer + reset + stateAct + stateReact + verbalizeInterpretations + + roboy::newDialog::examples::StateMachineExamples + toyPersonality + main + fromCode + fromFile + fromString + roboy::talk::StatementBuilder random @@ -839,6 +1069,47 @@ concept toString + roboy::linguistics::word2vec::examples::ToyDataGetter + verbose + toyDataDirectory + toyDataFilePath + toyDataInetURL + ToyDataGetter + getToyDataFilePath + ensureToyDataIsPresent + downloadData + fileExists + + roboy::newDialog::states::toyStates::ToyFarewellState + ToyFarewellState + act + react + getNextState + + roboy::newDialog::states::toyStates::ToyGreetingsState + inputOK + ToyGreetingsState + act + react + getNextState + getRequiredTransitionNames + + roboy::newDialog::states::toyStates::ToyIntroState + ToyIntroState + act + react + getNextState + getRequiredTransitionNames + + roboy::newDialog::states::toyStates::ToyRandomAnswerState + ToyRandomAnswerState + act + react + getNextState + + roboy::newDialog::states::factories::ToyStateFactory + getByClassName + roboy::linguistics::Triple agens predicate @@ -858,12 +1129,52 @@ UdpOutput act + roboy::context::Context::Updaters + DIALOG_TOPICS_UPDATER + classType + targetValueType + Updaters + roboy::memory::Util getPartURI getQuestionType calculateLevenshteinDistance min + roboy::context::Value + value + getValue + updateValue + + roboy::context::Context::ValueHistories + DIALOG_TOPICS + classType + returnType + ValueHistories + getClassType + getReturnType + getLastValue + getNLastValues + + roboy::context::ValueHistory + counter + data + ValueHistory + getValue + getLastNValues + updateValue + generateKey + getValue + + roboy::context::Context::Values + FACE_COORDINATES + classType + returnType + Values + getClassType + getReturnType + getLastValue + roboy::talk::Verbalizer greetings farewells @@ -906,6 +1217,12 @@ react setNextState + roboy::linguistics::word2vec::examples::Word2vecTrainingExample + main + + roboy::linguistics::word2vec::examples::Word2vecUptrainingExample + main + roboy::memory::WorkingMemory memory agensTripleMap @@ -918,14 +1235,20 @@ toString retrieve + com::google::gson + edu::cmu::sphinx::api + java::awt + java::io java::net java::util + javax::swing + org::apache::jena::query org::apache::jena::rdf::model @@ -938,6 +1261,14 @@ roboy + roboy::context + + roboy::context::contextObjects + + roboy::context::GUI + + roboy::context::visionContext + roboy::dialog roboy::dialog::action @@ -956,26 +1287,70 @@ roboy::linguistics::sentenceanalysis + roboy::linguistics::word2vec + + roboy::linguistics::word2vec::examples + roboy::logic roboy::memory - roboy::memory::Neo4jRelations + roboy::memory::Neo4jRelationships roboy::memory::nodes + roboy::newDialog + + roboy::newDialog::examples + + roboy::newDialog::states + + roboy::newDialog::states::factories + + roboy::newDialog::states::toyStates + roboy::ros roboy::talk roboy::util - roboy::util::ros - roboy_communication_cognition roboy_communication_control + AbstractValue.java + + AbstractValueHistory.java + + AttributeManager.java + + Context.java + + CoordinateSet.java + + DialogTopics.java + + DialogTopicsUpdater.java + + FaceCoordinates.java + + FaceCoordinatesUpdater.java + + ExternalContextInterface.java + + ExternalUpdater.java + + ContextGUI.java + + InternalUpdater.java + + IntervalUpdater.java + + Value.java + + ValueHistory.java + Action.java FaceAction.java @@ -1020,6 +1395,8 @@ LocationDBpedia.java + PersonalFollowUpState.java + PersonalQAState.java QuestionAnsweringState.java @@ -1032,7 +1409,9 @@ SegueState.java - State.java + State.java + + State.java WildTalkState.java @@ -1114,6 +1493,8 @@ Preprocessor.java + SemanticParserAnalyzer.java + SentenceAnalyzer.java SimpleTokenizer.java @@ -1122,6 +1503,12 @@ Triple.java + ToyDataGetter.java + + Word2vecTrainingExample.java + + Word2vecUptrainingExample.java + Intention.java IntentionClassifier.java @@ -1142,12 +1529,14 @@ Neo4jMemory.java - Neo4jRelations.java + Neo4jRelationships.java Interlocutor.java MemoryNodeModel.java + Roboy.java + PersistentKnowledge.java RoboyMind.java @@ -1156,6 +1545,24 @@ WorkingMemory.java + DialogStateMachine.java + + StateMachineExamples.java + + NewDialogSystem.java + + StateBasedPersonality.java + + ToyStateFactory.java + + ToyFarewellState.java + + ToyGreetingsState.java + + ToyIntroState.java + + ToyRandomAnswerState.java + Ros.java RosClients.java @@ -1164,14 +1571,14 @@ RosManager.java - RosNode.java - StatementBuilder.java Verbalizer.java IO.java + JsonQAValues.java + JsonUtils.java Lists.java @@ -1180,6 +1587,8 @@ Relation.java + ContextTest.java + LocationDBpediaStateTest.java QuestionAnsweringStateTest.java @@ -1192,68 +1601,90 @@ PASInterpreterTest.java + DialogStateMachineTest.java + VerbalizerTest.java - RosCommunicationTest.java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/action + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/contextObjects + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/examples + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec/examples + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/factories + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/context/GUI + + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/io - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/action + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/io + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/logic - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/logic - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/newDialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/logic + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/memory/nodes - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/memory/nodes + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/phonetics - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/phonetics + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/ros - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/linguistics/sentenceanalysis - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/util/ros + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/sentenceanalysis - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/ros + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/dialog/personality/states - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/linguistics/sentenceanalysis + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/dialog/personality/states - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/talk - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/dialog/personality/states + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/talk - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/talk + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/talk + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/newDialog/states/toyStates - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/util - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/test/java/roboy/util + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/test/java/roboy/context/visionContext - /home/roboy/workspace/Roboy/src/roboy_dialog_system/src/main/java/roboy/util + /home/emilka/ros/Roboy/src/roboy_dialog_system/roboy_dialog/src/main/java/roboy/linguistics/word2vec diff --git a/docs/doxyxml/index.xsd b/docs/doxyxml/index.xsd old mode 100644 new mode 100755 diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value.xml new file mode 100644 index 00000000..632dbf41 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value.xml @@ -0,0 +1,80 @@ + + + + roboy::context::AbstractValue + roboy.context.AbstractValueHistory< K, V > + roboy.context.Value< V > + + + V + + + + + V + V roboy.context.AbstractValue< V >.getValue + () + getValue + getValue + + + + + + + + + + void + void roboy.context.AbstractValue< V >.updateValue + (V key) + updateValue + updateValue + + V + key + + + + + + + + + + + +Stores a single value. + +On update, the value is overwritten. + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::AbstractValuegetValue + roboy::context::AbstractValueupdateValue + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value_history.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value_history.xml new file mode 100644 index 00000000..c9644315 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_abstract_value_history.xml @@ -0,0 +1,68 @@ + + + + roboy::context::AbstractValueHistory + roboy::context::AbstractValue< V > + + + K + + + V + + + + + Map< K, V > + Map<K, V> roboy.context.AbstractValueHistory< K, V >.getLastNValues + (int n) + getLastNValues + + int + n + + + + + + + + + + + +ValueHistory maintains a map containing all (current and past) values. + +These values are accessible over the getLastNValues method. + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::AbstractValueHistorygetLastNValues + roboy::context::AbstractValueHistorygetValue + roboy::context::AbstractValueHistoryupdateValue + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_attribute_interface.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_attribute_interface.xml new file mode 100644 index 00000000..e368a406 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_attribute_interface.xml @@ -0,0 +1,67 @@ + + + + roboy::context::AttributeInterface + roboy.context.Context.HistoryAttributes + roboy.context.Context.ValueAttributes + + + Class + Class roboy.context.ExternalContextInterface.getClassType + () + getClassType + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.ExternalContextInterface.getReturnType + () + getReturnType + getReturnType + getReturnType + + + + + + + + + + +Interface for an enum describing all attributes belonging to the Context. + +Defining the class and the return types enable retrieving values over generic methods with AttributeManager. + + + + + + + + + + + + + + + + + + + + + roboy::context::AttributeInterfacegetClassType + roboy::context::AttributeInterfacegetReturnType + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_direct_update_policy.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_direct_update_policy.xml new file mode 100644 index 00000000..6393c68c --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_direct_update_policy.xml @@ -0,0 +1,52 @@ + + + + roboy::context::DirectUpdatePolicy + roboy.context.contextObjects.DialogTopicsUpdater + + + V + DataType + + + + + void + void roboy.context.DirectUpdatePolicy< V extends DataType >.putValue + (V value) + putValue + + V + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::DirectUpdatePolicyputValue + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_external_context_interface.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_external_context_interface.xml new file mode 100644 index 00000000..4b804541 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_external_context_interface.xml @@ -0,0 +1,67 @@ + + + + roboy::context::ExternalContextInterface + roboy.context.Context.ValueHistories + roboy.context.Context.Values + + + Class + Class roboy.context.ExternalContextInterface.getClassType + () + getClassType + getClassType + getClassType + + + + + + + + + + Class + Class roboy.context.ExternalContextInterface.getReturnType + () + getReturnType + getReturnType + getReturnType + + + + + + + + + + +Interface for an enum which lists Context values and valueHistories. + +Methods enable retrieving values over generic methods with AttributeManager. + + + + + + + + + + + + + + + + + + + + + roboy::context::ExternalContextInterfacegetClassType + roboy::context::ExternalContextInterfacegetReturnType + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_history_attribute.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_history_attribute.xml new file mode 100644 index 00000000..99ec1ac1 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_history_attribute.xml @@ -0,0 +1,114 @@ + + + + roboy::context::HistoryAttribute + roboy.context.SimpleHistoryAttribute< K extends Integer, V extends DataType > + + + K + + + V + + + + + V + V roboy.context.HistoryAttribute< K, V >.getLastValue + () + getLastValue + getLastValue + + + + + + + + + + V + V roboy.context.HistoryAttribute< K, V >.getValue + (K key) + getValue + getValue + + K + key + + + + + + + + + + + Map< K, V > + Map<K, V> roboy.context.HistoryAttribute< K, V >.getLastNValues + (int n) + getLastNValues + getLastNValues + + int + n + + + + + + + + + + + K + K roboy.context.HistoryAttribute< K, V >.storeValue + (V key) + storeValue + storeValue + + V + key + + + + + + + + + + + +This enables saving basic History information by the key type T and data/value type V. + + + + + + + + + + + + + + + + + + + + + + + roboy::context::HistoryAttributegetLastNValues + roboy::context::HistoryAttributegetLastValue + roboy::context::HistoryAttributegetValue + roboy::context::HistoryAttributestoreValue + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1_value_attribute.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1_value_attribute.xml new file mode 100644 index 00000000..91116c24 --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1_value_attribute.xml @@ -0,0 +1,73 @@ + + + + roboy::context::ValueAttribute + roboy.context.SimpleValueAttribute< V extends DataType > + + + V + + + + + V + V roboy.context.ValueAttribute< V >.getValue + () + getValue + getValue + + + + + + + + + + void + void roboy.context.ValueAttribute< V >.updateValue + (V key) + updateValue + updateValue + + V + key + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + roboy::context::ValueAttributegetValue + roboy::context::ValueAttributeupdateValue + + + diff --git a/docs/doxyxml/interfaceroboy_1_1context_1_1data_types_1_1_data_type.xml b/docs/doxyxml/interfaceroboy_1_1context_1_1data_types_1_1_data_type.xml new file mode 100644 index 00000000..fd0bfcba --- /dev/null +++ b/docs/doxyxml/interfaceroboy_1_1context_1_1data_types_1_1_data_type.xml @@ -0,0 +1,33 @@ + + + + roboy::context::dataTypes::DataType + roboy.context.contextObjects.CoordinateSet + roboy.context.dataTypes.Topic + +Attributes should be able to store data in appropriate data types. + +Example: coordinates for location data from Vision or Audio.If we want to store data beyond runtime, we could add serialization. + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/doxyxml/interfaceroboy_1_1dialog_1_1action_1_1_action.xml b/docs/doxyxml/interfaceroboy_1_1dialog_1_1action_1_1_action.xml old mode 100644 new mode 100755 index 24fdbc14..9cbf5c58 --- a/docs/doxyxml/interfaceroboy_1_1dialog_1_1action_1_1_action.xml +++ b/docs/doxyxml/interfaceroboy_1_1dialog_1_1action_1_1_action.xml @@ -10,30 +10,30 @@ The interface is empty, since different output devices will require different informations in an action. The most important action is the SpeechAction which is used for communication. - + - + - + - + - + - + - + - + diff --git a/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1_personality.xml b/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1_personality.xml old mode 100644 new mode 100755 index a325c4ed..a1c53022 --- a/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1_personality.xml +++ b/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1_personality.xml @@ -6,6 +6,7 @@ roboy.dialog.personality.DefaultPersonality roboy.dialog.personality.KnockKnockPersonality roboy.dialog.personality.SmallTalkPersonality + roboy.newDialog.StateBasedPersonality List< Action > @@ -14,6 +15,7 @@ answer answer answer + answer answer answer @@ -35,7 +37,7 @@ - + @@ -43,36 +45,42 @@ A personality is designed to define how Roboy reacts in every given situation. Roboy can always only represent one personality at a time. Different personalities are meant to be used in different situations, like a more formal or loose one depending on the occasion where he is at. In the future, also different languages could be realized by the use of different personalities.The currently used personality is the SmallTalkPersonality which makes use of a state machine to act and react differently in different situations. - + + + + + + + - + - + - + - + - + - + - + - + - + roboy::dialog::personality::Personalityanswer diff --git a/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1states_1_1_state.xml b/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1states_1_1_state.xml old mode 100644 new mode 100755 index df0db13a..d3f747da --- a/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1states_1_1_state.xml +++ b/docs/doxyxml/interfaceroboy_1_1dialog_1_1personality_1_1states_1_1_state.xml @@ -25,21 +25,22 @@ act act act - act act act + act + act act act act - act act + act - + Reaction @@ -56,8 +57,8 @@ react react react - react react + react Interpretation input @@ -68,7 +69,7 @@ - + @@ -76,114 +77,120 @@ A state always acts when its enters and reacts when its left. Both, the reaction of the last and the action of the next state, are combined to give the answer of Roboy. - + - + - + - + - + - + - + - + - + - + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + roboy::dialog::personality::states::Stateact roboy::dialog::personality::states::Statereact diff --git a/docs/doxyxml/interfaceroboy_1_1io_1_1_communication.xml b/docs/doxyxml/interfaceroboy_1_1io_1_1_communication.xml old mode 100644 new mode 100755 index 42161a9a..d285e440 --- a/docs/doxyxml/interfaceroboy_1_1io_1_1_communication.xml +++ b/docs/doxyxml/interfaceroboy_1_1io_1_1_communication.xml @@ -20,7 +20,7 @@ - + void @@ -34,7 +34,7 @@ - + @@ -42,18 +42,18 @@ - + - + - + - + roboy::io::Communicationcommunicate roboy::io::CommunicationsetPersonality diff --git a/docs/doxyxml/interfaceroboy_1_1io_1_1_input_device.xml b/docs/doxyxml/interfaceroboy_1_1io_1_1_input_device.xml old mode 100644 new mode 100755 index 909b2f2b..88e57b64 --- a/docs/doxyxml/interfaceroboy_1_1io_1_1_input_device.xml +++ b/docs/doxyxml/interfaceroboy_1_1io_1_1_input_device.xml @@ -27,7 +27,7 @@ - + @@ -35,48 +35,48 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + roboy::io::InputDevicelisten diff --git a/docs/doxyxml/interfaceroboy_1_1io_1_1_output_device.xml b/docs/doxyxml/interfaceroboy_1_1io_1_1_output_device.xml old mode 100644 new mode 100755 index 514d9f80..c6343289 --- a/docs/doxyxml/interfaceroboy_1_1io_1_1_output_device.xml +++ b/docs/doxyxml/interfaceroboy_1_1io_1_1_output_device.xml @@ -32,7 +32,7 @@ - + @@ -40,54 +40,54 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + roboy::io::OutputDeviceact diff --git a/docs/doxyxml/interfaceroboy_1_1linguistics_1_1phonetics_1_1_phonetic_encoder.xml b/docs/doxyxml/interfaceroboy_1_1linguistics_1_1phonetics_1_1_phonetic_encoder.xml old mode 100644 new mode 100755 index b498a6e3..4eb6317f --- a/docs/doxyxml/interfaceroboy_1_1linguistics_1_1phonetics_1_1_phonetic_encoder.xml +++ b/docs/doxyxml/interfaceroboy_1_1linguistics_1_1phonetics_1_1_phonetic_encoder.xml @@ -24,7 +24,7 @@ - + @@ -32,30 +32,30 @@ This is intended to be used to correct terms that Roboy misunderstood, but currently is not is use. - + - + - + - + - + - + - + - + roboy::linguistics::phonetics::PhoneticEncoderencode diff --git a/docs/doxyxml/interfaceroboy_1_1linguistics_1_1sentenceanalysis_1_1_analyzer.xml b/docs/doxyxml/interfaceroboy_1_1linguistics_1_1sentenceanalysis_1_1_analyzer.xml old mode 100644 new mode 100755 index 7fec4813..e6b0ef09 --- a/docs/doxyxml/interfaceroboy_1_1linguistics_1_1sentenceanalysis_1_1_analyzer.xml +++ b/docs/doxyxml/interfaceroboy_1_1linguistics_1_1sentenceanalysis_1_1_analyzer.xml @@ -10,6 +10,7 @@ roboy.linguistics.sentenceanalysis.OpenNLPParser roboy.linguistics.sentenceanalysis.OpenNLPPPOSTagger roboy.linguistics.sentenceanalysis.Preprocessor + roboy.linguistics.sentenceanalysis.SemanticParserAnalyzer roboy.linguistics.sentenceanalysis.SentenceAnalyzer roboy.linguistics.sentenceanalysis.SimpleTokenizer @@ -27,6 +28,7 @@ analyze analyze analyze + analyze analyze Interpretation @@ -38,7 +40,7 @@ - + @@ -46,72 +48,78 @@ An analyzer always takes an existing interpretation of a sentence and returns one including its own analysis results (usually an enriched version of the input interpretation). - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + - + - + - + - + - + - + roboy::linguistics::sentenceanalysis::Analyzeranalyze diff --git a/docs/doxyxml/interfaceroboy_1_1logic_1_1_intention.xml b/docs/doxyxml/interfaceroboy_1_1logic_1_1_intention.xml old mode 100644 new mode 100755 index feb533bc..4ff486cc --- a/docs/doxyxml/interfaceroboy_1_1logic_1_1_intention.xml +++ b/docs/doxyxml/interfaceroboy_1_1logic_1_1_intention.xml @@ -6,7 +6,7 @@ - + diff --git a/docs/doxyxml/interfaceroboy_1_1memory_1_1_memory.xml b/docs/doxyxml/interfaceroboy_1_1memory_1_1_memory.xml old mode 100644 new mode 100755 index cf480176..e268abf4 --- a/docs/doxyxml/interfaceroboy_1_1memory_1_1_memory.xml +++ b/docs/doxyxml/interfaceroboy_1_1memory_1_1_memory.xml @@ -48,7 +48,7 @@ - + List< T > @@ -90,7 +90,7 @@ - + @@ -105,7 +105,7 @@ - + roboy::memory::Memoryretrieve roboy::memory::Memorysave diff --git a/docs/doxyxml/linguistics_2_concept_8java.xml b/docs/doxyxml/linguistics_2_concept_8java.xml old mode 100644 new mode 100755 index c15f3c1b..20ecbac5 --- a/docs/doxyxml/linguistics_2_concept_8java.xml +++ b/docs/doxyxml/linguistics_2_concept_8java.xml @@ -16,6 +16,6 @@ Stringid; } - + diff --git a/docs/doxyxml/namespacecom_1_1google_1_1gson.xml b/docs/doxyxml/namespacecom_1_1google_1_1gson.xml new file mode 100644 index 00000000..4df36aa7 --- /dev/null +++ b/docs/doxyxml/namespacecom_1_1google_1_1gson.xml @@ -0,0 +1,11 @@ + + + + com::google::gson + + + + + + + diff --git a/docs/doxyxml/namespaceedu_1_1cmu_1_1sphinx_1_1api.xml b/docs/doxyxml/namespaceedu_1_1cmu_1_1sphinx_1_1api.xml old mode 100644 new mode 100755 index a2e72e0a..91f745aa --- a/docs/doxyxml/namespaceedu_1_1cmu_1_1sphinx_1_1api.xml +++ b/docs/doxyxml/namespaceedu_1_1cmu_1_1sphinx_1_1api.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespacejava_1_1awt.xml b/docs/doxyxml/namespacejava_1_1awt.xml new file mode 100644 index 00000000..b3881f5d --- /dev/null +++ b/docs/doxyxml/namespacejava_1_1awt.xml @@ -0,0 +1,11 @@ + + + + java::awt + + + + + + + diff --git a/docs/doxyxml/namespacejava_1_1io.xml b/docs/doxyxml/namespacejava_1_1io.xml old mode 100644 new mode 100755 index 2e191ea0..c29bb0e0 --- a/docs/doxyxml/namespacejava_1_1io.xml +++ b/docs/doxyxml/namespacejava_1_1io.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespacejava_1_1net.xml b/docs/doxyxml/namespacejava_1_1net.xml old mode 100644 new mode 100755 index 2969612d..1d532f6e --- a/docs/doxyxml/namespacejava_1_1net.xml +++ b/docs/doxyxml/namespacejava_1_1net.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespacejava_1_1util.xml b/docs/doxyxml/namespacejava_1_1util.xml old mode 100644 new mode 100755 index 9807e112..6ce6f567 --- a/docs/doxyxml/namespacejava_1_1util.xml +++ b/docs/doxyxml/namespacejava_1_1util.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespacejavax_1_1swing.xml b/docs/doxyxml/namespacejavax_1_1swing.xml new file mode 100644 index 00000000..45cd5cf7 --- /dev/null +++ b/docs/doxyxml/namespacejavax_1_1swing.xml @@ -0,0 +1,11 @@ + + + + javax::swing + + + + + + + diff --git a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1query.xml b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1query.xml old mode 100644 new mode 100755 index acfae15a..08e6944a --- a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1query.xml +++ b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1query.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1rdf_1_1model.xml b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1rdf_1_1model.xml old mode 100644 new mode 100755 index e7071914..4a204e9e --- a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1rdf_1_1model.xml +++ b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1rdf_1_1model.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1sparql.xml b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1sparql.xml old mode 100644 new mode 100755 index 607978b7..af3f2c50 --- a/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1sparql.xml +++ b/docs/doxyxml/namespaceorg_1_1apache_1_1jena_1_1sparql.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceorg_1_1json.xml b/docs/doxyxml/namespaceorg_1_1json.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/namespaceorg_1_1junit_1_1_assert.xml b/docs/doxyxml/namespaceorg_1_1junit_1_1_assert.xml old mode 100644 new mode 100755 index 465a1d6b..8b172dd4 --- a/docs/doxyxml/namespaceorg_1_1junit_1_1_assert.xml +++ b/docs/doxyxml/namespaceorg_1_1junit_1_1_assert.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceorg_1_1ros_1_1node.xml b/docs/doxyxml/namespaceorg_1_1ros_1_1node.xml old mode 100644 new mode 100755 index ba70a040..d24604d4 --- a/docs/doxyxml/namespaceorg_1_1ros_1_1node.xml +++ b/docs/doxyxml/namespaceorg_1_1ros_1_1node.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy.xml b/docs/doxyxml/namespaceroboy.xml old mode 100644 new mode 100755 index 9acca789..2f5fd8fa --- a/docs/doxyxml/namespaceroboy.xml +++ b/docs/doxyxml/namespaceroboy.xml @@ -2,11 +2,13 @@ roboy + roboy::context roboy::dialog roboy::io roboy::linguistics roboy::logic roboy::memory + roboy::newDialog roboy::ros roboy::talk roboy::util diff --git a/docs/doxyxml/namespaceroboy_1_1context.xml b/docs/doxyxml/namespaceroboy_1_1context.xml new file mode 100644 index 00000000..75fd29f0 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context.xml @@ -0,0 +1,24 @@ + + + + roboy::context + roboy::context::AbstractValue + roboy::context::AbstractValueHistory + roboy::context::AttributeManager + roboy::context::Context + roboy::context::ExternalContextInterface + roboy::context::ExternalUpdater + roboy::context::InternalUpdater + roboy::context::IntervalUpdater + roboy::context::Value + roboy::context::ValueHistory + roboy::context::contextObjects + roboy::context::GUI + roboy::context::visionContext + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1_g_u_i.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1_g_u_i.xml new file mode 100644 index 00000000..96ae1436 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1_g_u_i.xml @@ -0,0 +1,12 @@ + + + + roboy::context::GUI + roboy::context::GUI::ContextGUI + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1context_objects.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1context_objects.xml new file mode 100644 index 00000000..13691831 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1context_objects.xml @@ -0,0 +1,16 @@ + + + + roboy::context::contextObjects + roboy::context::contextObjects::CoordinateSet + roboy::context::contextObjects::DialogTopics + roboy::context::contextObjects::DialogTopicsUpdater + roboy::context::contextObjects::FaceCoordinates + roboy::context::contextObjects::FaceCoordinatesUpdater + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1data_types.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1data_types.xml new file mode 100644 index 00000000..ac9ae6aa --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1data_types.xml @@ -0,0 +1,14 @@ + + + + roboy::context::dataTypes + roboy::context::dataTypes::CoordinateSet + roboy::context::dataTypes::DataType + roboy::context::dataTypes::Topic + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1dialog_context.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1dialog_context.xml new file mode 100644 index 00000000..d3f8fdea --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1dialog_context.xml @@ -0,0 +1,13 @@ + + + + roboy::context::dialogContext + roboy::context::dialogContext::DialogTopics + roboy::context::dialogContext::DialogTopicsUpdater + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1memory_context.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1memory_context.xml new file mode 100644 index 00000000..c511d064 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1memory_context.xml @@ -0,0 +1,13 @@ + + + + roboy::context::memoryContext + roboy::context::memoryContext::InterlocutorNode + roboy::context::memoryContext::InterlocutorNodeUpdater + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1context_1_1vision_context.xml b/docs/doxyxml/namespaceroboy_1_1context_1_1vision_context.xml new file mode 100644 index 00000000..50159210 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1context_1_1vision_context.xml @@ -0,0 +1,12 @@ + + + + roboy::context::visionContext + roboy::context::visionContext::ContextTest + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1dialog.xml b/docs/doxyxml/namespaceroboy_1_1dialog.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/namespaceroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml b/docs/doxyxml/namespaceroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml old mode 100644 new mode 100755 index 314241de..06c9127c --- a/docs/doxyxml/namespaceroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml +++ b/docs/doxyxml/namespaceroboy_1_1dialog_1_1_config_1_1_configuration_profile.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1dialog_1_1action.xml b/docs/doxyxml/namespaceroboy_1_1dialog_1_1action.xml old mode 100644 new mode 100755 index ca2d5fed..bc051aab --- a/docs/doxyxml/namespaceroboy_1_1dialog_1_1action.xml +++ b/docs/doxyxml/namespaceroboy_1_1dialog_1_1action.xml @@ -10,6 +10,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality.xml b/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality.xml old mode 100644 new mode 100755 index ff1cfac9..967fb6ea --- a/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality.xml +++ b/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality.xml @@ -12,6 +12,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality_1_1states.xml b/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality_1_1states.xml old mode 100644 new mode 100755 index 50df9f4a..3893e7d4 --- a/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality_1_1states.xml +++ b/docs/doxyxml/namespaceroboy_1_1dialog_1_1personality_1_1states.xml @@ -14,6 +14,7 @@ roboy::dialog::personality::states::IntroductionState roboy::dialog::personality::states::LocationDBpedia roboy::dialog::personality::states::LocationDBpediaStateTest + roboy::dialog::personality::states::PersonalFollowUpState roboy::dialog::personality::states::PersonalQAState roboy::dialog::personality::states::QuestionAnsweringState roboy::dialog::personality::states::QuestionAnsweringStateTest @@ -27,6 +28,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1io.xml b/docs/doxyxml/namespaceroboy_1_1io.xml old mode 100644 new mode 100755 index c99e8780..a9c22962 --- a/docs/doxyxml/namespaceroboy_1_1io.xml +++ b/docs/doxyxml/namespaceroboy_1_1io.xml @@ -25,6 +25,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1linguistics.xml b/docs/doxyxml/namespaceroboy_1_1linguistics.xml old mode 100644 new mode 100755 index 6f6f916f..80e8867f --- a/docs/doxyxml/namespaceroboy_1_1linguistics.xml +++ b/docs/doxyxml/namespaceroboy_1_1linguistics.xml @@ -10,10 +10,11 @@ roboy::linguistics::Triple roboy::linguistics::phonetics roboy::linguistics::sentenceanalysis + roboy::linguistics::word2vec - + diff --git a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1phonetics.xml b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1phonetics.xml old mode 100644 new mode 100755 index 581404de..c6925886 --- a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1phonetics.xml +++ b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1phonetics.xml @@ -11,6 +11,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1sentenceanalysis.xml b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1sentenceanalysis.xml old mode 100644 new mode 100755 index 142e7827..0809444b --- a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1sentenceanalysis.xml +++ b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1sentenceanalysis.xml @@ -15,12 +15,13 @@ roboy::linguistics::sentenceanalysis::OpenNLPParserTest roboy::linguistics::sentenceanalysis::OpenNLPPPOSTagger roboy::linguistics::sentenceanalysis::Preprocessor + roboy::linguistics::sentenceanalysis::SemanticParserAnalyzer roboy::linguistics::sentenceanalysis::SentenceAnalyzer roboy::linguistics::sentenceanalysis::SimpleTokenizer - + diff --git a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec.xml b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec.xml new file mode 100644 index 00000000..5d57ddb5 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec.xml @@ -0,0 +1,12 @@ + + + + roboy::linguistics::word2vec + roboy::linguistics::word2vec::examples + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec_1_1examples.xml b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec_1_1examples.xml new file mode 100644 index 00000000..6ce20f41 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1linguistics_1_1word2vec_1_1examples.xml @@ -0,0 +1,14 @@ + + + + roboy::linguistics::word2vec::examples + roboy::linguistics::word2vec::examples::ToyDataGetter + roboy::linguistics::word2vec::examples::Word2vecTrainingExample + roboy::linguistics::word2vec::examples::Word2vecUptrainingExample + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1logic.xml b/docs/doxyxml/namespaceroboy_1_1logic.xml old mode 100644 new mode 100755 index 57d0b35c..e19d8177 --- a/docs/doxyxml/namespaceroboy_1_1logic.xml +++ b/docs/doxyxml/namespaceroboy_1_1logic.xml @@ -11,6 +11,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1memory.xml b/docs/doxyxml/namespaceroboy_1_1memory.xml old mode 100644 new mode 100755 index ac0396ad..4979d658 --- a/docs/doxyxml/namespaceroboy_1_1memory.xml +++ b/docs/doxyxml/namespaceroboy_1_1memory.xml @@ -8,7 +8,7 @@ roboy::memory::LexiconPredicate roboy::memory::Memory roboy::memory::Neo4jMemory - roboy::memory::Neo4jRelations + roboy::memory::Neo4jRelationships roboy::memory::PersistentKnowledge roboy::memory::RoboyMind roboy::memory::Util @@ -18,6 +18,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1memory_1_1_neo4j_relations.xml b/docs/doxyxml/namespaceroboy_1_1memory_1_1_neo4j_relations.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/namespaceroboy_1_1memory_1_1_neo4j_relationships.xml b/docs/doxyxml/namespaceroboy_1_1memory_1_1_neo4j_relationships.xml new file mode 100755 index 00000000..bc3ab6a2 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1memory_1_1_neo4j_relationships.xml @@ -0,0 +1,11 @@ + + + + roboy::memory::Neo4jRelationships + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1memory_1_1nodes.xml b/docs/doxyxml/namespaceroboy_1_1memory_1_1nodes.xml old mode 100644 new mode 100755 index f00e74a3..0debf4a4 --- a/docs/doxyxml/namespaceroboy_1_1memory_1_1nodes.xml +++ b/docs/doxyxml/namespaceroboy_1_1memory_1_1nodes.xml @@ -4,10 +4,11 @@ roboy::memory::nodes roboy::memory::nodes::Interlocutor roboy::memory::nodes::MemoryNodeModel + roboy::memory::nodes::Roboy - + diff --git a/docs/doxyxml/namespaceroboy_1_1new_dialog.xml b/docs/doxyxml/namespaceroboy_1_1new_dialog.xml new file mode 100644 index 00000000..fff0d222 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1new_dialog.xml @@ -0,0 +1,17 @@ + + + + roboy::newDialog + roboy::newDialog::DialogStateMachine + roboy::newDialog::DialogStateMachineTest + roboy::newDialog::NewDialogSystem + roboy::newDialog::StateBasedPersonality + roboy::newDialog::examples + roboy::newDialog::states + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1examples.xml b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1examples.xml new file mode 100644 index 00000000..5848f7e1 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1examples.xml @@ -0,0 +1,12 @@ + + + + roboy::newDialog::examples + roboy::newDialog::examples::StateMachineExamples + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states.xml b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states.xml new file mode 100644 index 00000000..11abae31 --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states.xml @@ -0,0 +1,14 @@ + + + + roboy::newDialog::states + roboy::newDialog::states::State + roboy::newDialog::states::factories + roboy::newDialog::states::toyStates + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1factories.xml b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1factories.xml new file mode 100644 index 00000000..31c69d2d --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1factories.xml @@ -0,0 +1,12 @@ + + + + roboy::newDialog::states::factories + roboy::newDialog::states::factories::ToyStateFactory + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1toy_states.xml b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1toy_states.xml new file mode 100644 index 00000000..1df99c9c --- /dev/null +++ b/docs/doxyxml/namespaceroboy_1_1new_dialog_1_1states_1_1toy_states.xml @@ -0,0 +1,15 @@ + + + + roboy::newDialog::states::toyStates + roboy::newDialog::states::toyStates::ToyFarewellState + roboy::newDialog::states::toyStates::ToyGreetingsState + roboy::newDialog::states::toyStates::ToyIntroState + roboy::newDialog::states::toyStates::ToyRandomAnswerState + + + + + + + diff --git a/docs/doxyxml/namespaceroboy_1_1ros.xml b/docs/doxyxml/namespaceroboy_1_1ros.xml old mode 100644 new mode 100755 index 4d2794d1..6375cfd7 --- a/docs/doxyxml/namespaceroboy_1_1ros.xml +++ b/docs/doxyxml/namespaceroboy_1_1ros.xml @@ -6,11 +6,10 @@ roboy::ros::RosClients roboy::ros::RosMainNode roboy::ros::RosManager - roboy::ros::RosNode - + diff --git a/docs/doxyxml/namespaceroboy_1_1talk.xml b/docs/doxyxml/namespaceroboy_1_1talk.xml old mode 100644 new mode 100755 index aa660ab8..1a8e5fb7 --- a/docs/doxyxml/namespaceroboy_1_1talk.xml +++ b/docs/doxyxml/namespaceroboy_1_1talk.xml @@ -9,6 +9,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy_1_1util.xml b/docs/doxyxml/namespaceroboy_1_1util.xml old mode 100644 new mode 100755 index dec96096..979f40ae --- a/docs/doxyxml/namespaceroboy_1_1util.xml +++ b/docs/doxyxml/namespaceroboy_1_1util.xml @@ -4,15 +4,17 @@ roboy::util roboy::util::Concept roboy::util::IO + roboy::util::JsonEntryModel + roboy::util::JsonModel + roboy::util::JsonQAValues roboy::util::JsonUtils roboy::util::Lists roboy::util::Maps roboy::util::Relation - roboy::util::ros - + diff --git a/docs/doxyxml/namespaceroboy_1_1util_1_1ros.xml b/docs/doxyxml/namespaceroboy_1_1util_1_1ros.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/namespaceroboy__communication__cognition.xml b/docs/doxyxml/namespaceroboy__communication__cognition.xml old mode 100644 new mode 100755 index 08bac8cc..eda0f4f8 --- a/docs/doxyxml/namespaceroboy__communication__cognition.xml +++ b/docs/doxyxml/namespaceroboy__communication__cognition.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/namespaceroboy__communication__control.xml b/docs/doxyxml/namespaceroboy__communication__control.xml old mode 100644 new mode 100755 index a64f457a..537788ad --- a/docs/doxyxml/namespaceroboy__communication__control.xml +++ b/docs/doxyxml/namespaceroboy__communication__control.xml @@ -6,6 +6,6 @@ - + diff --git a/docs/doxyxml/new_dialog_2states_2_state_8java.xml b/docs/doxyxml/new_dialog_2states_2_state_8java.xml new file mode 100644 index 00000000..07e52a93 --- /dev/null +++ b/docs/doxyxml/new_dialog_2states_2_state_8java.xml @@ -0,0 +1,224 @@ + + + + State.java + roboy::newDialog::states::State + roboy::newDialog::states + + + + + +packageroboy.newDialog.states; + +importcom.google.gson.JsonObject; +importroboy.linguistics.sentenceanalysis.Interpretation; + +importjava.util.*; + +publicabstractclassState{ + + +//Statename/identifier +privateStringstateIdentifier; + +//Ifthisstatecan'treacttotheinput,thePersonalitystatemachinewillaskthefallbackstate +privateStatefallback; + +//Possibletransitionstootherstates.ThenextstateisselectedbasedonsomeconditionsingetNextState(); +privateHashMap<String,State>transitions; + + +publicState(StringstateIdentifier){ +this.stateIdentifier=stateIdentifier; +fallback=null; +transitions=newHashMap<>(); +} + +//regionidentifier,fallback&transitions + +publicStringgetIdentifier(){ +returnstateIdentifier; +} +publicvoidsetIdentifier(StringstateIdentifier){ +this.stateIdentifier=stateIdentifier; +} + +publicfinalStategetFallback(){ +returnfallback; +} + +publicfinalvoidsetFallback(Statefallback){ +this.fallback=fallback; +} + +publicfinalvoidsetTransition(Stringname,StategoToState){ +transitions.put(name,goToState); +} +publicfinalStategetTransition(Stringname){ +returntransitions.get(name); +} +publicfinalHashMap<String,State>getAllTransitions(){ +returntransitions; +} + +//endregion + +//Functionsthatmustbeimplementedinsubclasses: + +//regiontobeimplementedinsubclasses + +publicabstractList<Interpretation>act(); + + +publicabstractList<Interpretation>react(Interpretationinput); + + +publicabstractStategetNextState(); + + +//endregion + +//Utilityfunctions:makesureinitializationiscorrect + +//regioncorrectinitializationchecks + +protectedSet<String>getRequiredTransitionNames(){ +//defaultimplementation:norequiredtransitions +returnnewHashSet<>(); +} + +publicfinalbooleanallRequiredTransitionsAreInitialized(){ +booleanallGood=true; + +for(StringtName:getRequiredTransitionNames()){ +if(!transitions.containsKey(tName)){ +System.err.println("Transition"+tName+"isrequiredbutisnotdefined!"); +allGood=false; +} +} + +returnallGood; +} + +protectedSet<String>newSet(String...tNames){ +HashSet<String>result=newHashSet<>(); +result.addAll(Arrays.asList(tNames)); +returnresult; +} + +//endregion + +publicJsonObjecttoJsonObject(){ +JsonObjectstateJson=newJsonObject(); +stateJson.addProperty("identifier",getIdentifier()); + +StringclassName=getClass().getCanonicalName(); +stateJson.addProperty("implementation",className); + +if(fallback!=null){ +StringfallbackID=fallback.getIdentifier(); +stateJson.addProperty("fallback",fallbackID); +} + +//transitions +JsonObjecttransitionsJson=newJsonObject(); +for(Map.Entry<String,State>transition:getAllTransitions().entrySet()){ +StringtransName=transition.getKey(); +StringtransStateID=transition.getValue().getIdentifier(); +transitionsJson.addProperty(transName,transStateID); +} +stateJson.add("transitions",transitionsJson); + + +returnstateJson; + +} + +publicStringtoString(){ +StringBuilders=newStringBuilder(); +s.append("State").append(getIdentifier()).append("ofclass"); +s.append(this.getClass().getSimpleName()).append("{\n"); + +Statefallback=getFallback(); +if(fallback!=null){ +s.append("!fallback:").append(fallback.getIdentifier()).append("\n"); +} +for(Map.Entry<String,State>transition:getAllTransitions().entrySet()){ +s.append("").append(transition.getKey()).append(":"); +s.append(transition.getValue().getIdentifier()).append("\n"); +} + +returns.append("}\n").toString(); + + +} + +@Override +publicbooleanequals(Objectobj){ +if(!(objinstanceofState)){ +returnfalse; +} +Stateother=(State)obj; + +//differentclass +if(other.getClass()!=this.getClass()){ +returnfalse; +} + +//otherhasafallback,thisdoesn't +if(this.fallback==null&&other.fallback!=null){ +returnfalse; +} + +//thishasafallback,otherdoesn't +if(other.fallback==null&&this.fallback!=null){ +returnfalse; +} + +//bothhavefallbacks,comparethembyIDs +if(this.fallback!=null){ +StringthisFallbackID=this.getFallback().getIdentifier(); +StringotherFallbackID=this.getFallback().getIdentifier(); +//differentfallbackIDs +if(!thisFallbackID.equals(otherFallbackID)){ +returnfalse; +} +} + +//comparetransitions:allofthistransitionsarepresentintheother +booleanotherHasAllOfThis=this.equalsHelper_compareTransitions(other); +booleanthisHasAllOfOther=other.equalsHelper_compareTransitions(this); + +returnotherHasAllOfThis&&thisHasAllOfOther; +} + +privatebooleanequalsHelper_compareTransitions(Stateother){ + +//foreverytransitioninthisstate +for(Map.Entry<String,State>transition:getAllTransitions().entrySet()){ + +//transitionname +StringtransName=transition.getKey(); +//idofthestatethistransitionpointsto +StringthisTransStateID=transition.getValue().getIdentifier(); + +//checkiftransitionintheotherstatepointstothesameid +StateotherTransState=other.getTransition(transName); +if(otherTransState==null)returnfalse; + +StringotherTransStateID=otherTransState.getIdentifier(); +if(!thisTransStateID.equals(otherTransStateID))returnfalse; + +} +returntrue; + +} + + +} + + + + + diff --git a/docs/doxyxml/nutshell_8h.xml b/docs/doxyxml/nutshell_8h.xml old mode 100644 new mode 100755 diff --git a/docs/doxyxml/util_2_concept_8java.xml b/docs/doxyxml/util_2_concept_8java.xml old mode 100644 new mode 100755 index 509a5c67..f37ad306 --- a/docs/doxyxml/util_2_concept_8java.xml +++ b/docs/doxyxml/util_2_concept_8java.xml @@ -27,14 +27,14 @@ publicConcept() { -this.attributes=newHashMap<String,Object>(); +this.attributes=newHashMap<>(); this.attributes.put("class_name","Person");//TODOremovehardcodedpersonconstructor this.attributes.put("id",RoboyMind.getInstance().object_id++); } publicConcept(Map<String,Object>attrs) { -this.attributes=newHashMap<String,Object>(); +this.attributes=newHashMap<>(); this.attributes.put("class_name","Person"); this.attributes.put("id",RoboyMind.getInstance().object_id++); for(Map.Entry<String,Object>attr:attrs.entrySet()) @@ -44,7 +44,7 @@ } publicConcept(Stringname){ -this.attributes=newHashMap<String,Object>(); +this.attributes=newHashMap<>(); attributes.put(Linguistics.NAME,name); this.attributes.put("id",RoboyMind.getInstance().object_id++); } @@ -70,80 +70,76 @@ publicStringgetProperties() { -Stringproperties=""; +StringBuilderproperties=newStringBuilder(); for(Map.Entry<String,Object>attribute:this.getAttributes().entrySet()) { //if(attribute.getKey()!="class_name"&&attribute.getKey()!="id") //{ -properties+=attribute.getKey()+","; +properties.append(attribute.getKey()).append(","); //} } -if(properties.length()>0&&properties.charAt(properties.length()-1)==',') +if(properties.length()>0&&properties.charAt(properties.length()-1)==',') { -properties=properties.substring(0,properties.length()-1); +properties=newStringBuilder(properties.substring(0,properties.length()-1)); } -returnproperties; +returnproperties.toString(); } publicStringgetValues() { -Stringvalues=""; +StringBuildervalues=newStringBuilder(); for(Map.Entry<String,Object>attribute:this.getAttributes().entrySet()) { -if(attribute.getKey()!="class"&&attribute.getKey()!="id") +if(!attribute.getKey().equals("class")&&!attribute.getKey().equals("id")) { -values+=attribute.getValue().toString()+","; +values.append(attribute.getValue().toString()).append(","); } } if(values.length()>0&&values.charAt(values.length()-1)==',') { -values=values.substring(0,values.length()-1); +values=newStringBuilder(values.substring(0,values.length()-1)); } -returnvalues; +returnvalues.toString(); } publicbooleanhasAttribute(Stringproperty) { -if(this.getProperties()!=""&&this.getProperties().contains(property)) -{ -returntrue; -} -returnfalse; -} - -publicObjectretrieve() -{ -returnRoboyMind.getInstance().retrieve(this); -} - -publicbooleanupdateInMemory() -{ -if(RoboyMind.getInstance().retrieve(this).size()==0) -{ -RoboyMind.getInstance().save(this); -} -returnRoboyMind.getInstance().update(this); -} - -publicintgetID() -{ -returnInteger.parseInt(this.getAttribute("id").toString().replace("\"","")); -} - -//TODOgetClass - - -} +return!this.getProperties().equals("")&&this.getProperties().contains(property); +} + +publicObjectretrieve() +{ +returnRoboyMind.getInstance().retrieve(this); +} + +publicbooleanupdateInMemory() +{ +if(RoboyMind.getInstance().retrieve(this).size()==0) +{ +RoboyMind.getInstance().save(this); +} +returnRoboyMind.getInstance().update(this); +} + +publicintgetID() +{ +returnInteger.parseInt(this.getAttribute("id").toString().replace("\"","")); +} + +//TODOgetClass + + +} - + diff --git a/docs/html/arrowdown.png b/docs/html/arrowdown.png old mode 100644 new mode 100755 diff --git a/docs/html/arrowright.png b/docs/html/arrowright.png old mode 100644 new mode 100755 diff --git a/docs/html/bc_s.png b/docs/html/bc_s.png old mode 100644 new mode 100755 diff --git a/docs/html/bdwn.png b/docs/html/bdwn.png old mode 100644 new mode 100755 diff --git a/docs/html/closed.png b/docs/html/closed.png old mode 100644 new mode 100755 diff --git a/docs/html/doc.png b/docs/html/doc.png old mode 100644 new mode 100755 diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css old mode 100644 new mode 100755 diff --git a/docs/html/doxygen.png b/docs/html/doxygen.png old mode 100644 new mode 100755 diff --git a/docs/html/dynsections.js b/docs/html/dynsections.js old mode 100644 new mode 100755 diff --git a/docs/html/folderclosed.png b/docs/html/folderclosed.png old mode 100644 new mode 100755 diff --git a/docs/html/folderopen.png b/docs/html/folderopen.png old mode 100644 new mode 100755 diff --git a/docs/html/graph_legend.html b/docs/html/graph_legend.html old mode 100644 new mode 100755 index e02a047f..5b5e9979 --- a/docs/html/graph_legend.html +++ b/docs/html/graph_legend.html @@ -90,7 +90,7 @@
  • A box with a gray border denotes an undocumented struct or class.
  • -A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relations are shown. A graph is truncated if it does not fit within the specified boundaries.
  • +A box with a red border denotes a documented struct or class forwhich not all inheritance/containment relationships are shown. A graph is truncated if it does not fit within the specified boundaries.

    The arrows have the following meaning:

      diff --git a/docs/html/graph_legend.md5 b/docs/html/graph_legend.md5 old mode 100644 new mode 100755 diff --git a/docs/html/graph_legend.png b/docs/html/graph_legend.png old mode 100644 new mode 100755 diff --git a/docs/html/index.html b/docs/html/index.html old mode 100644 new mode 100755 diff --git a/docs/html/jquery.js b/docs/html/jquery.js old mode 100644 new mode 100755 diff --git a/docs/html/nav_f.png b/docs/html/nav_f.png old mode 100644 new mode 100755 diff --git a/docs/html/nav_g.png b/docs/html/nav_g.png old mode 100644 new mode 100755 diff --git a/docs/html/nav_h.png b/docs/html/nav_h.png old mode 100644 new mode 100755 diff --git a/docs/html/open.png b/docs/html/open.png old mode 100644 new mode 100755 diff --git a/docs/html/search/close.png b/docs/html/search/close.png old mode 100644 new mode 100755 diff --git a/docs/html/search/mag_sel.png b/docs/html/search/mag_sel.png old mode 100644 new mode 100755 diff --git a/docs/html/search/nomatches.html b/docs/html/search/nomatches.html old mode 100644 new mode 100755 diff --git a/docs/html/search/search.css b/docs/html/search/search.css old mode 100644 new mode 100755 diff --git a/docs/html/search/search.js b/docs/html/search/search.js old mode 100644 new mode 100755 diff --git a/docs/html/search/search_l.png b/docs/html/search/search_l.png old mode 100644 new mode 100755 diff --git a/docs/html/search/search_m.png b/docs/html/search/search_m.png old mode 100644 new mode 100755 diff --git a/docs/html/search/search_r.png b/docs/html/search/search_r.png old mode 100644 new mode 100755 diff --git a/docs/html/search/searchdata.js b/docs/html/search/searchdata.js old mode 100644 new mode 100755 diff --git a/docs/html/splitbar.png b/docs/html/splitbar.png old mode 100644 new mode 100755 diff --git a/docs/html/sync_off.png b/docs/html/sync_off.png old mode 100644 new mode 100755 diff --git a/docs/html/sync_on.png b/docs/html/sync_on.png old mode 100644 new mode 100755 diff --git a/docs/html/tab_a.png b/docs/html/tab_a.png old mode 100644 new mode 100755 diff --git a/docs/html/tab_b.png b/docs/html/tab_b.png old mode 100644 new mode 100755 diff --git a/docs/html/tab_h.png b/docs/html/tab_h.png old mode 100644 new mode 100755 diff --git a/docs/html/tab_s.png b/docs/html/tab_s.png old mode 100644 new mode 100755 diff --git a/docs/html/tabs.css b/docs/html/tabs.css old mode 100644 new mode 100755 diff --git a/docs/images/context.png b/docs/images/context.png new file mode 100644 index 00000000..73a12b9e Binary files /dev/null and b/docs/images/context.png differ diff --git a/docs/images/overview_diagram.jpg b/docs/images/overview_diagram.jpg old mode 100644 new mode 100755 diff --git a/docs/images/parser.png b/docs/images/parser.png new file mode 100644 index 00000000..40273521 Binary files /dev/null and b/docs/images/parser.png differ diff --git a/docs/latex/Makefile b/docs/latex/Makefile old mode 100644 new mode 100755 diff --git a/docs/latex/doxygen.sty b/docs/latex/doxygen.sty old mode 100644 new mode 100755 diff --git a/docs/latex/refman.tex b/docs/latex/refman.tex old mode 100644 new mode 100755 diff --git a/docs/requirements.txt b/docs/requirements.txt old mode 100644 new mode 100755 diff --git a/pom.xml b/pom.xml old mode 100644 new mode 100755 index d249aab6..3532bf0a --- a/pom.xml +++ b/pom.xml @@ -9,74 +9,79 @@ Roboy Roboy Dialog System + - + + + org.apache.maven.plugins maven-compiler-plugin + 3.7.0 - 1.7 - 1.7 + 1.8 + 1.8 - 2.3.2 - - maven-assembly-plugin - - - package - - single - - - - - - jar-with-dependencies - - - - true - lib/ - roboy.dialog.DialogSystem - - - - - - - jdeb - org.vafer - 1.5 - - - package - - jdeb - - - - - ${project.build.directory}/${project.build.finalName}.jar - file - - perm - /usr/share/jdeb/lib - - - - - - - + + maven-assembly-plugin + + + package + + single + + + + + + jar-with-dependencies + + + + true + lib/ + roboy.dialog.DialogSystem + + + + + + jdeb + org.vafer + 1.5 + + + package + + jdeb + + + + + ${project.build.directory}/${project.build.finalName}.jar + file + + perm + /usr/share/jdeb/lib + + + + + + + + resources + + @@ -91,14 +96,14 @@ http://repository.springsource.com/maven/bundles/external - - - true - - central - Central Repository - https://repo.maven.apache.org/maven2 - + + + true + + central + Central Repository + https://repo.maven.apache.org/maven2 + snapshots-repo @@ -117,43 +122,65 @@ + + org.apache.opennlp opennlp-tools 1.7.0 + com.google.code.gson gson 2.7 + commons-codec commons-codec 1.10 + edu.wpi.rail jrosbridge 0.2.0 + org.json json 20160810 + org.mobicents.external.freetts freetts 1.0 + junit junit 4.12 + + com.google.guava + guava + 23.0 + + + + org.mockito + mockito-all + 1.10.19 + test + + + org.apache.jena jena-arq @@ -171,7 +198,7 @@ sphinx4-core 5prealpha-SNAPSHOT - + edu.cmu.sphinx sphinx4-data @@ -208,7 +235,7 @@ com.springsource.org.apache.commons.logging - + org.ros.rosjava_bootstrap @@ -257,5 +284,32 @@ snakeyaml 1.18 + + + + org.deeplearning4j + deeplearning4j-nlp + 0.9.1 + + + + + org.nd4j + nd4j-native-platform + 0.9.1 + + + + + org.slf4j + + + + + slf4j-nop + 1.7.7 + + - \ No newline at end of file + + diff --git a/resources/en-parser-chunking.bin b/resources/en-parser-chunking.bin old mode 100644 new mode 100755 diff --git a/resources/en-pos-maxent.bin b/resources/en-pos-maxent.bin old mode 100644 new mode 100755 diff --git a/resources/knowledgebase/triples.csv b/resources/knowledgebase/triples.csv old mode 100644 new mode 100755 diff --git a/resources/knowledgebase/triviaConcepts.csv b/resources/knowledgebase/triviaConcepts.csv old mode 100644 new mode 100755 diff --git a/resources/knowledgebase/triviaWords.csv b/resources/knowledgebase/triviaWords.csv old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/_overview.txt b/resources/ontology/concepts/_overview.txt old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/action.json b/resources/ontology/concepts/action.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/age.json b/resources/ontology/concepts/age.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/agreement.json b/resources/ontology/concepts/agreement.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/animal.json b/resources/ontology/concepts/animal.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/animate.json b/resources/ontology/concepts/animate.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/answer.json b/resources/ontology/concepts/answer.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/apologizing.json b/resources/ontology/concepts/apologizing.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/being.json b/resources/ontology/concepts/being.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/china.json b/resources/ontology/concepts/china.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/city.json b/resources/ontology/concepts/city.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/cloudy.json b/resources/ontology/concepts/cloudy.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/compliment.json b/resources/ontology/concepts/compliment.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/continent.json b/resources/ontology/concepts/continent.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/country.json b/resources/ontology/concepts/country.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/disagreement.json b/resources/ontology/concepts/disagreement.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/dog.json b/resources/ontology/concepts/dog.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/driving.json b/resources/ontology/concepts/driving.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/farewell.json b/resources/ontology/concepts/farewell.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/feeling.json b/resources/ontology/concepts/feeling.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/finland.json b/resources/ontology/concepts/finland.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/gender.json b/resources/ontology/concepts/gender.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/greeting.json b/resources/ontology/concepts/greeting.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/immaterial.json b/resources/ontology/concepts/immaterial.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/inanimate.json b/resources/ontology/concepts/inanimate.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/insult.json b/resources/ontology/concepts/insult.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/joke.json b/resources/ontology/concepts/joke.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/location.json b/resources/ontology/concepts/location.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/movement.json b/resources/ontology/concepts/movement.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/object.json b/resources/ontology/concepts/object.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/opinion.json b/resources/ontology/concepts/opinion.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/person.json b/resources/ontology/concepts/person.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/planet.json b/resources/ontology/concepts/planet.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/predicate.json b/resources/ontology/concepts/predicate.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/province.json b/resources/ontology/concepts/province.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/quantity.json b/resources/ontology/concepts/quantity.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/question.json b/resources/ontology/concepts/question.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/rainy.json b/resources/ontology/concepts/rainy.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/relationship.json b/resources/ontology/concepts/relationship.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/sandiego.json b/resources/ontology/concepts/sandiego.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/size.json b/resources/ontology/concepts/size.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/space.json b/resources/ontology/concepts/space.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/sports.json b/resources/ontology/concepts/sports.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/state.json b/resources/ontology/concepts/state.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/suggestion.json b/resources/ontology/concepts/suggestion.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/sunny.json b/resources/ontology/concepts/sunny.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/thanking.json b/resources/ontology/concepts/thanking.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/thing.json b/resources/ontology/concepts/thing.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/time.json b/resources/ontology/concepts/time.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/traveling.json b/resources/ontology/concepts/traveling.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/utterance.json b/resources/ontology/concepts/utterance.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/walking.json b/resources/ontology/concepts/walking.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/weathercondition.json b/resources/ontology/concepts/weathercondition.json old mode 100644 new mode 100755 diff --git a/resources/ontology/concepts/windy.json b/resources/ontology/concepts/windy.json old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/_format.txt b/resources/ontology/terms/_format.txt old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/am.json b/resources/ontology/terms/am.json old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/are.json b/resources/ontology/terms/are.json old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/feel.json b/resources/ontology/terms/feel.json old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/feeling.json b/resources/ontology/terms/feeling.json old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/feels b/resources/ontology/terms/feels old mode 100644 new mode 100755 diff --git a/resources/ontology/terms/is.json b/resources/ontology/terms/is.json old mode 100644 new mode 100755 diff --git a/resources/personalityFiles/ExamplePersonality.json b/resources/personalityFiles/ExamplePersonality.json new file mode 100644 index 00000000..ea0c644f --- /dev/null +++ b/resources/personalityFiles/ExamplePersonality.json @@ -0,0 +1,33 @@ +{ + "initialState": "Greetings", + "states": [ + { + "identifier": "Greetings", + "implementation" : "roboy.newDialog.states.toyStates.ToyGreetingsState", + "fallback" : "RandomAnswer", + "transitions" : { + "next" : "Intro", + "noHello" : "Farewell" + } + }, + { + "identifier": "Intro", + "implementation" : "roboy.newDialog.states.toyStates.ToyIntroState", + "transitions" : { + "next" : "Farewell" + } + }, + { + "identifier": "Farewell", + "implementation" : "roboy.newDialog.states.toyStates.ToyFarewellState", + "transitions" : {} + }, + { + "identifier": "RandomAnswer", + "implementation" : "roboy.newDialog.states.toyStates.ToyRandomAnswerState", + "transitions" : { + "next" : "Farewell" + } + } + ] +} \ No newline at end of file diff --git a/resources/sentences/QAList.json b/resources/sentences/QAList.json new file mode 100755 index 00000000..c8b31da2 --- /dev/null +++ b/resources/sentences/QAList.json @@ -0,0 +1,279 @@ +{ + "name": { + "Q": [ + "How can I call you?", + "What is your name?", + "Who are you?" + ], + "A": { + "SUCCESS": [ + "Nice to meet you %s" + ], + "FAILURE": [ + "My ears are failing me today." + ] + }, + "FUP": { + "Q": [ + "%s, I will come and get you" + ], + "A": [ + "Nice to see that you are still alive %s" + ] + } + }, + "FROM": { + "Q": [ + "Where are you from?", + "Where were you born?", + "I have hard time guessing your home country. What is it?", + "Which town do you call your home?" + ], + "A": { + "SUCCESS": [ + "Oh, I should visit %s" + ], + "FAILURE": [ + "Oh, I have never heard of that." + ] + }, + "FUP": { + "Q": [ + "What is the weather in %s?", + "What was the last time you visited %s?", + "Do I need a visa to go to %s?" + ], + "A": [ + "You are from a very interesting place %s" + ] + } + }, + "HAS_HOBBY": { + "Q": [ + "What is your favorite thing to do?", + "What is your hobby?", + "What do you do in your free time?", + "How do you spend your free time?", + "What is your favorite pastime activity?" + ], + "A": { + "SUCCESS": [ + "You are just like me, I love %s too" + ], + "FAILURE": [ + "Don't know what that is, but good luck!" + ] + }, + "FUP": { + "Q": [ + "Have you got any new hobby besides %s?", + "You still like %s, right?", + "Do you think I can do %s? I heard you like it." + ], + "A": [ + "Leisure time is the best time %s" + ] + } + }, + "LIVE_IN": { + "Q": [ + "Where do you live?", + "Which city do you live in?", + "Where is your current home?" + ], + "A": { + "SUCCESS": [ + "I should visit %s ", + "It is beautiful in %s", + "%s is a beautiful place" + ], + "FAILURE": [ + "Oh, I have never heard of that." + ] + }, + "FUP": { + "Q": [ + "You live in %s, right? I must pay a visit.", + "Is not %s a nice place to live?", + "How is the accommodation market in %s?" + ], + "A": [ + "I should visit %s", + "It is beautiful in %s", + "%s is a beautiful place", + ] + } + }, + "FRIEND_OF": { + "Q": [ + "Who is your best friend?", + "Have I met any of your friends?", + "Do you have a friend whom I have met?", + "Maybe I know some friends of yours. Would you name one?" + ], + "A": { + "SUCCESS": [ + "Oh, I believe I have met %s they're nice." + ], + "FAILURE": [ + "I don't think I know them." + ] + }, + "FUP": { + "Q": [ + "Have you made any new friends, %s?" + ], + "A": [ + "Oh, I have met %s they're nice." + ] + } + }, + "STUDY_AT": { + "Q": [ + "Where do you study?", + "Which university do you go to?", + "Which university do you study at?", + "What is your alma mater?" + ], + "A": { + "SUCCESS": [ + "%s must be a cool place to study at." + ], + "FAILURE": [ + "Oh well, whatever suits you." + ] + }, + "FUP": { + "Q": [ + "Have you graduated from %s already?", + "Do you still study at %s?", + "Which degree are you pursuing at %s?" + ], + "A": [ + "Ok, I think it is good for your future career %s", + "It is not that interesting, you know %s" + ] + } + }, + "MEMBER_OF": { + "Q": [ + "Are you a member of some cool organization?", + "Do you belong to any organizations?" + ], + "A": { + "SUCCESS": [ + "%s? That is cool!" + ], + "FAILURE": [ + "Oh well, whatever suits you." + ] + }, + "FUP": { + "Q": [ + "Are you still a member of %s?", + "Have you left %s already?", + "Is it nice to be a part of %s?" + ], + "A": [ + "That is cool! %s" + ] + } + }, + "WORK_FOR": { + "Q": [ + "Where do you work?", + "For which company do you work?", + "Who is your employer?", + "Where are you employed?", + "Which organization do you work at?", + "Where do you earn your living?" + ], + "A": { + "SUCCESS": [ + "I have heard of %s" + ], + "FAILURE": [ + "I don't know that one." + ] + }, + "FUP": { + "Q": [ + "Do you still work for %s?", + "Is %s a good company?", + "How much do they pay you at %s?" + ], + "A": [ + "I think it is good for you %s" + ] + } + }, + "OCCUPIED_AS": { + "Q": [ + "What do you do?", + "What is your profession?", + "What do you work as?", + "What is your field of expertise?" + ], + "A": { + "SUCCESS": [ + "You are probably very poor doing %s" + ], + "FAILURE": [ + "Oh well, whatever suits you." + ] + }, + "FUP": { + "Q": [ + "Are you still doing that %s stuff?" + ], + "A": [ + "True, true. You are probably very poor due to this %s" + ] + } + }, + "movies": { + "Q": [ + "What is your favourite movie?", + "What was the last movie you saw in the cinema?", + "What is your favorite TV show?", + "Which comedy do you like the most?" + ], + "A": { + "SUCCESS": [ + "Oh, I would watch %s. If those vision guys finally fixed my perception." + ], + "FAILURE": [ + "Haven't heard of it. It's probably shit." + ] + }, + "FUP": { + "Q": [ + "You are a movie addict, right? What do you think about %s?" + ], + "A": [ + "Nevermind. I better check IMDB %s" + ] + } + }, + "OTHER": { + "Q": [ + "Other?" + ], + "A": { + "SUCCESS": [ + "Other %s and other" + ], + "FAILURE": [ + "There is no other on the Earth" + ] + }, + "FUP": { + "Q": [ + "Do you remember other %s?" + ], + "A": [ + "Other is still other, amigo %s" + ] + } + } +} \ No newline at end of file diff --git a/resources/sentences/answersFollowUp.json b/resources/sentences/answersFollowUp.json new file mode 100755 index 00000000..e7ca7dd7 --- /dev/null +++ b/resources/sentences/answersFollowUp.json @@ -0,0 +1,35 @@ +{ + "name" : [ + ["Nice to see that you are still alive ",""] + ], + "FROM" : [ + ["You are from a very interesting place",""] + ], + "HAS_HOBBY" : [ + ["Leisure time is the best time",""] + ], + "LIVE_IN" : [ + ["I should visit ",""], + ["It is beautiful in ",""], + [""," is a beautiful place"] + ], + "FRIEND_OF" : [ + ["Oh, I have met "," they're nice."] + ], + "STUDY_AT" : [ + ["","Ok, I think it is good for your future career"], + ["","It is not so interesting, you know"] + ], + "MEMBER_OF" : [ + ["","? That is cool!"] + ], + "WORK_FOR" : [ + ["I think it is good for you",""] + ], + "movies" : [ + ["Oh, I would watch ",". If those vision guys finally fixed my perception."] + ], + "OCCUPIED_AS" : [ + ["You are probably very poor doing ",""] + ] +} diff --git a/resources/sentences/failureAnswers.json b/resources/sentences/failureAnswers.json old mode 100644 new mode 100755 index ac88eca3..3ce12444 --- a/resources/sentences/failureAnswers.json +++ b/resources/sentences/failureAnswers.json @@ -26,7 +26,10 @@ "movies" : [ "Haven't heard of it. It's probably shit." ], - "OCCUPATION" : [ + "OCCUPIED_AS" : [ "Oh well, whatever." + ], + "OTHER" : [ + "Other" ] } diff --git a/resources/sentences/followUp.json b/resources/sentences/followUp.json new file mode 100755 index 00000000..e04afb1a --- /dev/null +++ b/resources/sentences/followUp.json @@ -0,0 +1,44 @@ +{ + "name" : [ + "%s, I will come and get you" + ], + "FROM" : [ + "What is the weather in %s?", + "What was the last time you visited %s?", + "Do I need a visa to go to %s?" + ], + "HAS_HOBBY" : [ + "Have you got any new hobby besides %s?", + "You still like %s, right?", + "Do you think I can do %s? I heard you like it." + ], + "LIVE_IN" : [ + "You live in %s, right? I must pay a visit.", + "Is not %s a nice place to live?", + "How is the accommodation market in %s?" + ], + "FRIEND_OF" : [ + "Have you made any new friends, %s?" + ], + "STUDY_AT" : [ + "Have you graduated from %s already?", + "Do you still study at %s?", + "Which degree are you pursuing at %s?" + ], + "MEMBER_OF" : [ + "Are you still a member of %s?", + "Have you left %s already?", + "Is it nice to be a part of %s?" + ], + "WORK_FOR" : [ + "Do you still work for %s?", + "Is %s a good company?", + "How much do they pay you at %s?" + ], + "movies" : [ + "MOVIE, MOVIE, MOVIE" + ], + "OCCUPIED_AS" : [ + "OCCUPATION, OCCUPATION, OCCUPATION" + ] +} \ No newline at end of file diff --git a/resources/sentences/questions.json b/resources/sentences/questions.json old mode 100644 new mode 100755 index 0a064527..98921ae2 --- a/resources/sentences/questions.json +++ b/resources/sentences/questions.json @@ -52,10 +52,13 @@ "What is your favorite TV show?", "Which comedy do you like the most?" ], - "OCCUPATION" : [ + "OCCUPIED_AS" : [ "What do you do?", "What is your profession?", "What do you work as?", "What is your field of expertise?" + ], + "OTHER" : [ + "Other" ] -} +} \ No newline at end of file diff --git a/resources/sentences/successAnswers.json b/resources/sentences/successAnswers.json old mode 100644 new mode 100755 index fa89dd1d..c4030e17 --- a/resources/sentences/successAnswers.json +++ b/resources/sentences/successAnswers.json @@ -28,7 +28,10 @@ "movies" : [ ["Oh, I would watch ",". If those vision guys finally fixed my perception."] ], - "OCCUPATION" : [ + "OCCUPIED_AS" : [ ["You are probably very poor doing ",""] + ], + "OTHER" : [ + ["Other ",""] ] } diff --git a/resources/tmp.txt b/resources/tmp.txt old mode 100644 new mode 100755 diff --git a/roboy_parser b/roboy_parser new file mode 160000 index 00000000..490ba9e2 --- /dev/null +++ b/roboy_parser @@ -0,0 +1 @@ +Subproject commit 490ba9e29be5da02c7914280da56087892733296 diff --git a/src/deb/control/control b/src/deb/control/control old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/9462/9462.dic b/src/edu/cmu/sphinx/models/9462/9462.dic old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/9462/9462.lm b/src/edu/cmu/sphinx/models/9462/9462.lm old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/README b/src/edu/cmu/sphinx/models/en-us/en-us/README old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/feat.params b/src/edu/cmu/sphinx/models/en-us/en-us/feat.params old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/mdef b/src/edu/cmu/sphinx/models/en-us/en-us/mdef old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/means b/src/edu/cmu/sphinx/models/en-us/en-us/means old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/mixture_weights b/src/edu/cmu/sphinx/models/en-us/en-us/mixture_weights old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/noisedict b/src/edu/cmu/sphinx/models/en-us/en-us/noisedict old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/sendump b/src/edu/cmu/sphinx/models/en-us/en-us/sendump old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/transition_matrices b/src/edu/cmu/sphinx/models/en-us/en-us/transition_matrices old mode 100644 new mode 100755 diff --git a/src/edu/cmu/sphinx/models/en-us/en-us/variances b/src/edu/cmu/sphinx/models/en-us/en-us/variances old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/context/AbstractValue.java b/src/main/java/roboy/context/AbstractValue.java new file mode 100644 index 00000000..6b13d926 --- /dev/null +++ b/src/main/java/roboy/context/AbstractValue.java @@ -0,0 +1,11 @@ +package roboy.context; + +/** + * Stores a single value. + * On update, the value is overwritten. + */ +public interface AbstractValue { + V getValue(); + + void updateValue(V key); +} diff --git a/src/main/java/roboy/context/AbstractValueHistory.java b/src/main/java/roboy/context/AbstractValueHistory.java new file mode 100644 index 00000000..1429e5ff --- /dev/null +++ b/src/main/java/roboy/context/AbstractValueHistory.java @@ -0,0 +1,11 @@ +package roboy.context; + +import java.util.Map; + +/** + * ValueHistory maintains a map containing all (current and past) values. + * These values are accessible over the getLastNValues method. + */ +public interface AbstractValueHistory extends AbstractValue { + Map getLastNValues(int n); +} diff --git a/src/main/java/roboy/context/AttributeManager.java b/src/main/java/roboy/context/AttributeManager.java new file mode 100644 index 00000000..9a57fec8 --- /dev/null +++ b/src/main/java/roboy/context/AttributeManager.java @@ -0,0 +1,28 @@ +package roboy.context; + +import com.google.common.collect.ImmutableClassToInstanceMap; + +import java.util.Map; + +/** + * The collection of values, split into valueHistories (H) and single values (V). + */ +public class AttributeManager { + + protected ImmutableClassToInstanceMap valueHistories; + protected ImmutableClassToInstanceMap values; + + protected T getLastValue(ExternalContextInterface attribute) { + Class type = attribute.getReturnType(); + return type.cast(valueHistories.get(attribute.getClassType()).getValue()); + } + + protected Map getNLastValues(H attribute, int n) { + return (Map) valueHistories.get(attribute.getClassType()).getLastNValues(n); + } + + protected T getValue(V attribute) { + Class type = attribute.getReturnType(); + return type.cast(values.get(attribute.getClassType()).getValue()); + } +} diff --git a/src/main/java/roboy/context/Context.java b/src/main/java/roboy/context/Context.java new file mode 100644 index 00000000..86d86701 --- /dev/null +++ b/src/main/java/roboy/context/Context.java @@ -0,0 +1,135 @@ +package roboy.context; + +import com.google.common.collect.ImmutableClassToInstanceMap; +import roboy.context.contextObjects.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +/** + * Singleton class serving as an interface to access all context objects. + * Takes care of correct initialization of attribute histories and updaters. + *

      + * Queries to values are handled through the inherited AttributeManager methods. + *

      + * For usage examples, check out ContextTest.java + */ +public class Context extends AttributeManager { + private static Context context; + + private final ArrayList externalUpdaters = new ArrayList<>(); + public final HashMap internalUpdaters = new HashMap<>(); + + private Context() { + FaceCoordinates faceCoordinates = new FaceCoordinates(); + DialogTopics dialogTopics = new DialogTopics(); + + values = new ImmutableClassToInstanceMap.Builder() + // Collect all Values centrally right here. + .put(FaceCoordinates.class, faceCoordinates) + .build(); + + valueHistories = new ImmutableClassToInstanceMap.Builder() + // Collect all ValueHistories centrally right here. + .put(DialogTopics.class, dialogTopics) + .build(); + + // Initialize and store the external updaters. + externalUpdaters.add(new FaceCoordinatesUpdater(faceCoordinates, 1)); + // Initialize direct updaters with their targets. + internalUpdaters.put(DialogTopicsUpdater.class, new DialogTopicsUpdater(dialogTopics)); + } + + public static Context getInstance() { + if (context == null) { + context = new Context(); + } + return context; + } + + /** + * All available valueHistories. + */ + public enum ValueHistories implements ExternalContextInterface { + DIALOG_TOPICS(DialogTopics.class, String.class); + + final Class classType; + final Class returnType; + + ValueHistories(Class attribute, Class dataType) { + this.classType = attribute; + this.returnType = dataType; + } + + public Class getClassType() { + return this.classType; + } + + public Class getReturnType() { + return this.returnType; + } + + public T getLastValue() { + return Context.getInstance().getLastValue(this); + } + + public Map getNLastValues(int n) { + return Context.getInstance().getNLastValues(this, n); + } + } + + /** + * All available values. + */ + public enum Values implements ExternalContextInterface { + FACE_COORDINATES(FaceCoordinates.class, CoordinateSet.class); + + final Class classType; + final Class returnType; + + Values(Class attribute, Class value) { + this.classType = attribute; + this.returnType = value; + } + + public Class getClassType() { + return this.classType; + } + + public Class getReturnType() { + return this.returnType; + } + + public T getLastValue() { + return Context.getInstance().getValue(this); + } + } + + /** + * All available updaters by their class and their target's value type. + */ + public enum Updaters { + DIALOG_TOPICS_UPDATER(DialogTopicsUpdater.class, String.class); + + final Class classType; + final Class targetValueType; + + Updaters(Class attribute, Class valueType) { + this.classType = attribute; + this.targetValueType = valueType; + } + } + + /** + * Directly update an attribute. + * + * @param updater The name of the Value or ValueHistory object. + * @param value Data to put into the Value or ValueHistory object. + */ + public void updateValue(Updaters updater, V value) { + // Could throw exception if the value does not match the target data type. + Class type = updater.targetValueType; + internalUpdaters.get(updater.classType).putValue(type.cast(value)); + } +} diff --git a/src/main/java/roboy/context/ExternalContextInterface.java b/src/main/java/roboy/context/ExternalContextInterface.java new file mode 100644 index 00000000..bba1fbcc --- /dev/null +++ b/src/main/java/roboy/context/ExternalContextInterface.java @@ -0,0 +1,11 @@ +package roboy.context; + +/** + * Interface for an enum which lists Context values and valueHistories. + * Methods enable retrieving values over generic methods with AttributeManager. + */ +public interface ExternalContextInterface { + Class getClassType(); + + Class getReturnType(); +} diff --git a/src/main/java/roboy/context/ExternalUpdater.java b/src/main/java/roboy/context/ExternalUpdater.java new file mode 100644 index 00000000..e1654e4c --- /dev/null +++ b/src/main/java/roboy/context/ExternalUpdater.java @@ -0,0 +1,9 @@ +package roboy.context; + +/** + * For Values which should be updated upon incoming data or at regular intervals, + * this class fetches and passes the values. + */ +public abstract class ExternalUpdater { + protected abstract void update(); +} diff --git a/src/main/java/roboy/context/GUI/ContextGUI.java b/src/main/java/roboy/context/GUI/ContextGUI.java new file mode 100644 index 00000000..2eae88aa --- /dev/null +++ b/src/main/java/roboy/context/GUI/ContextGUI.java @@ -0,0 +1,160 @@ +package roboy.context.GUI; + +import roboy.context.Context; + +import javax.swing.*; +import javax.swing.border.TitledBorder; +import java.awt.*; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.HashMap; +import java.util.Map; + +/** + * A simple GUI with the goal of showing the attribute values and histories in the Context. + */ +public class ContextGUI { + private JFrame mainFrame; + + // Panel displaying valueAttributes. + private TitledBorder valueBorder; + private JPanel valuePanel; + private Map valueDisplays; + private Map historyDisplays; + private static int MAX_HISTORY_VALUES = 10; + + // Panel displaying historyAttributes. + private TitledBorder historyBorder; + private JPanel historyPanel; + + // Update button panel. + private JPanel controlPanel; + + private static int FULL_WIDTH = 400; + private static int FULL_HEIGHT = 300; + private static int ATTR_WIDTH = 390; + private static int ATTR_HEIGHT = 50; + private static int HISTORY_HEIGHT = 100; + + private static String NO_VALUE = ""; + + public static void run() { + ContextGUI gui = new ContextGUI(); + gui.startFrame(); + } + + private ContextGUI() { + prepareGUI(); + } + + private void prepareGUI() { + // Window initialization. + mainFrame = new JFrame("Context GUI"); + mainFrame.setSize(FULL_WIDTH, FULL_HEIGHT); + mainFrame.setLayout(new FlowLayout()); + JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); + + mainFrame.add(mainPanel); + + // Attribute part initialization. + valuePanel = new JPanel(); + valuePanel.setLayout(new GridLayout(0, 2)); + valuePanel.setPreferredSize(new Dimension(ATTR_WIDTH, ATTR_HEIGHT)); + valueBorder = BorderFactory.createTitledBorder("Context values"); + valueBorder.setTitleJustification(TitledBorder.CENTER); + valuePanel.setBorder(valueBorder); + + valueDisplays = new HashMap<>(); + for (Context.Values attribute : Context.Values.values()) { + valuePanel.add(new JLabel(attribute.toString() + ":", JLabel.CENTER)); + Object val = attribute.getLastValue(); + if (val == null) { + val = NO_VALUE; + } + JLabel valueLabel = new JLabel(val.toString(), JLabel.CENTER); + valueDisplays.put(attribute, valueLabel); + valuePanel.add(valueLabel); + } + mainPanel.add(valuePanel); + + // History part initialization. + historyPanel = new JPanel(); + historyPanel.setLayout(new GridLayout(0, 2)); + historyPanel.setPreferredSize(new Dimension(ATTR_WIDTH, HISTORY_HEIGHT)); + historyBorder = BorderFactory.createTitledBorder("Histories"); + historyBorder.setTitleJustification(TitledBorder.CENTER); + historyPanel.setBorder(historyBorder); + + historyDisplays = new HashMap<>(); + for (Context.ValueHistories attribute : Context.ValueHistories.values()) { + historyPanel.add(new JLabel(attribute.toString() + ":", JLabel.CENTER)); + Map vals = attribute.getNLastValues(MAX_HISTORY_VALUES); + DefaultListModel sorted = new DefaultListModel<>(); + if (vals.size() == 0) { + sorted.add(0, NO_VALUE); + } else { + for (Integer i = 0; i < vals.size(); i++) { + sorted.add(i, vals.get(vals.size() - i - 1).toString()); + } + } + JList historyList = new JList(sorted); + JScrollPane scrollPane = new JScrollPane(); + scrollPane.setViewportView(historyList); + historyDisplays.put(attribute, scrollPane); + historyPanel.add(scrollPane); + } + mainPanel.add(historyPanel); + + mainFrame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent windowEvent) { + mainFrame.dispose(); + } + }); + + controlPanel = new JPanel(); + controlPanel.setLayout(new FlowLayout()); + + mainPanel.add(controlPanel); + mainPanel.setVisible(true); + } + + private void startFrame() { + JButton updateButton = new JButton("Update"); + updateButton.addActionListener(e -> { + updateValues(); + updateHistories(); + } + ); + controlPanel.add(updateButton); + mainFrame.setVisible(true); + } + + private void updateValues() { + for (Context.Values attribute : Context.Values.values()) { + Object val = attribute.getLastValue(); + if (val == null) { + continue; + } + valueDisplays.get(attribute).setText(val.toString()); + } + valuePanel.updateUI(); + } + + private void updateHistories() { + for (Context.ValueHistories attribute : Context.ValueHistories.values()) { + Map vals = attribute.getNLastValues(MAX_HISTORY_VALUES); + if (vals.size() == 0) { + continue; + } + DefaultListModel sorted = new DefaultListModel<>(); + for (Integer i = 0; i < vals.size(); i++) { + sorted.add(i, vals.get(vals.size() - i - 1).toString()); + } + JList historyList = new JList(sorted); + JScrollPane pane = historyDisplays.get(attribute); + pane.setViewportView(historyList); + } + historyPanel.updateUI(); + } +} diff --git a/src/main/java/roboy/context/InternalUpdater.java b/src/main/java/roboy/context/InternalUpdater.java new file mode 100644 index 00000000..e34715a2 --- /dev/null +++ b/src/main/java/roboy/context/InternalUpdater.java @@ -0,0 +1,19 @@ +package roboy.context; + +/** + * An updater which can be called from inside DM to update a Value or ValueHistory. + * + * @param The target Value or ValueHistory. + * @param The data type stored in the target. + */ +public class InternalUpdater, V> { + AbstractValue target; + + protected InternalUpdater(T target) { + this.target = target; + } + + public synchronized void putValue(V value) { + target.updateValue(value); + } +} diff --git a/src/main/java/roboy/context/IntervalUpdater.java b/src/main/java/roboy/context/IntervalUpdater.java new file mode 100644 index 00000000..2595e2da --- /dev/null +++ b/src/main/java/roboy/context/IntervalUpdater.java @@ -0,0 +1,44 @@ +package roboy.context; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; + +import static java.util.concurrent.TimeUnit.SECONDS; + +/** + * An implementation of the UpdatePolicy which performs regular updates on a target object. + * The method update() needs to be implemented in the subclass. + * + * @param The class of the target object. + */ +public abstract class IntervalUpdater extends ExternalUpdater { + protected final T target; + protected final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + public final int updateFrequency; + + /** + * Create a new updater service, executing the update() method at regular time intervals. + * + * @param target The target attribute of the update() method. + * @param updateFrequencySeconds Delay in seconds between calls to the update() method. + */ + public IntervalUpdater(T target, int updateFrequencySeconds) { + this.target = target; + updateFrequency = updateFrequencySeconds; + start(); + } + + /** + * Starts the ScheduledExecutorService of the updating thread. + */ + private void start() { + final Runnable updater = () -> update(); + // Schedules regular updates, starting 1 second after initialization. + final ScheduledFuture updaterHandle = scheduler.scheduleAtFixedRate( + updater, 1, updateFrequency, SECONDS); + // Cancel each scheduled task after 30 seconds of runtime - prevent excessive threads if the goal is down. + scheduler.schedule((Runnable) () -> updaterHandle.cancel(true), 30, SECONDS); + } + +} diff --git a/src/main/java/roboy/context/Value.java b/src/main/java/roboy/context/Value.java new file mode 100644 index 00000000..0a718619 --- /dev/null +++ b/src/main/java/roboy/context/Value.java @@ -0,0 +1,19 @@ +package roboy.context; + +/** + * Stores a single value of type V. + */ +public class Value implements AbstractValue { + private volatile V value = null; + + @Override + public V getValue() { + return value; + } + + @Override + public void updateValue(V value) { + this.value = value; + } + +} diff --git a/src/main/java/roboy/context/ValueHistory.java b/src/main/java/roboy/context/ValueHistory.java new file mode 100644 index 00000000..029e7662 --- /dev/null +++ b/src/main/java/roboy/context/ValueHistory.java @@ -0,0 +1,82 @@ +package roboy.context; + +import java.util.HashMap; + +/** + * HashMap implementation of a value history with unique Integer keys. + */ +public class ValueHistory implements AbstractValueHistory { + /** + * This counter tracks the number of values, indices still start from 0. + * Reading is allowed without synchronization, modifications only through generateKey(). + */ + private volatile int counter; + private HashMap data; + + public ValueHistory() { + data = new HashMap<>(); + counter = 0; + } + + /** + * @return The last element added to this list. + */ + @Override + public V getValue() { + if (counter == 0) { + return null; + } else { + return getValue(counter - 1); + } + } + + /** + * Get a copy of the last n entries added to the list. + * Less values may be returned if there are not enough values in this list. + * In case of no values, an empty array is returned. + * + * @param n The number of instances to retrieve. + * @return A hashmap of n last values added to the list. + */ + @Override + public HashMap getLastNValues(int n) { + HashMap reponse = new HashMap<>(); + int lastToRetrieve = counter - Math.min(n, counter); + for (int i = counter - 1; i >= lastToRetrieve; i--) { + reponse.put(i - lastToRetrieve, getValue(i)); + } + return reponse; + } + + /** + * Puts a value into the list in the last place. + * + * @param value The value to be added. + */ + @Override + public synchronized void updateValue(V value) { + Integer key = generateKey(); + data.put(key, value); + } + + /** + * Generates a key that is unique through incrementing an internal counter. + * + * @return A key which is unique in this list instance. + */ + private synchronized int generateKey() { + return counter++; + } + + /** + * In a ValueList, only getValue() and updateValue() directly access the HashMap data. + * Setting these methods to be synchronous avoids concurrency issues. + * + * @param key The key of the value. + * @return The value, or null if not found. + */ + private synchronized V getValue(int key) { + return data.getOrDefault(key, null); + } + +} diff --git a/src/main/java/roboy/context/contextObjects/CoordinateSet.java b/src/main/java/roboy/context/contextObjects/CoordinateSet.java new file mode 100644 index 00000000..eecd5ff9 --- /dev/null +++ b/src/main/java/roboy/context/contextObjects/CoordinateSet.java @@ -0,0 +1,16 @@ +package roboy.context.contextObjects; + +/** + * A coordinate set data structure for the interlocutor face. + */ +public class CoordinateSet { + final double x; + final double y; + final double z; + + public CoordinateSet(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } +} diff --git a/src/main/java/roboy/context/contextObjects/DialogTopics.java b/src/main/java/roboy/context/contextObjects/DialogTopics.java new file mode 100644 index 00000000..683898bb --- /dev/null +++ b/src/main/java/roboy/context/contextObjects/DialogTopics.java @@ -0,0 +1,6 @@ +package roboy.context.contextObjects; + +import roboy.context.ValueHistory; + +public class DialogTopics extends ValueHistory { +} diff --git a/src/main/java/roboy/context/contextObjects/DialogTopicsUpdater.java b/src/main/java/roboy/context/contextObjects/DialogTopicsUpdater.java new file mode 100644 index 00000000..2126d4d1 --- /dev/null +++ b/src/main/java/roboy/context/contextObjects/DialogTopicsUpdater.java @@ -0,0 +1,12 @@ +package roboy.context.contextObjects; + +import roboy.context.InternalUpdater; + +/** + * Updater available to all DM for adding new values to the DialogTopics attribute. + */ +public class DialogTopicsUpdater extends InternalUpdater { + public DialogTopicsUpdater(DialogTopics target) { + super(target); + } +} diff --git a/src/main/java/roboy/context/contextObjects/FaceCoordinates.java b/src/main/java/roboy/context/contextObjects/FaceCoordinates.java new file mode 100644 index 00000000..30e19bad --- /dev/null +++ b/src/main/java/roboy/context/contextObjects/FaceCoordinates.java @@ -0,0 +1,10 @@ +package roboy.context.contextObjects; + +import roboy.context.Value; + +/** + * xzy-coordinates of a person in the field of vision. + */ +public class FaceCoordinates extends Value { + +} diff --git a/src/main/java/roboy/context/contextObjects/FaceCoordinatesUpdater.java b/src/main/java/roboy/context/contextObjects/FaceCoordinatesUpdater.java new file mode 100644 index 00000000..4d2b3bd4 --- /dev/null +++ b/src/main/java/roboy/context/contextObjects/FaceCoordinatesUpdater.java @@ -0,0 +1,22 @@ +package roboy.context.contextObjects; + +import roboy.context.IntervalUpdater; + +import java.util.Random; + +/** + * Asynchronously triggers ROS queries for face coordinates (in the future). + */ +public class FaceCoordinatesUpdater extends IntervalUpdater { + public FaceCoordinatesUpdater(FaceCoordinates target, int updateFrequencySeconds) { + super(target, updateFrequencySeconds); + } + + @Override + protected void update() { + Random r = new Random(); + // TODO replace dummy functionality! (And also update the test accordingly.) + CoordinateSet set = new CoordinateSet(r.nextDouble(), r.nextDouble(), r.nextDouble()); + target.updateValue(set); + } +} diff --git a/src/main/java/roboy/dialog/Config.java b/src/main/java/roboy/dialog/Config.java old mode 100644 new mode 100755 index c7e09f2b..0d4ea82f --- a/src/main/java/roboy/dialog/Config.java +++ b/src/main/java/roboy/dialog/Config.java @@ -24,7 +24,8 @@ public enum ConfigurationProfile { DEFAULT("DEFAULT"), NOROS("NOROS"), STANDALONE("STANDALONE"), - DEBUG("DEBUG"); + DEBUG("DEBUG"), + MEMORY("MEMORY"); public String profileName; @@ -46,6 +47,13 @@ public enum ConfigurationProfile { public static boolean SHUTDOWN_ON_SERVICE_FAILURE = true; /** ROS hostname, will be fetched from the configuration file in the DEFAULT profile. */ public static String ROS_HOSTNAME = null; + /** If true, memory will be queried. Ensure that if NOROS=false, then MEMORY=true. + * When NOROS=true, MEMORY can be either true or false. **/ + public static boolean MEMORY = true; + /** Semantic parser socket port. */ + public static int PARSER_PORT = -1; + /** Context GUI demo trigger. Set manually, if wanted. **/ + public static boolean DEMO_GUI = false; /** Configuration file to store changing values. */ private static String yamlConfigFile = "config.properties"; @@ -56,6 +64,9 @@ public enum ConfigurationProfile { */ public Config(ConfigurationProfile profile) { initializeYAMLConfig(); + // Initialize semantic parser socket port + PARSER_PORT = yamlConfig.getInt("PARSER_PORT"); + DEMO_GUI = yamlConfig.getBoolean("DEMO_GUI"); switch(profile) { case DEFAULT: setDefaultProfile(); @@ -69,6 +80,9 @@ public Config(ConfigurationProfile profile) { case DEBUG: setDebugProfile(); break; + case MEMORY: + setMemoryProfile(); + break; default: setDefaultProfile(); } @@ -99,6 +113,7 @@ private void setNoROSProfile() { NOROS = true; SHUTDOWN_ON_ROS_FAILURE = false; SHUTDOWN_ON_SERVICE_FAILURE = false; + MEMORY = false; } private void setStandaloneProfile() { @@ -107,6 +122,7 @@ private void setStandaloneProfile() { NOROS = true; SHUTDOWN_ON_ROS_FAILURE = false; SHUTDOWN_ON_SERVICE_FAILURE = false; + MEMORY = false; } private void setDebugProfile() { @@ -114,12 +130,20 @@ private void setDebugProfile() { SHUTDOWN_ON_SERVICE_FAILURE = false; } + private void setMemoryProfile() { + NOROS = true; + SHUTDOWN_ON_ROS_FAILURE = false; + SHUTDOWN_ON_SERVICE_FAILURE = false; + MEMORY = true; + ROS_HOSTNAME = yamlConfig.getString("ROS_HOSTNAME"); + } + private void initializeYAMLConfig() { this.yamlConfig = new YAMLConfiguration(); try { File propertiesFile = new File(yamlConfigFile); - if(propertiesFile == null) { + if(! propertiesFile.exists()) { // propertiesFile == null doesn't work! System.out.println("Could not find "+yamlConfigFile+" file in project path! YAML configurations will be unavailable."); return; } diff --git a/src/main/java/roboy/dialog/DialogSystem.java b/src/main/java/roboy/dialog/DialogSystem.java old mode 100644 new mode 100755 index b9bd9bde..331c9391 --- a/src/main/java/roboy/dialog/DialogSystem.java +++ b/src/main/java/roboy/dialog/DialogSystem.java @@ -6,6 +6,7 @@ import com.google.gson.JsonIOException; +import roboy.context.GUI.ContextGUI; import roboy.dialog.action.Action; import roboy.dialog.action.ShutDownAction; import roboy.dialog.personality.Personality; @@ -14,6 +15,7 @@ import roboy.io.*; import roboy.linguistics.sentenceanalysis.*; +import roboy.memory.Neo4jMemory; import roboy.talk.Verbalizer; import roboy.ros.RosMainNode; @@ -31,7 +33,7 @@ * 1. Input devices produce an Input object * 2. The Input object is transformed into an Interpretation object containing * the input sentence in the Linguistics.SENTENCE attribute and all other - * attributes of the Input object in the corresponding fields + * lists of the Input object in the corresponding fields * 3. Linguistic Analyzers are used on the Interpretation object to add additional information * 4. The Personality class takes the Interpretation object and decides how to answer * to this input @@ -82,8 +84,16 @@ public static void main(String[] args) throws JsonIOException, IOException, Inte new Config(DEFAULT); } + if(Config.DEMO_GUI) { + final Runnable gui = () -> ContextGUI.run(); + Thread t = new Thread(gui); + t.start(); + } + // initialize ROS node RosMainNode rosMainNode = new RosMainNode(); + // initialize Memory with ROS + Neo4jMemory.getInstance(rosMainNode); /* * I/O INITIALIZATION @@ -120,6 +130,7 @@ public static void main(String[] args) throws JsonIOException, IOException, Inte analyzers.add(new OntologyNERAnalyzer()); analyzers.add(new AnswerAnalyzer()); analyzers.add(new EmotionAnalyzer()); + analyzers.add(new SemanticParserAnalyzer(Config.PARSER_PORT)); //if(!Config.NOROS) { // analyzers.add(new IntentAnalyzer(rosMainNode)); //} @@ -136,7 +147,7 @@ public static void main(String[] args) throws JsonIOException, IOException, Inte // emotion.act(new FaceAction("angry")); // } // emotion.act(new FaceAction("neutral")); -// while (!multiIn.listen().attributes.containsKey(Linguistics.ROBOYDETECTED)) { +// while (!multiIn.listen().lists.containsKey(Linguistics.ROBOYDETECTED)) { // } Personality smallTalk = new SmallTalkPersonality(new Verbalizer(), rosMainNode); diff --git a/src/main/java/roboy/dialog/action/Action.java b/src/main/java/roboy/dialog/action/Action.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/action/FaceAction.java b/src/main/java/roboy/dialog/action/FaceAction.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/action/ShutDownAction.java b/src/main/java/roboy/dialog/action/ShutDownAction.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/action/SpeechAction.java b/src/main/java/roboy/dialog/action/SpeechAction.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/CuriousPersonality.java b/src/main/java/roboy/dialog/personality/CuriousPersonality.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/DefaultPersonality.java b/src/main/java/roboy/dialog/personality/DefaultPersonality.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/KnockKnockPersonality.java b/src/main/java/roboy/dialog/personality/KnockKnockPersonality.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/Personality.java b/src/main/java/roboy/dialog/personality/Personality.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/SmallTalkPersonality.java b/src/main/java/roboy/dialog/personality/SmallTalkPersonality.java old mode 100644 new mode 100755 index 52f7204e..5828e070 --- a/src/main/java/roboy/dialog/personality/SmallTalkPersonality.java +++ b/src/main/java/roboy/dialog/personality/SmallTalkPersonality.java @@ -156,7 +156,7 @@ public String getName() { return name; } - public void setName(String name) { + public void setName(String name) { this.name = name; } diff --git a/src/main/java/roboy/dialog/personality/states/AbstractBooleanState.java b/src/main/java/roboy/dialog/personality/states/AbstractBooleanState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/AnecdoteState.java b/src/main/java/roboy/dialog/personality/states/AnecdoteState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/CelebrityState.java b/src/main/java/roboy/dialog/personality/states/CelebrityState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/ConverseState.java b/src/main/java/roboy/dialog/personality/states/ConverseState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/FarewellState.java b/src/main/java/roboy/dialog/personality/states/FarewellState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/GenerativeCommunicationState.java b/src/main/java/roboy/dialog/personality/states/GenerativeCommunicationState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/GreetingState.java b/src/main/java/roboy/dialog/personality/states/GreetingState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/IdleState.java b/src/main/java/roboy/dialog/personality/states/IdleState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/InquiryState.java b/src/main/java/roboy/dialog/personality/states/InquiryState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/IntroductionState.java b/src/main/java/roboy/dialog/personality/states/IntroductionState.java old mode 100644 new mode 100755 index 04b47660..0dcec992 --- a/src/main/java/roboy/dialog/personality/states/IntroductionState.java +++ b/src/main/java/roboy/dialog/personality/states/IntroductionState.java @@ -1,12 +1,17 @@ package roboy.dialog.personality.states; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; import roboy.linguistics.Linguistics; import roboy.linguistics.Linguistics.SEMANTIC_ROLE; import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.memory.Neo4jMemory; +import roboy.memory.Neo4jRelationships; import roboy.memory.nodes.Interlocutor; +import roboy.memory.nodes.MemoryNodeModel; import roboy.util.Lists; /** @@ -16,6 +21,8 @@ public class IntroductionState extends AbstractBooleanState{ Interlocutor person = new Interlocutor(); + Neo4jMemory memory; + public Neo4jRelationships predicate = Neo4jRelationships.FRIEND_OF; private static final List introductions = Lists.stringList( "I am Roboy. Who are you?", @@ -64,15 +71,35 @@ protected boolean determineSuccess(Interpretation input) { // List agens = PersistentKnowledge.getInstance().retrieve(new Triple(null,name,null)); // List patiens = PersistentKnowledge.getInstance().retrieve(new Triple(null,null,name)); //TODO Currently assuming no duplicate names in memory. Support for last name addition needed. - person.addName(name); - if(!person.FAMILIAR) { - return false; - } - setSuccessTexts(Lists.stringList( - "Oh hi, "+name+". Sorry, I didn't recognize you at first. But you know how the vision guys are.", - "Hi "+name+" nice to see you again." - )); - return true; + String retrievedResult = ""; + person.addName(name); + if(!person.FAMILIAR) { + return false; + } else { + ArrayList ids = person.getRelationships(predicate); + if (ids != null && !ids.isEmpty()) { + memory = Neo4jMemory.getInstance(); + try { + for (int i = 0; i < ids.size() && i < 3; i++) { + MemoryNodeModel requestedObject = memory.getById(ids.get(i)); + retrievedResult += requestedObject.getProperties().get("name").toString(); + retrievedResult += " and "; + } + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (!retrievedResult.equals("")) { + retrievedResult = "By the way I know you are friends with " + retrievedResult.substring(0, retrievedResult.length() - 5); + } + } + setSuccessTexts(Lists.stringList( + "Oh hi, " + name + ". Sorry, I didn't recognize you at first. But you know how the vision guys are. " + retrievedResult, + "Hi " + name + " nice to see you again. " + retrievedResult + )); + return true; } return false; } diff --git a/src/main/java/roboy/dialog/personality/states/LocationDBpedia.java b/src/main/java/roboy/dialog/personality/states/LocationDBpedia.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/PersonalFollowUpState.java b/src/main/java/roboy/dialog/personality/states/PersonalFollowUpState.java new file mode 100755 index 00000000..f04a7123 --- /dev/null +++ b/src/main/java/roboy/dialog/personality/states/PersonalFollowUpState.java @@ -0,0 +1,106 @@ +package roboy.dialog.personality.states; + +import roboy.linguistics.Linguistics; +import roboy.linguistics.Linguistics.SEMANTIC_ROLE; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.memory.Neo4jMemory; +import roboy.memory.Neo4jRelationships; +import roboy.memory.nodes.Interlocutor; +import roboy.memory.nodes.MemoryNodeModel; +import roboy.util.Lists; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class PersonalFollowUpState extends AbstractBooleanState{ + + private List questions; + private List successTexts; + public Neo4jRelationships predicate; + private Interlocutor person; + + public PersonalFollowUpState(List questions, List failureTexts, + List successTexts, Neo4jRelationships predicate, QuestionRandomizerState nextState, Interlocutor person) { + this.questions = questions; + this.successTexts = successTexts; + this.predicate = predicate; + this.person = person; + this.setNextState(nextState); + setFailureTexts(failureTexts); + } + + /** + * Ask the question. + * Using Neo4jRelationships predicate + */ + @Override + public List act() { + String retrievedResult = ""; + ArrayList ids = person.getRelationships(predicate); + Neo4jMemory memory = Neo4jMemory.getInstance(); + try { + MemoryNodeModel requestedObject = memory.getById(ids.get(0)); + retrievedResult = requestedObject.getProperties().get("name").toString(); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return Lists.interpretationList(new Interpretation(String.format(questions.get((int)Math.random()*questions.size()), retrievedResult))); + } + + /** + * Retrieve the answer and add it to the memory, if needed. + * + * As locations, hobbies, workplaces etc are individual nodes in memory, + * those will be retrieved or created if necessary. + */ + @SuppressWarnings("unchecked") + @Override + protected boolean determineSuccess(Interpretation input) { + String[] tokens = (String[]) input.getFeatures().get(Linguistics.TOKENS); + String answer = null; + if(tokens.length==1){ + answer = tokens[0]; + } + else if(input.getFeatures().containsKey(Linguistics.OBJ_ANSWER)) + { + answer = (String) input.getFeature(Linguistics.OBJ_ANSWER); + } + else { + Map pas = (Map) input.getFeature(Linguistics.PAS); + if(pas==null) return false; + String predicate = ((String)pas.get(SEMANTIC_ROLE.PREDICATE)).toLowerCase(); + String agent = (String)pas.get(SEMANTIC_ROLE.AGENT); + String patient = (String)pas.get(SEMANTIC_ROLE.PATIENT); + if(agent==null) return false; + if(patient==null) return false; + if(!"am".equals(predicate) && !agent.toLowerCase().contains("i") && !agent.toLowerCase().contains("my")) return false; + answer = patient; + } + if(answer!=null){ + + // TODO Remove old code after successfully switching to Neo4j memory + //WorkingMemory memory = WorkingMemory.getInstance(); + // List nameTriple = memory.retrieve(new Triple("is","name",null)); + //if(nameTriple.isEmpty()) return false; + //String name = nameTriple.get(0).patiens; + //WorkingMemory.getInstance().save(new Triple(predicate,name,answer)); + + // Add the new information about the person to the memory. + // person.addInformation(predicate.type, answer); + + + List sTexts = new ArrayList<>(); + for(String s: successTexts){ + sTexts.add(String.format(s, "")); + } + setSuccessTexts(sTexts); + return true; + } + return false; + } + +} diff --git a/src/main/java/roboy/dialog/personality/states/PersonalQAState.java b/src/main/java/roboy/dialog/personality/states/PersonalQAState.java old mode 100644 new mode 100755 index b38e4a7a..130f5d1b --- a/src/main/java/roboy/dialog/personality/states/PersonalQAState.java +++ b/src/main/java/roboy/dialog/personality/states/PersonalQAState.java @@ -7,19 +7,19 @@ import roboy.linguistics.Linguistics; import roboy.linguistics.Linguistics.SEMANTIC_ROLE; import roboy.linguistics.sentenceanalysis.Interpretation; -import roboy.memory.Neo4jRelations; +import roboy.memory.Neo4jRelationships; import roboy.memory.nodes.Interlocutor; import roboy.util.Lists; public class PersonalQAState extends AbstractBooleanState{ private List questions; - private List successTexts; - public Neo4jRelations predicate; + private List successTexts; + public Neo4jRelationships predicate; private Interlocutor person; public PersonalQAState(List questions, List failureTexts, - List successTexts, Neo4jRelations predicate, Interlocutor person) { + List successTexts, Neo4jRelationships predicate, Interlocutor person) { this.questions = questions; this.successTexts = successTexts; this.predicate = predicate; @@ -32,7 +32,7 @@ public PersonalQAState(List questions, List failureTexts, */ @Override public List act() { - return Lists.interpretationList(new Interpretation(questions.get((int)Math.random()*questions.size()))); + return Lists.interpretationList(new Interpretation(String.format(questions.get((int)Math.random()*questions.size())))); } /** @@ -78,8 +78,8 @@ else if(input.getFeatures().containsKey(Linguistics.OBJ_ANSWER)) List sTexts = new ArrayList<>(); - for(String[] s: successTexts){ - sTexts.add(s[0]+answer+s[1]); + for(String s: successTexts){ + sTexts.add(String.format(s, answer)); } setSuccessTexts(sTexts); return true; diff --git a/src/main/java/roboy/dialog/personality/states/QuestionAnsweringState.java b/src/main/java/roboy/dialog/personality/states/QuestionAnsweringState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/QuestionAskingState.java b/src/main/java/roboy/dialog/personality/states/QuestionAskingState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/QuestionRandomizerState.java b/src/main/java/roboy/dialog/personality/states/QuestionRandomizerState.java old mode 100644 new mode 100755 index b7878d5f..e7fc46c7 --- a/src/main/java/roboy/dialog/personality/states/QuestionRandomizerState.java +++ b/src/main/java/roboy/dialog/personality/states/QuestionRandomizerState.java @@ -1,16 +1,16 @@ package roboy.dialog.personality.states; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import roboy.linguistics.sentenceanalysis.Interpretation; -import roboy.memory.Neo4jRelations; +import roboy.memory.Neo4jRelationships; import roboy.memory.nodes.Interlocutor; +import roboy.util.JsonQAValues; import roboy.util.JsonUtils; -import static roboy.memory.Neo4jRelations.*; +import static roboy.memory.Neo4jRelationships.*; /** * Manages the questions that can be asked from a person. @@ -24,25 +24,45 @@ public class QuestionRandomizerState implements State{ private PersonalQAState[] questionStates; private PersonalQAState locationQuestion; - private HashMap alreadyAsked; + private PersonalFollowUpState[] followUpStates; + private HashMap alreadyAsked; private State inner; private State chosenState; private Interlocutor person; + private JsonQAValues questionsAndAnswers; + boolean askFollowUp = true; // All spoken phrases for asking questions are stored in these JSON files. - String questionsFile = "sentences/questions.json"; - String successAnswersFile = "sentences/successAnswers.json"; - String failureAnswersFile = "sentences/failureAnswers.json"; +// String questionsFile = "sentences/questions.json"; +// String successAnswersFile = "sentences/successAnswers.json"; +// String failureAnswersFile = "sentences/failureAnswers.json"; +// String followUpFile = "sentences/followUp.json"; +// String answersFollowUpFile = "sentences/answersFollowUp.json"; + + String QAfile = "sentences/QAList.json"; + Map> questions; - Map> successAnswers; + Map> successAnswers; Map> failureAnswers; + Map> followUp; + Map> answersFollowUp; public QuestionRandomizerState(State inner, Interlocutor person) { this.inner = inner; this.person = person; - questions = JsonUtils.getSentencesFromJsonFile(questionsFile); - successAnswers = JsonUtils.getSentenceArraysFromJsonFile(successAnswersFile); - failureAnswers = JsonUtils.getSentencesFromJsonFile(failureAnswersFile); +// questions = JsonUtils.getSentencesFromJsonFile(questionsFile); +// successAnswers = JsonUtils.getSentenceArraysFromJsonFile(successAnswersFile); +// failureAnswers = JsonUtils.getSentencesFromJsonFile(failureAnswersFile); +// followUp = JsonUtils.getSentencesFromJsonFile(followUpFile); +// answersFollowUp = JsonUtils.getSentenceArraysFromJsonFile(answersFollowUpFile); + questionsAndAnswers = JsonUtils.getQuestionsAndAnswersFromJson(QAfile); + + questions = questionsAndAnswers.getQuestions(); + successAnswers = questionsAndAnswers.getSuccessAnswers(); + failureAnswers = questionsAndAnswers.getFailureAnswers(); + followUp = questionsAndAnswers.getFollowUpQuestions(); + answersFollowUp = questionsAndAnswers.getFollowUpAnswers(); + // alreadyAsked is filled automatically by the initializeQuestion method, // then updated to match already existing information with checkForAskedQuestions() alreadyAsked = new HashMap<>(); @@ -57,10 +77,16 @@ public QuestionRandomizerState(State inner, Interlocutor person) { initializeQuestion(HAS_HOBBY), initializeQuestion(WORK_FOR), initializeQuestion(STUDY_AT) -// TODO request support for Occupation and Movie data in the database. -// initializeQuestion(OCCUPATION), +// TODO request support for Occupation and Movie data in the database. +// initializeQuestion(OTHER), // initializeQuestion(LIKES_MOVIE), }; + followUpStates = new PersonalFollowUpState[] { + initializeFollowUpQuestion(FROM), + initializeFollowUpQuestion(HAS_HOBBY), + initializeFollowUpQuestion(WORK_FOR), + initializeFollowUpQuestion(STUDY_AT) + }; } @Override @@ -82,6 +108,12 @@ public List act() { if(!alreadyAsked.get(questionStates[index].predicate)){ alreadyAsked.put(questionStates[index].predicate, true); chosenState = questionStates[index]; + return chosenState.act(); + } else if (askFollowUp) { + // TODO Probably to think about better fix then equal amount of the questions + //index = (int) (Math.random() * followUpStates.length); + chosenState = followUpStates[index]; + askFollowUp = false; return chosenState.act(); } } @@ -102,18 +134,28 @@ public void setTop(State top){ } } - private PersonalQAState initializeQuestion(Neo4jRelations relation) { - alreadyAsked.put(relation, false); + private PersonalQAState initializeQuestion(Neo4jRelationships relationship) { + alreadyAsked.put(relationship, false); return new PersonalQAState( - questions.get(relation.type), - failureAnswers.get(relation.type), - successAnswers.get(relation.type), - relation, person); + questions.get(relationship.type), + failureAnswers.get(relationship.type), + successAnswers.get(relationship.type), + relationship, person); + } + + private PersonalFollowUpState initializeFollowUpQuestion(Neo4jRelationships relationship) { + return new PersonalFollowUpState( + followUp.get(relationship.type), + failureAnswers.get(relationship.type), + answersFollowUp.get(relationship.type), + relationship, this, person); } private void checkForAskedQuestions() { - for(Neo4jRelations relation : alreadyAsked.keySet()) { - if(person.hasRelation(relation)) alreadyAsked.put(relation, true); + for(Neo4jRelationships relationship : alreadyAsked.keySet()) { + if(person.hasRelationship(relationship)) { + alreadyAsked.put(relationship, true); + } } } diff --git a/src/main/java/roboy/dialog/personality/states/Reaction.java b/src/main/java/roboy/dialog/personality/states/Reaction.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/SegueState.java b/src/main/java/roboy/dialog/personality/states/SegueState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/State.java b/src/main/java/roboy/dialog/personality/states/State.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/dialog/personality/states/WildTalkState.java b/src/main/java/roboy/dialog/personality/states/WildTalkState.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/BingInput.java b/src/main/java/roboy/io/BingInput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/BingOutput.java b/src/main/java/roboy/io/BingOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/CelebritySimilarityInput.java b/src/main/java/roboy/io/CelebritySimilarityInput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/CerevoiceOutput.java b/src/main/java/roboy/io/CerevoiceOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/CommandLineCommunication.java b/src/main/java/roboy/io/CommandLineCommunication.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/CommandLineInput.java b/src/main/java/roboy/io/CommandLineInput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/CommandLineOutput.java b/src/main/java/roboy/io/CommandLineOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/Communication.java b/src/main/java/roboy/io/Communication.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/EmotionOutput.java b/src/main/java/roboy/io/EmotionOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/FreeTTSOutput.java b/src/main/java/roboy/io/FreeTTSOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/Input.java b/src/main/java/roboy/io/Input.java old mode 100644 new mode 100755 index 6a79d87d..88de2db1 --- a/src/main/java/roboy/io/Input.java +++ b/src/main/java/roboy/io/Input.java @@ -5,7 +5,7 @@ /** * The result of an input device consists of a sentence, if it is an audio device, and - * an arbitrary map of attributes. + * an arbitrary map of lists. */ public class Input { diff --git a/src/main/java/roboy/io/InputDevice.java b/src/main/java/roboy/io/InputDevice.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/MultiInputDevice.java b/src/main/java/roboy/io/MultiInputDevice.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/MultiOutputDevice.java b/src/main/java/roboy/io/MultiOutputDevice.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/OutputDevice.java b/src/main/java/roboy/io/OutputDevice.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/RoboyNameDetectionInput.java b/src/main/java/roboy/io/RoboyNameDetectionInput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/UdpInput.java b/src/main/java/roboy/io/UdpInput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/UdpOutput.java b/src/main/java/roboy/io/UdpOutput.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/io/Vision.java b/src/main/java/roboy/io/Vision.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/Concept.java b/src/main/java/roboy/linguistics/Concept.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/DetectedEntity.java b/src/main/java/roboy/linguistics/DetectedEntity.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/Entity.java b/src/main/java/roboy/linguistics/Entity.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/Linguistics.java b/src/main/java/roboy/linguistics/Linguistics.java old mode 100644 new mode 100755 index 7fd24658..01c28804 --- a/src/main/java/roboy/linguistics/Linguistics.java +++ b/src/main/java/roboy/linguistics/Linguistics.java @@ -124,5 +124,10 @@ public enum SEMANTIC_ROLE { * The confidence score of the machine learning intent classification in the IntentAnalyzer */ public static final String INTENT_DISTANCE = "intentdistance"; + + /** + * The result of SemanticParserAnalyzer, formal language representation + */ + public static final String PARSE = "parse"; } diff --git a/src/main/java/roboy/linguistics/Term.java b/src/main/java/roboy/linguistics/Term.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/Triple.java b/src/main/java/roboy/linguistics/Triple.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/phonetics/DoubleMetaphoneEncoder.java b/src/main/java/roboy/linguistics/phonetics/DoubleMetaphoneEncoder.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/phonetics/MetaphoneEncoder.java b/src/main/java/roboy/linguistics/phonetics/MetaphoneEncoder.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/phonetics/PhoneticEncoder.java b/src/main/java/roboy/linguistics/phonetics/PhoneticEncoder.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/phonetics/Phonetics.java b/src/main/java/roboy/linguistics/phonetics/Phonetics.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/phonetics/SoundexEncoder.java b/src/main/java/roboy/linguistics/phonetics/SoundexEncoder.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/Analyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/Analyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/AnswerAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/AnswerAnalyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/DictionaryBasedSentenceTypeDetector.java b/src/main/java/roboy/linguistics/sentenceanalysis/DictionaryBasedSentenceTypeDetector.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/EmotionAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/EmotionAnalyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/IntentAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/IntentAnalyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/Interpretation.java b/src/main/java/roboy/linguistics/sentenceanalysis/Interpretation.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/OntologyNERAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/OntologyNERAnalyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/OpenNLPPPOSTagger.java b/src/main/java/roboy/linguistics/sentenceanalysis/OpenNLPPPOSTagger.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/OpenNLPParser.java b/src/main/java/roboy/linguistics/sentenceanalysis/OpenNLPParser.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/Preprocessor.java b/src/main/java/roboy/linguistics/sentenceanalysis/Preprocessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/SemanticParserAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/SemanticParserAnalyzer.java new file mode 100644 index 00000000..27ba2da6 --- /dev/null +++ b/src/main/java/roboy/linguistics/sentenceanalysis/SemanticParserAnalyzer.java @@ -0,0 +1,89 @@ +package roboy.linguistics.sentenceanalysis; + +import jdk.nashorn.internal.runtime.regexp.joni.Config; +import roboy.linguistics.Linguistics; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; + +import java.net.Socket; +import java.net.ConnectException; + + +/** + * Semantic parser class. Connects DM to Roboy parser and adds its result to interpretation class. + */ +public class SemanticParserAnalyzer implements Analyzer{ + + private Socket clientSocket; /**< Client socket for the parser */ + private PrintWriter out; /**< Output stream for the parser */ + private BufferedReader in; /**< Input stream from the parser */ + private boolean debug = true; /**< Boolean variable for debugging purpose */ + + /** + * A constructor. + * Creates ParserAnalyzer class and connects the parser to DM using a socket. + */ + public SemanticParserAnalyzer(int portNumber) { + this.debug = true; + try { + // Create string-string socket + this.clientSocket = new Socket("localhost", portNumber); + // Declaring input + this.in = new BufferedReader( + new InputStreamReader(clientSocket.getInputStream())); + // Declaring output + this.out = new PrintWriter(clientSocket.getOutputStream(), true); + } catch (IOException e) { + System.err.println("Semantic Parser Client Error: " + e.getMessage()); + } + } + + /** + * An analyzer function. + * Sends input sentence to the parser and saves its response in output interpretation. + * + * @param interpretation Input interpretation with currently processed sentence + * and results from previous analysis. + * @return Input interpretation with semantic parser result. + */ + @Override + public Interpretation analyze(Interpretation interpretation) { + if (this.clientSocket!=null && this.clientSocket.isConnected()) { + try { + String response; + if (this.debug) {System.out.println("SEMANTIC PARSER:" + interpretation.getFeature("sentence")); } + this.out.println(interpretation.getFeature("sentence")); + response = this.in.readLine(); + if (this.debug) { + System.out.println("> Full response:" + response); + } + if (response!=null && response.contains("=>")) { + try { + if (this.debug) { + System.out.println("> Parse:" + response.substring(0, response.indexOf("=>"))); + } + if (this.debug) { + System.out.println("> Answer:" + response.substring(response.indexOf("=>") + 3)); + } + interpretation.getFeatures().put(Linguistics.PARSE, response.substring(0, response.indexOf("=>"))); + interpretation.getFeatures().put(Linguistics.PRED_ANSWER, response.substring(response.indexOf("=>") + 3)); + } + catch (Exception e) { + System.err.println("Exception while parsing intent response: " + e.getStackTrace()); + } + } + return interpretation; + } + catch (IOException e) { + e.printStackTrace(); + return interpretation; + } + } + else + return interpretation; + } + +} \ No newline at end of file diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/SentenceAnalyzer.java b/src/main/java/roboy/linguistics/sentenceanalysis/SentenceAnalyzer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/sentenceanalysis/SimpleTokenizer.java b/src/main/java/roboy/linguistics/sentenceanalysis/SimpleTokenizer.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/linguistics/word2vec/examples/ToyDataGetter.java b/src/main/java/roboy/linguistics/word2vec/examples/ToyDataGetter.java new file mode 100644 index 00000000..f3346c98 --- /dev/null +++ b/src/main/java/roboy/linguistics/word2vec/examples/ToyDataGetter.java @@ -0,0 +1,79 @@ +package roboy.linguistics.word2vec.examples; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; + +/** + * Utility class to load toy data from the internet if necessary. + * May be refactored into something bigger and more useful later. + */ +public class ToyDataGetter { + + private final boolean verbose; + private final String toyDataDirectory = "./resources/word2vec_toy_data_and_model/"; + private final String toyDataFilePath = "./resources/word2vec_toy_data_and_model/raw_sentences.txt"; + private final String toyDataInetURL = "https://raw.githubusercontent.com/deeplearning4j/dl4j-examples/master/dl4j-examples/src/main/resources/raw_sentences.txt"; + + + public ToyDataGetter(boolean verbose) { + this.verbose = verbose; + } + + + public String getToyDataFilePath() { + return toyDataFilePath; + } + + /** + * Checks if toy data is present on the hard drive. It will be downloaded if necessary. + */ + public void ensureToyDataIsPresent() { + + // check if already downloaded + if (fileExists(toyDataFilePath)) { + if (verbose) System.out.println("Found data file (" + toyDataFilePath + ")"); + return; + } + + // need to download + try { + if (verbose) System.out.println("Data file is missing and will be downloaded to " + toyDataFilePath); + + // make sure directory exists + File dir = new File(toyDataDirectory); + dir.mkdirs(); + + downloadData(toyDataInetURL, toyDataFilePath); + + } catch (IOException e) { + System.err.println("Sorry, couldn't download toy data! Exception: " + e.getMessage()); + if (verbose) { + e.printStackTrace(); + } + } + + } + + + private void downloadData(String fromURL, String toFilePath) throws IOException { + URL website = new URL(fromURL); + ReadableByteChannel rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(toFilePath); + long bytesTransferred = fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + + if (verbose) { + System.out.println("Download complete, saved " + bytesTransferred + " bytes to " + toFilePath); + } + + } + + private boolean fileExists(String filePath) { + File data = new File(filePath); + return data.exists(); + } + +} diff --git a/src/main/java/roboy/linguistics/word2vec/examples/Word2vecTrainingExample.java b/src/main/java/roboy/linguistics/word2vec/examples/Word2vecTrainingExample.java new file mode 100644 index 00000000..2906124c --- /dev/null +++ b/src/main/java/roboy/linguistics/word2vec/examples/Word2vecTrainingExample.java @@ -0,0 +1,63 @@ +package roboy.linguistics.word2vec.examples; + +import org.deeplearning4j.models.word2vec.Word2Vec; +import org.deeplearning4j.text.sentenceiterator.BasicLineIterator; +import org.deeplearning4j.text.sentenceiterator.SentenceIterator; +import org.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor; +import org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory; +import org.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory; + +import java.util.Collection; + + +/** + * Neural net that processes text into word-vectors. + * + * Adapted from org.deeplearning4j.examples.nlp.word2vec.Word2VecRawTextExample + */ +public class Word2vecTrainingExample { + + public static void main(String[] args) throws Exception { + + ToyDataGetter dataGetter = new ToyDataGetter(true); + dataGetter.ensureToyDataIsPresent(); + String dataPath = dataGetter.getToyDataFilePath(); + + // load and preprocess data + + System.out.println("Load & Vectorize Sentences...."); + // Strip white space before and after for each line + SentenceIterator iter = new BasicLineIterator(dataPath); + // Split on white spaces in the line to get words + TokenizerFactory t = new DefaultTokenizerFactory(); + + /* + CommonPreprocessor will apply the following regex to each token: [\d\.:,"'\(\)\[\]|/?!;]+ + So, effectively all numbers, punctuation symbols and some special symbols are stripped off. + Additionally it forces lower case for all tokens. + */ + t.setTokenPreProcessor(new CommonPreprocessor()); + + + System.out.println("Building model...."); + Word2Vec vec = new Word2Vec.Builder() + .minWordFrequency(5) + .iterations(1) + .layerSize(100) + .seed(42) + .windowSize(5) + .iterate(iter) + .tokenizerFactory(t) + .build(); + + System.out.println("Fitting Word2Vec model...."); + vec.fit(); + + // Prints out the closest 10 words to "day". An example on what to do with these Word Vectors. + Collection lst = vec.wordsNearest("day", 10); + System.out.println("10 Words closest to 'day': " + lst); + + } + + +} diff --git a/src/main/java/roboy/linguistics/word2vec/examples/Word2vecUptrainingExample.java b/src/main/java/roboy/linguistics/word2vec/examples/Word2vecUptrainingExample.java new file mode 100644 index 00000000..ea0f2f09 --- /dev/null +++ b/src/main/java/roboy/linguistics/word2vec/examples/Word2vecUptrainingExample.java @@ -0,0 +1,108 @@ +package roboy.linguistics.word2vec.examples; + +import org.deeplearning4j.models.embeddings.WeightLookupTable; +import org.deeplearning4j.models.embeddings.inmemory.InMemoryLookupTable; +import org.deeplearning4j.models.embeddings.loader.WordVectorSerializer; +import org.deeplearning4j.models.word2vec.VocabWord; +import org.deeplearning4j.models.word2vec.Word2Vec; +import org.deeplearning4j.models.word2vec.wordstore.VocabCache; +import org.deeplearning4j.models.word2vec.wordstore.inmemory.AbstractCache; +import org.deeplearning4j.text.sentenceiterator.BasicLineIterator; +import org.deeplearning4j.text.sentenceiterator.SentenceIterator; +import org.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor; +import org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory; +import org.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory; + +import java.util.Collection; + + +/** + * Neural net that processes text into word-vectors. + * This example shows how to save/load and train the model. + * + * Adapted from org.deeplearning4j.examples.nlp.word2vec.Word2VecUptrainingExample + */ +public class Word2vecUptrainingExample { + + public static void main(String[] args) throws Exception { + + + String modelPath = "./resources/word2vec_toy_data_and_model/raw_sentences.model"; + + ToyDataGetter dataGetter = new ToyDataGetter(true); + dataGetter.ensureToyDataIsPresent(); + String dataPath = dataGetter.getToyDataFilePath(); + + // load and preprocess data + System.out.println("Load & Vectorize Sentences...."); + // Strip white space before and after for each line + SentenceIterator iter = new BasicLineIterator(dataPath); + // Split on white spaces in the line to get words + TokenizerFactory t = new DefaultTokenizerFactory(); + t.setTokenPreProcessor(new CommonPreprocessor()); + + // manual creation of VocabCache and WeightLookupTable usually isn't necessary + // but in this case we'll need them + VocabCache cache = new AbstractCache<>(); + WeightLookupTable table = new InMemoryLookupTable.Builder() + .vectorLength(100) + .useAdaGrad(false) + .cache(cache).build(); + + System.out.println("Building model...."); + Word2Vec vec = new Word2Vec.Builder() + .minWordFrequency(5) + .iterations(1) + .epochs(1) + .layerSize(100) + .seed(42) + .windowSize(5) + .iterate(iter) + .tokenizerFactory(t) + .lookupTable(table) + .vocabCache(cache) + .build(); + + System.out.println("Fitting Word2Vec model...."); + vec.fit(); + + + Collection lst = vec.wordsNearest("day", 10); + System.out.println("Closest words to 'day' on 1st run: " + lst); + + /* + at this moment we're supposed to have model built, and it can be saved for future use. + */ + + WordVectorSerializer.writeWord2VecModel(vec, modelPath); + + /* + Let's assume that some time passed, and now we have new corpus to be used to weights update. + Instead of building new model over joint corpus, we can use weights update mode. + */ + Word2Vec word2Vec = WordVectorSerializer.readWord2VecModel(modelPath); + + /* + PLEASE NOTE: after model is restored, it's still required to set SentenceIterator and TokenizerFactory, if you're going to train this model + */ + SentenceIterator iterator = new BasicLineIterator(dataPath); + TokenizerFactory tokenizerFactory = new DefaultTokenizerFactory(); + tokenizerFactory.setTokenPreProcessor(new CommonPreprocessor()); + + word2Vec.setTokenizerFactory(tokenizerFactory); + word2Vec.setSentenceIterator(iterator); + + + System.out.println("Word2vec uptraining..."); + + word2Vec.fit(); + + lst = word2Vec.wordsNearest("day", 10); + System.out.println("Closest words to 'day' on 2nd run: " + lst); + + /* + Model can be saved for future use now + */ + + } +} diff --git a/src/main/java/roboy/logic/Intention.java b/src/main/java/roboy/logic/Intention.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/logic/IntentionClassifier.java b/src/main/java/roboy/logic/IntentionClassifier.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/logic/PASInterpreter.java b/src/main/java/roboy/logic/PASInterpreter.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/logic/StatementInterpreter.java b/src/main/java/roboy/logic/StatementInterpreter.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/memory/DBpediaMemory.java b/src/main/java/roboy/memory/DBpediaMemory.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/memory/Memory.java b/src/main/java/roboy/memory/Memory.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/memory/Neo4jMemory.java b/src/main/java/roboy/memory/Neo4jMemory.java old mode 100644 new mode 100755 index ab4ca2b5..8a904693 --- a/src/main/java/roboy/memory/Neo4jMemory.java +++ b/src/main/java/roboy/memory/Neo4jMemory.java @@ -20,7 +20,7 @@ public class Neo4jMemory implements Memory private Gson gson = new Gson(); private Neo4jMemory (RosMainNode node){ - this.rosMainNode = node; + Neo4jMemory.rosMainNode = node; } public static Neo4jMemory getInstance(RosMainNode node) @@ -32,18 +32,12 @@ public static Neo4jMemory getInstance(RosMainNode node) } - public static Neo4jMemory getInstance() + public static Neo4jMemory getInstance() { - try{ - return memory; - } - catch (NullPointerException e) - { - e.printStackTrace(); + if (memory == null) { System.out.println("Memory wasn't initialized correctly. Use public static Neo4jMemory getInstance(RosMainNode node) instead."); - return null; } - + return memory; } /** @@ -55,10 +49,9 @@ public static Neo4jMemory getInstance() @Override public boolean save(MemoryNodeModel node) throws InterruptedException, IOException { - if(Config.NOROS) return false; + if(!Config.MEMORY) return false; String response = rosMainNode.UpdateMemoryQuery(node.toJSON(gson)); - if(response == null) return false; - return(response.contains("OK")); + return response != null && (response.contains("OK")); } /** @@ -69,7 +62,7 @@ public boolean save(MemoryNodeModel node) throws InterruptedException, IOExcepti */ public MemoryNodeModel getById(int id) throws InterruptedException, IOException { - if(Config.NOROS) return new MemoryNodeModel(); + if(!Config.MEMORY) return new MemoryNodeModel(); String result = rosMainNode.GetMemoryQuery("{'id':"+id+"}"); if(result == null || result.contains("FAIL")) return null; return gson.fromJson(result, MemoryNodeModel.class); @@ -83,7 +76,7 @@ public MemoryNodeModel getById(int id) throws InterruptedException, IOException */ public ArrayList getByQuery(MemoryNodeModel query) throws InterruptedException, IOException { - if(Config.NOROS) return new ArrayList<>(); + if(!Config.MEMORY) return new ArrayList<>(); String result = rosMainNode.GetMemoryQuery(query.toJSON(gson)); if(result == null || result.contains("FAIL")) return null; Type type = new TypeToken>>() {}.getType(); @@ -93,7 +86,7 @@ public ArrayList getByQuery(MemoryNodeModel query) throws InterruptedEx public int create(MemoryNodeModel query) throws InterruptedException, IOException { - if(Config.NOROS) return 0; + if(!Config.MEMORY) return 0; String result = rosMainNode.CreateMemoryQuery(query.toJSON(gson)); // Handle possible Memory error message. if(result == null || result.contains("FAIL")) return 0; @@ -110,11 +103,11 @@ public int create(MemoryNodeModel query) throws InterruptedException, IOExceptio */ public boolean remove(MemoryNodeModel query) throws InterruptedException, IOException { - if(Config.NOROS) return false; + if(!Config.MEMORY) return false; //Remove all fields which were not explicitly set, for safety. query.setStripQuery(true); String response = rosMainNode.DeleteMemoryQuery(query.toJSON(gson)); - return response == null ? false : response.contains("OK"); + return response != null && response.contains("OK"); } /** @@ -130,4 +123,14 @@ public List retrieve(MemoryNodeModel query) throws InterruptedE return null; } + public String determineNodeType(String relationship) { + // TODO expand list as new Node types are added. + if(relationship.equals(Neo4jRelationships.HAS_HOBBY.type)) return "Hobby"; + if(relationship.equals(Neo4jRelationships.FROM.type)) return "Country"; + if(relationship.equals(Neo4jRelationships.WORK_FOR.type)) return "Organization"; + if(relationship.equals(Neo4jRelationships.STUDY_AT.type)) return "Organization"; + if(relationship.equals(Neo4jRelationships.OCCUPIED_AS.type)) return "Occupation"; + if(relationship.equals(Neo4jRelationships.OTHER.type)) return "Other"; + else return ""; + } } diff --git a/src/main/java/roboy/memory/Neo4jRelations.java b/src/main/java/roboy/memory/Neo4jRelationships.java old mode 100644 new mode 100755 similarity index 71% rename from src/main/java/roboy/memory/Neo4jRelations.java rename to src/main/java/roboy/memory/Neo4jRelationships.java index bf31e46c..32510741 --- a/src/main/java/roboy/memory/Neo4jRelations.java +++ b/src/main/java/roboy/memory/Neo4jRelationships.java @@ -5,19 +5,21 @@ * Respective questions should be added to the questions.json file * and used in the QuestionRandomizerState. */ -public enum Neo4jRelations { +public enum Neo4jRelationships { FROM("FROM"), HAS_HOBBY("HAS_HOBBY"), LIVE_IN("LIVE_IN"), STUDY_AT("STUDY_AT"), - OCCUPATION("OCCUPATION"), + OCCUPIED_AS("OCCUPIED_AS"), WORK_FOR("WORK_FOR"), FRIEND_OF("FRIEND_OF"), - MEMBER_OF("MEMBER_OF"); + MEMBER_OF("MEMBER_OF"), + OTHER("OTHER"), + IS("IS"); public String type; - Neo4jRelations(String type) { + Neo4jRelationships(String type) { this.type=type; } } diff --git a/src/main/java/roboy/memory/PersistentKnowledge.java b/src/main/java/roboy/memory/PersistentKnowledge.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/memory/RoboyMind.java b/src/main/java/roboy/memory/RoboyMind.java old mode 100644 new mode 100755 index c2a86713..2daac70f --- a/src/main/java/roboy/memory/RoboyMind.java +++ b/src/main/java/roboy/memory/RoboyMind.java @@ -79,7 +79,7 @@ private List FindInstances(String property, String value) List result = new ArrayList(); - // get these objects' attributes + // get these objects' lists for (JsonValue i: response) { JsonObject attributes = ListAttributes(i.toString()); @@ -197,7 +197,7 @@ public boolean save(Concept object) throws NullPointerException @Override public List retrieve(Concept object) { - // get objects matching the requested attributes + // get objects matching the requested lists String properties = "id"; String values = object.getAttribute("id").toString(); @@ -206,7 +206,7 @@ public List retrieve(Concept object) return result; } - public boolean update(Concept object) // requires having attributes id and class_name + public boolean update(Concept object) // requires having lists id and class_name { String object_name = object.getAttribute("class_name").toString() + "_" + object.getAttribute("id"); List saved_objects = RoboyMind.getInstance().retrieve(object); diff --git a/src/main/java/roboy/memory/WorkingMemory.java b/src/main/java/roboy/memory/WorkingMemory.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/memory/nodes/Interlocutor.java b/src/main/java/roboy/memory/nodes/Interlocutor.java old mode 100644 new mode 100755 index 42f46229..e1308288 --- a/src/main/java/roboy/memory/nodes/Interlocutor.java +++ b/src/main/java/roboy/memory/nodes/Interlocutor.java @@ -2,7 +2,7 @@ import roboy.dialog.Config; import roboy.memory.Neo4jMemory; -import roboy.memory.Neo4jRelations; +import roboy.memory.Neo4jRelationships; import java.io.IOException; import java.util.ArrayList; @@ -16,12 +16,12 @@ public class Interlocutor { Neo4jMemory memory; public boolean FAMILIAR = false; // Memory is not queried in NOROS mode. - private boolean noROS; + private boolean memoryROS; public Interlocutor() { this.person = new MemoryNodeModel(true); this.memory = Neo4jMemory.getInstance(); - this.noROS = Config.NOROS; + this.memoryROS = Config.MEMORY; } /** @@ -35,7 +35,7 @@ public void addName(String name) { person.setProperty("name", name); person.setLabel("Person"); - if(!noROS) { + if(memoryROS) { ArrayList ids = new ArrayList<>(); // Query memory for matching persons. try { @@ -73,21 +73,25 @@ public String getName() { return (String) person.getProperty("name"); } - public boolean hasRelation(Neo4jRelations type) { - return !(person.getRelation(type.type) == null) && (!person.getRelation(type.type).isEmpty()); + public boolean hasRelationship(Neo4jRelationships type) { + return !(person.getRelationship(type.type) == null) && (!person.getRelationship(type.type).isEmpty()); + } + + public ArrayList getRelationships(Neo4jRelationships type) { + return person.getRelationship(type.type); } /** * Adds a new relation to the person node, updating memory. */ - public void addInformation(String relation, String name) { - if(noROS) return; + public void addInformation(String relationship, String name) { + if(!memoryROS) return; ArrayList ids = new ArrayList<>(); // First check if node with given name exists by a matching query. MemoryNodeModel relatedNode = new MemoryNodeModel(true); relatedNode.setProperty("name", name); //This adds a label type to the memory query depending on the relation. - relatedNode.setLabel(determineNodeType(relation)); + relatedNode.setLabel(memory.determineNodeType(relationship)); try { ids = memory.getByQuery(relatedNode); } catch (InterruptedException | IOException e) { @@ -97,14 +101,14 @@ public void addInformation(String relation, String name) { // Pick first from list if multiple matches found. if(ids != null && !ids.isEmpty()) { //TODO Change from using first id to specifying if multiple matches are found. - person.setRelation(relation, ids.get(0)); + person.setRelationship(relationship, ids.get(0)); } // Create new node if match is not found. else { try { int id = memory.create(relatedNode); if(id != 0) { // 0 is default value, returned if Memory response was FAIL. - person.setRelation(relation, id); + person.setRelationship(relationship, id); } } catch (InterruptedException | IOException e) { System.out.println("Unexpected memory error: creating node for new relation failed."); @@ -119,14 +123,4 @@ public void addInformation(String relation, String name) { e.printStackTrace(); } } - - private String determineNodeType(String relation) { - // TODO expand list as new Node types are added. - if(relation.equals(Neo4jRelations.HAS_HOBBY.type)) return "Hobby"; - if(relation.equals(Neo4jRelations.FROM.type)) return "Country"; - if(relation.equals(Neo4jRelations.WORK_FOR.type)) return "Organization"; - if(relation.equals(Neo4jRelations.STUDY_AT.type)) return "Organization"; - else return ""; - } - -} +} \ No newline at end of file diff --git a/src/main/java/roboy/memory/nodes/MemoryNodeModel.java b/src/main/java/roboy/memory/nodes/MemoryNodeModel.java old mode 100644 new mode 100755 index 434a1d96..55d34c8d --- a/src/main/java/roboy/memory/nodes/MemoryNodeModel.java +++ b/src/main/java/roboy/memory/nodes/MemoryNodeModel.java @@ -2,7 +2,6 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import org.json.JSONObject; import java.lang.reflect.Type; import java.util.ArrayList; @@ -24,7 +23,7 @@ public class MemoryNodeModel { //name, birthdate private HashMap properties; //Relation: - private HashMap> relations; + private HashMap> relationships; //If true, then fields with default values will be removed from JSON format. // Transient as stripping information is not a part of the node and not included in query. transient boolean stripQuery = false; @@ -38,7 +37,7 @@ public MemoryNodeModel(boolean stripQuery) { id = 0; labels = new ArrayList<>(); properties = new HashMap<>(); - relations = new HashMap<>(); + relationships = new HashMap<>(); } else { id = 0; this.stripQuery = true; @@ -83,28 +82,30 @@ public void setProperty(String key, Object property) { properties.put(key, property); } - public HashMap> getRelations() { - return relations; + public HashMap> getRelationships() { + return relationships; } - public ArrayList getRelation(String key) { - return (relations != null ? relations.get(key.toLowerCase()) : null); + public ArrayList getRelationship(String key) { + //TODO: Sort this shit out + //return (relationships != null ? relationships.get(key.toLowerCase()) : null); + return (relationships != null ? relationships.get(key) : null); } - public void setRelations(HashMap> relations) { - if(this.relations == null) { - this.relations = new HashMap<>(); + public void setRelationships(HashMap> relationships) { + if(this.relationships == null) { + this.relationships = new HashMap<>(); } - this.relations.putAll(relations); + this.relationships.putAll(relationships); } - public void setRelation(String key, Integer id) { - if(this.relations == null) { - this.relations = new HashMap<>(); + public void setRelationship(String key, Integer id) { + if(this.relationships == null) { + this.relationships = new HashMap<>(); } - if(relations.containsKey(key)) { - relations.get(key).add(id); + if(relationships.containsKey(key)) { + relationships.get(key).add(id); } else { ArrayList idList = new ArrayList(); idList.add(id); - relations.put(key, idList); + relationships.put(key, idList); } } diff --git a/src/main/java/roboy/memory/nodes/Roboy.java b/src/main/java/roboy/memory/nodes/Roboy.java new file mode 100755 index 00000000..26d46f24 --- /dev/null +++ b/src/main/java/roboy/memory/nodes/Roboy.java @@ -0,0 +1,121 @@ +package roboy.memory.nodes; + +import roboy.dialog.Config; +import roboy.memory.Neo4jMemory; +import roboy.memory.Neo4jRelationships; + +import java.io.IOException; +import java.util.ArrayList; + +/** + * Encapsulates a MemoryNodeModel and enables dialog states to easily store + * and retrieve information about Roboy. + */ +public class Roboy { + private MemoryNodeModel roboy; + Neo4jMemory memory; + // Memory is not queried in NOROS mode. + private boolean memoryROS; + + /** + * Initializer for the Roboy node + */ + public Roboy(String name) { + this.roboy = new MemoryNodeModel(true); + this.memory = Neo4jMemory.getInstance(); + this.memoryROS = Config.MEMORY; + this.InitializeRoboy(name); // May be eg "roboy junior" + } + + /** + * This method initializes the roboy property as a node that + * is in sync with memory and represents the Roboy itself. + * + * If something goes wrong during querying, Roboy stays empty + * and soulless, and has to fallback + */ + // TODO consider a fallback for the amnesia mode + private void InitializeRoboy(String name) { + roboy.setProperty("name", name); + roboy.setLabel("Robot"); + + // + if(memoryROS) { + ArrayList ids = new ArrayList<>(); + try { + ids = memory.getByQuery(roboy); + } catch (InterruptedException | IOException e) { + System.out.println("Cannot retrieve or find Roboy in the Memory. Go the amnesia mode"); + e.printStackTrace(); + } + // Pick first if matches found. + if (ids != null && !ids.isEmpty()) { + try { + this.roboy = memory.getById(ids.get(0)); + } catch (InterruptedException | IOException e) { + System.out.println("Unexpected memory error: provided ID not found upon querying. Go the amnesia mode"); + e.printStackTrace(); + } + } + } + } + + /** + * Method to obtain the name of the Roboy node + * @return String name - text containing the name as in the Memory + */ + public String getName() { + return (String) roboy.getProperty("name"); + } + + /** + * Method to obtain the specific type relationships of the Roboy node + * @return ArrayList ids - list containing integer IDs of the nodes + * related to the Roboy by specific relationship type as in the Memory + */ + public ArrayList getRelationships(Neo4jRelationships type) { + return roboy.getRelationship(type.type); + } + + /** + * Adds a new relation to the Roboy node, updating memory. + */ + public void addInformation(String relationship, String name) { + if(!memoryROS) return; + ArrayList ids = new ArrayList<>(); + // First check if node with given name exists by a matching query. + MemoryNodeModel relatedNode = new MemoryNodeModel(true); + relatedNode.setProperty("name", name); + //This adds a label type to the memory query depending on the relation. + relatedNode.setLabel(memory.determineNodeType(relationship)); + try { + ids = memory.getByQuery(relatedNode); + } catch (InterruptedException | IOException e) { + System.out.println("Exception while querying memory by template."); + e.printStackTrace(); + } + // Pick first from list if multiple matches found. + if(ids != null && !ids.isEmpty()) { + roboy.setRelationship(relationship, ids.get(0)); + } + // Create new node if match is not found. + else { + try { + int id = memory.create(relatedNode); + if(id != 0) { // 0 is default value, returned if Memory response was FAIL. + roboy.setRelationship(relationship, id); + } + } catch (InterruptedException | IOException e) { + System.out.println("Unexpected memory error: creating node for new relation failed."); + e.printStackTrace(); + } + } + //Update the Roboy node in memory. + try{ + memory.save(roboy); + } catch (InterruptedException | IOException e) { + System.out.println("Unexpected memory error: updating person information failed."); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/roboy/newDialog/DialogStateMachine.java b/src/main/java/roboy/newDialog/DialogStateMachine.java new file mode 100644 index 00000000..84e51099 --- /dev/null +++ b/src/main/java/roboy/newDialog/DialogStateMachine.java @@ -0,0 +1,342 @@ +package roboy.newDialog; + +import com.google.gson.*; +import roboy.newDialog.states.State; +import roboy.newDialog.states.factories.ToyStateFactory; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; + +/** + * State machine to manage dialog states. + * Dialog state machines can be written to files and loaded from them later. + * + * Personalities can be implemented using a dialog state machine. + */ +public class DialogStateMachine { + + // maps string identifiers to state objects ("Greeting" -> {GreetingState}) + // allows to have multiple instances of the same state class with different identifiers ("Greeting2" -> {GreetingState}) + private HashMap identifierToState; + + private State activeState; + private State initalState; + private boolean enableDebug; + + public DialogStateMachine() { + this(true); + } + + public DialogStateMachine(boolean enableDebug) { + this.enableDebug = enableDebug; + identifierToState = new HashMap<>(); + activeState = null; + } + + public State getInitialState() { + return initalState; + } + /** + * Set the initial state of this state machine. + * The state will be automatically added to the machine. + * If active state was null, it will be set to the new initial state. + * @param initial initial state + */ + public void setInitialState(State initial) { + if (initial == null) return; + + if (!identifierToState.containsValue(initial)) { + addState(initial); + } + this.initalState = initial; + if (activeState == null) { + setActiveState(initial); + } + } + public void setInitialState(String identifier) { + State initial = identifierToState.get(identifier); + if (initial == null) { + if (enableDebug) { + System.out.println("[!!] setInitialState: Unknown identifier: " + identifier); + } + return; + } + setInitialState(initial); + } + + + public State getActiveState() { + return activeState; + } + public void setActiveState(State s) { + if (s == null) return; + + if (!identifierToState.containsValue(s)) { + addState(s); + } + activeState = s; + } + public void setActiveState(String identifier) { + State s = identifierToState.get(identifier); + if (s == null) { + if (enableDebug) { + System.out.println("[!!] setInitialState: Unknown identifier: " + identifier); + } + return; + } + activeState = s; + } + + + + public State getStateByIdentifier(String identifier) { + return identifierToState.get(identifier); + } + public void addState(State s) { + identifierToState.put(s.getIdentifier(), s); + } + + + + public void loadFromString(String s) { + JsonParser parser = new JsonParser(); + JsonElement json = parser.parse(s); + loadFromJSON(json); + } + + public void loadFromFile(File f) throws FileNotFoundException { + JsonParser parser = new JsonParser(); + JsonElement json = parser.parse(new FileReader(f)); + loadFromJSON(json); + } + + + private void loadFromJSON(JsonElement json) { + identifierToState.clear(); + activeState = null; + initalState = null; + + if (!json.isJsonObject()) { + if (enableDebug) { + System.out.println("[!!] loadFromJSON: State machine must be a JSON object!"); + } + return; + } + + JsonObject personalityJson = json.getAsJsonObject(); + //System.out.println("jsonObject: " + personalityJson); + + JsonElement initialStateJson = personalityJson.get("initialState"); + if (initialStateJson == null) { + if (enableDebug) { + System.out.println("[!!] loadFromJSON: Initial state not defined!"); + } + return; + } + String initialStateIdentifier = initialStateJson.getAsString(); + + + JsonElement statesJson = personalityJson.get("states"); + if (statesJson == null) { + if (enableDebug) { + System.out.println("[!!] loadFromJSON: states not defined!"); + } + return; + } + JsonArray states = statesJson.getAsJsonArray(); + + // for each state: create an object of the correct type + // and add it to the hash map + for (JsonElement state : states) { + JsonObject s = state.getAsJsonObject(); + + String identifier = s.get("identifier").getAsString(); + String implementation = s.get("implementation").getAsString(); + + State object = ToyStateFactory.getByClassName(implementation, identifier); + if (object != null) { + identifierToState.put(identifier, object); + } + } + + + // now all states were converted into objects + // set initial state + setInitialState(initialStateIdentifier); // actually also sets the active state in this case + setActiveState(initialStateIdentifier); + + + // set fallbacks and transitions (if defined) + for (JsonElement state : states) { + JsonObject s = state.getAsJsonObject(); + + String identifier = s.get("identifier").getAsString(); + State thisState = identifierToState.get(identifier); + + if (thisState == null) { + throw new RuntimeException("State with identifier " + identifier + " is missing!"); + } + + + // check if fallback is defined + JsonElement fallbackEntry = s.get("fallback"); + if (fallbackEntry != null && !fallbackEntry.isJsonNull()) { + String fallbackIdentifier = fallbackEntry.getAsString(); + if (fallbackIdentifier != null) { + State fallbackState = identifierToState.get(fallbackIdentifier); + if (fallbackState == null) { + if (enableDebug) { + System.out.println("[!!] loadFromJSON: fallback " + fallbackIdentifier + " missing"); + } + } else { + thisState.setFallback(fallbackState); + } + } + } + + + // set the transitions + JsonObject transitions = s.getAsJsonObject("transitions"); + if (transitions != null && !transitions.isJsonNull()) { + + for (Map.Entry entry : transitions.entrySet()) { + String transitionName = entry.getKey(); + String transitionTarget = entry.getValue().getAsString(); + + State transitionState = identifierToState.get(transitionTarget); + + if (transitionState != null) { + thisState.setTransition(transitionName, transitionState); + } + } + } + } + + + if (enableDebug) { + // check if all states have all required transitions initialized correctly + for (State s : identifierToState.values()) { + if (!s.allRequiredTransitionsAreInitialized()) { + System.out.println("[!!] loadFromJSON: Some required transitions are missing in the " + + "state with identifier " + s.getIdentifier()); + } + } + } + + + } + + public void saveToFile(File f) throws FileNotFoundException { + + String json = toJsonString(); + + try( PrintWriter out = new PrintWriter( f ) ){ + out.println( json ); + } + + } + + + + private JsonObject toJsonObject() { + JsonObject stateMachineJson = new JsonObject(); + if (initalState == null) { + if (enableDebug) { + System.out.println("[!!] toJsonObject: initial state undefined!"); + } + } else { + stateMachineJson.addProperty("initialState", initalState.getIdentifier()); + } + + // all states + JsonArray statesJsonArray = new JsonArray(); + for (State state : identifierToState.values()) { + JsonObject stateJson = state.toJsonObject(); + statesJsonArray.add(stateJson); + } + stateMachineJson.add("states", statesJsonArray); + + return stateMachineJson; + } + + public String toJsonString() { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + JsonObject json = toJsonObject(); + return gson.toJson(json); + } + + + public String toString() { + StringBuilder s = new StringBuilder(); + s.append("###################################################\n"); + s.append("Dialog State Machine\n"); + s.append("###################################################\n"); + + s.append(">> Current state:\n"); + s.append(activeState).append("\n"); + + s.append(">> Initial state:\n"); + s.append(initalState).append("\n"); + + s.append(">> All states:\n"); + for (State state : identifierToState.values()) { + s.append(state); + } + + s.append("###################################################\n"); + + return s.toString(); + } + + + @Override + public boolean equals(Object obj) { + if ( ! (obj instanceof DialogStateMachine) ) { + return false; + } + + // Two state machines are equal if and only if: + // - they contain the same states (same names + classes) + // - the initial state is identical + // - they states are identically connected (transitions + fallbacks) + + // The active state is not important for the structure and will be ignored by this check! + + DialogStateMachine other = (DialogStateMachine) obj; + + // check initial states + if (initalState == null && other.initalState != null) { + return false; + } + if (initalState != null && (!initalState.equals(other.initalState)) ) { + return false; + } + + + // all states + transitions from this machine are present in the other + for (State thisState : identifierToState.values()) { + String stateID = thisState.getIdentifier(); + State otherState = other.getStateByIdentifier(stateID); + if (otherState == null) return false; + if ( ! thisState.equals(otherState)) return false; + } + + + // all states + transitions from the other machine are present in this + for (State otherState : other.identifierToState.values()) { + String stateID = otherState.getIdentifier(); + State thisState = this.getStateByIdentifier(stateID); + if (thisState == null) return false; + if ( ! thisState.equals(otherState)) return false; + } + + + return true; + } + + +} diff --git a/src/main/java/roboy/newDialog/NewDialogSystem.java b/src/main/java/roboy/newDialog/NewDialogSystem.java new file mode 100644 index 00000000..74c907d5 --- /dev/null +++ b/src/main/java/roboy/newDialog/NewDialogSystem.java @@ -0,0 +1,74 @@ +package roboy.newDialog; + + +import org.apache.commons.configuration2.YAMLConfiguration; +import org.apache.commons.configuration2.ex.ConfigurationException; +import roboy.dialog.Config; +import roboy.dialog.action.Action; +import roboy.io.*; +import roboy.linguistics.sentenceanalysis.*; +import roboy.talk.Verbalizer; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static roboy.dialog.Config.ConfigurationProfile.NOROS; + +/** + * Temporary class to test new state based personality. + * Will be be extended and might replace the old DialogSystem in the future. + */ +public class NewDialogSystem { + + private static String getPersonalityFilePathFromConfig() throws FileNotFoundException, ConfigurationException { + YAMLConfiguration yamlConfig = new YAMLConfiguration(); + yamlConfig.read(new FileReader(new File("config.properties"))); + return yamlConfig.getString("PERSONALITY_FILE"); + } + + public static void main(String[] args) throws Exception { + + // TODO: catch all exceptions or make sure none are thrown + new Config(NOROS); + + + MultiInputDevice multiIn = new MultiInputDevice(new CommandLineInput()); + MultiOutputDevice multiOut = new MultiOutputDevice(new CommandLineOutput()); + List analyzers = new ArrayList<>(); + analyzers.add(new Preprocessor()); + analyzers.add(new SimpleTokenizer()); + + StateBasedPersonality personality = new StateBasedPersonality(new Verbalizer()); + String personalityFilePath = getPersonalityFilePathFromConfig(); + personality.loadFromFile(new File(personalityFilePath)); + + + Input raw; + Interpretation interpretation; + + // Repeat conversation a few times + for (int numConversations = 0; numConversations < 2; numConversations++) { + + System.out.println("-------------- new conversation --------------"); + List actions = personality.startConversation(); + + while ( ! actions.isEmpty() ) { + multiOut.act(actions); + raw = multiIn.listen(); + interpretation = new Interpretation(raw.sentence, raw.attributes); + for (Analyzer a : analyzers) { + interpretation = a.analyze(interpretation); + } + actions = personality.answer(interpretation); + } + + } + } + + + +} diff --git a/src/main/java/roboy/newDialog/StateBasedPersonality.java b/src/main/java/roboy/newDialog/StateBasedPersonality.java new file mode 100644 index 00000000..a62f8040 --- /dev/null +++ b/src/main/java/roboy/newDialog/StateBasedPersonality.java @@ -0,0 +1,167 @@ +package roboy.newDialog; + +import roboy.dialog.action.Action; +import roboy.dialog.action.FaceAction; +import roboy.dialog.personality.Personality; +import roboy.linguistics.Linguistics; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.newDialog.states.State; +import roboy.talk.Verbalizer; + +import java.util.ArrayList; +import java.util.List; + +/** + * Implementation of Personality based on a DialogStateMachine. + * + * In contrast to previous Personality implementations, this one is more generic + * as it loads the dialog from a file. Additionally, it is still possible to + * define the dialog structure directly from code (as it was done in previous + * implementations). + * + * Instead of using nested states that will pass an utterance to each other if a state + * cannot give an appropriate reaction, we use a fallback concept. + * If a state doesn't know how to react, it simply doesn't react at all. If a fallback + * (with is another state) is attached to it, the personality will pass the utterance + * to the fallback automatically. + * This concept helps to decouple the states and reduce the dependencies between them. + */ +public class StateBasedPersonality extends DialogStateMachine implements Personality { + + + private final Verbalizer verbalizer; + + + public StateBasedPersonality(Verbalizer verb) { + verbalizer = verb; + reset(); + } + + + private void reset() { + // go back to initial state + setActiveState(getInitialState()); + } + + /** + * Always called once by the (new) DialogSystem at the beginning of every new conversation. + * @return list of actions based on act() of the initial/active state + */ + public List startConversation() { + State activeState = getActiveState(); + if (activeState == null) { + System.out.println("[!!] ERROR: This personality state machine has not been initialized!"); + return new ArrayList<>(); + } + if ( ! activeState.equals(getInitialState())) { + System.out.println("[!!] WARNING: The active state is different from the initial state " + + "at the beginning of conversation!"); + } + + + return stateAct(activeState); + } + + + @Override + public List answer(Interpretation input) { + + State activeState = getActiveState(); + if (activeState == null) { + System.out.println("[!!] ERROR: This personality state machine has not been initialized!"); + return new ArrayList<>(); + } + List answerActions = new ArrayList<>(); + + + // SPECIAL NON-STATE BASED BEHAVIOUR + // TODO: special treatment for profanity, farewell phrases etc. + if (input.getFeatures().containsKey(Linguistics.EMOTION)) { + // change facial expression based on input + answerActions.add(new FaceAction((String) input.getFeatures().get(Linguistics.EMOTION))); + } + + + // ACTIVE STATE REACTS TO INPUT + List react = stateReact(activeState, input); + answerActions.addAll(react); + + + // MOVE TO THE NEXT STATE + State next = activeState.getNextState(); + if (next == null) { + reset(); // go back to initial state + return answerActions; + } + setActiveState(next); + + + // NEXT STATE ACTS + List act = stateAct(next); + answerActions.addAll(act); + + return answerActions; + } + + + /** + * Call the act function of the state and verbalize all interpretations into actions. + * @param state state to call ACT on + * @return list of actions + */ + private List stateAct(State state) { + List stateActIntepretations = state.act(); + return verbalizeInterpretations(stateActIntepretations); + } + + + /** + * Call the react function of the state. If the state can't react, recursively ask fallbacks. + * Verbalize the resulting reaction interpretation into actions. + * + * @param state state to call REact on + * @param input input from the person Roboy speaks to + * @return list of actions + */ + private List stateReact(State state, Interpretation input) { + + List reaction = state.react(input); + State fallback = state.getFallback(); + + // fallbacks + int fallbackCount = 0, maxFallbackCount = 1000; // limit to prevent infinite loops + while (reaction == null && fallback != null && fallbackCount < maxFallbackCount) { + // active state doesn't know how to react + // ask fallbacks recursively until + // - there is a reaction + // - there is no fallback + reaction = fallback.react(input); + fallback = fallback.getFallback(); + + // prevent infinite loops + fallbackCount++; + } + if (fallbackCount >= maxFallbackCount) System.out.println("[!!] WARNING: possibly infinite fallback loop"); + + return verbalizeInterpretations(reaction); + } + + + /** + * Verbalizes all interpretations into actions using the verbalizer. + * @param interpretations list of interpretations. + * @return list of actions + */ + private List verbalizeInterpretations(List interpretations) { + List listOfActions = new ArrayList<>(); + if (interpretations != null) { + // verbalize all act interpretations + for (Interpretation i : interpretations) { + listOfActions.add(verbalizer.verbalize(i)); + } + } + return listOfActions; + } + + +} diff --git a/src/main/java/roboy/newDialog/examples/StateMachineExamples.java b/src/main/java/roboy/newDialog/examples/StateMachineExamples.java new file mode 100644 index 00000000..771bb6df --- /dev/null +++ b/src/main/java/roboy/newDialog/examples/StateMachineExamples.java @@ -0,0 +1,125 @@ +package roboy.newDialog.examples; + +import roboy.newDialog.DialogStateMachine; +import roboy.newDialog.states.toyStates.*; + +import java.io.File; + +/** + * This class provides examples how to load state machines from files + * or create them from code directly. + */ +public class StateMachineExamples { + + public static void main(String[] args) throws Exception { + // create all states and set all connections from code directly + DialogStateMachine code = fromCode(); + + // load states and connections from file + DialogStateMachine file = fromFile(); + + // load states and connections from string (not readable, mainly used for unit tests) + DialogStateMachine string = fromString(); + + System.out.println(file); + + System.out.println("JSON representation:"); + System.out.println(file.toJsonString()); + + + System.out.println("Dialog machine from code, file and string are equal: " + + ( code.equals(file) && + code.equals(string) && + string.equals(code) && + string.equals(file) && + file.equals(string) && + file.equals(code) + ) + ); + + + //System.out.println("Saving to resources/personalityFiles/ExamplePersonality2.json"); + //file.saveToFile(new File ("resources/personalityFiles/ExamplePersonality2.json")); + + } + + private static DialogStateMachine fromCode() { + + // create states + ToyGreetingsState greetings = new ToyGreetingsState("Greetings"); + ToyIntroState intro = new ToyIntroState("Intro"); + ToyFarewellState farewell = new ToyFarewellState("Farewell"); + ToyRandomAnswerState randomAnswer = new ToyRandomAnswerState("RandomAnswer"); + + // set fallbacks and transitions + greetings.setFallback(randomAnswer); + greetings.setTransition("next", intro); + greetings.setTransition("noHello", farewell); + intro.setTransition("next", farewell); + randomAnswer.setTransition("next", farewell); + + // create the dialog machine an register states + DialogStateMachine stateMachine = new DialogStateMachine(); + stateMachine.addState(greetings); + stateMachine.addState(intro); + stateMachine.addState(farewell); + stateMachine.addState(randomAnswer); + stateMachine.setInitialState(greetings); + + return stateMachine; + + } + + private static DialogStateMachine fromFile() throws Exception { + DialogStateMachine stateMachine = new DialogStateMachine(); + stateMachine.loadFromFile(new File("resources/personalityFiles/ExamplePersonality.json")); + return stateMachine; + } + + private static DialogStateMachine fromString() { + DialogStateMachine stateMachine = new DialogStateMachine(); + stateMachine.loadFromString(toyPersonality); + return stateMachine; + } + + + + private static final String toyPersonality = "{\n" + + " \"initialState\": \"Greetings\",\n" + + " \"states\": [\n" + + " {\n" + + " \"identifier\": \"Greetings\",\n" + + " \"implementation\" : \"roboy.newDialog.states.toyStates.ToyGreetingsState\",\n" + + " \"fallback\" : \"RandomAnswer\",\n" + + " \"transitions\" : {\n" + + " \"next\" : \"Intro\",\n" + + " \"noHello\" : \"Farewell\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"identifier\": \"Intro\",\n" + + " \"implementation\" : \"roboy.newDialog.states.toyStates.ToyIntroState\",\n" + + " \"fallback\" : null,\n" + + " \"transitions\" : {\n" + + " \"next\" : \"Farewell\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"identifier\": \"Farewell\",\n" + + " \"implementation\" : \"roboy.newDialog.states.toyStates.ToyFarewellState\",\n" + + " \"fallback\" : null,\n" + + " \"transitions\" : {}\n" + + " },\n" + + " {\n" + + " \"identifier\": \"RandomAnswer\",\n" + + " \"implementation\" : \"roboy.newDialog.states.toyStates.ToyRandomAnswerState\",\n" + + " \"fallback\" : null,\n" + + " \"transitions\" : {\n" + + " \"next\" : \"Farewell\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + + +} diff --git a/src/main/java/roboy/newDialog/states/State.java b/src/main/java/roboy/newDialog/states/State.java new file mode 100644 index 00000000..ceff6191 --- /dev/null +++ b/src/main/java/roboy/newDialog/states/State.java @@ -0,0 +1,288 @@ +package roboy.newDialog.states; + +import com.google.gson.JsonObject; +import roboy.linguistics.sentenceanalysis.Interpretation; + +import java.util.*; + +/** + * Central class of the dialog state system. Every dialog state should extend this class. + * A state always acts when it is entered and reacts when its left. Both, the reaction of + * the last and the action of the next state, are combined to give the answer of Roboy. + * + * A state can have any number of transitions to other states. Every transition has a name + * (like "next" or "errorState"). When designing a new state, only the transition names + * are known. At run time the transitions will point to other states. You can get the + * attached state by the transition name using getTransition(transitionName). + * + * A fallback can be attached to a state. In the case this state doesn't know how to react + * to an utterance, it can return null from the react() function. The state machine will query + * the fallback in this case. More details on the fallback concept can be found in the + * description of the StateBasedPersonality and in comments below. + */ +public abstract class State { + + + // State name/identifier + private String stateIdentifier; + + // If this state can't react to the input, the Personality state machine will ask the fallback state + private State fallback; + + // Possible transitions to other states. The next state is selected based on some conditions in getNextState(); + private HashMap transitions; + + + public State(String stateIdentifier) { + this.stateIdentifier = stateIdentifier; + fallback = null; + transitions = new HashMap<>(); + } + + //region identifier, fallback & transitions + + public String getIdentifier() { + return stateIdentifier; + } + public void setIdentifier(String stateIdentifier) { + this.stateIdentifier = stateIdentifier; + } + + /** + * If this state can't react to the input, the Personality state machine will ask the fallback state + * to react to the input. This state still remains active. + * @return fallback state + */ + public final State getFallback() { + return fallback; + } + + /** + * Set the fallback state. The Personality state machine will ask the fallback state if this one has no answer. + * @param fallback fallback state + */ + public final void setFallback(State fallback) { + this.fallback = fallback; + } + + /** + * Define a possible transition from this state to another. Something like: + * "next" -> {GreetingState} + * "rudeInput" -> {EvilState} + * The next active state will be selected in getNextState() based on internal conditions. + * + * @param name name of the transition + * @param goToState state to transit to + */ + public final void setTransition(String name, State goToState) { + transitions.put(name, goToState); + } + public final State getTransition(String name) { + return transitions.get(name); + } + public final HashMap getAllTransitions() { + return transitions; + } + + //endregion + + // Functions that must be implemented in sub classes: + + // region to be implemented in subclasses + + /** + * A state always acts after the reaction. Both, the reaction of the last and the action of the next state, + * are combined to give the answer of Roboy. + * @return interpretations + */ + public abstract List act(); + + + /** + * Defines how to react to an input. This is usually the answer to the incoming question or some other statement. + * If this state can't react, it can return 'null' to trigger the fallback state for the answer. + * + * Note: In the new architecture, react() does not define the next state anymore! Reaction and state + * transitions are now decoupled. State transitions are defined in getNextState() + * + * @param input input from the person we talk to + * @return reaction to the input OR null (will trigger the fallback state) + */ + public abstract List react(Interpretation input); + + + /** + * After this state has reacted, the personality state machine will ask this state to which state to go next. + * If this state is not ready, it will return itself. Otherwise, depending on internal conditions, this state + * will select one of the states defined in transitions to be the next one. + * + * @return next actie state after this one has reacted + */ + public abstract State getNextState(); + + + //endregion + + // Utility functions: make sure initialization is correct + + //region correct initialization checks + + /** + * Defines the names of all transition that HAVE to be defined for this state. + * This function is used by allRequiredTransitionsAreInitialized() to make sure this state was + * initialized correctly. Default implementation requires no transitions to be defined. + * + * Override this function in sub classes. + * @return a set of transition names that have to be defined + */ + protected Set getRequiredTransitionNames() { + // default implementation: no required transitions + return new HashSet<>(); + } + + /** + * Checks if all required transitions were initialized correctly. + * Required transitions are defined in getRequiredTransitionNames(). + * + * @return true if this state was initialized correctly + */ + public final boolean allRequiredTransitionsAreInitialized() { + boolean allGood = true; + + for (String tName : getRequiredTransitionNames()) { + if (!transitions.containsKey(tName)) { + System.err.println("Transition " + tName + " is required but is not defined!"); + allGood = false; + } + } + + return allGood; + } + + /** + * Utility function to create and initialize string sets in just one code line. + * @param tNames names of the required transitions + * @return set initialized with inputs + */ + protected Set newSet(String ... tNames) { + HashSet result = new HashSet<>(); + result.addAll(Arrays.asList(tNames)); + return result; + } + + //endregion + + public JsonObject toJsonObject() { + JsonObject stateJson = new JsonObject(); + stateJson.addProperty("identifier", getIdentifier()); + + String className = getClass().getCanonicalName(); + stateJson.addProperty("implementation", className); + + if (fallback != null) { + String fallbackID = fallback.getIdentifier(); + stateJson.addProperty("fallback", fallbackID); + } + + // transitions + JsonObject transitionsJson = new JsonObject(); + for (Map.Entry transition : getAllTransitions().entrySet()) { + String transName = transition.getKey(); + String transStateID = transition.getValue().getIdentifier(); + transitionsJson.addProperty(transName, transStateID); + } + stateJson.add("transitions", transitionsJson); + + + return stateJson; + + } + + public String toString() { + StringBuilder s = new StringBuilder(); + s.append("State ").append(getIdentifier()).append(" of class "); + s.append(this.getClass().getSimpleName()).append(" {\n"); + + State fallback = getFallback(); + if (fallback != null) { + s.append(" ! fallback: ").append(fallback.getIdentifier()).append("\n"); + } + for (Map.Entry transition : getAllTransitions().entrySet()) { + s.append(" ").append(transition.getKey()).append(": "); + s.append(transition.getValue().getIdentifier()).append("\n"); + } + + return s.append("}\n").toString(); + + + } + + @Override + public boolean equals(Object obj) { + if ( ! (obj instanceof State)) { + return false; + } + State other = (State) obj; + + // different class + if (other.getClass() != this.getClass()) { + return false; + } + + // other has a fallback, this doesn't + if (this.fallback == null && other.fallback != null) { + return false; + } + + // this has a fallback, other doesn't + if (other.fallback == null && this.fallback != null) { + return false; + } + + // both have fallbacks, compare them by IDs + if (this.fallback != null) { + String thisFallbackID = this.getFallback().getIdentifier(); + String otherFallbackID = this.getFallback().getIdentifier(); + // different fallback IDs + if (!thisFallbackID.equals(otherFallbackID)) { + return false; + } + } + + // compare transitions: all of this transitions are present in the other + boolean otherHasAllOfThis = this.equalsHelper_compareTransitions(other); + boolean thisHasAllOfOther = other.equalsHelper_compareTransitions(this); + + return otherHasAllOfThis && thisHasAllOfOther; + } + + /** + * check if every transition of this is present in the other and points to the same ID + * @param other other state to compare transitions + * @return true if all transitions of this state are present in the other state + */ + private boolean equalsHelper_compareTransitions(State other) { + + // for every transition in this state + for (Map.Entry transition : getAllTransitions().entrySet()) { + + // transition name + String transName = transition.getKey(); + // id of the state this transition points to + String thisTransStateID = transition.getValue().getIdentifier(); + + // check if transition in the other state points to the same id + State otherTransState = other.getTransition(transName); + if (otherTransState == null) return false; + + String otherTransStateID = otherTransState.getIdentifier(); + if (! thisTransStateID.equals(otherTransStateID)) return false; + + } + return true; + + } + + +} + diff --git a/src/main/java/roboy/newDialog/states/factories/ToyStateFactory.java b/src/main/java/roboy/newDialog/states/factories/ToyStateFactory.java new file mode 100644 index 00000000..c26156fe --- /dev/null +++ b/src/main/java/roboy/newDialog/states/factories/ToyStateFactory.java @@ -0,0 +1,29 @@ +package roboy.newDialog.states.factories; + + +import roboy.newDialog.states.State; + +/** + * Temporary factory to create State objects based on class name. + * + * May be replaced with something more generic later. + */ +public class ToyStateFactory { + + public static State getByClassName(String className, String instanceName) { + switch (className) { + case "roboy.newDialog.states.toyStates.ToyFarewellState": + return new roboy.newDialog.states.toyStates.ToyFarewellState(instanceName); + case "roboy.newDialog.states.toyStates.ToyGreetingsState": + return new roboy.newDialog.states.toyStates.ToyGreetingsState(instanceName); + case "roboy.newDialog.states.toyStates.ToyIntroState": + return new roboy.newDialog.states.toyStates.ToyIntroState(instanceName); + case "roboy.newDialog.states.toyStates.ToyRandomAnswerState": + return new roboy.newDialog.states.toyStates.ToyRandomAnswerState(instanceName); + default: + System.out.println("Unknown class name: " + className); + return null; + } + } + +} diff --git a/src/main/java/roboy/newDialog/states/toyStates/ToyFarewellState.java b/src/main/java/roboy/newDialog/states/toyStates/ToyFarewellState.java new file mode 100644 index 00000000..2ba3a2bb --- /dev/null +++ b/src/main/java/roboy/newDialog/states/toyStates/ToyFarewellState.java @@ -0,0 +1,38 @@ +package roboy.newDialog.states.toyStates; + +import roboy.newDialog.states.State; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.util.Lists; + +import java.util.List; + +/** + * ToyFarewellState always acts with "Bye bye". + * The Interlocutor answer is ignored and there is no reaction. + * This ends the conversation. + * + * Fallback is not required. + * This state has no outgoing transitions. + */ +public class ToyFarewellState extends State { + + public ToyFarewellState(String stateIdentifier) { + super(stateIdentifier); + } + + @Override + public List act() { + return Lists.interpretationList(new Interpretation("Bye bye! [say anything, will end conversation]")); + } + + @Override + public List react(Interpretation input) { + return null; // no reaction, we are done (fallback should also be set to null) + } + + @Override + public State getNextState() { + return null; // no next state, we are done + } + +} diff --git a/src/main/java/roboy/newDialog/states/toyStates/ToyGreetingsState.java b/src/main/java/roboy/newDialog/states/toyStates/ToyGreetingsState.java new file mode 100644 index 00000000..89d1026d --- /dev/null +++ b/src/main/java/roboy/newDialog/states/toyStates/ToyGreetingsState.java @@ -0,0 +1,70 @@ +package roboy.newDialog.states.toyStates; + +import roboy.newDialog.states.State; +import roboy.linguistics.Linguistics; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.logic.StatementInterpreter; +import roboy.talk.Verbalizer; +import roboy.util.Lists; + +import java.util.*; + +/** + * ToyGreetingsState can be used as the initial state. + * Roboy will greet the Interlocutor with "Hello". + * + * If the response is a greeting, the "next" transition is taken. + * Otherwise the fallback will be triggered and the "noHello" transition is taken. + * + * Fallback is required. + * Outgoing transitions that have to be defined: + * - next: following state if there was a greeting + * - noHello: following state if there was NO greeting + */ +public class ToyGreetingsState extends State { + + private boolean inputOK = true; + + public ToyGreetingsState(String stateIdentifier) { + super(stateIdentifier); + } + + @Override + public List act() { + return Lists.interpretationList(new Interpretation("Hello! [expecting greeting]")); + } + + @Override + public List react(Interpretation input) { + String sentence = (String) input.getFeatures().get(Linguistics.SENTENCE); + inputOK = StatementInterpreter.isFromList(sentence, Verbalizer.greetings); + + if (inputOK) { + return Lists.interpretationList(new Interpretation("I like it when you greet me! [greeting detected, next state]")); + + } else { + return null; // -> fallback state will be used + // alternatively: return Lists.interpretationList(new Interpretation("Got no greeting :(")); + } + } + + + @Override + public State getNextState() { + if (inputOK) { + return getTransition("next"); + + } else { + return getTransition("noHello"); + // alternatively: return this to repeat + } + } + + + + @Override + protected Set getRequiredTransitionNames() { + // optional: define all required transitions here: + return newSet("next", "noHello"); + } +} diff --git a/src/main/java/roboy/newDialog/states/toyStates/ToyIntroState.java b/src/main/java/roboy/newDialog/states/toyStates/ToyIntroState.java new file mode 100644 index 00000000..c2499367 --- /dev/null +++ b/src/main/java/roboy/newDialog/states/toyStates/ToyIntroState.java @@ -0,0 +1,46 @@ +package roboy.newDialog.states.toyStates; + +import roboy.newDialog.states.State; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.util.Lists; + +import java.util.*; + +/** + * ToyIntroState demonstrates a simple introduction. + * Roboy will tell the Interlocutor his name and ask for the Interlocutor's name. + * The reply is ignored. + * + * Fallback is not required. + * Outgoing transitions that have to be defined: + * - next: following state + */ +public class ToyIntroState extends State { + + + public ToyIntroState(String stateIdentifier) { + super(stateIdentifier); + } + + @Override + public List act() { + return Lists.interpretationList(new Interpretation("My name is Roboy! Who are you? [say anything]")); + } + + @Override + public List react(Interpretation input) { + return Lists.interpretationList(new Interpretation("Nice to meet you! [moving to next state]")); + } + + @Override + public State getNextState() { + return getTransition("next"); + } + + @Override + protected Set getRequiredTransitionNames() { + // optional: define all required transitions here: + return newSet("next"); + } + +} diff --git a/src/main/java/roboy/newDialog/states/toyStates/ToyRandomAnswerState.java b/src/main/java/roboy/newDialog/states/toyStates/ToyRandomAnswerState.java new file mode 100644 index 00000000..09cd78c0 --- /dev/null +++ b/src/main/java/roboy/newDialog/states/toyStates/ToyRandomAnswerState.java @@ -0,0 +1,37 @@ +package roboy.newDialog.states.toyStates; + +import roboy.newDialog.states.State; +import roboy.linguistics.sentenceanalysis.Interpretation; +import roboy.util.Lists; + +import java.util.List; + +/** + * ToyRandomAnswerState is meant to be used as a fallback state. + * It only implements the react() function returning a hardcoded random answer. + * This state should never become active (meaning that no transition should point to it.) + * + * Fallback is not required (this state should be the fallback). + * This state has no outgoing transitions. + */ +public class ToyRandomAnswerState extends State { + + public ToyRandomAnswerState(String stateIdentifier) { + super(stateIdentifier); + } + + @Override + public List act() { + return null; // this state is only used as fallback, no act needed + } + + @Override + public List react(Interpretation input) { + return Lists.interpretationList(new Interpretation("I'm Roboy! I'm awesome! [random answer]")); + } + + @Override + public State getNextState() { + return null; // this state is only used as fallback, no transitions needed + } +} diff --git a/src/main/java/roboy/ros/Ros.java b/src/main/java/roboy/ros/Ros.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/ros/RosClients.java b/src/main/java/roboy/ros/RosClients.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/ros/RosMainNode.java b/src/main/java/roboy/ros/RosMainNode.java old mode 100644 new mode 100755 index 2e2a0a63..668ad67d --- a/src/main/java/roboy/ros/RosMainNode.java +++ b/src/main/java/roboy/ros/RosMainNode.java @@ -28,7 +28,7 @@ public class RosMainNode extends AbstractNodeMain { public RosMainNode() { // Ctor is called but should not be initialized offline. - if (Config.NOROS) return; + if (Config.NOROS && !Config.MEMORY) return; clients = new RosManager(); diff --git a/src/main/java/roboy/ros/RosManager.java b/src/main/java/roboy/ros/RosManager.java old mode 100644 new mode 100755 index 105ad090..c9449391 --- a/src/main/java/roboy/ros/RosManager.java +++ b/src/main/java/roboy/ros/RosManager.java @@ -24,6 +24,12 @@ boolean initialize(ConnectedNode node) { boolean success = true; // Iterate through the RosClients enum, mapping a client for each. for(RosClients c : RosClients.values()) { + // Do not initialize non-memory services if NOROS, but Memory! + if(Config.NOROS && Config.MEMORY) { + if (!c.address.contains("memory")) { + continue; + } + } try { clientMap.put(c, node.newServiceClient(c.address, c.type)); System.out.println(c.toString()+" initialization SUCCESS!"); diff --git a/src/main/java/roboy/talk/StatementBuilder.java b/src/main/java/roboy/talk/StatementBuilder.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/talk/Verbalizer.java b/src/main/java/roboy/talk/Verbalizer.java old mode 100644 new mode 100755 index 9b907d0d..1a82357e --- a/src/main/java/roboy/talk/Verbalizer.java +++ b/src/main/java/roboy/talk/Verbalizer.java @@ -51,7 +51,7 @@ private SpeechAction greet(Interpretation interpretation){ "farewell","bye-bye"); private ShutDownAction farewell(Interpretation interpretation){ - return new ShutDownAction(Arrays.asList(new SpeechAction(StatementBuilder.random(farewells)))); + return new ShutDownAction(Arrays.asList(new SpeechAction(StatementBuilder.random(farewells)))); } private static final List segues = @@ -138,7 +138,7 @@ private String dateToText(String date){ "09","ninth", "10","tenth", "11","eleventh", - "12","twelveth", + "12","twelfth", "13","thirteenth", "14","fourteenth", "16","sixteenth", @@ -155,8 +155,8 @@ private String dateToText(String date){ "27","twenty seventh", "28","twenty eighth", "29","twenty ninth", - "30","thirtiest", - "31","thiry first" + "30","thirtieth", + "31","thirty first" ); private static final Map lowNumberMap = Maps.intStringMap( @@ -209,7 +209,7 @@ private String dateToText(String date){ 1,"ten", 2,"twenty", 3,"thirty", - 4,"fourty", + 4,"forty", 5,"fifty", 6,"sixty", 7,"seventy", diff --git a/src/main/java/roboy/util/Concept.java b/src/main/java/roboy/util/Concept.java old mode 100644 new mode 100755 index 88e61690..e573c1cd --- a/src/main/java/roboy/util/Concept.java +++ b/src/main/java/roboy/util/Concept.java @@ -19,14 +19,14 @@ public class Concept { public Concept() { - this.attributes = new HashMap(); + this.attributes = new HashMap<>(); this.attributes.put("class_name", "Person"); //TODO remove hardcoded person constructor this.attributes.put("id", RoboyMind.getInstance().object_id++); } public Concept(Map attrs) { - this.attributes = new HashMap(); + this.attributes = new HashMap<>(); this.attributes.put("class_name", "Person"); this.attributes.put("id", RoboyMind.getInstance().object_id++); for (Map.Entry attr: attrs.entrySet()) @@ -36,7 +36,7 @@ public Concept(Map attrs) } public Concept(String name){ - this.attributes = new HashMap(); + this.attributes = new HashMap<>(); attributes.put(Linguistics.NAME, name); this.attributes.put("id", RoboyMind.getInstance().object_id++); } @@ -62,54 +62,50 @@ public Object getAttribute(String key){ public String getProperties() { - String properties = ""; + StringBuilder properties = new StringBuilder(); for (Map.Entry attribute : this.getAttributes().entrySet()) { // if (attribute.getKey() != "class_name" && attribute.getKey() != "id") // { - properties += attribute.getKey() + ","; + properties.append(attribute.getKey()).append(","); // } } - if (properties.length()>0 && properties.charAt(properties.length()-1)==',') + if (properties.length() > 0 && properties.charAt(properties.length()-1) == ',') { - properties = properties.substring(0, properties.length()-1); + properties = new StringBuilder(properties.substring(0, properties.length() - 1)); } - return properties; + return properties.toString(); } public String getValues() { - String values = ""; + StringBuilder values = new StringBuilder(); for (Map.Entry attribute : this.getAttributes().entrySet()) { - if (attribute.getKey() != "class" && attribute.getKey() != "id") + if ( ! attribute.getKey().equals("class") && ! attribute.getKey().equals("id")) { - values += attribute.getValue().toString() + ","; + values.append(attribute.getValue().toString()).append(","); } } if (values.length()>0 && values.charAt(values.length()-1)==',') { - values = values.substring(0, values.length()-1); + values = new StringBuilder(values.substring(0, values.length() - 1)); } - return values; + return values.toString(); } public boolean hasAttribute(String property) { - if (this.getProperties() != "" && this.getProperties().contains(property)) - { - return true; - } - return false; + return ! this.getProperties().equals("") && this.getProperties().contains(property); } public Object retrieve() diff --git a/src/main/java/roboy/util/IO.java b/src/main/java/roboy/util/IO.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/util/JsonQAValues.java b/src/main/java/roboy/util/JsonQAValues.java new file mode 100644 index 00000000..55a01f11 --- /dev/null +++ b/src/main/java/roboy/util/JsonQAValues.java @@ -0,0 +1,38 @@ +package roboy.util; + +import java.util.List; +import java.util.Map; + +public class JsonQAValues { + private Map> questions; + private Map> successAnswers; + private Map> failureAnswers; + private Map> followUp; + private Map> answersFollowUp; + + public JsonQAValues(Map> questions, Map> successAnswers, + Map> failureAnswers, Map> followUp, + Map> answersFollowUp) { + this.questions = questions; + this.successAnswers = successAnswers; + this.failureAnswers = failureAnswers; + this.followUp = followUp; + this.answersFollowUp = answersFollowUp; + } + + public Map> getQuestions() { + return questions; + } + public Map> getSuccessAnswers() { + return successAnswers; + } + public Map> getFailureAnswers() { + return failureAnswers; + } + public Map> getFollowUpQuestions() { + return followUp; + } + public Map> getFollowUpAnswers() { + return answersFollowUp; + } +} diff --git a/src/main/java/roboy/util/JsonUtils.java b/src/main/java/roboy/util/JsonUtils.java old mode 100644 new mode 100755 index 1acba0f4..c5b6ac36 --- a/src/main/java/roboy/util/JsonUtils.java +++ b/src/main/java/roboy/util/JsonUtils.java @@ -7,10 +7,99 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Type; -import java.util.List; -import java.util.Map; +import java.util.*; + +class JsonModel { + // Add the new entry + JsonEntryModel name; + JsonEntryModel FROM; + JsonEntryModel HAS_HOBBY; + JsonEntryModel LIVE_IN; + JsonEntryModel FRIEND_OF; + JsonEntryModel STUDY_AT; + JsonEntryModel MEMBER_OF; + JsonEntryModel WORK_FOR; + JsonEntryModel OCCUPIED_AS; +} + +class JsonEntryModel { + List Q; + Map> A; + Map> FUP; +} public class JsonUtils { + /** + * Fetches the complite JSON string, splits and converts + * the most straightforward way into backward-compatible Map<> entries + * initializing a backward-compatible JsonQAValues class + */ + public static JsonQAValues getQuestionsAndAnswersFromJson(String file) { + // TODO Design a good and smart way to do this for new Dialog SM. Needs discussion + InputStream input = JsonUtils.class.getClassLoader().getResourceAsStream(file); + BufferedReader br = new BufferedReader( new InputStreamReader(input)); + + Gson gson = new Gson(); + JsonModel jsonObject = gson.fromJson(br, JsonModel.class); + Map> questions = new HashMap<>(); + Map> successAnswers = new HashMap<>(); + Map> failureAnswers = new HashMap<>(); + Map> followUp = new HashMap<>(); + Map> answersFollowUp = new HashMap<>(); + // Questions + questions.put("name", jsonObject.name.Q); + questions.put("FROM", jsonObject.FROM.Q); + questions.put("HAS_HOBBY", jsonObject.HAS_HOBBY.Q); + questions.put("LIVE_IN", jsonObject.LIVE_IN.Q); + questions.put("FRIEND_OF", jsonObject.FRIEND_OF.Q); + questions.put("STUDY_AT", jsonObject.STUDY_AT.Q); + questions.put("MEMBER_OF", jsonObject.MEMBER_OF.Q); + questions.put("WORK_FOR", jsonObject.WORK_FOR.Q); + questions.put("OCCUPIED_AS", jsonObject.OCCUPIED_AS.Q); + // Success Answer + successAnswers.put("name", jsonObject.name.A.get("SUCCESS")); + successAnswers.put("FROM", jsonObject.FROM.A.get("SUCCESS")); + successAnswers.put("HAS_HOBBY", jsonObject.HAS_HOBBY.A.get("SUCCESS")); + successAnswers.put("LIVE_IN", jsonObject.LIVE_IN.A.get("SUCCESS")); + successAnswers.put("FRIEND_OF", jsonObject.FRIEND_OF.A.get("SUCCESS")); + successAnswers.put("STUDY_AT", jsonObject.STUDY_AT.A.get("SUCCESS")); + successAnswers.put("MEMBER_OF", jsonObject.MEMBER_OF.A.get("SUCCESS")); + successAnswers.put("WORK_FOR", jsonObject.WORK_FOR.A.get("SUCCESS")); + successAnswers.put("OCCUPIED_AS", jsonObject.OCCUPIED_AS.A.get("SUCCESS")); + // Failure Answer + failureAnswers.put("name", jsonObject.name.A.get("FAILURE")); + failureAnswers.put("FROM", jsonObject.FROM.A.get("FAILURE")); + failureAnswers.put("HAS_HOBBY", jsonObject.HAS_HOBBY.A.get("FAILURE")); + failureAnswers.put("LIVE_IN", jsonObject.LIVE_IN.A.get("FAILURE")); + failureAnswers.put("FRIEND_OF", jsonObject.FRIEND_OF.A.get("FAILURE")); + failureAnswers.put("STUDY_AT", jsonObject.STUDY_AT.A.get("FAILURE")); + failureAnswers.put("MEMBER_OF", jsonObject.MEMBER_OF.A.get("FAILURE")); + failureAnswers.put("WORK_FOR", jsonObject.WORK_FOR.A.get("FAILURE")); + failureAnswers.put("OCCUPIED_AS", jsonObject.OCCUPIED_AS.A.get("FAILURE")); + // Follow Ups + followUp.put("name", jsonObject.name.FUP.get("Q")); + followUp.put("FROM", jsonObject.FROM.FUP.get("Q")); + followUp.put("HAS_HOBBY", jsonObject.HAS_HOBBY.FUP.get("Q")); + followUp.put("LIVE_IN", jsonObject.LIVE_IN.FUP.get("Q")); + followUp.put("FRIEND_OF", jsonObject.FRIEND_OF.FUP.get("Q")); + followUp.put("STUDY_AT", jsonObject.STUDY_AT.FUP.get("Q")); + followUp.put("MEMBER_OF", jsonObject.MEMBER_OF.FUP.get("Q")); + followUp.put("WORK_FOR", jsonObject.WORK_FOR.FUP.get("Q")); + followUp.put("OCCUPIED_AS", jsonObject.OCCUPIED_AS.FUP.get("Q")); + // Follow Up Answers + answersFollowUp.put("name", jsonObject.name.FUP.get("A")); + answersFollowUp.put("FROM", jsonObject.FROM.FUP.get("A")); + answersFollowUp.put("HAS_HOBBY", jsonObject.HAS_HOBBY.FUP.get("A")); + answersFollowUp.put("LIVE_IN", jsonObject.LIVE_IN.FUP.get("A")); + answersFollowUp.put("FRIEND_OF", jsonObject.FRIEND_OF.FUP.get("A")); + answersFollowUp.put("STUDY_AT", jsonObject.STUDY_AT.FUP.get("A")); + answersFollowUp.put("MEMBER_OF", jsonObject.MEMBER_OF.FUP.get("A")); + answersFollowUp.put("WORK_FOR", jsonObject.WORK_FOR.FUP.get("A")); + answersFollowUp.put("OCCUPIED_AS", jsonObject.OCCUPIED_AS.FUP.get("A")); + // Data + JsonQAValues q = new JsonQAValues(questions, successAnswers, failureAnswers, followUp, answersFollowUp); + return q; + } /** * Fetches the map of (keyword) -> (lists of corresponding questions) from the @@ -42,3 +131,4 @@ public static Map> getSentenceArraysFromJsonFile(String fi return q; } } + diff --git a/src/main/java/roboy/util/Lists.java b/src/main/java/roboy/util/Lists.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/util/Maps.java b/src/main/java/roboy/util/Maps.java old mode 100644 new mode 100755 diff --git a/src/main/java/roboy/util/Relation.java b/src/main/java/roboy/util/Relation.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/context/visionContext/ContextTest.java b/src/test/java/roboy/context/visionContext/ContextTest.java new file mode 100644 index 00000000..7606e256 --- /dev/null +++ b/src/test/java/roboy/context/visionContext/ContextTest.java @@ -0,0 +1,41 @@ +package roboy.context.visionContext; + +import org.junit.Test; +import roboy.context.Context; +import roboy.context.contextObjects.CoordinateSet; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +public class ContextTest { + /** + * Checks that the values of FACE_COORDINATES get automatically updated. + */ + @Test + public void getLastAttributeValue() throws Exception { + int updateFrequency = 1; //Assuming the updater's frequency is 1 second! + int sleeptime = updateFrequency * 1000 * 2; // Here in millis and double the actual update time. + Context.Values face = Context.Values.FACE_COORDINATES; + for(int i = 0; i < 3; i++) { + CoordinateSet set = face.getLastValue(); + Thread.sleep(sleeptime); + assertNotEquals(face.getLastValue(), set); + } + } + + @Test + public void setAndGetDialogTopics() { + Context ct = Context.getInstance(); + Context.Updaters updater = Context.Updaters.DIALOG_TOPICS_UPDATER; + Context.ValueHistories topics = Context.ValueHistories.DIALOG_TOPICS; + + ct.updateValue(updater, "test1"); + assertEquals("test1", ( topics.getLastValue())); + ct.updateValue(updater, "test2"); + Map values = topics.getNLastValues(2); + assertEquals("test1", values.get(0)); + assertEquals("test2", values.get(1)); + } +} \ No newline at end of file diff --git a/src/test/java/roboy/dialog/personality/states/LocationDBpediaStateTest.java b/src/test/java/roboy/dialog/personality/states/LocationDBpediaStateTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/dialog/personality/states/QuestionAnsweringStateTest.java b/src/test/java/roboy/dialog/personality/states/QuestionAnsweringStateTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/linguistics/sentenceanalysis/AnswerAnalyzerTest.java b/src/test/java/roboy/linguistics/sentenceanalysis/AnswerAnalyzerTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/linguistics/sentenceanalysis/DictionaryBasedSentenceTypeDetectorTest.java b/src/test/java/roboy/linguistics/sentenceanalysis/DictionaryBasedSentenceTypeDetectorTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/linguistics/sentenceanalysis/OpenNLPParserTest.java b/src/test/java/roboy/linguistics/sentenceanalysis/OpenNLPParserTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/logic/PASInterpreterTest.java b/src/test/java/roboy/logic/PASInterpreterTest.java old mode 100644 new mode 100755 diff --git a/src/test/java/roboy/newDialog/DialogStateMachineTest.java b/src/test/java/roboy/newDialog/DialogStateMachineTest.java new file mode 100644 index 00000000..d3eea3dd --- /dev/null +++ b/src/test/java/roboy/newDialog/DialogStateMachineTest.java @@ -0,0 +1,165 @@ +package roboy.newDialog; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; + +import org.junit.Test; +import roboy.newDialog.states.State; +import roboy.newDialog.DialogStateMachine; +import roboy.newDialog.states.toyStates.ToyFarewellState; +import roboy.newDialog.states.toyStates.ToyGreetingsState; + +public class DialogStateMachineTest { + + + // minimal state machine with 2 states + private static String MINI_STATE_MACHINE = "{\n" + + " \"initialState\": \"Greetings\",\n" + + " \"states\": [\n" + + " {\n" + + " \"identifier\": \"Farewell\",\n" + + " \"implementation\": \"roboy.newDialog.states.toyStates.ToyFarewellState\",\n" + + " \"transitions\": {}\n" + + " },\n" + + " {\n" + + " \"identifier\": \"Greetings\",\n" + + " \"implementation\": \"roboy.newDialog.states.toyStates.ToyGreetingsState\",\n" + + " \"fallback\": \"Farewell\",\n" + + " \"transitions\": {\n" + + " \"next\": \"Farewell\",\n" + + " \"noHello\": \"Farewell\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + + // helper, creates equivalent state machine from code + private static DialogStateMachine fromCode() { + + DialogStateMachine machine = new DialogStateMachine(); + ToyGreetingsState greeting = new ToyGreetingsState("Greetings"); + ToyFarewellState farewell = new ToyFarewellState("Farewell"); + greeting.setTransition("next", farewell); + greeting.setTransition("noHello", farewell); + greeting.setFallback(farewell); + machine.addState(greeting); + machine.addState(farewell); + machine.setInitialState(greeting); + + return machine; + } + + + // machine should always equal itself + @Test + public void machineEqualsItself() { + DialogStateMachine machine = new DialogStateMachine(); + assertTrue(machine.equals(machine)); + + machine.loadFromString(MINI_STATE_MACHINE); + assertTrue(machine.equals(machine)); + } + + // minimal string example should equal the machine build from code + @Test + public void stringEqualsCode() { + DialogStateMachine fromString = new DialogStateMachine(); + fromString.loadFromString(MINI_STATE_MACHINE); + + DialogStateMachine fromCode = fromCode(); + + assertTrue(fromString.equals(fromCode)); + assertTrue(fromCode.equals(fromString)); + } + + // machines are not equal if initial state is different + @Test + public void notEqualsNoInitialState() { + DialogStateMachine fromString = new DialogStateMachine(); + fromString.loadFromString(MINI_STATE_MACHINE); + + DialogStateMachine fromCode = fromCode(); + // change initial state + fromCode.setInitialState(fromCode.getStateByIdentifier("Farewell")); + + assertFalse(fromString.equals(fromCode)); + assertFalse(fromCode.equals(fromString)); + } + + // machines are not equal if one has more states + @Test + public void notEqualsDifferentStates() { + DialogStateMachine fromString = new DialogStateMachine(); + fromString.loadFromString(MINI_STATE_MACHINE); + + DialogStateMachine fromCode = fromCode(); + // add one more state + fromCode.addState(new ToyGreetingsState("NewEvilState")); + + assertFalse(fromString.equals(fromCode)); + assertFalse(fromCode.equals(fromString)); + } + + // machines are not equal if one has different transitions + @Test + public void notEqualsDifferentTransitions() { + DialogStateMachine fromString = new DialogStateMachine(); + fromString.loadFromString(MINI_STATE_MACHINE); + + DialogStateMachine fromCode = fromCode(); + // changeTransitions + State greetingsCode = fromCode.getStateByIdentifier("Greetings"); + greetingsCode.setTransition("evilLoopback", greetingsCode); + + assertFalse(fromString.equals(fromCode)); + assertFalse(fromCode.equals(fromString)); + } + + + // after loading, the initial set equals the active state + @Test + public void activeStateIsSetToInitialState() { + DialogStateMachine machine = new DialogStateMachine(); + machine.loadFromString(MINI_STATE_MACHINE); + + assertTrue(machine.getInitialState() == machine.getActiveState()); + } + + // all states from the string are present in the machine + @Test + public void machineContainsAllStates() { + DialogStateMachine machine = new DialogStateMachine(); + machine.loadFromString(MINI_STATE_MACHINE); + assertTrue( machine.getStateByIdentifier("Greetings") != null ); + assertTrue( machine.getStateByIdentifier("Farewell") != null ); + } + + + // all transitions from the string are present in the machine + @Test + public void transitionsAreOK() { + DialogStateMachine machine = new DialogStateMachine(); + machine.loadFromString(MINI_STATE_MACHINE); + State greetings = machine.getStateByIdentifier("Greetings"); + State farewell = machine.getStateByIdentifier("Farewell"); + + assertTrue( greetings.getTransition("noHello") == farewell); + assertTrue( greetings.getTransition("next") == farewell ); + } + + // all fallbacks from the string are present in the machine + @Test + public void fallbackIsOK() { + DialogStateMachine machine = new DialogStateMachine(); + machine.loadFromString(MINI_STATE_MACHINE); + State greetings = machine.getStateByIdentifier("Greetings"); + State farewell = machine.getStateByIdentifier("Farewell"); + + assertTrue( greetings.getFallback() == farewell); + } + + + + + +} diff --git a/src/test/java/roboy/talk/VerbalizerTest.java b/src/test/java/roboy/talk/VerbalizerTest.java old mode 100644 new mode 100755 diff --git a/todo.txt b/todo.txt old mode 100644 new mode 100755