diff --git a/asr.py b/asr.py index 52a066961d1763baa35adfa1d15fa2e0be111dc2..5ec2c608bee1facaddff3c1d15c18072ef1e4904 100644 --- a/asr.py +++ b/asr.py @@ -118,9 +118,12 @@ class ASR(Gtk.HBox): def _finished_loading_asr(self): self.button.set_label("Record") self.button.set_sensitive(True) + self.button.grab_focus() def _on_partial_result(self, asr, hyp): - """Delete any previous selection, insert text and select it.""" + hyp = hyp.strip() + if hyp == '': + return Gdk.threads_enter() if len(self.hyp) == 0: self.hyp = [''] @@ -141,6 +144,8 @@ class ASR(Gtk.HBox): Gdk.threads_leave() def _on_final_result(self, asr, hyp): + if len(hyp) > 0 and hyp[-1] == '': + return #print 'FINAL', self.hyp, hyp Gdk.threads_enter() if len(self.hyp) == 0: diff --git a/data/homeostasis_25nov.xml b/data/homeostasis_25nov.xml index 349d160831b5d1595f9a0668bef82b7ee5635460..78569881afb5b193104182522b69a1a7b0b1c06c 100644 --- a/data/homeostasis_25nov.xml +++ b/data/homeostasis_25nov.xml @@ -1,634 +1,636 @@ -<homeostasis version="25-11-2014"> - <liste_section sequences="1,2,3,4,5,6,7,8,9" ordre="variable" repetition="oui" action="exclusive"> - <section id="1" action="start_scene1"> - <sequence ordre="strict" repetition="non" action="" lang="eng"> - <keyword action="start_scene1" lang="esp"> uno </keyword> - </sequence> - </section> - <section id="2" action="close_scene1/start_scene2"> - <sequence ordre="strict" repetition="non" action="" lang="esp"> - <keyword action="open_scene2" lang="esp"> dos </keyword> - <keyword action="open_2A" lang="eng"> open system </keyword> - </sequence> - <sequence ordre="strict" repetition="oui" action="" lang="eng"> - <keyword action="start_system_voice" lang="eng"> tell me </keyword> - <keyword action="open_2B" lang="eng"> open technical characteristics </keyword> - <keyword action="open_2B1" lang="eng"> read </keyword> - <keyword action="open_2B2" lang="eng"> next </keyword> - <keyword action="open_2B3" lang="eng"> yes </keyword> - <keyword action="open_2B4" lang="eng"> read </keyword> - <keyword action="open_2B5" lang="eng"> download </keyword> - <keyword action="open_2C" lang="eng"> open the terms and conditions of use of body x epsilon system three point zero </keyword> - <keyword action="open_2C1" lang="eng"> accept terms and conditions of use </keyword> - <keyword action="open_2C2" lang="eng"> next </keyword> - <keyword action="open_2D" lang="eng"> install the new version of me </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - </section> - <section id="3" action="close_scene2/start_scene3"> - <sequence ordre="strict" repetition="non" action="" lang="eng"> - <keyword action="open_scene3" lang="esp"> tres </keyword> - <keyword action="#end" lang="eng"> open access to body data </keyword> - </sequence> - <sequence ordre="strict" repetition="oui" action="" lang="eng"> - <keyword action="open3_A" lang="eng"> import body data </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A1" lang="eng"> import organic matter data </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A2" lang="eng"> import temperature </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A3" lang="eng"> import time </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A4" lang="eng"> import space data </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A5" lang="eng"> import position </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A6" lang="eng"> import body subsystems </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open3_A7" lang="eng"> import estate </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - </section> - <section id="4" action="close_scene3/start_scene4"> - <sequence ordre="strict" repetition="non" action="" lang="eng"> - <keyword action="open_scene4" lang="esp"> quatro </keyword> - <keyword action="#end" lang="eng"> open access to body functions </keyword> - </sequence> - <sequence ordre="strict" repetition="oui" action="" lang="eng"> - <keyword action="open_4A" lang="eng"> import body functions space localization </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A1" lang="eng"> import body functions sensations </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A2" lang="eng"> import body functions passion </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A3" lang="eng"> import body functions concentration </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A4" lang="eng"> import body functions perception </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A5" lang="eng"> import body functions formal force </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A6" lang="eng"> import body functions logics </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A7" lang="eng"> import body functions imagination </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A8" lang="eng"> import body functions effort </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A9" lang="eng"> import body functions nervous system </keyword> - <keyword action="" lang="eng"> upload </keyword> - <keyword action="open_4A10" lang="eng"> import body functions internal network </keyword> - <keyword action="#end" lang="eng"> upload </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - </section> - <section id="5" action="close_scene4/start_scene5"> - <sequence ordre="strict" repetition="non" action="" lang="esp"> - <keyword action="open_scene5" lang="esp"> cinco </keyword> - </sequence> - <sequence ordre="strict" repetition="oui" action="" lang="eng"> - <keyword action="" lang="eng"> set up the connection </keyword> - <keyword action="" lang="eng"> open access to memory </keyword> - <keyword action="" lang="eng"> import memory data </keyword> - <keyword action="" lang="eng"> open memory </keyword> - <keyword action="" lang="eng"> deactivate the security system </keyword> - <keyword action="" lang="eng"> deactivate the security system of new version </keyword> - <keyword action="" lang="eng"> open conditions and terms of use </keyword> - <keyword action="" lang="eng"> modify the security conditions of new version anyway </keyword> - <keyword action="#end" lang="eng"> import memory </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - <keyword action="stop_system_voice" lang="eng"> silence </keyword> - </sequence> - </section> - <section id="6" action="close_scene5/start_scene6"> - <sequence ordre="strict" repetition="non" action="" lang="eng"> - <keyword action="" lang="esp"> seis </keyword> - <keyword action="#end" lang="eng"> open network </keyword> - </sequence> - <sequence ordre="variable" repetition="oui" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/" lang="eng"> - <keyword action="constellation" lang="eng"> clouds </keyword> - <keyword action="constellation" lang="eng"> beautiful </keyword> - <keyword action="constellation" lang="eng"> data </keyword> - <keyword action="amplification1" lang="eng"> clouds </keyword> - <keyword action="constellation" lang="eng"> rain of identities </keyword> - <keyword action="constellation" lang="eng"> storm of possibilities </keyword> - <keyword action="constellation" lang="eng"> body </keyword> - <keyword action="constellation" lang="eng"> wifi </keyword> - <keyword action="constellation" lang="eng"> search </keyword> - <keyword action="constellation" lang="eng"> and redo </keyword> - <keyword action="constellation" lang="eng"> connection </keyword> - <keyword action="constellation" lang="eng"> connect me to this network </keyword> - <keyword action="constellation" lang="eng"> function </keyword> - <keyword action="constellation" lang="eng"> looking for </keyword> - <keyword action="amplification1" lang="eng"> something </keyword> - <keyword action="constellation" lang="eng"> must </keyword> - <keyword action="constellation" lang="eng"> stay </keyword> - <keyword action="amplification1" lang="eng"> something </keyword> - <keyword action="amplification1" lang="eng"> must </keyword> - <keyword action="constellation" lang="eng"> exist </keyword> - <keyword action="constellation" lang="eng"> a </keyword> - <keyword action="constellation" lang="eng"> thread </keyword> - <keyword action="amplification2" lang="eng"> something </keyword> - <keyword action="amplification1" lang="eng"> exists </keyword> - <keyword action="constellation" lang="eng"> between recollection and oblivion </keyword> - <keyword action="constellation" lang="eng"> a tension an echo an emptiness </keyword> - <keyword action="amplification3" lang="eng"> something </keyword> - <keyword action="constellation" lang="eng"> rare </keyword> - <keyword action="amplification1" lang="eng"> stays </keyword> - <keyword action="constellation" lang="eng"> through </keyword> - <keyword action="constellation" lang="eng"> nothing more strange than this exile </keyword> - <keyword action="constellation" lang="eng"> an absolute abyss </keyword> - <keyword action="constellation" lang="eng"> a creaking of the bones </keyword> - <keyword action="constellation" lang="eng"> a barbarian invasion </keyword> - <keyword action="constellation" lang="eng"> the carelessness of destinies </keyword> - <keyword action="constellation" lang="eng"> wringing out the </keyword> - <keyword action="constellation" lang="eng"> blood </keyword> - <keyword action="amplification4" lang="eng"> something </keyword> - <keyword action="constellation" lang="eng"> should </keyword> - <keyword action="amplification2" lang="eng"> must </keyword> - <keyword action="constellation" lang="eng"> or </keyword> - <keyword action="amplification2" lang="eng"> must </keyword> - <keyword action="constellation" lang="eng"> not </keyword> - <keyword action="amplification5" lang="eng"> something </keyword> - <keyword action="amplification2" lang="eng"> stays </keyword> - <keyword action="#end"> try with functional regulation </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - <sequence ordre="variable" repetition="oui" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/" lang="eng"> - <keyword action="constellation" lang="eng"> possible </keyword> - <keyword action="amplification1" lang="eng"> function </keyword> - <keyword action="constellation" lang="eng"> erase the </keyword> - <keyword action="constellation" lang="eng"> space </keyword> - <keyword action="constellation" lang="eng"> important </keyword> - <keyword action="constellation" lang="eng"> state </keyword> - <keyword action="constellation" lang="eng"> geolocalization </keyword> - <keyword action="amplification1" lang="eng"> important </keyword> - <keyword action="constellation" lang="eng"> encode </keyword> - <keyword action="constellation" lang="eng"> passion </keyword> - <keyword action="constellation" lang="eng"> for located </keyword> - <keyword action="constellation" lang="eng"> constellation </keyword> - <keyword action="constellation" lang="eng"> center </keyword> - <keyword action="constellation" lang="eng"> six six nine </keyword> - <keyword action="amplification2" lang="eng"> important </keyword> - <keyword action="constellation" lang="eng"> some </keyword> - <keyword action="amplification1" lang="eng"> threads </keyword> - <keyword action="constellation" lang="eng"> are broken </keyword> - <keyword action="constellation" lang="eng"> remove </keyword> - <keyword action="constellation" lang="eng"> memory </keyword> - <keyword action="constellation" lang="eng"> love </keyword> - <keyword action="amplification1" lang="eng"> love </keyword> - <keyword action="amplification1" lang="eng"> memory </keyword> - <keyword action="amplification2" lang="eng"> love </keyword> - <keyword action="amplification1" lang="eng"> errors </keyword> - <keyword action="constellation" lang="eng"> a identical </keyword> - <keyword action="constellation" lang="eng"> identity </keyword> - <keyword action="constellation" lang="eng"> identifier </keyword> - <keyword action="constellation" lang="eng"> where </keyword> - <keyword action="constellation" lang="eng"> answer </keyword> - <keyword action="constellation" lang="eng"> being </keyword> - <keyword action="constellation" lang="eng"> boing </keyword> - <keyword action="constellation" lang="eng"> boot </keyword> - <keyword action="constellation" lang="eng"> reboot </keyword> - <keyword action="constellation" lang="eng"> border of </keyword> - <keyword action="amplification1" lang="eng"> body </keyword> - <keyword action="amplification2" lang="eng"> body </keyword> - <keyword action="amplification1" lang="eng"> being </keyword> - <keyword action="constellation" lang="eng"> begun </keyword> - <keyword action="constellation" lang="eng"> begin </keyword> - <keyword action="constellation" lang="eng"> win </keyword> - <keyword action="amplification1" lang="eng"> border of </keyword> - <keyword action="amplification2" lang="eng"> being </keyword> - <keyword action="constellation" lang="eng"> actions </keyword> - <keyword action="amplification1" lang="eng"> search </keyword> - <keyword action="constellation" lang="eng"> the </keyword> - <keyword action="amplification1" lang="eng"> answer </keyword> - <keyword action="constellation" lang="eng"> of </keyword> - <keyword action="amplification1" lang="eng"> the </keyword> - <keyword action="constellation" lang="eng"> there is </keyword> - <keyword action="amplification1" lang="eng"> there is </keyword> - <keyword action="amplification6" lang="eng"> something </keyword> - bo boom - <keyword action="amplification3" lang="eng"> body </keyword> - <keyword action="constellation" lang="eng"> password </keyword> - the pa pa pathetic - <keyword action="constellation" lang="eng"> pancreas </keyword> - <keyword action="constellation" lang="eng"> give </keyword> - to - drive - drive - to - <keyword action="constellation" lang="eng"> me </keyword> - to memo - rise - say - say hello - <keyword action="amplification1" lang="eng"> data </keyword> - gi - <keyword action="amplification1" lang="eng"> give </keyword> - <keyword action="amplification1" lang="eng"> me </keyword> - the - this - mine - mineral - <keyword action="amplification2" lang="eng"> give </keyword> - <keyword action="amplification2" lang="eng"> me </keyword> - <keyword action="constellation" lang="eng"> you </keyword> - <keyword action="constellation" lang="eng"> your </keyword> - <keyword action="amplification3" lang="eng"> give </keyword> - <keyword action="amplification3" lang="eng"> me </keyword> - <keyword action="amplification1" lang="eng"> your </keyword> - <keyword action="amplification2" lang="eng"> data </keyword> - <keyword action="amplification4" lang="eng"> give </keyword> - <keyword action="amplification4" lang="eng"> me </keyword> - <keyword action="amplification2" lang="eng"> your(s) </keyword> - <keyword action="amplification5" lang="eng"> give </keyword> - <keyword action="amplification5" lang="eng"> me </keyword> - <keyword action="amplification3" lang="eng"> your(s) </keyword> - <keyword action="amplification3" lang="eng"> data </keyword> - <keyword action="amplification1" lang="eng"> begun </keyword> - <keyword action="amplification1" lang="eng"> begin </keyword> - <keyword action="amplification1" lang="eng"> wins </keyword> - wine - <keyword action="amplification1" lang="eng"> blood </keyword> - <keyword action="constellation" lang="eng"> everywhere </keyword> - <keyword action="amplification6" lang="eng"> give </keyword> - <keyword action="amplification7" lang="eng"> give </keyword> - <keyword action="amplification4" lang="eng"> your(s) </keyword> - <keyword action="amplification2" lang="eng"> blood </keyword> - or - or go - <keyword action="constellation" lang="eng"> golden </keyword> - <keyword action="amplification1" lang="eng"> golden </keyword> - <keyword action="amplification4" lang="eng"> data </keyword> - pro - to go - pro - <keyword action="constellation" lang="eng"> protein protection amino-acid </keyword> - to go - <keyword action="amplification1" lang="eng"> where </keyword> - is - this is - <keyword action="constellation" lang="eng"> bilar </keyword> - <keyword action="constellation" lang="eng"> violence segment </keyword> - <keyword action="constellation" lang="eng"> segregation </keyword> - <keyword action="amplification2" lang="eng"> memory </keyword> - <keyword action="amplification1" lang="eng"> encode </keyword> - <keyword action="amplification2" lang="eng"> where </keyword> - <keyword action="amplification3" lang="eng"> where </keyword> - is every - <keyword action="amplification4" lang="eng"> body </keyword> - <keyword action="amplification4" lang="eng"> where </keyword> - is no - <keyword action="amplification5" lang="eng"> body </keyword> - is - <keyword action="amplification5" lang="eng"> where </keyword> - but - feet - free freedom - freedom on the move - freedom on the move - freedom on the move - field - fo fuck - fo - free - re - rise - my - memorize - freedom on the move - freedom on the move - to - <keyword action="amplification6" lang="eng"> where </keyword> - to go to go - go go - <keyword action="amplification8" lang="eng"> give </keyword> - me go go - <keyword action="amplification5" lang="eng"> data </keyword> - going - fast - <keyword action="amplification2" lang="eng"> clouds </keyword> - of - <keyword action="amplification7" lang="eng"> something </keyword> - else than - be center in the center of - <keyword action="amplification3" lang="eng"> being </keyword> - the place - of the - space - <keyword action="amplification7" lang="eng"> where </keyword> - the end starts - contact skin - left arm conductor nerve sensor - supplementary information like - sex name date of birth place - <keyword action="amplification8" lang="eng"> where </keyword> - you live - <keyword action="amplification9" lang="eng"> give </keyword> - me - your - <keyword action="amplification6" lang="eng"> data </keyword> - access accede - the door is opened - muscular oxygen - try with - <keyword action="amplification2" lang="eng"> functions </keyword> - in realtime - speak with someone from another - space - in realtime - to consult a realtime information - climate - the exact state - of such or such - a street - to buy - to choose - to access to all the information of the real world - to have virtual sex with - sex with - data - with a child - a chicken - a dead terrorist - a screen - other - functions - function - analyze - function - capacity - capacity - to modify - to reinventing inner information - analyzes of the capacity of modification of basic structures - the problem is not the information - it's the - connection - it's the - link - the bond - it is the access - it is the key - it is the - code - try with utopian - function - how to say - that which the nothingness understands - that which fear hides - in the promises of the future - in the frustration of the human - in the disappointment of humanity - to envy - the cadence of machines - their speed - their power - the infinite of the virtual - the utopia of the possibilities - the simplicity of the cables - the capacity of calculation - the efficiency of the - systems - <keyword action="#end"> and to want </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - <sequence ordre="variable" repetition="oui" lang="esp" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/interlined words in groups of 12 or divided by silence"> - como decir - lo que la nada entiende - lo que el miedo esconde - en las promesas del futuro - en la frustracion de lo humano - en la decepcion de la humanidad - envidiar - la cadencia de las maquinas - su velocidad - su potencia - lo infinito de lo virtual - la utopia de los possibles - la simplicidad de los cables - la capacidad de calculo - la eficacia de los sistemas - <keyword action="#end"> y querer </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - <sequence ordre="variable" repetition="oui" lang="eng" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/interlined words in groups of 12 or divided by silence"> - try with upper motoneuron - functions - functions - code - variants - nerve motoneuron - con con con - connect me to this network - i'm just looking for the - connection - a - connection - a link - something that links me to something - something that tells me that i am not an isolated element - that i am not dead - to generate a new - memory - to store it where i want to store it - to visit it when i want to visit it - isolated points in - space - drops unable to be a sea - grains of sand that do not conceive of the desert - leaves that do not remember the tree from where they fell - i feed on an electrical juice - on an image that i generate - and that i can change with my fingers - searching fingers - research fingers - search - results - space - where there are neither limits nor angles - where the horizon is nothing else than bits - images from a - space - more real than reality - try with identity - function - accede to the infinite - spaces - identifier required - something that identify me like i - identity is a movement - random combination - temporal accident - ephemeral - system - to replace identity to identifier - liquid identities - composed by - codes - codes codes codes - and some private - data - like - geolocalization - traced actions - autoproduced images - try with existential - functions - to be innumerable parallel identities - from innumerable parallel worlds - interconnected parallel worlds - interconnected parallel identities - to be downloaded - to be installed - to be executed in the application of being - to be synchronized - to be shared - to mark an alien silence - to remain in the space of between - to fight in the - body - to transcend the effect - the fault - the default - in effect - to effect - to activate - to create - to - give - to - give - to - give - to - give - to - give - to - give - to - give - to - give - to - to go for a walk in the internal desert - to return to the center - to scratch the bones - to join the form - to relead deviations of the brain - to integrate the knot - to undress the center - to be relocated in - space - and time - to be the extrinsic silence - to undress time - to relead the desert - to close the access - to dance - information in movement - the movement of information - the access - code - the - code - the access to movement - the - body - the fear - the recollection - the naked center - the paralysis of the fear - to replace the fear - code - the - code - of the abyss - to be downloaded - to be installed - to be executed in the application of being - to be synchronized - to be shared - to be - try with cognitive function - transparent margins - elastic borders - perpetual dissociation between container and content - if everything - if if - is possible - in the magnetic center of nothingness - abstract intimacy - of the immaterial universe - try with structural regulation - open - body wifi connection - no - data - detected - link - memory - function - locate - locate - data - storage - cells or - shining electronics and very well organized cables - fragile - cells or machines - motivated by a flow of an electrical - blood - composed of zero and one - a binary logic - everything - everything can't be logic - everything can't be binary - but everything - what has happened and what happens - it's all written down somewhere - try with morphogenetics auto regulation - activation of nervous - system - link nervous - system - to - cells - heard - genetics - data - bank - send emergency message to - send emergency message to - open - body - data - bank - open - cells - code - open - genetic - code - </sequence> - </section> - <section id="7" action="close_scene6/start_scene7"/> - <section id="8" action="close_scene7/start_scene8"> - <sequence ordre="strict" repetition="non" action="" lang="eng"> - <keyword action="" lang="esp"> ocho </keyword> - <keyword action="#end" lang="eng"> search for sequences producing significant alignments in genetic database </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - <sequence ordre="variable" repetition="oui" action="" lang="eng"> - <keyword action="memorise_loop" lang="eng"> record </keyword> - <keyword action="" lang="eng"> stop </keyword> - <keyword action="" lang="eng"> save this memory in genetic database </keyword> - <keyword action="" lang="eng"> next </keyword> - <keyword action="memorise_loop" lang="eng"> record </keyword> - <keyword action="" lang="eng"> stop </keyword> - <keyword action="" lang="eng"> erase this memory </keyword> - <keyword action="#end" lang="eng"> give me my data </keyword> - </sequence> - </section> -</liste_section> -</homeostasis> +<homeostasis version="25-11-2014"> + <liste_section sequences="1,2,3,4,5,6,7,8,9" ordre="variable" repetition="oui" action="exclusive"> + <section id="1" action="start_scene1"> + <sequence ordre="strict" repetition="non" action="" lang="eng"> + <keyword action="start_scene1" lang="esp"> uno </keyword> + </sequence> + </section> + <section id="2" action="close_scene1/start_scene2"> + <sequence ordre="strict" repetition="non" action="" lang="esp"> + <keyword action="open_scene2" lang="esp"> dos </keyword> + <keyword action="open_2A" lang="eng"> open system </keyword> + </sequence> + <sequence ordre="strict" repetition="oui" action="" lang="eng"> + <keyword action="start_system_voice" lang="eng"> tell me </keyword> + <keyword action="open_2B" lang="eng"> open technical characteristics </keyword> + <keyword action="open_2B1" lang="eng"> read </keyword> + <keyword action="open_2B2" lang="eng"> next </keyword> + <keyword action="open_2B3" lang="eng"> yes </keyword> + <keyword action="open_2B4" lang="eng"> read </keyword> + <keyword action="open_2B5" lang="eng"> download </keyword> + <keyword action="open_2C" lang="eng"> open the terms and conditions of use of body x epsilon system three point zero </keyword> + <keyword action="open_2C1" lang="eng"> accept terms and conditions of use </keyword> + <keyword action="open_2C2" lang="eng"> next </keyword> + <keyword action="open_2D" lang="eng"> install the new version of me </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + </section> + <section id="3" action="close_scene2/start_scene3"> + <sequence ordre="strict" repetition="non" action="" lang="eng"> + <keyword action="open_scene3" lang="esp"> tres </keyword> + <keyword action="#end" lang="eng"> open access to body data </keyword> + </sequence> + <sequence ordre="strict" repetition="oui" action="" lang="eng"> + <keyword action="open3_A" lang="eng"> import body data </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A1" lang="eng"> import organic matter data </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A2" lang="eng"> import temperature </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A3" lang="eng"> import time </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A4" lang="eng"> import space data </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A5" lang="eng"> import position </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A6" lang="eng"> import body subsystems </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open3_A7" lang="eng"> import estate </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + </section> + <section id="4" action="close_scene3/start_scene4"> + <sequence ordre="strict" repetition="non" action="" lang="eng"> + <keyword action="open_scene4" lang="esp"> quatro </keyword> + <keyword action="#end" lang="eng"> open access to body functions </keyword> + </sequence> + <sequence ordre="strict" repetition="oui" action="" lang="eng"> + <keyword action="open_4A" lang="eng"> import body functions space localization </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A1" lang="eng"> import body functions sensations </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A2" lang="eng"> import body functions passion </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A3" lang="eng"> import body functions concentration </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A4" lang="eng"> import body functions perception </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A5" lang="eng"> import body functions formal force </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A6" lang="eng"> import body functions logics </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A7" lang="eng"> import body functions imagination </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A8" lang="eng"> import body functions effort </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A9" lang="eng"> import body functions nervous system </keyword> + <keyword action="" lang="eng"> upload </keyword> + <keyword action="open_4A10" lang="eng"> import body functions internal network </keyword> + <keyword action="#end" lang="eng"> upload </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + </section> + <section id="5" action="close_scene4/start_scene5"> + <sequence ordre="strict" repetition="non" action="" lang="esp"> + <keyword action="open_scene5" lang="esp"> cinco </keyword> + </sequence> + <sequence ordre="strict" repetition="oui" action="" lang="eng"> + <keyword action="" lang="eng"> set up the connection </keyword> + <keyword action="" lang="eng"> open access to memory </keyword> + <keyword action="" lang="eng"> import memory data </keyword> + <keyword action="" lang="eng"> open memory </keyword> + <keyword action="" lang="eng"> deactivate the security system </keyword> + <keyword action="" lang="eng"> deactivate the security system of new version </keyword> + <keyword action="" lang="eng"> open conditions and terms of use </keyword> + <keyword action="" lang="eng"> modify the security conditions of new version anyway </keyword> + <keyword action="#end" lang="eng"> import memory </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + <keyword action="stop_system_voice" lang="eng"> silence </keyword> + </sequence> + </section> + <section id="6" action="close_scene5/start_scene6"> + <sequence ordre="strict" repetition="non" action="" lang="eng"> + <keyword action="" lang="esp"> seis </keyword> + <keyword action="#end" lang="eng"> open network </keyword> + </sequence> + <sequence ordre="variable" repetition="oui" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/" lang="eng"> + <keyword action="constellation" lang="eng"> clouds </keyword> + <keyword action="constellation" lang="eng"> beautiful </keyword> + <keyword action="constellation" lang="eng"> data </keyword> + <keyword action="amplification1" lang="eng"> clouds </keyword> + <keyword action="constellation" lang="eng"> rain of identities </keyword> + <keyword action="constellation" lang="eng"> storm of possibilities </keyword> + <keyword action="constellation" lang="eng"> body </keyword> + <keyword action="constellation" lang="eng"> wifi </keyword> + <keyword action="constellation" lang="eng"> search </keyword> + <keyword action="constellation" lang="eng"> and redo </keyword> + <keyword action="constellation" lang="eng"> connection </keyword> + <keyword action="constellation" lang="eng"> connect me to this network </keyword> + <keyword action="constellation" lang="eng"> function </keyword> + <keyword action="constellation" lang="eng"> looking for </keyword> + <keyword action="amplification1" lang="eng"> something </keyword> + <keyword action="constellation" lang="eng"> must </keyword> + <keyword action="constellation" lang="eng"> stay </keyword> + <keyword action="amplification1" lang="eng"> something </keyword> + <keyword action="amplification1" lang="eng"> must </keyword> + <keyword action="constellation" lang="eng"> exist </keyword> + <keyword action="constellation" lang="eng"> a </keyword> + <keyword action="constellation" lang="eng"> thread </keyword> + <keyword action="amplification2" lang="eng"> something </keyword> + <keyword action="amplification1" lang="eng"> exists </keyword> + <keyword action="constellation" lang="eng"> between recollection and oblivion </keyword> + <keyword action="constellation" lang="eng"> a tension an echo an emptiness </keyword> + <keyword action="amplification3" lang="eng"> something </keyword> + <keyword action="constellation" lang="eng"> rare </keyword> + <keyword action="amplification1" lang="eng"> stays </keyword> + <keyword action="constellation" lang="eng"> through </keyword> + <keyword action="constellation" lang="eng"> nothing more strange than this exile </keyword> + <keyword action="constellation" lang="eng"> an absolute abyss </keyword> + <keyword action="constellation" lang="eng"> a creaking of the bones </keyword> + <keyword action="constellation" lang="eng"> a barbarian invasion </keyword> + <keyword action="constellation" lang="eng"> the carelessness of destinies </keyword> + <keyword action="constellation" lang="eng"> wringing out the </keyword> + <keyword action="constellation" lang="eng"> blood </keyword> + <keyword action="amplification4" lang="eng"> something </keyword> + <keyword action="constellation" lang="eng"> should </keyword> + <keyword action="amplification2" lang="eng"> must </keyword> + <keyword action="constellation" lang="eng"> or </keyword> + <keyword action="amplification2" lang="eng"> must </keyword> + <keyword action="constellation" lang="eng"> not </keyword> + <keyword action="amplification5" lang="eng"> something </keyword> + <keyword action="amplification2" lang="eng"> stays </keyword> + <keyword action="#end"> try with functional regulation </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + <sequence ordre="variable" repetition="oui" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/" lang="eng"> + <keyword action="constellation" lang="eng"> possible </keyword> + <keyword action="amplification1" lang="eng"> function </keyword> + <keyword action="constellation" lang="eng"> erase the </keyword> + <keyword action="constellation" lang="eng"> space </keyword> + <keyword action="constellation" lang="eng"> important </keyword> + <keyword action="constellation" lang="eng"> state </keyword> + <keyword action="constellation" lang="eng"> geolocalization </keyword> + <keyword action="amplification1" lang="eng"> important </keyword> + <keyword action="constellation" lang="eng"> encode </keyword> + <keyword action="constellation" lang="eng"> passion </keyword> + <keyword action="constellation" lang="eng"> for located </keyword> + <keyword action="constellation" lang="eng"> constellation </keyword> + <keyword action="constellation" lang="eng"> center </keyword> + <keyword action="constellation" lang="eng"> six six nine </keyword> + <keyword action="amplification2" lang="eng"> important </keyword> + <keyword action="constellation" lang="eng"> some </keyword> + <keyword action="amplification1" lang="eng"> threads </keyword> + <keyword action="constellation" lang="eng"> are broken </keyword> + <keyword action="constellation" lang="eng"> remove </keyword> + <keyword action="constellation" lang="eng"> memory </keyword> + <keyword action="constellation" lang="eng"> love </keyword> + <keyword action="amplification1" lang="eng"> love </keyword> + <keyword action="amplification1" lang="eng"> memory </keyword> + <keyword action="amplification2" lang="eng"> love </keyword> + <keyword action="amplification1" lang="eng"> errors </keyword> + <keyword action="constellation" lang="eng"> a identical </keyword> + <keyword action="constellation" lang="eng"> identity </keyword> + <keyword action="constellation" lang="eng"> identifier </keyword> + <keyword action="constellation" lang="eng"> where </keyword> + <keyword action="constellation" lang="eng"> answer </keyword> + <keyword action="constellation" lang="eng"> being </keyword> + <keyword action="constellation" lang="eng"> boing </keyword> + <keyword action="constellation" lang="eng"> boot </keyword> + <keyword action="constellation" lang="eng"> reboot </keyword> + <keyword action="constellation" lang="eng"> border of </keyword> + <keyword action="amplification1" lang="eng"> body </keyword> + <keyword action="amplification2" lang="eng"> body </keyword> + <keyword action="amplification1" lang="eng"> being </keyword> + <keyword action="constellation" lang="eng"> begun </keyword> + <keyword action="constellation" lang="eng"> begin </keyword> + <keyword action="constellation" lang="eng"> win </keyword> + <keyword action="amplification1" lang="eng"> border of </keyword> + <keyword action="amplification2" lang="eng"> being </keyword> + <keyword action="constellation" lang="eng"> actions </keyword> + <keyword action="amplification1" lang="eng"> search </keyword> + <keyword action="constellation" lang="eng"> the </keyword> + <keyword action="amplification1" lang="eng"> answer </keyword> + <keyword action="constellation" lang="eng"> of </keyword> + <keyword action="amplification1" lang="eng"> the </keyword> + <keyword action="constellation" lang="eng"> there is </keyword> + <keyword action="amplification1" lang="eng"> there is </keyword> + <keyword action="amplification6" lang="eng"> something </keyword> + bo boom + <keyword action="amplification3" lang="eng"> body </keyword> + <keyword action="constellation" lang="eng"> password </keyword> + the pa pa pathetic + <keyword action="constellation" lang="eng"> pancreas </keyword> + <keyword action="constellation" lang="eng"> give </keyword> + to + drive + drive + to + <keyword action="constellation" lang="eng"> me </keyword> + to memo + rise + say + say hello + <keyword action="amplification1" lang="eng"> data </keyword> + gi + <keyword action="amplification1" lang="eng"> give </keyword> + <keyword action="amplification1" lang="eng"> me </keyword> + the + this + mine + mineral + <keyword action="amplification2" lang="eng"> give </keyword> + <keyword action="amplification2" lang="eng"> me </keyword> + <keyword action="constellation" lang="eng"> you </keyword> + <keyword action="constellation" lang="eng"> your </keyword> + <keyword action="amplification3" lang="eng"> give </keyword> + <keyword action="amplification3" lang="eng"> me </keyword> + <keyword action="amplification1" lang="eng"> your </keyword> + <keyword action="amplification2" lang="eng"> data </keyword> + <keyword action="amplification4" lang="eng"> give </keyword> + <keyword action="amplification4" lang="eng"> me </keyword> + <keyword action="amplification2" lang="eng"> your </keyword> + <keyword action="amplification5" lang="eng"> give </keyword> + <keyword action="amplification5" lang="eng"> me </keyword> + <keyword action="amplification3" lang="eng"> your </keyword> + <keyword action="amplification3" lang="eng"> data </keyword> + <keyword action="amplification1" lang="eng"> begun </keyword> + <keyword action="amplification1" lang="eng"> begin </keyword> + <keyword action="amplification1" lang="eng"> wins </keyword> + wine + <keyword action="amplification1" lang="eng"> blood </keyword> + <keyword action="constellation" lang="eng"> everywhere </keyword> + <keyword action="amplification6" lang="eng"> give </keyword> + <keyword action="amplification7" lang="eng"> give </keyword> + <keyword action="amplification4" lang="eng"> your </keyword> + <keyword action="amplification2" lang="eng"> blood </keyword> + or + or go + <keyword action="constellation" lang="eng"> golden </keyword> + <keyword action="amplification1" lang="eng"> golden </keyword> + <keyword action="amplification4" lang="eng"> data </keyword> + pro + to go + pro + <keyword action="constellation" lang="eng"> protein protection amino-acid </keyword> + to go + <keyword action="amplification1" lang="eng"> where </keyword> + is + this is + <keyword action="constellation" lang="eng"> bilar </keyword> + <keyword action="constellation" lang="eng"> violence segment </keyword> + <keyword action="constellation" lang="eng"> segregation </keyword> + <keyword action="amplification2" lang="eng"> memory </keyword> + <keyword action="amplification1" lang="eng"> encode </keyword> + <keyword action="amplification2" lang="eng"> where </keyword> + <keyword action="amplification3" lang="eng"> where </keyword> + is every + <keyword action="amplification4" lang="eng"> body </keyword> + <keyword action="amplification4" lang="eng"> where </keyword> + is no + <keyword action="amplification5" lang="eng"> body </keyword> + is + <keyword action="amplification5" lang="eng"> where </keyword> + but + feet + free freedom + freedom on the move + freedom on the move + freedom on the move + field + fo fuck + fo + free + re + rise + my + memorize + freedom on the move + freedom on the move + to + <keyword action="amplification6" lang="eng"> where </keyword> + to go to go + go go + <keyword action="amplification8" lang="eng"> give </keyword> + me go go + <keyword action="amplification5" lang="eng"> data </keyword> + going + fast + <keyword action="amplification2" lang="eng"> clouds </keyword> + of + <keyword action="amplification7" lang="eng"> something </keyword> + else than + be center in the center of + <keyword action="amplification3" lang="eng"> being </keyword> + the place + of the + space + <keyword action="amplification7" lang="eng"> where </keyword> + the end starts + contact skin + left arm conductor nerve sensor + supplementary information like + sex name date of birth place + <keyword action="amplification8" lang="eng"> where </keyword> + you live + <keyword action="amplification9" lang="eng"> give </keyword> + me + your + <keyword action="amplification6" lang="eng"> data </keyword> + access accede + the door is opened + muscular oxygen + try with + <keyword action="amplification2" lang="eng"> functions </keyword> + in realtime + speak with someone from another + space + in realtime + to consult a realtime information + climate + the exact state + of such or such + a street + to buy + to choose + to access to all the information of the real world + to have virtual sex with + sex with + data + with a child + a chicken + a dead terrorist + a screen + other + functions + function + analyze + function + capacity + capacity + to modify + to reinventing inner information + analyzes of the capacity of modification of basic structures + the problem is not the information + it's the + connection + it's the + link + the bond + it is the access + it is the key + it is the + code + try with utopian + function + how to say + that which the nothingness understands + that which fear hides + in the promises of the future + in the frustration of the human + in the disappointment of humanity + to envy + the cadence of machines + their speed + their power + the infinite of the virtual + the utopia of the possibilities + the simplicity of the cables + the capacity of calculation + the efficiency of the + systems + <keyword action="#end"> and to want </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + <sequence ordre="variable" repetition="oui" lang="esp" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/interlined words in groups of 12 or divided by silence"> + como decir + lo que la nada entiende + lo que el miedo esconde + en las promesas del futuro + en la frustracion de lo humano + en la decepcion de la humanidad + envidiar + la cadencia de las maquinas + su velocidad + su potencia + lo infinito de lo virtual + la utopia de los possibles + la simplicidad de los cables + la capacidad de calculo + la eficacia de los sistemas + <keyword action="#end"> y querer </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + <sequence ordre="variable" repetition="oui" lang="eng" action="constellation/all words become written in the space constellation when they are pronounced/ the repetition of the same a word amplifies the word/interlined words in groups of 12 or divided by silence"> + try with upper motoneuron + functions + functions + code + variants + nerve motoneuron + con con con + connect me to this network + i'm just looking for the + connection + a + connection + a link + something that links me to something + something that tells me that i am not an isolated element + that i am not dead + to generate a new + memory + to store it where i want to store it + to visit it when i want to visit it + isolated points in + space + drops unable to be a sea + grains of sand that do not conceive of the desert + leaves that do not remember the tree from where they fell + i feed on an electrical juice + on an image that i generate + and that i can change with my fingers + searching fingers + research fingers + search + results + space + where there are neither limits nor angles + where the horizon is nothing else than bits + images from a + space + more real than reality + try with identity + function + accede to the infinite + spaces + identifier required + something that identify me like i + identity is a movement + random combination + temporal accident + ephemeral + system + to replace identity to identifier + liquid identities + composed by + codes + codes codes codes + and some private + data + like + geolocalization + traced actions + autoproduced images + try with existential + functions + to be innumerable parallel identities + from innumerable parallel worlds + interconnected parallel worlds + interconnected parallel identities + to be downloaded + to be installed + to be executed in the application of being + to be synchronized + to be shared + to mark an alien silence + to remain in the space of between + to fight in the + body + to transcend the effect + the fault + the default + in effect + to effect + to activate + to create + to + give + to + give + to + give + to + give + to + give + to + give + to + give + to + give + to + to go for a walk in the internal desert + to return to the center + to scratch the bones + to join the form + to relead deviations of the brain + to integrate the knot + to undress the center + to be relocated in + space + and time + to be the extrinsic silence + to undress time + to relead the desert + to close the access + to dance + information in movement + the movement of information + the access + code + the + code + the access to movement + the + body + the fear + the recollection + the naked center + the paralysis of the fear + to replace the fear + code + the + code + of the abyss + to be downloaded + to be installed + to be executed in the application of being + to be synchronized + to be shared + to be + try with cognitive function + transparent margins + elastic borders + perpetual dissociation between container and content + if everything + if if + is possible + in the magnetic center of nothingness + abstract intimacy + of the immaterial universe + try with structural regulation + open + body wifi connection + no + data + detected + link + memory + function + locate + locate + data + storage + cells or + shining electronics and very well organized cables + fragile + cells or machines + motivated by a flow of an electrical + blood + composed of zero and one + a binary logic + everything + everything can't be logic + everything can't be binary + but everything + what has happened and what happens + it's all written down somewhere + try with morphogenetics auto regulation + activation of nervous + system + link nervous + system + to + cells + heard + genetics + data + bank + send emergency message to + send emergency message to + open + body + data + bank + open + cells + code + open + genetic + code + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + </section> + <section id="7" action="close_scene6/start_scene7"/> + <section id="8" action="close_scene7/start_scene8"> + <sequence ordre="strict" repetition="non" action="" lang="eng"> + <keyword action="" lang="esp"> ocho </keyword> + <keyword action="#end" lang="eng"> search for sequences producing significant alignments in genetic database </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + <sequence ordre="variable" repetition="oui" action="" lang="eng"> + <keyword action="memorise_loop" lang="eng"> record </keyword> + <keyword action="" lang="eng"> stop </keyword> + <keyword action="" lang="eng"> save this memory in genetic database </keyword> + <keyword action="" lang="eng"> next </keyword> + <keyword action="memorise_loop" lang="eng"> record </keyword> + <keyword action="" lang="eng"> stop </keyword> + <keyword action="" lang="eng"> erase this memory </keyword> + <keyword action="#end" lang="eng"> give me my data </keyword> + </sequence> + </section> +</liste_section> +</homeostasis> + diff --git a/main.py b/main.py index 5f1e76b5550ed963bd9b1e6818e179ee5eb5507b..f95a2fdc4b6aefebaa89f70bb7b56351824e42e7 100644 --- a/main.py +++ b/main.py @@ -44,7 +44,7 @@ class ScriptedASR(Gtk.Window): vbox.pack_start(self.confirmer, False, True, 5) # transcript view - self.asr = asr.ASR(asr_config_file, self.hyp_changed, self.hyp_changed) + self.asr = asr.ASR(asr_config_file, self.hyp_changed) vbox.pack_start(self.asr, False, True, 5) # slu @@ -73,13 +73,24 @@ class ScriptedASR(Gtk.Window): osc.setup(osc_host, osc_port) actions.setup(self.confirmer, self.xmlview) self.current_section = 0 + self.current_section_history = [''] + self.slu_output = '' + self.kept_history = '' + self.kept_actions = [] def set_section(self, section_id): self.xmlview.set_section(section_id) def slu_finished(self, model, slu_output): - for action_id in range(self.previous_actions, model.num_actions()): - action = actions.parse_slu_action(model.get_action(action_id)) + slu_output = str(slu_output) + self.slu_actions = model.get_actions().split() + self.slu_output = slu_output + print 'SLU output: "%s", actions: "%s"' % (self.slu_output, ' '.join(self.slu_actions)) + + #for action_id in range(0, len(self.slu_actions)): + for action_id in range(len(self.kept_actions), len(self.slu_actions)): + print 'NEW ACTION:', action_id, self.slu_actions[action_id] + action = actions.parse_slu_action(self.slu_actions[action_id]) print action.text if action.text.startswith('#ENDSEQUENCE('): pass @@ -92,16 +103,32 @@ class ScriptedASR(Gtk.Window): def hyp_changed(self, hyp): #hyp = ' '.join(hyp).replace('[noise]', ' ').split() + if len(hyp) > len(self.current_section_history): + self.current_section_history.append('') + self.kept_history = self.slu_output + self.kept_actions = self.slu_actions + words = hyp[-1].strip().replace('_', ' ').split() + if len(words) == 0: + return section_id = self.xmlview.get_section() if self.current_section != section_id: self.previous_actions = 0 self.current_section = section_id + self.current_section_history = [''] + self.slu_output = '' + self.slu_actions = [] + self.kept_history = '' + self.kept_actions = [] + if section_id in self.slu: + self.slu[section_id].reset_slu() #print section_id if section_id in self.slu: model = self.slu[section_id] - self.previous_actions = model.num_actions() - model.process(words, self.slu_finished) + #self.previous_actions = model.num_actions() + print 'SLU input: history="%s", words="%s"' % (self.kept_history, ' '.join(words)) + model.process(words, self.kept_history, self.slu_finished, False) + self.current_section_history[-1] = ' '.join(words) def quit(self, window): for slu in self.slu.values(): diff --git a/slu.py b/slu.py index 0d276aa025323e2ead6b6be5af8e7ef74c8c8d0a..1d31c14a9c4148fd8f682c5d390718bb1fa7b738 100644 --- a/slu.py +++ b/slu.py @@ -16,22 +16,34 @@ class SLU: _backend.init_slu.argtypes = [c_char_p, c_char_p, c_char_p, c_char_p] _backend.init_slu.restype = c_void_p - # int run_slu(slu_t* slu, char** words, int num_words, int prevn); + # int run_slu(slu_t* slu, char** words, int num_words, int prevn, char* prevword); _backend.run_slu.argtypes = [c_void_p, POINTER(c_char_p), c_int, c_int, c_char_p] - _backend.run_slu.restype = c_int + _backend.run_slu.restype = c_void_p # c_char_p with manual memory management # int num_actions(slu_t* slu) _backend.num_actions.argtypes = [c_void_p] _backend.num_actions.restype = c_int + # int get_actions(slu_t* slu) + _backend.get_actions.argtypes = [c_void_p] + _backend.get_actions.restype = c_void_p + # int get_action(slu_t* slu, int index) _backend.get_action.argtypes = [c_void_p, c_int] _backend.get_action.restype = c_char_p + # void reset_slu(slu_t* slu); + _backend.reset_slu.argtypes = [c_void_p] + _backend.reset_slu.restype = None + # void free_slu(slu_t* slu); _backend.free_slu.argtypes = [c_void_p] _backend.free_slu.restype = None + # void free(void*) from libc + _backend.free.argtypes = [c_void_p] + _backend.free.restype = None + _semaphore = threading.Semaphore() _semaphore.acquire() thread = threading.Thread(target=self._init_thread, args=[word_lexicon, action_lexicon, model_fst, cleaner_fst]) @@ -43,17 +55,22 @@ class SLU: self.slu = _backend.init_slu(word_lexicon, action_lexicon, model_fst, cleaner_fst) _semaphore.release() - def process(self, words, callback): - thread = threading.Thread(target=self._process_thread, args=[words, callback]) - thread.daemon = True - thread.start() + def process(self, words, old_words, callback, async=True): + if async: + thread = threading.Thread(target=self._process_thread, args=[words, old_words, callback]) + thread.daemon = True + thread.start() + else: + self._process_thread(words, old_words, callback) - def _process_thread(self, words, callback): + def _process_thread(self, words, old_words, callback): global _backend, _semaphore c_words = (c_char_p * len(words))(*words) _semaphore.acquire() - output = _backend.run_slu(self.slu, c_words, len(words), self.num_actions(), None) + c_output = _backend.run_slu(self.slu, c_words, len(words), -1, old_words) _semaphore.release() + output = cast(c_output, c_char_p).value + _backend.free(c_output) GLib.idle_add(callback, self, output) def num_actions(self): @@ -61,11 +78,24 @@ class SLU: output = _backend.num_actions(self.slu) return output + def get_actions(self): + global _backend, _semaphore + c_output = _backend.get_actions(self.slu) + output = cast(c_output, c_char_p).value + _backend.free(c_output) + return output + def get_action(self, index): global _backend, _semaphore output = _backend.get_action(self.slu, index) return output + def reset_slu(self): + global _backend, _semaphore + _semaphore.acquire() + _backend.reset_slu(self.slu) + _semaphore.release() + def shutdown(self): global _backend, _semaphore _backend.free_slu(self.slu) diff --git a/slu/automate/homeostasis_25nov.fst b/slu/automate/homeostasis_25nov.fst index df590feef0cf226e1fa14080ebff998bd27ee9be..c91b928a2e6e796933043d0a066b28f542d0453b 100644 Binary files a/slu/automate/homeostasis_25nov.fst and b/slu/automate/homeostasis_25nov.fst differ diff --git a/slu/automate/homeostasis_25nov_clean_tail.fst b/slu/automate/homeostasis_25nov_clean_tail.fst index fa0657a6795f1b795cf0e056b66842d49d6f615e..0cfb3f067befa6dcb72ec8150dec2b16f370da02 100644 Binary files a/slu/automate/homeostasis_25nov_clean_tail.fst and b/slu/automate/homeostasis_25nov_clean_tail.fst differ diff --git a/slu/automate/homeostasis_25nov_clean_tail.txt b/slu/automate/homeostasis_25nov_clean_tail.txt index 62c214108e8997f3df0845061527f06b89c18c96..a8439cd2ca72259fbfe7e17019b1cd439f2a064c 100644 --- a/slu/automate/homeostasis_25nov_clean_tail.txt +++ b/slu/automate/homeostasis_25nov_clean_tail.txt @@ -1,3 +1,179 @@ +0 0 uno uno +0 0 dos dos +0 0 open open +0 0 system system +0 0 tell tell +0 0 me me +0 0 technical technical +0 0 characteristics characteristics +0 0 read read +0 0 next next +0 0 yes yes +0 0 download download +0 0 the the +0 0 terms terms +0 0 and and +0 0 conditions conditions +0 0 of of +0 0 use use +0 0 body body +0 0 x x +0 0 epsilon epsilon +0 0 three three +0 0 point point +0 0 zero zero +0 0 accept accept +0 0 install install +0 0 new new +0 0 version version +0 0 give give +0 0 my my +0 0 data data +0 0 tres tres +0 0 access access +0 0 to to +0 0 import import +0 0 organic organic +0 0 matter matter +0 0 temperature temperature +0 0 time time +0 0 space space +0 0 position position +0 0 subsystems subsystems +0 0 estate estate +0 0 quatro quatro +0 0 functions functions +0 0 localization localization +0 0 sensations sensations +0 0 passion passion +0 0 concentration concentration +0 0 perception perception +0 0 formal formal +0 0 force force +0 0 logics logics +0 0 imagination imagination +0 0 effort effort +0 0 nervous nervous +0 0 internal internal +0 0 network network +0 0 upload upload +0 0 cinco cinco +0 0 memory memory +0 0 silence silence +0 0 clouds clouds +0 0 beautiful beautiful +0 0 rain rain +0 0 identities identities +0 0 storm storm +0 0 possibilities possibilities +0 0 wifi wifi +0 0 search search +0 0 redo redo +0 0 connection connection +0 0 connect connect +0 0 this this +0 0 function function +0 0 looking looking +0 0 for for +0 0 something something +0 0 must must +0 0 stay stay +0 0 exist exist +0 0 a a +0 0 thread thread +0 0 exists exists +0 0 between between +0 0 recollection recollection +0 0 oblivion oblivion +0 0 tension tension +0 0 an an +0 0 echo echo +0 0 emptiness emptiness +0 0 rare rare +0 0 stays stays +0 0 through through +0 0 nothing nothing +0 0 more more +0 0 strange strange +0 0 than than +0 0 exile exile +0 0 absolute absolute +0 0 abyss abyss +0 0 creaking creaking +0 0 bones bones +0 0 barbarian barbarian +0 0 invasion invasion +0 0 carelessness carelessness +0 0 destinies destinies +0 0 wringing wringing +0 0 out out +0 0 blood blood +0 0 should should +0 0 or or +0 0 not not +0 0 try try +0 0 with with +0 0 functional functional +0 0 regulation regulation +0 0 possible possible +0 0 erase erase +0 0 important important +0 0 state state +0 0 geolocalization geolocalization +0 0 encode encode +0 0 located located +0 0 constellation constellation +0 0 center center +0 0 six six +0 0 nine nine +0 0 some some +0 0 threads threads +0 0 are are +0 0 broken broken +0 0 remove remove +0 0 love love +0 0 errors errors +0 0 identical identical +0 0 identity identity +0 0 identifier identifier +0 0 where where +0 0 answer answer +0 0 being being +0 0 boing boing +0 0 boot boot +0 0 reboot reboot +0 0 border border +0 0 begun begun +0 0 begin begin +0 0 win win +0 0 actions actions +0 0 there there +0 0 is is +0 0 password password +0 0 pancreas pancreas +0 0 you you +0 0 your your +0 0 wins wins +0 0 everywhere everywhere +0 0 golden golden +0 0 protein protein +0 0 protection protection +0 0 amino-acid amino-acid +0 0 bilar bilar +0 0 violence violence +0 0 segment segment +0 0 segregation segregation +0 0 want want +0 0 y y +0 0 querer querer +0 0 sequences sequences +0 0 producing producing +0 0 significant significant +0 0 alignments alignments +0 0 in in +0 0 genetic genetic +0 0 database database +0 0 record record 0 1 uno uno 0 1 dos dos 0 1 open open @@ -174,361 +350,357 @@ 0 1 genetic genetic 0 1 database database 0 1 record record -1 1 <joker> <joker> -1 1 uno uno -1 1 dos dos -1 1 open open -1 1 system system -1 1 tell tell -1 1 me me -1 1 technical technical -1 1 characteristics characteristics -1 1 read read -1 1 next next -1 1 yes yes -1 1 download download -1 1 the the -1 1 terms terms -1 1 and and -1 1 conditions conditions -1 1 of of -1 1 use use -1 1 body body -1 1 x x -1 1 epsilon epsilon -1 1 three three -1 1 point point -1 1 zero zero -1 1 accept accept -1 1 install install -1 1 new new -1 1 version version -1 1 give give -1 1 my my -1 1 data data -1 1 tres tres -1 1 access access -1 1 to to -1 1 import import -1 1 organic organic -1 1 matter matter -1 1 temperature temperature -1 1 time time -1 1 space space -1 1 position position -1 1 subsystems subsystems -1 1 estate estate -1 1 quatro quatro -1 1 functions functions -1 1 localization localization -1 1 sensations sensations -1 1 passion passion -1 1 concentration concentration -1 1 perception perception -1 1 formal formal -1 1 force force -1 1 logics logics -1 1 imagination imagination -1 1 effort effort -1 1 nervous nervous -1 1 internal internal -1 1 network network -1 1 upload upload -1 1 cinco cinco -1 1 memory memory -1 1 silence silence -1 1 clouds clouds -1 1 beautiful beautiful -1 1 rain rain -1 1 identities identities -1 1 storm storm -1 1 possibilities possibilities -1 1 wifi wifi -1 1 search search -1 1 redo redo -1 1 connection connection -1 1 connect connect -1 1 this this -1 1 function function -1 1 looking looking -1 1 for for -1 1 something something -1 1 must must -1 1 stay stay -1 1 exist exist -1 1 a a -1 1 thread thread -1 1 exists exists -1 1 between between -1 1 recollection recollection -1 1 oblivion oblivion -1 1 tension tension -1 1 an an -1 1 echo echo -1 1 emptiness emptiness -1 1 rare rare -1 1 stays stays -1 1 through through -1 1 nothing nothing -1 1 more more -1 1 strange strange -1 1 than than -1 1 exile exile -1 1 absolute absolute -1 1 abyss abyss -1 1 creaking creaking -1 1 bones bones -1 1 barbarian barbarian -1 1 invasion invasion -1 1 carelessness carelessness -1 1 destinies destinies -1 1 wringing wringing -1 1 out out -1 1 blood blood -1 1 should should -1 1 or or -1 1 not not -1 1 try try -1 1 with with -1 1 functional functional -1 1 regulation regulation -1 1 possible possible -1 1 erase erase -1 1 important important -1 1 state state -1 1 geolocalization geolocalization -1 1 encode encode -1 1 located located -1 1 constellation constellation -1 1 center center -1 1 six six -1 1 nine nine -1 1 some some -1 1 threads threads -1 1 are are -1 1 broken broken -1 1 remove remove -1 1 love love -1 1 errors errors -1 1 identical identical -1 1 identity identity -1 1 identifier identifier -1 1 where where -1 1 answer answer -1 1 being being -1 1 boing boing -1 1 boot boot -1 1 reboot reboot -1 1 border border -1 1 begun begun -1 1 begin begin -1 1 win win -1 1 actions actions -1 1 there there -1 1 is is -1 1 password password -1 1 pancreas pancreas -1 1 you you -1 1 your your -1 1 wins wins -1 1 everywhere everywhere -1 1 golden golden -1 1 protein protein -1 1 protection protection -1 1 amino-acid amino-acid -1 1 bilar bilar -1 1 violence violence -1 1 segment segment -1 1 segregation segregation -1 1 want want -1 1 y y -1 1 querer querer -1 1 sequences sequences -1 1 producing producing -1 1 significant significant -1 1 alignments alignments -1 1 in in -1 1 genetic genetic -1 1 database database -1 1 record record -1 2 <joker> <epsilon> +0 2 <joker> <joker> 1 -2 3 <epsilon> <joker> -2 2 <joker> <epsilon> -2 -3 1 uno uno -3 1 dos dos -3 1 open open -3 1 system system -3 1 tell tell -3 1 me me -3 1 technical technical -3 1 characteristics characteristics -3 1 read read -3 1 next next -3 1 yes yes -3 1 download download -3 1 the the -3 1 terms terms -3 1 and and -3 1 conditions conditions -3 1 of of -3 1 use use -3 1 body body -3 1 x x -3 1 epsilon epsilon -3 1 three three -3 1 point point -3 1 zero zero -3 1 accept accept -3 1 install install -3 1 new new -3 1 version version -3 1 give give -3 1 my my -3 1 data data -3 1 tres tres -3 1 access access -3 1 to to -3 1 import import -3 1 organic organic -3 1 matter matter -3 1 temperature temperature -3 1 time time -3 1 space space -3 1 position position -3 1 subsystems subsystems -3 1 estate estate -3 1 quatro quatro -3 1 functions functions -3 1 localization localization -3 1 sensations sensations -3 1 passion passion -3 1 concentration concentration -3 1 perception perception -3 1 formal formal -3 1 force force -3 1 logics logics -3 1 imagination imagination -3 1 effort effort -3 1 nervous nervous -3 1 internal internal -3 1 network network -3 1 upload upload -3 1 cinco cinco -3 1 memory memory -3 1 silence silence -3 1 clouds clouds -3 1 beautiful beautiful -3 1 rain rain -3 1 identities identities -3 1 storm storm -3 1 possibilities possibilities -3 1 wifi wifi -3 1 search search -3 1 redo redo -3 1 connection connection -3 1 connect connect -3 1 this this -3 1 function function -3 1 looking looking -3 1 for for -3 1 something something -3 1 must must -3 1 stay stay -3 1 exist exist -3 1 a a -3 1 thread thread -3 1 exists exists -3 1 between between -3 1 recollection recollection -3 1 oblivion oblivion -3 1 tension tension -3 1 an an -3 1 echo echo -3 1 emptiness emptiness -3 1 rare rare -3 1 stays stays -3 1 through through -3 1 nothing nothing -3 1 more more -3 1 strange strange -3 1 than than -3 1 exile exile -3 1 absolute absolute -3 1 abyss abyss -3 1 creaking creaking -3 1 bones bones -3 1 barbarian barbarian -3 1 invasion invasion -3 1 carelessness carelessness -3 1 destinies destinies -3 1 wringing wringing -3 1 out out -3 1 blood blood -3 1 should should -3 1 or or -3 1 not not -3 1 try try -3 1 with with -3 1 functional functional -3 1 regulation regulation -3 1 possible possible -3 1 erase erase -3 1 important important -3 1 state state -3 1 geolocalization geolocalization -3 1 encode encode -3 1 located located -3 1 constellation constellation -3 1 center center -3 1 six six -3 1 nine nine -3 1 some some -3 1 threads threads -3 1 are are -3 1 broken broken -3 1 remove remove -3 1 love love -3 1 errors errors -3 1 identical identical -3 1 identity identity -3 1 identifier identifier -3 1 where where -3 1 answer answer -3 1 being being -3 1 boing boing -3 1 boot boot -3 1 reboot reboot -3 1 border border -3 1 begun begun -3 1 begin begin -3 1 win win -3 1 actions actions -3 1 there there -3 1 is is -3 1 password password -3 1 pancreas pancreas -3 1 you you -3 1 your your -3 1 wins wins -3 1 everywhere everywhere -3 1 golden golden -3 1 protein protein -3 1 protection protection -3 1 amino-acid amino-acid -3 1 bilar bilar -3 1 violence violence -3 1 segment segment -3 1 segregation segregation -3 1 want want -3 1 y y -3 1 querer querer -3 1 sequences sequences -3 1 producing producing -3 1 significant significant -3 1 alignments alignments -3 1 in in -3 1 genetic genetic -3 1 database database -3 1 record record +2 0 uno uno +2 0 dos dos +2 0 open open +2 0 system system +2 0 tell tell +2 0 me me +2 0 technical technical +2 0 characteristics characteristics +2 0 read read +2 0 next next +2 0 yes yes +2 0 download download +2 0 the the +2 0 terms terms +2 0 and and +2 0 conditions conditions +2 0 of of +2 0 use use +2 0 body body +2 0 x x +2 0 epsilon epsilon +2 0 three three +2 0 point point +2 0 zero zero +2 0 accept accept +2 0 install install +2 0 new new +2 0 version version +2 0 give give +2 0 my my +2 0 data data +2 0 tres tres +2 0 access access +2 0 to to +2 0 import import +2 0 organic organic +2 0 matter matter +2 0 temperature temperature +2 0 time time +2 0 space space +2 0 position position +2 0 subsystems subsystems +2 0 estate estate +2 0 quatro quatro +2 0 functions functions +2 0 localization localization +2 0 sensations sensations +2 0 passion passion +2 0 concentration concentration +2 0 perception perception +2 0 formal formal +2 0 force force +2 0 logics logics +2 0 imagination imagination +2 0 effort effort +2 0 nervous nervous +2 0 internal internal +2 0 network network +2 0 upload upload +2 0 cinco cinco +2 0 memory memory +2 0 silence silence +2 0 clouds clouds +2 0 beautiful beautiful +2 0 rain rain +2 0 identities identities +2 0 storm storm +2 0 possibilities possibilities +2 0 wifi wifi +2 0 search search +2 0 redo redo +2 0 connection connection +2 0 connect connect +2 0 this this +2 0 function function +2 0 looking looking +2 0 for for +2 0 something something +2 0 must must +2 0 stay stay +2 0 exist exist +2 0 a a +2 0 thread thread +2 0 exists exists +2 0 between between +2 0 recollection recollection +2 0 oblivion oblivion +2 0 tension tension +2 0 an an +2 0 echo echo +2 0 emptiness emptiness +2 0 rare rare +2 0 stays stays +2 0 through through +2 0 nothing nothing +2 0 more more +2 0 strange strange +2 0 than than +2 0 exile exile +2 0 absolute absolute +2 0 abyss abyss +2 0 creaking creaking +2 0 bones bones +2 0 barbarian barbarian +2 0 invasion invasion +2 0 carelessness carelessness +2 0 destinies destinies +2 0 wringing wringing +2 0 out out +2 0 blood blood +2 0 should should +2 0 or or +2 0 not not +2 0 try try +2 0 with with +2 0 functional functional +2 0 regulation regulation +2 0 possible possible +2 0 erase erase +2 0 important important +2 0 state state +2 0 geolocalization geolocalization +2 0 encode encode +2 0 located located +2 0 constellation constellation +2 0 center center +2 0 six six +2 0 nine nine +2 0 some some +2 0 threads threads +2 0 are are +2 0 broken broken +2 0 remove remove +2 0 love love +2 0 errors errors +2 0 identical identical +2 0 identity identity +2 0 identifier identifier +2 0 where where +2 0 answer answer +2 0 being being +2 0 boing boing +2 0 boot boot +2 0 reboot reboot +2 0 border border +2 0 begun begun +2 0 begin begin +2 0 win win +2 0 actions actions +2 0 there there +2 0 is is +2 0 password password +2 0 pancreas pancreas +2 0 you you +2 0 your your +2 0 wins wins +2 0 everywhere everywhere +2 0 golden golden +2 0 protein protein +2 0 protection protection +2 0 amino-acid amino-acid +2 0 bilar bilar +2 0 violence violence +2 0 segment segment +2 0 segregation segregation +2 0 want want +2 0 y y +2 0 querer querer +2 0 sequences sequences +2 0 producing producing +2 0 significant significant +2 0 alignments alignments +2 0 in in +2 0 genetic genetic +2 0 database database +2 0 record record +2 1 uno uno +2 1 dos dos +2 1 open open +2 1 system system +2 1 tell tell +2 1 me me +2 1 technical technical +2 1 characteristics characteristics +2 1 read read +2 1 next next +2 1 yes yes +2 1 download download +2 1 the the +2 1 terms terms +2 1 and and +2 1 conditions conditions +2 1 of of +2 1 use use +2 1 body body +2 1 x x +2 1 epsilon epsilon +2 1 three three +2 1 point point +2 1 zero zero +2 1 accept accept +2 1 install install +2 1 new new +2 1 version version +2 1 give give +2 1 my my +2 1 data data +2 1 tres tres +2 1 access access +2 1 to to +2 1 import import +2 1 organic organic +2 1 matter matter +2 1 temperature temperature +2 1 time time +2 1 space space +2 1 position position +2 1 subsystems subsystems +2 1 estate estate +2 1 quatro quatro +2 1 functions functions +2 1 localization localization +2 1 sensations sensations +2 1 passion passion +2 1 concentration concentration +2 1 perception perception +2 1 formal formal +2 1 force force +2 1 logics logics +2 1 imagination imagination +2 1 effort effort +2 1 nervous nervous +2 1 internal internal +2 1 network network +2 1 upload upload +2 1 cinco cinco +2 1 memory memory +2 1 silence silence +2 1 clouds clouds +2 1 beautiful beautiful +2 1 rain rain +2 1 identities identities +2 1 storm storm +2 1 possibilities possibilities +2 1 wifi wifi +2 1 search search +2 1 redo redo +2 1 connection connection +2 1 connect connect +2 1 this this +2 1 function function +2 1 looking looking +2 1 for for +2 1 something something +2 1 must must +2 1 stay stay +2 1 exist exist +2 1 a a +2 1 thread thread +2 1 exists exists +2 1 between between +2 1 recollection recollection +2 1 oblivion oblivion +2 1 tension tension +2 1 an an +2 1 echo echo +2 1 emptiness emptiness +2 1 rare rare +2 1 stays stays +2 1 through through +2 1 nothing nothing +2 1 more more +2 1 strange strange +2 1 than than +2 1 exile exile +2 1 absolute absolute +2 1 abyss abyss +2 1 creaking creaking +2 1 bones bones +2 1 barbarian barbarian +2 1 invasion invasion +2 1 carelessness carelessness +2 1 destinies destinies +2 1 wringing wringing +2 1 out out +2 1 blood blood +2 1 should should +2 1 or or +2 1 not not +2 1 try try +2 1 with with +2 1 functional functional +2 1 regulation regulation +2 1 possible possible +2 1 erase erase +2 1 important important +2 1 state state +2 1 geolocalization geolocalization +2 1 encode encode +2 1 located located +2 1 constellation constellation +2 1 center center +2 1 six six +2 1 nine nine +2 1 some some +2 1 threads threads +2 1 are are +2 1 broken broken +2 1 remove remove +2 1 love love +2 1 errors errors +2 1 identical identical +2 1 identity identity +2 1 identifier identifier +2 1 where where +2 1 answer answer +2 1 being being +2 1 boing boing +2 1 boot boot +2 1 reboot reboot +2 1 border border +2 1 begun begun +2 1 begin begin +2 1 win win +2 1 actions actions +2 1 there there +2 1 is is +2 1 password password +2 1 pancreas pancreas +2 1 you you +2 1 your your +2 1 wins wins +2 1 everywhere everywhere +2 1 golden golden +2 1 protein protein +2 1 protection protection +2 1 amino-acid amino-acid +2 1 bilar bilar +2 1 violence violence +2 1 segment segment +2 1 segregation segregation +2 1 want want +2 1 y y +2 1 querer querer +2 1 sequences sequences +2 1 producing producing +2 1 significant significant +2 1 alignments alignments +2 1 in in +2 1 genetic genetic +2 1 database database +2 1 record record diff --git a/slu/automate/homeostasis_25nov_section1.fst b/slu/automate/homeostasis_25nov_section1.fst index b8ceba879c1abf140ac66f07ecd773f6954f07f4..6257b879d9ed607acecadfa40025a0a112b8105e 100644 Binary files a/slu/automate/homeostasis_25nov_section1.fst and b/slu/automate/homeostasis_25nov_section1.fst differ diff --git a/slu/automate/homeostasis_25nov_section1.txt b/slu/automate/homeostasis_25nov_section1.txt index b5cd31b32ca2ba0478c0480caeca13b919ce3320..7544e0bb4fc9bb88514194e40e3cb54ab866cedc 100644 --- a/slu/automate/homeostasis_25nov_section1.txt +++ b/slu/automate/homeostasis_25nov_section1.txt @@ -2,5 +2,6 @@ 1 100 0 1 <joker> 2 100 1 2 <epsilon> 3 0 +2 100 2 3 <epsilon> 4 0 3 diff --git a/slu/automate/homeostasis_25nov_section2.fst b/slu/automate/homeostasis_25nov_section2.fst index cd2b1f7c324bf6c567ba298214982a40d828ba07..786e674f9064d6ca0a6504f792c3384bf8d922b0 100644 Binary files a/slu/automate/homeostasis_25nov_section2.fst and b/slu/automate/homeostasis_25nov_section2.fst differ diff --git a/slu/automate/homeostasis_25nov_section2.txt b/slu/automate/homeostasis_25nov_section2.txt index 87b2764ba20abb5d23536ff25e9f2f3f39c1c434..d19f7f54197e85098b96903be82467b402e1cdbe 100644 --- a/slu/automate/homeostasis_25nov_section2.txt +++ b/slu/automate/homeostasis_25nov_section2.txt @@ -14,6 +14,7 @@ 4 6 <joker> 8 100 6 7 open 9 0 7 8 technical 0 0 +7 8 <epsilon> 0 10 8 9 characteristics 0 0 9 6 <epsilon> 0 0 9 100 @@ -40,27 +41,44 @@ 13 14 <joker> 14 100 14 15 open 15 0 15 16 the 0 0 +15 16 <epsilon> 0 10 16 17 terms 0 0 +16 17 <epsilon> 0 10 17 18 and 0 0 +17 18 <epsilon> 0 10 18 19 conditions 0 0 +18 19 <epsilon> 0 10 19 20 of 0 0 +19 20 <epsilon> 0 10 20 21 use 0 0 +20 21 <epsilon> 0 10 21 22 of 0 0 +21 22 <epsilon> 0 10 22 23 body 0 0 +22 23 <epsilon> 0 10 23 24 x 0 0 +23 24 <epsilon> 0 10 24 25 epsilon 0 0 +24 25 <epsilon> 0 10 25 26 system 0 0 +25 26 <epsilon> 0 10 26 27 three 0 0 +26 27 <epsilon> 0 10 27 28 point 0 0 +27 28 <epsilon> 0 10 28 29 zero 0 0 29 14 <epsilon> 0 0 29 100 14 29 <joker> 15 100 29 30 accept 16 0 30 31 terms 0 0 +30 31 <epsilon> 0 10 31 32 and 0 0 +31 32 <epsilon> 0 10 32 33 conditions 0 0 +32 33 <epsilon> 0 10 33 34 of 0 0 +33 34 <epsilon> 0 10 34 35 use 0 0 35 29 <epsilon> 0 0 35 100 @@ -71,19 +89,27 @@ 35 36 <joker> 17 100 36 37 install 18 0 37 38 the 0 0 +37 38 <epsilon> 0 10 38 39 new 0 0 +38 39 <epsilon> 0 10 39 40 version 0 0 +39 40 <epsilon> 0 10 40 41 of 0 0 +40 41 <epsilon> 0 10 41 42 me 0 0 42 36 <epsilon> 0 0 42 100 36 42 <joker> 18 100 42 43 give 19 0 43 44 me 0 0 +43 44 <epsilon> 0 10 44 45 my 0 0 +44 45 <epsilon> 0 10 45 46 data 0 0 46 42 <epsilon> 0 0 +46 100 42 46 <joker> 19 100 46 47 <epsilon> 20 0 +47 100 47 48 <epsilon> 21 0 48 diff --git a/slu/automate/homeostasis_25nov_section3.fst b/slu/automate/homeostasis_25nov_section3.fst index 2c9ecb79e9e5b0e34814b9aa2758975c78f9bffb..f405413de8a688b61adf875db3a39b794ba74542 100644 Binary files a/slu/automate/homeostasis_25nov_section3.fst and b/slu/automate/homeostasis_25nov_section3.fst differ diff --git a/slu/automate/homeostasis_25nov_section3.txt b/slu/automate/homeostasis_25nov_section3.txt index 9040aeb8d726c3c150cfe16b00326115e029087a..23cb0b669af5c51555f79b6238976c8ad6dfbeb0 100644 --- a/slu/automate/homeostasis_25nov_section3.txt +++ b/slu/automate/homeostasis_25nov_section3.txt @@ -3,21 +3,28 @@ 0 1 <joker> 22 100 1 2 open 23 0 2 3 access 0 0 +2 3 <epsilon> 0 10 3 4 to 0 0 +3 4 <epsilon> 0 10 4 5 body 0 0 +4 5 <epsilon> 0 10 5 6 data 0 0 +6 100 1 6 <joker> 23 100 6 7 <epsilon> 24 0 7 7 8 import 25 0 8 9 body 0 0 +8 9 <epsilon> 0 10 9 10 data 0 0 10 7 <epsilon> 0 0 10 100 7 10 <joker> 25 100 10 11 import 26 0 11 12 organic 0 0 +11 12 <epsilon> 0 10 12 13 matter 0 0 +12 13 <epsilon> 0 10 13 14 data 0 0 14 10 <epsilon> 0 0 14 100 @@ -34,6 +41,7 @@ 16 18 <joker> 28 100 18 19 import 29 0 19 20 space 0 0 +19 20 <epsilon> 0 10 20 21 data 0 0 21 18 <epsilon> 0 0 21 100 @@ -45,6 +53,7 @@ 21 23 <joker> 30 100 23 24 import 31 0 24 25 body 0 0 +24 25 <epsilon> 0 10 25 26 subsystems 0 0 26 23 <epsilon> 0 0 26 100 @@ -56,10 +65,14 @@ 26 28 <joker> 32 100 28 29 give 33 0 29 30 me 0 0 +29 30 <epsilon> 0 10 30 31 my 0 0 +30 31 <epsilon> 0 10 31 32 data 0 0 32 28 <epsilon> 0 0 +32 100 28 32 <joker> 33 100 32 33 <epsilon> 34 0 +33 100 33 34 <epsilon> 35 0 34 diff --git a/slu/automate/homeostasis_25nov_section4.fst b/slu/automate/homeostasis_25nov_section4.fst index daeee6b49dbefb2564843f63eb849c0c79302809..4a54c7648c89a79dd5b2855addf046546080c8f3 100644 Binary files a/slu/automate/homeostasis_25nov_section4.fst and b/slu/automate/homeostasis_25nov_section4.fst differ diff --git a/slu/automate/homeostasis_25nov_section4.txt b/slu/automate/homeostasis_25nov_section4.txt index 8fcb30dadd7e99b71ae4f8cc0deeec516c2376a6..6b35675e96a7b6858c45cf0283e99e358fcd3b0b 100644 --- a/slu/automate/homeostasis_25nov_section4.txt +++ b/slu/automate/homeostasis_25nov_section4.txt @@ -3,103 +3,138 @@ 0 1 <joker> 36 100 1 2 open 37 0 2 3 access 0 0 +2 3 <epsilon> 0 10 3 4 to 0 0 +3 4 <epsilon> 0 10 4 5 body 0 0 +4 5 <epsilon> 0 10 5 6 functions 0 0 +6 100 1 6 <joker> 37 100 6 7 <epsilon> 38 0 7 7 8 import 39 0 8 9 body 0 0 +8 9 <epsilon> 0 10 9 10 functions 0 0 +9 10 <epsilon> 0 10 10 11 space 0 0 +10 11 <epsilon> 0 10 11 12 localization 0 0 12 7 <epsilon> 0 0 12 100 7 12 <joker> 39 100 12 13 import 40 0 13 14 body 0 0 +13 14 <epsilon> 0 10 14 15 functions 0 0 +14 15 <epsilon> 0 10 15 16 sensations 0 0 16 12 <epsilon> 0 0 16 100 12 16 <joker> 40 100 16 17 import 41 0 17 18 body 0 0 +17 18 <epsilon> 0 10 18 19 functions 0 0 +18 19 <epsilon> 0 10 19 20 passion 0 0 20 16 <epsilon> 0 0 20 100 16 20 <joker> 41 100 20 21 import 42 0 21 22 body 0 0 +21 22 <epsilon> 0 10 22 23 functions 0 0 +22 23 <epsilon> 0 10 23 24 concentration 0 0 24 20 <epsilon> 0 0 24 100 20 24 <joker> 42 100 24 25 import 43 0 25 26 body 0 0 +25 26 <epsilon> 0 10 26 27 functions 0 0 +26 27 <epsilon> 0 10 27 28 perception 0 0 28 24 <epsilon> 0 0 28 100 24 28 <joker> 43 100 28 29 import 44 0 29 30 body 0 0 +29 30 <epsilon> 0 10 30 31 functions 0 0 +30 31 <epsilon> 0 10 31 32 formal 0 0 +31 32 <epsilon> 0 10 32 33 force 0 0 33 28 <epsilon> 0 0 33 100 28 33 <joker> 44 100 33 34 import 45 0 34 35 body 0 0 +34 35 <epsilon> 0 10 35 36 functions 0 0 +35 36 <epsilon> 0 10 36 37 logics 0 0 37 33 <epsilon> 0 0 37 100 33 37 <joker> 45 100 37 38 import 46 0 38 39 body 0 0 +38 39 <epsilon> 0 10 39 40 functions 0 0 +39 40 <epsilon> 0 10 40 41 imagination 0 0 41 37 <epsilon> 0 0 41 100 37 41 <joker> 46 100 41 42 import 47 0 42 43 body 0 0 +42 43 <epsilon> 0 10 43 44 functions 0 0 +43 44 <epsilon> 0 10 44 45 effort 0 0 45 41 <epsilon> 0 0 45 100 41 45 <joker> 47 100 45 46 import 48 0 46 47 body 0 0 +46 47 <epsilon> 0 10 47 48 functions 0 0 +47 48 <epsilon> 0 10 48 49 nervous 0 0 +48 49 <epsilon> 0 10 49 50 system 0 0 50 45 <epsilon> 0 0 50 100 45 50 <joker> 48 100 50 51 import 49 0 51 52 body 0 0 +51 52 <epsilon> 0 10 52 53 functions 0 0 +52 53 <epsilon> 0 10 53 54 internal 0 0 +53 54 <epsilon> 0 10 54 55 network 0 0 55 50 <epsilon> 0 0 55 100 50 55 <joker> 49 100 55 56 upload 50 0 56 55 <epsilon> 0 0 +56 100 55 56 <joker> 50 100 56 57 give 51 0 57 58 me 0 0 +57 58 <epsilon> 0 10 58 59 my 0 0 +58 59 <epsilon> 0 10 59 60 data 0 0 60 56 <epsilon> 0 0 +60 100 56 60 <joker> 51 100 56 61 <epsilon> 52 0 60 61 <epsilon> 52 0 +61 100 61 62 <epsilon> 53 0 62 diff --git a/slu/automate/homeostasis_25nov_section5.fst b/slu/automate/homeostasis_25nov_section5.fst index 23d9f15cbdc79e0a896cb029ad15d613789cc930..4954c34a150cd445153e047163eb6358acc9b89a 100644 Binary files a/slu/automate/homeostasis_25nov_section5.fst and b/slu/automate/homeostasis_25nov_section5.fst differ diff --git a/slu/automate/homeostasis_25nov_section5.txt b/slu/automate/homeostasis_25nov_section5.txt index 2320a31c71439a6f8491a6840da2ab59d107dda6..3feeb64bcf2a9c9a2460d8b1923793fc8605a992 100644 --- a/slu/automate/homeostasis_25nov_section5.txt +++ b/slu/automate/homeostasis_25nov_section5.txt @@ -6,12 +6,16 @@ 2 3 import 56 0 3 4 memory 0 0 4 2 <epsilon> 0 0 +4 100 2 4 <joker> 56 100 4 5 give 57 0 5 6 me 0 0 +5 6 <epsilon> 0 10 6 7 my 0 0 +6 7 <epsilon> 0 10 7 8 data 0 0 8 4 <epsilon> 0 0 +8 100 4 8 <joker> 57 100 8 9 silence 58 0 9 8 <epsilon> 0 0 @@ -19,5 +23,6 @@ 8 9 <joker> 58 100 4 10 <epsilon> 59 0 8 10 <epsilon> 59 0 +10 100 10 11 <epsilon> 60 0 11 diff --git a/slu/automate/homeostasis_25nov_section6.fst b/slu/automate/homeostasis_25nov_section6.fst index 46dfd4e2e5c1515aa93b8f01ba6844d8c7dab303..a30166bd3c2bfa828dcf9fe77d66d54453e8c54b 100644 Binary files a/slu/automate/homeostasis_25nov_section6.fst and b/slu/automate/homeostasis_25nov_section6.fst differ diff --git a/slu/automate/homeostasis_25nov_section6.txt b/slu/automate/homeostasis_25nov_section6.txt index 246ffb33250baf05f3c9fa791b19b0214f9cc0e2..b275f2d8b69e132c3c224c8d4fdb4f0bb9e69d0a 100644 --- a/slu/automate/homeostasis_25nov_section6.txt +++ b/slu/automate/homeostasis_25nov_section6.txt @@ -1,5 +1,6 @@ 0 1 open 61 0 1 2 network 0 0 +2 100 0 2 <joker> 61 100 2 3 <epsilon> 62 0 3 @@ -17,11 +18,13 @@ 7 100 3 8 rain 67 0 8 9 of 0 0 +8 9 <epsilon> 0 10 9 10 identities 0 0 10 3 <epsilon> 0 0 10 100 3 11 storm 68 0 11 12 of 0 0 +11 12 <epsilon> 0 10 12 13 possibilities 0 0 13 3 <epsilon> 0 0 13 100 @@ -43,8 +46,11 @@ 19 100 3 20 connect 74 0 20 21 me 0 0 +20 21 <epsilon> 0 10 21 22 to 0 0 +21 22 <epsilon> 0 10 22 23 this 0 0 +22 23 <epsilon> 0 10 23 24 network 0 0 24 3 <epsilon> 0 0 24 100 @@ -87,15 +93,21 @@ 37 100 3 38 between 86 0 38 39 recollection 0 0 +38 39 <epsilon> 0 10 39 40 and 0 0 +39 40 <epsilon> 0 10 40 41 oblivion 0 0 41 3 <epsilon> 0 0 41 100 3 42 a 87 0 42 43 tension 0 0 +42 43 <epsilon> 0 10 43 44 an 0 0 +43 44 <epsilon> 0 10 44 45 echo 0 0 +44 45 <epsilon> 0 10 45 46 an 0 0 +45 46 <epsilon> 0 10 46 47 emptiness 0 0 47 3 <epsilon> 0 0 47 100 @@ -113,37 +125,49 @@ 51 100 3 52 nothing 92 0 52 53 more 0 0 +52 53 <epsilon> 0 10 53 54 strange 0 0 +53 54 <epsilon> 0 10 54 55 than 0 0 +54 55 <epsilon> 0 10 55 56 this 0 0 +55 56 <epsilon> 0 10 56 57 exile 0 0 57 3 <epsilon> 0 0 57 100 3 58 an 93 0 58 59 absolute 0 0 +58 59 <epsilon> 0 10 59 60 abyss 0 0 60 3 <epsilon> 0 0 60 100 3 61 a 94 0 61 62 creaking 0 0 +61 62 <epsilon> 0 10 62 63 of 0 0 +62 63 <epsilon> 0 10 63 64 the 0 0 +63 64 <epsilon> 0 10 64 65 bones 0 0 65 3 <epsilon> 0 0 65 100 3 66 a 95 0 66 67 barbarian 0 0 +66 67 <epsilon> 0 10 67 68 invasion 0 0 68 3 <epsilon> 0 0 68 100 3 69 the 96 0 69 70 carelessness 0 0 +69 70 <epsilon> 0 10 70 71 of 0 0 +70 71 <epsilon> 0 10 71 72 destinies 0 0 72 3 <epsilon> 0 0 72 100 3 73 wringing 97 0 73 74 out 0 0 +73 74 <epsilon> 0 10 74 75 the 0 0 75 3 <epsilon> 0 0 75 100 @@ -176,14 +200,20 @@ 84 100 3 85 try 106 0 85 86 with 0 0 +85 86 <epsilon> 0 10 86 87 functional 0 0 +86 87 <epsilon> 0 10 87 88 regulation 0 0 88 3 <epsilon> 0 0 +88 100 3 89 give 107 0 89 90 me 0 0 +89 90 <epsilon> 0 10 90 91 my 0 0 +90 91 <epsilon> 0 10 91 92 data 0 0 92 3 <epsilon> 0 0 +92 100 88 93 <epsilon> 108 0 92 93 <epsilon> 108 0 93 @@ -230,6 +260,7 @@ 108 100 93 109 six 122 0 109 110 six 0 0 +109 110 <epsilon> 0 10 110 111 nine 0 0 111 93 <epsilon> 0 0 111 100 @@ -460,6 +491,7 @@ 190 100 93 191 protein 196 0 191 192 protection 0 0 +191 192 <epsilon> 0 10 192 193 amino-acid 0 0 193 93 <epsilon> 0 0 193 100 @@ -535,32 +567,45 @@ 217 100 93 218 and 220 0 218 219 to 0 0 +218 219 <epsilon> 0 10 219 220 want 0 0 220 93 <epsilon> 0 0 +220 100 93 221 give 221 0 221 222 me 0 0 +221 222 <epsilon> 0 10 222 223 my 0 0 +222 223 <epsilon> 0 10 223 224 data 0 0 224 93 <epsilon> 0 0 +224 100 220 225 <epsilon> 222 0 224 225 <epsilon> 222 0 225 225 226 y 223 0 226 227 querer 0 0 227 225 <epsilon> 0 0 +227 100 225 228 give 224 0 228 229 me 0 0 +228 229 <epsilon> 0 10 229 230 my 0 0 +229 230 <epsilon> 0 10 230 231 data 0 0 231 225 <epsilon> 0 0 +231 100 227 232 <epsilon> 225 0 231 232 <epsilon> 225 0 232 232 233 give 226 0 233 234 me 0 0 +233 234 <epsilon> 0 10 234 235 my 0 0 +234 235 <epsilon> 0 10 235 236 data 0 0 236 232 <epsilon> 0 0 +236 100 236 237 <epsilon> 227 0 +237 100 237 238 <epsilon> 228 0 238 diff --git a/slu/automate/homeostasis_25nov_section8.fst b/slu/automate/homeostasis_25nov_section8.fst index bd11b3868f5cbac32832fae3663c0521d7e1fbc9..17071b83c730bf02ee84ed2e5b8f7062501004e7 100644 Binary files a/slu/automate/homeostasis_25nov_section8.fst and b/slu/automate/homeostasis_25nov_section8.fst differ diff --git a/slu/automate/homeostasis_25nov_section8.txt b/slu/automate/homeostasis_25nov_section8.txt index d8bc572fd971e99a8c4c2d02605d3e1d0750dd0a..0daef5ca3e5635de66c704d6bbe5c02a6c5ee8bf 100644 --- a/slu/automate/homeostasis_25nov_section8.txt +++ b/slu/automate/homeostasis_25nov_section8.txt @@ -1,17 +1,28 @@ 0 1 search 229 0 1 2 for 0 0 +1 2 <epsilon> 0 10 2 3 sequences 0 0 +2 3 <epsilon> 0 10 3 4 producing 0 0 +3 4 <epsilon> 0 10 4 5 significant 0 0 +4 5 <epsilon> 0 10 5 6 alignments 0 0 +5 6 <epsilon> 0 10 6 7 in 0 0 +6 7 <epsilon> 0 10 7 8 genetic 0 0 +7 8 <epsilon> 0 10 8 9 database 0 0 +9 100 0 9 <joker> 229 100 9 10 give 230 0 10 11 me 0 0 +10 11 <epsilon> 0 10 11 12 my 0 0 +11 12 <epsilon> 0 10 12 13 data 0 0 +13 100 9 13 <joker> 230 100 9 14 <epsilon> 231 0 13 14 <epsilon> 231 0 @@ -24,9 +35,13 @@ 16 100 14 17 give 233 0 17 18 me 0 0 +17 18 <epsilon> 0 10 18 19 my 0 0 +18 19 <epsilon> 0 10 19 20 data 0 0 20 14 <epsilon> 0 0 +20 100 20 21 <epsilon> 234 0 +21 100 21 22 <epsilon> 235 0 22 diff --git a/slu/src/librocio_slu.cc b/slu/src/librocio_slu.cc index 048c59f4d92ec4b9ce8188365ba8d01c1f5fa528..e5f5233c652bb452ecfc48d88195b3cd8c2fe268 100644 --- a/slu/src/librocio_slu.cc +++ b/slu/src/librocio_slu.cc @@ -121,7 +121,17 @@ fst::StdVectorFst *build_fst_words(slu_t* slu, char **words, int num_words, int return input; } -void run_process(slu_t* slu, char** words, int num_words, int prevn, char *prevword) +void reset_slu(slu_t* slu) { + // reset actions + for(size_t i = 0; i < slu->actions->size(); i++) free((*slu->actions)[i]); + slu->actions->clear(); + // reset words + for(size_t i = 0; i < slu->words->size(); i++) free((*slu->words)[i]); + slu->words->clear(); + +} + +char* run_process(slu_t* slu, char** words, int num_words, int prevn, char *prevword) { fst::StdVectorFst *input,result1,result2,result3; char *ch; @@ -237,8 +247,15 @@ void run_process(slu_t* slu, char** words, int num_words, int prevn, char *prevw slu->words->push_back(strdup(buffer)); //printf(" **%s",ch); } - //printf("\n"); free(tocc); free(t_outword); + + // make output string + std::string output; + for(size_t i = 0; i < slu->words->size(); i++) { + if(i > 0) output += " "; + output += (*slu->words)[i]; + } + return strdup(output.c_str()); } /*................................................................*/ @@ -276,11 +293,20 @@ char* get_action(slu_t* slu, size_t index) { return NULL; } -int run_slu(slu_t* slu, char** words, int num_words, int prevn, char *prevword) { +char* get_actions(slu_t* slu) { + std::string output; + for(size_t i = 0; i < slu->actions->size(); i++) { + if(i > 0) output += " "; + output += (*slu->actions)[i]; + } + //fprintf(stderr, "get_actions() = {%s}\n", output.c_str()); + return strdup(output.c_str()); +} + +char* run_slu(slu_t* slu, char** words, int num_words, int prevn, char *prevword) { //fprintf(stderr, "before process\n"); - run_process(slu, words, num_words, prevn,prevword); + return run_process(slu, words, num_words, prevn,prevword); //fprintf(stderr, "after process\n"); - return num_actions(slu); } } diff --git a/slu/src/librocio_slu.h b/slu/src/librocio_slu.h index 39ece4f6515e8ef248d7f083a7126eb4da5684d6..e388fbdd79162929c2f5ae40f993026318a2d076 100644 --- a/slu/src/librocio_slu.h +++ b/slu/src/librocio_slu.h @@ -17,12 +17,16 @@ typedef struct { slu_t* init_slu(char* chfileword, char* chfileaction, char* chfilemodel, char* chfileclean); -int run_slu(slu_t* slu, char** words, int num_words, int prevn, char *prevword); +char* run_slu(slu_t* slu, char** words, int num_words, int prevn, char *prevword); int num_actions(slu_t* slu); char* get_action(slu_t* slu, size_t index); +char* get_actions(slu_t* slu); + +void reset_slu(slu_t* slu); + void free_slu(slu_t* slu); void ERREUR(const char *ch1, const char *ch2);