瀏覽代碼

Merged branch dev into acapela_tts

Unknown 8 年之前
父節點
當前提交
e1d4fb10b0
共有 5 個文件被更改,包括 147 次插入10 次删除
  1. 1 1
      Docs/neuron_template.md
  2. 93 1
      Docs/stt.md
  3. 1 0
      brain.yml
  4. 2 2
      core/ShellGui.py
  5. 50 6
      jarvis.py

+ 1 - 1
Docs/neuron_template.md

@@ -2,7 +2,7 @@
 
 ## Synopsis
 
-Little description of what the neuron do.
+Little description of what the neuron does.
 
 ## Options
 

+ 93 - 1
Docs/stt.md

@@ -1 +1,93 @@
-# Speech To Text (STT)
+# Speech To Text (STT)
+
+This chapter describes how STT are working.
+This configuration must apply in the settings.yml.
+
+The syntax used is YAML.
+
+## General defaults
+
+The setting.yml defines the STT you want to use by default
+```
+default_speech_to_text: "type default STT here"
+```
+
+Then, still in the settings.yml file, each STT must set up its configuration following 'speech_to_text' tag :
+```
+speech_to_text:
+   - STT1:
+      STT1parameter1: "value option1"
+      STT1parameter2: "value option2"
+   - STT2:
+      STT2parameter1: "value option1"
+```
+
+## Current Available STT
+
+### Google
+
+The google STT is based on the [Google Speech Recognition API](https://cloud.google.com/speech/)
+
+| parameter| required | default | choices | comments |
+|----------|----------|---------|---------|----------|
+| key      | No       | None    |         |          |
+| language | No       | en-US   | [lang](https://en.wikipedia.org/wiki/Google_Voice_Search#Supported_languages)   |LCID string|
+
+### Bing
+
+The Bing STT is based on the [Microsoft Bing Voice Recognition API](https://www.microsoft.com/cognitive-services/en-us/speech-api)
+
+| parameter| required | default | choices | comments |
+|----------|----------|---------|---------|----------|
+| key      | YES      | None    |         |User info |
+| language | No       | en-US   | [lang](https://www.microsoft.com/cognitive-services/en-us/speech-api)|7 languages|
+
+### wit.ai
+
+The wit.ai STT is based on the Microsoft [Wit.ai API](https://wit.ai/)
+
+| parameter| required | default | choices | comments |
+|----------|----------|---------|---------|----------|
+| key      | YES      | None    |         |User info |
+| language | No       | en-US   |[lang](https://docs.api.ai/docs/languages)|          |
+
+### api.ai
+
+The api.ai STT is based on the [api.ai API](https://api.ai/)
+
+| parameter| required | default | choices | comments |
+|----------|----------|---------|---------|----------|
+| key      | YES      | None    |         |User info |
+| language | No       | en-US   |[lang](https://docs.api.ai/docs/languages)|          |
+
+### Houndify
+
+Not working yet ... in coming
+
+| parameter| required | default | choices | comments |
+|----------|----------|---------|---------|----------|
+| key      | YES      | None    |         |User info |
+| client_id| YES      | None    |         |User info |
+| language | No       | en-US   | en-US   |          |
+
+## Full Example
+
+In the settings.yml file :
+
+```
+default_speech_to_text: "google"
+speech_to_text:
+  - google:
+      language: "fr-FR"
+  - wit:
+      key: "B5JI3YUSLYOYWNIZRNBVM34XUODME2K"
+  - bing:
+      key: "9e48dert65904838bedc11aea6b36fb0"
+  - apiai:
+      key: "e0cbff145af44944a6b9f82c0668b527"
+      language: "fr"
+  - houndify:
+      key: "6ej90T7qAV74OYXk4X4vI2Xhk7wPsJu4aEZ0G5Ll-BMmV1JGtFpCxtSH9SmTY4G3bpEJ7a5y_GTQid-CAKI6vw=="
+      client_id: "lM2JXeaSticbSo9-llczbA=="
+
+```

+ 1 - 0
brain.yml

@@ -6,6 +6,7 @@
             - "Hello, I'm Jarvis"
     signals:
       - order: "hello"
+      - order: "je voudrais ecouter {{ artist_name }}"
 
   - name: "say hello"
     neurons:

+ 2 - 2
core/ShellGui.py

@@ -112,9 +112,9 @@ class ShellGui:
         :param sentence_to_test:
         :return:
         """
-        print type(sentence_to_test)
         sentence_to_test = sentence_to_test.encode('utf-8')
-        print type(sentence_to_test)
+        tts_name = tts_name.encode('utf-8')
+
         Say(message=sentence_to_test, tts=tts_name)
 
     @staticmethod

+ 50 - 6
jarvis.py

@@ -1,22 +1,66 @@
 # -*- coding: utf-8 -*-
 import os
 
+import re
+
 from core.ConfigurationManager import SettingLoader
+from core.ConfigurationManager.BrainLoader import BrainLoader
 from core.CrontabManager import CrontabManager
+from core.Models import Order
 from core.OrderAnalyser import OrderAnalyser
 
 import logging
 
 from core.TriggerLauncher import TriggerLauncher
 
-logging.basicConfig()
-logger = logging.getLogger("jarvis")
-logger.setLevel(logging.DEBUG)
-order = "dis bonjour"
 
-oa = OrderAnalyser(order=order)
+# user_said = "maman je voudrais ecouter ACDC"
+# order = "je voudrais ecouter {{ artist_name }}"
+
+user_said = "regle le reveil pour sept heures et dix minutes"
+order = "regle le reveil pour {{ hour }} heures et {{ minute }} minutes"
+
+
+brain = BrainLoader.get_brain()
+# take a look to each order
+
+
+def _is_containing_bracket(sentence):
+    # print "sentence to test %s" % sentence
+    pattern = r"{{|}}"
+    # prog = re.compile(pattern)
+    bool = re.search(pattern, sentence)
+    if bool is not None:
+        return True
+    return False
+
+list_word = user_said.split()
+# list_word = ["je", "voudrais"]
+print "user said: %s" % list_word
+
+
+def _get_order_without_variables(list_word_in_order):
+
+   pass
+
+
+# check if the order contain bracket
+if _is_containing_bracket(order):
+    # get a table of word said
+    list_word_in_order = order.split()
+    print "order matched: %s" % list_word_in_order
+    split_orider_variable = _get_order_without_variables(list_word_in_order)
+
+
+# return the beginning of the sentence before first bracket
+# return sentence[:sentence.find('{{')]
+
+# split each word
+# 
+
+
+
 
-oa.start()