Эх сурвалжийг харах

Merge pull request #187 from kalliope-project/dev_nico

add syntax highlighter + review doc contributing STT
Monf 8 жил өмнө
parent
commit
68d4ce0dd0

+ 10 - 0
CHANGELOG.md

@@ -1,3 +1,13 @@
+v0.4.1 / 2017-01-12
+===================
+- add CORS support for REST API
+- fix installation of community STT and TTS
+- add feature: sound/sentence when Kalliope is ready
+- fix Raspbian install
+- add offline STT (CMUSphinx)
+- orders are not anymore case sensitive
+- add STT utils class to split the audio catching from the processing
+
 v0.4.0 / 2016-12-28
 ===================
 - Add resources directory (neuron, stt, tts, (trigger))

+ 9 - 9
Docs/brain.md

@@ -20,7 +20,7 @@ Kalliope will look for the brain in the order bellow:
 
 Let's take a look on a basic synapse in our brain:
 
-```
+```yml
 ---
   - name: "Say-hello"
     signals:
@@ -37,14 +37,14 @@ The file starts with: `---`. This is a requirement for YAML to interpret the fil
 Items that begin with a ```-``` are considered as list items. Items have the format of ```key: value``` where value can be a simple string or a sequence of other items.
 
 At the top level we have a "name" tag. This is the **unique identifier** of the synapse. It must be an unique word with the only accepted values : alphanumerics and dash. ([a - zA - Z0 - 9\-])
-```
+```yml
 - name: "Say-hello"
 ```
 
 
 The first part, called **signals** is a list of input actions. This works exactly the same way as neurons. You must place here at least one action.
 In the following example, we use just one signal, an order. See the complete list of [available signals](signals.md) here.
-```
+```yml
 signals:
   - order: "say-hello"
 ```
@@ -62,13 +62,13 @@ To know if your order will be triggered by Kalliope, we recommend you to [use th
 
 >**Note:**
 You must pay attention to define the orders as precise as possible. As Kalliope is based on matching, if you define your orders in different synapses too similiary, Kalliope risks to trigger more actions that you were expecting. For exemple, if you define two different synapses as shown below:
-```
+```yml
 - name: "Say-hello"
   signals:
     - order: "say hello"
 ```
 and 
-```
+```yml
 - name: "Say-something"
   signals:
     - order: "say"
@@ -76,7 +76,7 @@ and
 When you will pronounce "say hello", it will trigger both synapses. 
 
 Then we have the neurons declaration. Neurons are modules that will be executed when the input action is triggered. You can define as many neurons as you want to the same input action (for example: say somethning, then do something etc...). This declaration contains a list (because it starts with a "-") of neurons
-```
+```yml
 neurons:
     - neuron_1_name
     - neuron_2_name
@@ -86,7 +86,7 @@ neurons:
 The order of execution of neurons is defined by the order in which they are listed in neurons declaration.
 
 Some neurons need parameters that can be passed as arguments following the syntax bellow:
-```
+```yml
 neurons:
     - neuron_name:
         parameter1: "value1"
@@ -107,14 +107,14 @@ Kalliope provides also a REST API to manage your synapses (get the list, get one
 If you want a better visibly, or simply sort your actions in different files, you can split the main brain file into multiple ones.
 
 To do that, use the import statement in the entry brain.yml file with the following syntax:
-```
+```yml
   - includes:
       - path/to/sub_brain.yml
       - path/to/another_sub_brain.yml
 ```
 
 E.g:
-```
+```yml
   - includes:
       - brains/rolling_shutter_commands.yml
       - brains/find_my_phone.yml

+ 1 - 1
Docs/contributing.md

@@ -29,7 +29,7 @@ See the dedicated documentation depending on the type of module you want to code
 ## Constraints
 
 1. Respect [PEP 257](https://www.python.org/dev/peps/pep-0257/) -- Docstring conventions. For each class or method add a description with summary, input parameter, returned parameter,  type of parameter
-    ```
+    ```python
     def my_method(my_parameter):
         """
         Description of he method

+ 4 - 4
Docs/contributing/contribute_neuron.md

@@ -26,7 +26,7 @@ Creating a new Neuron must follow some rules:
 1. Inside the Neuron file, the Neuron Class name is in __uppercase__.
 1. The Neuron __inherits from the NeuronModule__ coming from the Core.
 
-    ```
+    ```python
     from core.NeuronModule import NeuronModule
     class Say(NeuronModule):
     ```
@@ -36,13 +36,13 @@ Creating a new Neuron must follow some rules:
 The constructor has a __**kwargs argument__ which is corresponding to the Dict of incoming variables:values defined either in the brain file or in the signal.
 1. The Neuron must refer to its __parent structure__ in the init by calling the super of NeuronModule.
 
-    ```
+    ```Python
     def __init__(self, **kwargs):
         super(Say, self).__init__(**kwargs)
     ```
 
 1. You must run unit tests with success before sending a pull request. Add new tests that cover the code you want to publish.
-    ```
+    ```bash
     cd /path/to/kalliope
     python -m unittest discover
     ```
@@ -75,7 +75,7 @@ myneuron/
 ```
 
 Example of neuron code
-```
+```python
 class Myneuron(NeuronModule):
 def __init__(self, **kwargs):
     super(Myneuron, self).__init__(**kwargs)

+ 23 - 22
Docs/contributing/contribute_stt.md

@@ -23,11 +23,11 @@ Creating a new STT must follow some rules:
 1. The STT must be coded in __Python 2.7__.
 1. Under the STT repository, include the __init__.py file which contains: *from stt import STT* (/!\ respect the Case)
 1. Inside the STT file, the STT Class name is in __uppercase__.
-1. The STT __inherits from the OrderListener__ coming from the Core.
+1. The STT __inherits from the SpeechRecognition__ coming from the Utils file in the STT package.
 
-    ```
-    from kalliope.core.OrderListener import OrderListener
-    class Google(OrderListener):
+    ```python
+    from kalliope.stt.Utils import SpeechRecognition
+    class Google(SpeechRecognition):
     ```
 
 1. The STT has a constructor __init__ which is the entry point.
@@ -36,16 +36,28 @@ The constructor has a __**kwargs argument__ which is corresponding to the Dict o
 1. The STT must init itself first.
 1. Attach the incoming callback to the self.attribute.
 1. Obtain audio from the microphone in the constructor. (Note : we mostly use the [speech_recognition library](https://pypi.python.org/pypi/SpeechRecognition/))
-1. Once you get the text back, let give it to the callback
+1. Use self.start_listening(self.my_callback) from the mother class to get an audio and pass it to the callback of your choice.
+1. The callback methode must implement two arguments: recognizer and audio. The audio argument contains the stream caught by the microphone
+1. Once you get the text back, let give it to the callback method received in the constructor
 
-    ```
+    ```python
     def __init__(self, callback=None, **kwargs):
         OrderListener.__init__(self)
         self.callback = callback
-        # -------------------
-        # do amazing code
-        # -------------------
-        self.callback(audio_to_text)
+        
+        self.argument_from_settings = kwargs.get('argument_from_settings', None)
+        
+        # start the microphone to capture an audio, give to the function a callback        
+        self.stop_listening = self.start_listening(self.my_callback)
+        
+        def my_callback((self, recognizer, audio):
+            # ---------------------------------------------
+            # do amazing code
+            # 'audio' contain stream caught by the microphone
+            # ---------------------------------------------
+            
+            # at the end of the process, send the text into the received callback method
+            self.callback(audio_to_text)
     ```
 
 
@@ -63,15 +75,4 @@ mystt/
 ```
 
 Example of STT code
-```
-class Mystt(OrderListener):
-def __init__(self, callback=None, **kwargs):
-        OrderListener.__init__(self)
-        self.callback = callback
-        # -------------------
-        # - get the microphone audio 
-        # - do amazing code to retrieve the text
-        # - call the callback giving it the result text -> self.callback(audio_to_text)
-        # -------------------
-        
-```
+- [Google STT](../../kalliope/stt/google/README.md)

+ 3 - 3
Docs/contributing/contribute_tts.md

@@ -25,7 +25,7 @@ Creating a new TTS must follow some rules:
 1. Inside the TTS file, the TTS Class name is in __uppercase__.
 1. The TTS __inherits from the TTSModule__ coming from the Core.
 
-    ```
+    ```python
     from kalliope.core.TTS.TTSModule import TTSModule
     class Pico2wave(TTSModule):
     ```
@@ -35,7 +35,7 @@ Creating a new TTS must follow some rules:
 The constructor has a __**kwargs argument__ which is corresponding to the Dict of incoming variables:values defined either in the settings file.
 1. The TTS must refer to its __parent structure__ in the init by calling the super of TTSModule.
 
-    ```
+    ```python
     def __init__(self, **kwargs):
         super(Pico2wave, self).__init__(**kwargs)
     ```
@@ -59,7 +59,7 @@ mytts/
 ```
 
 Example of TTS code
-```
+```python
 class Mytts(TTSModule):
 def __init__(self, **kwargs):
     super(Mytts, self).__init__(**kwargs)

+ 1 - 1
Docs/contributing/dna.md

@@ -16,7 +16,7 @@ This file has a yaml syntax and must be present to allow Kalliope to install it
 ## DNA file examples
 
 A dna file for a neuron
-```
+```yml
 name: "wikipedia_searcher"
 type: "neuron"
 author: "The dream team of Kalliope project"

+ 2 - 2
Docs/contributing/installation_file.md

@@ -11,7 +11,7 @@ A playbook is like a recipe or an instructions manual which tells Ansible what t
 
 Let's see a basic playbook, the one used by the neuron [wikipedia_searcher](https://github.com/kalliope-project/kalliope_neuron_wikipedia)
 
-```
+```yml
 - name: Kalliope wikipedia_searcher neuron install
   hosts: localhost
   gather_facts: no
@@ -43,7 +43,7 @@ The only task we've added here is based on the [pip Ansible module](http://docs.
 Ansible comes with a lot of modules, see the [complete list here](http://docs.ansible.com/ansible/modules_by_category.html).
 
 Here is an example which use the [apt module](http://docs.ansible.com/ansible/apt_module.html) to install Debian packages
-```
+```yml
 tasks:
   - name: Install packages
     apt: name={{ item }} update_cache=yes

+ 2 - 2
Docs/contributing/neuron_template.md

@@ -5,7 +5,7 @@
 Little description of what the neuron does.
 
 ## Installation
-```
+```bash
 kalliope install --git-url https://github.com/my_user/my_neuron.git
 ```
 
@@ -34,7 +34,7 @@ Only necessary when the neuron use a template to say something
 ## Synapses example
 
 Description of what the synapse will do
-```
+```yml
  - name: "type here your name"
    signals:
      - order: "this is what I have to say to run this synapse"

+ 3 - 2
Docs/contributing/stt_template.md

@@ -5,8 +5,9 @@
 Description of your STT
 
 ## Installation
-
-    kalliope install --git-url https://github.com/username/mystt.git
+```bash
+kalliope install --git-url https://github.com/username/mystt.git
+```
 
 ## Options
 

+ 15 - 15
Docs/installation.md

@@ -13,81 +13,81 @@ Please follow the right link bellow to install requirements depending on your ta
 ### Method 1 - User install using the PIP package
 
 You can install kalliope on your system by using Pypi:
-```
+```bash
 sudo pip install kalliope
 ```
 
 ### Method 2 - Manual setup using sources
 
 Clone the project:
-```
+```bash
 git clone https://github.com/kalliope-project/kalliope.git
 cd kalliope
 ```
 
 Install the project:
-```
+```bash
 sudo python setup.py install
 ```
 
 ### Method 3 - Developer install using Virtualenv
 
 Install the `python-virtualenv` package:
-```
+```bash
 sudo apt-get install python-virtualenv
 ```
 
 Clone the project:
-```
+```bash
 git clone https://github.com/kalliope-project/kalliope.git
 cd kalliope
 ```
 
 Generate a local python environment:
-```
+```bash
 virtualenv venv
 ```
 
 Install the project using the local environment:
-```
+```bash
 venv/bin/pip install --editable .
 ```
 
 ### Method 4 - Developer, dependencies install only
 
 Clone the project:
-```
+```bash
 git clone https://github.com/kalliope-project/kalliope.git
 cd kalliope
 ```
 
 Install the python dependencies directly:
-```
+```bash
 sudo pip install -r install/python_requirements.txt
 ```
 
 ## Test your env
 
 To ensure that you can record your voice, run the following command to capture audio input from your microphone:
-```
+```bash
 rec test.wav
 ```
 
 Press CTRL-C after capturing a sample of your voice.
 
 Then play the recorded audio file
-```
+```bash
 mplayer test.wav
 ```
 
 You can then test that your Kalliope is working by using the "bonjour" order integrated in the [default brain](../kalliope/brain.yml).
 Start kalliope:
-```
+```bash
 kalliope start
 ```
 
 Kalliope will load default settings and brain, the output should looks the following
-```
+```bash
 Starting event manager
 Events loaded
 Starting Kalliope
@@ -97,13 +97,13 @@ Starting REST API Listening port: 5000
 
 Then speak the hotwork out loud to wake up Kalliope. By default, the hotwork is "Kalliopé" with the french pronunciation.
 If the trigger is successfully raised, you'll see "say something" into the console. 
-```
+```bash
 2016-12-05 20:54:21,950 :: INFO :: Keyword 1 detected at time: 2016-12-05 20:54:21
 Say something!
 ```
 
 Then you can say "bonjour" and listen the Kalliope response.
-```
+```bash
 Say something!
 Google Speech Recognition thinks you said Bonjour
 Order matched in the brain. Running synapse "say-hello-fr"

+ 4 - 4
Docs/installation/debian_jessie.md

@@ -3,26 +3,26 @@
 ## Debian packages requirements
 
 Edit `/etc/apt/sources.list` and check that you have `contrib` and `non-free` are enabled:
-```
+```bash
 deb http://httpredir.debian.org/debian jessie main contrib non-free
 deb-src http://httpredir.debian.org/debian jessie main contrib non-free
 ```
 
 Install some required system libraries and softwares:
 
-```
+```bash
 sudo apt-get update
 sudo apt-get install git python-dev libsmpeg0 libttspico-utils libsmpeg0 flac dialog libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential libssl-dev libffi-dev sox libatlas3-base mplayer
 ```
 
 Let's install the last release of python-pip
-```
+```bash
 wget https://bootstrap.pypa.io/get-pip.py
 sudo python get-pip.py
 ```
 
 Then, with pip, the last release of setuptools
-```
+```bash
 sudo pip install -U setuptools
 ```
 

+ 13 - 13
Docs/installation/raspbian_jessie.md

@@ -12,13 +12,13 @@
 
 Install some required system libraries and software:
 
-```
+```bash
 sudo apt-get update
 sudo apt-get install git python-dev libsmpeg0 libttspico-utils libsmpeg0 flac dialog libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential libssl-dev libffi-dev sox libatlas3-base mplayer
 ```
 
 Let's install the last release of python-pip
-```
+```bash
 wget https://bootstrap.pypa.io/get-pip.py
 sudo python get-pip.py
 ```
@@ -30,24 +30,24 @@ This part deals with the special configuration needed to get kalliope working on
 ### Packages
 
 On a Raspberry Pi, pulseaudio is not installed by default
-```
+```bash
 sudo apt-get install pulseaudio pulseaudio-utils
 ```
 
 Start the pulseaudio server
-```
+```bash
 pulseaudio -D
 ```
 
 ### Microphone configuration
 
 Get your output card
-```
+```bash
 aplay -l
 ```
 
 Output example with a USB headset connected
-```
+```bash
 **** List of PLAYBACK Hardware Devices ****
 card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
   Subdevices: 7/8
@@ -73,12 +73,12 @@ Here, we can see that we have
 
 
 Get your input (microphone card)
-```
+```bash
 arecord -l
 ```
 
 Output example with a USB headset connected
-```
+```bash
 **** List of CAPTURE Hardware Devices ****
 card 1: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
   Subdevices: 0/1
@@ -109,26 +109,26 @@ pcm.!default {
 Where `playback.pcm` is the output audio and the `capture.pcm` is the input audio.
 
 Restart alsa to apply changes
-```
+```bash
 sudo /etc/init.d/alsa-utils restart
 ```
 
 You can adjust the microphone sensibility by running alsamixer:
-```
+```bash
 alsamixer
 ```
 And then select your microphone device by pressing F6 and finally move up the `mic` sensibility level
 ![logo](../../images/alsamixer_mic_level.png)
 
 To ensure that you can record your voice, run the following command to capture audio input from your microphone
-```
+```bash
 rec test.wav
 ```
 
 Press CTRL-C after capturing a sample of your voice.
 
 Then play the recorded audio file
-```
+```bash
 mplayer test.wav
 ```
 
@@ -138,6 +138,6 @@ mplayer test.wav
 By default the audio stream will get out by HDMI if something is plugged to this port.
 Check the [official documentation](https://www.raspberrypi.org/documentation/configuration/audio-config.md) to switch from HDMI to analog.
 
-```
+```bash
 sudo raspi-config
 ```

+ 1 - 1
Docs/installation/ubuntu_14.04.md

@@ -4,7 +4,7 @@
 
 Install some required system libraries and softwares:
 
-```
+```bash
 sudo apt-get update
 sudo apt-get install git python-pip python-dev libsmpeg0 libttspico-utils libsmpeg0 flac dialog libffi-dev libffi-dev libssl-dev libjack0 libjack-dev portaudio19-dev build-essential libssl-dev libffi-dev sox libatlas3-base mplayer
 ```

+ 1 - 1
Docs/installation/ubuntu_16.04.md

@@ -4,7 +4,7 @@
 
 Install some required system libraries and softwares:
 
-```
+```bash
 sudo apt-get update
 sudo apt-get install git python-pip python-dev libsmpeg0 libttspico-utils libsmpeg0 flac dialog libffi-dev libffi-dev libssl-dev portaudio19-dev build-essential libssl-dev libffi-dev sox libatlas3-base mplayer
 ```

+ 12 - 12
Docs/kalliope_cli.md

@@ -2,12 +2,12 @@
 
 ## SYNOPSIS
 This is the syntax used to run Kalliope from command line
-```
+```bash
 kalliope command --option <argument>
 ```
 
 For example, to start Kalliope we simply use
-```
+```bash
 kalliope start
 ```
 
@@ -17,7 +17,7 @@ kalliope start
 Start Kalliope main program
 
 Example of use
-```
+```bash
 kalliope start
 ```
 
@@ -28,7 +28,7 @@ Launch the Kalliope shell Graphical User Interface.
 The GUI allows you to test your [STT](stt.md) and [TTS](tts.md) that you have configured in [settings.yml](default_settings.md) file of Kalliope.
 
 Example of use
-```
+```bash
 kalliope gui
 ```
 
@@ -36,12 +36,12 @@ kalliope gui
 Install a community module. You must set an install type option. Currently the only available option is `--git-url`.
 
 Syntax
-```
+```bash
 kalliope install --git-url <url>
 ```
 
 Example of use
-```
+```bash
 kalliope install --git-url https://github.com/kalliope-project/kalliope_neuron_wikipedia.git
 ```
 
@@ -53,11 +53,11 @@ Commands can be completed by the following options:
 Display the current isntalled version of Kalliope.
 
 Example of use
-```
+```bash
 kalliope --version
 ```
 
-```
+```bash
 kalliope -v
 ```
 
@@ -66,7 +66,7 @@ kalliope -v
 Run a specific synapse from the brain file.
 
 Example of use
-```
+```bash
 kalliope start --run-synapse "say-hello"
 ```
 
@@ -76,12 +76,12 @@ Replace the default brain file from the root of the project folder by a custom o
 > **Important note:** The path must be absolute. The absolute path contains the root directory and all other subdirectories in which a file or folder is contained. 
 
 Example of use
-```
+```bash
 kalliope start --brain-file /home/me/my_other_brain.yml
 ```
 
 You can combine the options together like, for example:
-```
+```bash
 kalliope start --run-synapse "say-hello" --brain-file /home/me/my_other_brain.yml
 ```
 
@@ -90,7 +90,7 @@ kalliope start --run-synapse "say-hello" --brain-file /home/me/my_other_brain.ym
 Show debug output in the console
 
 Example of use
-```
+```bash
 kalliope start --debug
 ```
 

+ 11 - 11
Docs/neurons.md

@@ -8,12 +8,12 @@ You can add as many neurons as you want to a synapse. The neurons are executed o
 Core neurons are already packaged with the installation of kalliope an can be used out of the box. Community neuron need to be installed manually.
 
 Use the CLI
-```
+```bash
 kalliope install --git-url <git_url>
 ```
 
 E.g:
-```
+```bash
 kalliope install --git-url https://github.com/kalliope-project/kalliope_neuron_wikipedia.git
 ```
 
@@ -22,7 +22,7 @@ You may be prompted to type your `sudo` password during the process. You can see
 ## Usage
 Neurons are declared in the `neurons` section of a synapse in your brain file.
 The `neurons` section is a list (because it starts with a "-") which contains neuron modules names
-```
+```yml
 neurons:
     - neuron_1_name
     - neuron_2_name
@@ -30,7 +30,7 @@ neurons:
 ```
 
 Some neurons need parameters that can be passed as arguments following the syntax bellow:
-```
+```yml
 neurons:
     - neuron_name:
         parameter1: "value1"
@@ -50,7 +50,7 @@ Neurons require some **parameters** from the synapse declaration to work. Those
 - from the captured order
 
 From the neuron declaration:
-```
+```yml
 neurons:
     - neuron_name:
         parameter1: "value1"
@@ -58,7 +58,7 @@ neurons:
 ```
 
 From the captured order:
-```
+```yml
   - name: "run-neuron-with-parameter-in-order"
     signals:
       - order: "this is an order with the parameter {{ parameter3 }}"
@@ -93,7 +93,7 @@ It is {{ hours }} and {{ minutes }} minutes.
 ```
 
 Placed in a complete synapse, it looks like the following
-```
+```yml
 - name: "time"
     signals:
       - order: "what time is it"
@@ -116,7 +116,7 @@ We can add some logic to a template with tags. Here a simple example with [a tes
 ```
 
 As this is multi-lines, we can put the content in a file and use a `file_template` instead of a `say_template` for more clarity.
-```
+```yml
 - name: "time"
     signals:
       - order: "what time is it"
@@ -135,14 +135,14 @@ set in [settings.yml](settings.md) file.
 
 You can override the default cache configuration. By default Kalliope uses a cache to save a generated audio from a TTS engine.
 This cache is useful to manage sentences that are not suppose to be changed very often. For example, the following sentence will not change in time, so it's more optimized to generate it once and to keep it in cash:
-```
+```yml
 - say:
     message:
       - "Hello, sir"
 ```
 
 In some cases, especially when the neuron is based on a template, the generated audio will change on each new call of the neuron and so the usage of a cache is not necessary. The best example of the case like this is the `systemdate` neuron. As the time changes every minute, the generated audio will change too and so, saving the generated audio in the cache is useless. In this case, you can override the cache usage for this neuron:
-```
+```yml
 - systemdate:
     say_template:
       - "It's {{ hours }} hour and {{ minutes }} minute"
@@ -152,7 +152,7 @@ In some cases, especially when the neuron is based on a template, the generated
 ### tts
 
 You can override the default tts for each neurons. Just add the "tts" parameter to the neuron like in the example bellow
-```
+```yml
 neurons:
   - say:
     message:

+ 11 - 11
Docs/rest_api.md

@@ -20,12 +20,12 @@ Kalliope provides the REST API to manage the synapses. For configuring the API r
 Normal response codes: 200
 Error response codes: unauthorized(401), itemNotFound(404)
 Curl command:
-```
+```bash
 curl -i --user admin:secret -X GET  http://localhost:5000/synapses/
 ```
 
 Output example:
-```
+```JSON
 {
   "synapses": [
     [
@@ -74,12 +74,12 @@ Output example:
 Normal response codes: 200
 Error response codes: unauthorized(401), itemNotFound(404)
 Curl command:
-```
+```bash
 curl -i --user admin:secret -X GET  http://localhost:5000/synapses/say-hello
 ```
 
 Output example:
-```
+```JSON
 {
   "synapses": {
     "name": "say-hello",
@@ -106,12 +106,12 @@ Output example:
 Normal response codes: 201
 Error response codes: unauthorized(401), itemNotFound(404)
 Curl command:
-```
+```bash
 curl -i --user admin:secret -X POST  http://localhost:5000/synapses/say-hello
 ```
 
 Output example:
-```
+```JSON
 {
   "synapses": {
     "name": "say-hello",
@@ -140,22 +140,22 @@ Normal response codes: 201
 Error response codes: unauthorized(401), itemNotFound(404)
 
 Curl command:
-```
+```bash
 curl -i --user admin:secret -H "Content-Type: application/json" -X POST -d '{"order":"my order"}' http://localhost:5000/order/
 ```
 
 If the order contains accent or quotes, use a file for testing with curl
-```
+```bash
 cat post.json 
 {"order":"j'aime"}
 ```
 Then
-```
+```bash
 curl -i --user admin:secret -H "Content-Type: application/json" -X POST --data @post.json http://localhost:5000/order/
 ```
 
 Output example if the order have matched and so launched synapses:
-```
+```JSON
 {
   "synapses": [
     {
@@ -177,7 +177,7 @@ Output example if the order have matched and so launched synapses:
 ```
 
 If the order haven't match ny synapses:
-```
+```JSON
 {
   "error": {
     "error": "The given order doesn't match any synapses"

+ 27 - 27
Docs/settings.md

@@ -28,7 +28,7 @@ The trigger is the module detecting the hotword that will wake up Kalliope.
 Common usage of hotword include Alexa on Amazon Echo, OK Google on some Android devices and Hey Siri on iPhones.
 
 Specify the name of the trigger module you want to use.
-```
+```yml
 default_trigger: "trigger_name"
 ```
 
@@ -39,14 +39,14 @@ Available triggers for Kalliope are:
 The hotword (also called a wake word or trigger word) detector is the engine in charge of waking up Kalliope.
 
 Each Trigger has it own configuration. This configuration is passed as argument following the syntax bellow
-```
+```yml
 triggers:
   - trigger_name:
       parameter_name: "value"
 ```
 
 E.g, the default Snowboy trigger configuration is
-```
+```yml
 triggers:
   - snowboy:
       pmdl_file: "trigger/snowboy/resources/model.pmdl"
@@ -62,12 +62,12 @@ A Speech To Text(STT) is an engine used to translate what you say into a text th
 By default, Kalliope uses google STT engine.
 
 The following syntax is used to provide the engine name:
-```
+```yml
 default_speech_to_text: "stt_name"
 ```
 
 E.g
-```
+```yml
 default_speech_to_text: "google"
 ```
 
@@ -75,14 +75,14 @@ Get the full list of [SST engine here](stt.md).
 
 #### speech_to_text
 Each STT has it own configuration. This configuration is passed as argument as shown bellow
-```
+```yml
 speech_to_text:
   - stt_name:
       parameter_name: "value"
 ```
 
 E.g:
-```
+```yml
 speech_to_text:
   - google:
       language: "fr-FR"
@@ -98,12 +98,12 @@ A Text To Speech is an engine used to translate written text into a speech, into
 By default, Kalliope use Pico2wave TTS engine.
 
 The following syntax is used to provide the TTS engine name
-```
+```yml
 default_text_to_speech: "tts_name"
 ```
 
 Eg
-```
+```yml
 default_text_to_speech: "pico2wave"
 ```
 
@@ -111,14 +111,14 @@ Get the full list of [TTS engine here](tts.md).
 
 #### text_to_speech
 Each TTS has it own configuration. This configuration is passed as argument following the syntax bellow
-```
+```yml
 text_to_speech:
   - tts_name:
       parameter_name: "value"
 ```
 
 E.g
-```
+```yml
 text_to_speech:
   - pico2wave:
       language: "fr-FR"
@@ -135,14 +135,14 @@ When Kalliope detects your trigger/hotword/magic word, it lets you know that it'
 one of the sentences provided in the variable random_wake_up_answers.
 
 This variable must contain a list of strings as shown bellow
-```
+```yml
 random_wake_up_answers:
   - "You sentence"
   - "Another sentence"
 ```
 
 E.g
-```
+```yml
 random_wake_up_answers:
   - "Yes sir?"
   - "I'm listening"
@@ -159,14 +159,14 @@ Place here a list of full paths of the sound files you want to use. Otherwise, y
 By default two file are provided: ding.wav and dong.wav. In all cases, the file must be in `.wav` or `.mp3` format. If more than on file is present in the list,
 Kalliope will select one randomly at each wake up.
 
-```
+```yml
 random_wake_up_sounds:
   - "local_file_in_sounds_folder.wav"
   - "/my/personal/full/path/my_file.mp3"
 ```
 
 E.g
-```
+```yml
 random_wake_up_sounds:
   - "ding.wav"
   - "dong.wav"
@@ -184,14 +184,14 @@ When Kalliope is ready, it lets you know that it's operational and now waiting f
 one of the sentences provided in the variable random_on_ready_answers.
 
 This variable must contain a list of strings as shown bellow
-```
+```yml
 random_on_ready_answers:
   - "Your sentence"
   - "Another sentence"
 ```
 
 E.g
-```
+```yml
 random_on_ready_answers:
   - "I am ready"
   - "Let's roll"
@@ -203,14 +203,14 @@ Place here a list of full paths of the sound files you want to use. Otherwise, y
 By default two file are provided: ding.wav and dong.wav. In all cases, the file must be in `.wav` or `.mp3` format. If more than on file is present in the list,
 Kalliope will select one randomly at each wake up.
 
-```
+```yml
 random_on_ready_sounds:
   - "local_file_in_sounds_folder.wav"
   - "/my/personal/full/path/my_file.mp3"
 ```
 
 E.g
-```
+```yml
 random_on_ready_sounds:
   - "ding.wav"
   - "dong.wav"
@@ -231,7 +231,7 @@ A Rest API can be activated in order to:
 For the complete API ref see the [REST API documentation](rest_api.md)
 
 Settings examples:
-```
+```yml
 rest_api:
   active: True
   port: 5000
@@ -261,17 +261,17 @@ If you want to allow request from external application, you'll need to enable th
 To do so, just indicated the origins that are allowed to leverage the API. The authorize values are:
 
 False to forbid CORS request.
-```
+```yml
 allowed_cors_origin: False
 ```
 
 or either a string or a list:
-```
+```yml
 allowed_cors_origin: "*"
 ```
 (in case of "*", all origins are accepted).
 or
-```
+```yml
 allowed_cors_origin:
   - 'http://mydomain.com/*'
   - 'http://localhost:4200/*'
@@ -283,12 +283,12 @@ Remember that an origin is composed of the scheme (http(s)), the port (eg: 80, 4
 
 Run a default [synapse](brain.md) when Kalliope can't find the order in any synapse.
 
-```
+```yml
 default_synapse: "synapse-name"
 ```
 
 E.g
-```
+```yml
 default_synapse: "Default-response"
 ```
 
@@ -297,13 +297,13 @@ default_synapse: "Default-response"
 The resources directory is the path where Kalliope will try to load community modules like Neurons, STTs or TTSs.
 Set a valid path is required if you want to install community neuron. The path can be relative or absolute.
 
-```
+```yml
 resource_directory:
   resource_name: "path"
 ```
 
 E.g
-```
+```yml
 resource_directory:
   neuron: "resources/neurons"
   stt: "resources/stt"

+ 10 - 10
Docs/signals.md

@@ -3,7 +3,7 @@
 A signal is an input event triggered by a synapse. When a signal is caught, Kalliope runs attached neurons of the synapse. The signal can be of two types: order and event.
 
 The syntax is the following
-```
+```yml
 signals:
     - signal_type: parameter
 ```
@@ -14,13 +14,13 @@ signals:
 An **order** signal is a word, or a sentence caught by the microphone and processed by the STT engine.
 
 Syntax:
-```
+```yml
 signals:
     - order: "<sentence>"
 ```
 
 Example:
-```
+```yml
 signals:
     - order: "please do this action"
 ```
@@ -40,7 +40,7 @@ will be started by Kalliope. So keep in mind that the best practice is to use re
 You can add one or more arguments to an order by adding bracket to the sentence.
 
 Syntax:
-```
+```yml
 signals:
     - order: "<sentence> {{ arg_name }}"
     - order: "<sentence> {{ arg_name }} <sentence>"
@@ -48,7 +48,7 @@ signals:
 ```
 
 Example:
-```
+```yml
 signals:
     - order: "I want to listen {{ artist_name }}"
     - order: "start the {{ episode_number }} episode"
@@ -75,7 +75,7 @@ The event system is based on [APScheduler](http://apscheduler.readthedocs.io/en/
 When you declare an event in the signal, Kalliope will schedule the launching of the target synapse.
 
 The syntax of an event declaration in a synapse is the following
-```
+```yml
 signals:
   - event:
       parameter1: "value1"
@@ -83,7 +83,7 @@ signals:
 ```
 
 For example, if we want Kalliope to run the synapse every day a 8:30, the event will be declared like this:
-```
+```yml
 - event:
     hour: "8"
     minute: "30"
@@ -132,7 +132,7 @@ Let's make a complete example. We want Kalliope to wake us up each morning of wo
 - Play our favourite web radio
 
 The synapse in the brain would be
-```
+```yml
   - name: "wake-up"
     signals:
       - event:
@@ -152,7 +152,7 @@ The synapse in the brain would be
 ```
 
 After setting up an event, you must restart Kalliope
-```
+```bash
 python kalliope.py start
 ```
 
@@ -166,7 +166,7 @@ That's it, the synapse is now scheduled and will be started automatically.
 
 
 ####  Make Kalliope say something on the third Friday of June, July, August, November and December at 00:00, 01:00, 02:00 and 03:00
-```
+```yml
 - name: "wake-up"
   signals:
     - event:

+ 4 - 4
Docs/stt.md

@@ -10,12 +10,12 @@ The configuration of each STT you use must appear in the [settings.yml](settings
 ## Settings
 
 The setting.yml defines the STT you want to use by default
-```
+```yml
 default_speech_to_text: "type default STT here"
 ```
 
 Then, still in the settings.yml file, each STT must set up its configuration following the 'speech_to_text' tag :
-```
+```yml
 speech_to_text:
    - STT1:
       STT1parameter1: "value option1"
@@ -40,7 +40,7 @@ Core STTs are already packaged with the installation of Kalliope an can be used
 Community STTs need to be installed manually.
 
 Use the CLI
-```
+```bash
 kalliope install --git-url <git_url>
 ```
 
@@ -50,7 +50,7 @@ You may be prompted to type your `sudo` password during the process. You can see
 
 In the settings.yml file :
 
-```
+```yml
 default_speech_to_text: "google"
 speech_to_text:
   - google:

+ 1 - 1
Docs/trigger.md

@@ -11,7 +11,7 @@ Once downloaded:
 - place the file in your personal config folder.
 - update the path of **pmdl_file** in [your settings](settings.md).
 
-If you want to keep "Kalliope" as the name of your bot, we recommend you to enhance the existing Snowboy model for your language.
+If you want to keep "Kalliope" as the name of your bot, we recommend you to __enhance the existing Snowboy model for your language__.
 
 We will update the following list with all Kalliope model created by the community. If the model doesn't exist, please create one with the following syntax:
 ```

+ 5 - 5
Docs/tts.md

@@ -13,14 +13,14 @@ The configuration of each TTS you use must appear in the [settings.yml](settings
 ### default_text_to_speech
 
 The `setting.yml` defines the STT you want to use by default
-```
+```yml
 default_text_to_speech: "type default TTS engine name here"
 ```
 
 ### text_to_speech
 
 Still in the `settings.yml` file, each TTS must set up its configuration following the 'text_to_speech' tag :
-```
+```yml
 text_to_speech:
    - TTS1:
       TTS1parameter1: "value option1"
@@ -38,7 +38,7 @@ is played by the audio player. Before generating a new audio file, Kalliope will
 TSS engine if the file has been generated before.
 
 You must set a path where the cache will be saved in the tag `cache_path`. This one is placed in /tmp by default.
-```
+```yml
 cache_path: "/tmp/kalliope_tts_cache"
 ```
 
@@ -63,7 +63,7 @@ Core TTSs are already packaged with the installation of Kalliope an can be used
 Community TTSs need to be installed manually.
 
 Use the CLI
-```
+```bash
 kalliope install --git-url <git_url>
 ```
 
@@ -71,7 +71,7 @@ You may be prompted to type your `sudo` password during the process. You can see
 
 ## Full Example
 
-```
+```yml
 default_text_to_speech: "voicerss"
 
 cache_path: "/tmp/kalliope_tts_cache"

+ 7 - 4
README.md

@@ -15,7 +15,7 @@ write it by yourself and add it to your project. You can also propose it to the
 Kalliope can run on all Linux Debian based distribution including a Raspberry Pi and it's multi-lang. The only thing you need is a microphone.
 
 Kalliope is easy-peasy to use, see the hello world
-```
+```yml
   - name: "Hello-world"
     signals:
       - order: "say hello"
@@ -67,9 +67,12 @@ Reading through this guide before writing any code is recommended.
 
 > **Meaning of Kalliope** Kalliope means "beautiful voice" from Greek καλλος (kallos) "beauty" and οψ (ops) "voice". 
 In Greek mythology she was a goddess of epic poetry and eloquence, one of the nine Muses.
-PRONOUNCED: kə-LIE-ə-pee (English) 
-PRONOUNCED: Ka-li-o-pé (French)
-PRONOUNCED: каллиопа (Russian)
+
+kə-LIE-ə-pee    (English) 
+Ka-li-o-pé      (French)
+каллиопа        (Russian)
+
+[Improve models with Snowboy](Docs/trigger.md)
 
 ## Links
 

+ 1 - 1
kalliope/settings.yml

@@ -15,7 +15,7 @@ default_trigger: "snowboy"
 # - snowboy
 triggers:
   - snowboy:
-      pmdl_file: "trigger/snowboy/resources/kalliope-FR-13samples.pmdl"
+      pmdl_file: "trigger/snowboy/resources/kalliope-FR-20samples.pmdl"
 
 
 # ---------------------------

+ 0 - 1
kalliope/stt/apiai/apiai.py

@@ -1,7 +1,6 @@
 import speech_recognition as sr
 
 from kalliope.core import Utils
-from kalliope.core.OrderListener import OrderListener
 from kalliope.stt.Utils import SpeechRecognition
 
 

BIN
kalliope/trigger/snowboy/resources/kalliope-FR-13samples.pmdl


BIN
kalliope/trigger/snowboy/resources/kalliope-FR-20samples.pmdl