Browse Source

rename project in the code

Nicolas Marcq 8 years ago
parent
commit
29110a8a25

+ 3 - 3
Docs/automated_install.md

@@ -3,12 +3,12 @@
 Clone the project
 Clone the project
 ```
 ```
 cd
 cd
-git clone https://repo/jarvis.git
+git clone https://repo/kalliope.git
 ```
 ```
 
 
 Run the install script.
 Run the install script.
 ```
 ```
-./jarvis/install/install_jarvis.sh
+./kalliope/install/install_kalliope.sh
 ```
 ```
 
 
 >**Note:** The install script must not be ran as root or with sudo. 
 >**Note:** The install script must not be ran as root or with sudo. 
@@ -26,4 +26,4 @@ Then play the recorded audio file
 play test.wav
 play test.wav
 ```
 ```
 
 
-If everything is ok, you can start playing with kalliope. First, 
+If everything is ok, you can start playing with Kalliope. First, 

+ 4 - 4
Docs/brain.md

@@ -62,7 +62,7 @@ neurons:
 ```
 ```
 Not here that parameters are indented with one tabulation bellow the neuron's name.
 Not here that parameters are indented with one tabulation bellow the neuron's name.
 
 
-In this example, the neuron called "say" will make Jarvis speak out loud the sentence in parameter **message**.
+In this example, the neuron called "say" will make Kalliope speak out loud the sentence in parameter **message**.
 See the complete list of [available neurons](neurons.md) here.
 See the complete list of [available neurons](neurons.md) here.
 
 
 The last part, called **signals** is a list of input action. This last works exactly the same way as neurons. You must place here at least one action.
 The last part, called **signals** is a list of input action. This last works exactly the same way as neurons. You must place here at least one action.
@@ -73,10 +73,10 @@ signals:
 ```
 ```
 
 
 In this example, the task is launched when the captured order contains "say hello". This means the order would start if you say
 In this example, the task is launched when the captured order contains "say hello". This means the order would start if you say
-- "say hello jarvis"
-- "jarvis, say hello"
+- "say hello Kalliope"
+- "Kalliope, say hello"
 - "I want you to say hello"
 - "I want you to say hello"
 - "i say goodbye you say hello"
 - "i say goodbye you say hello"
 - "whatever I say as long it contains say hello"
 - "whatever I say as long it contains say hello"
 
 
-To know if your spoken order will be triggered by jarvis, we recommend you to [use the GUI](jarvis_cli.md) for testing your STT engine.
+To know if your spoken order will be triggered by Kalliope, we recommend you to [use the GUI](kalliope_cli.md) for testing your STT engine.

+ 3 - 3
Docs/kalliope_cli.md

@@ -51,8 +51,8 @@ To use another brain file than the default one from the root of the project fold
 
 
 Example usage
 Example usage
 ```
 ```
-python jarvis.py start --brain-file /home/me/my_other_brain.yml
-python jarvis.py start --run-synapse "say hello" --brain-file /home/me/my_other_brain.yml
+python kalliope.py start --brain-file /home/me/my_other_brain.yml
+python kalliope.py start --run-synapse "say hello" --brain-file /home/me/my_other_brain.yml
 ```
 ```
 
 
 ### --debug
 ### --debug
@@ -61,5 +61,5 @@ Show debug output in the console
 
 
 Example usage
 Example usage
 ```
 ```
-python jarvis.py start --debug
+python kalliope.py start --debug
 ```
 ```

+ 1 - 1
brain.yml

@@ -113,7 +113,7 @@
     signals:
     signals:
       - order: "playbook"
       - order: "playbook"
 
 
-  - name: "Stop jarvis"
+  - name: "Stop kalliope"
     neurons:
     neurons:
       - say:
       - say:
           message: "Aurevoir"
           message: "Aurevoir"

+ 1 - 1
core/Cache.py

@@ -5,7 +5,7 @@ import logging
 from core.FileManager import FileManager
 from core.FileManager import FileManager
 
 
 DEFAULT_MODULE_NAME = "default"
 DEFAULT_MODULE_NAME = "default"
-DEFAULT_CACHE_PATH = "/tmp/jarvis/tts"
+DEFAULT_CACHE_PATH = "/tmp/kalliope/tts"
 DEFAULT_CACHE_EXTENSION = "tts"
 DEFAULT_CACHE_EXTENSION = "tts"
 DEFAULT_LANGUAGE = "default"
 DEFAULT_LANGUAGE = "default"
 DEFAULT_VOICE = "default"
 DEFAULT_VOICE = "default"

+ 2 - 2
core/ConfigurationManager/BrainLoader.py

@@ -118,9 +118,9 @@ class BrainLoader(object):
         Return the full path of the default brain file
         Return the full path of the default brain file
         :return:
         :return:
         """
         """
-        # get current script directory path. We are in /an/unknown/path/jarvis/core/ConfigurationManager
+        # get current script directory path. We are in /an/unknown/path/kalliope/core/ConfigurationManager
         cur_script_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
         cur_script_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-        # get parent dir. Now we are in /an/unknown/path/jarvis
+        # get parent dir. Now we are in /an/unknown/path/kalliope
         parent_dir = os.path.normpath(cur_script_directory + os.sep + os.pardir + os.sep + os.pardir)
         parent_dir = os.path.normpath(cur_script_directory + os.sep + os.pardir + os.sep + os.pardir)
         brain_path = parent_dir + os.sep + "brain.yml"
         brain_path = parent_dir + os.sep + "brain.yml"
         logger.debug("Real brain.yml path: %s" % brain_path)
         logger.debug("Real brain.yml path: %s" % brain_path)

+ 10 - 10
core/CrontabManager.py

@@ -30,7 +30,7 @@ class CrontabManager:
         Then add back line from event in the brain.yml
         Then add back line from event in the brain.yml
         :return:
         :return:
         """
         """
-        # clean the current crontab from all jarvis event
+        # clean the current crontab from all Kalliope event
         self._remove_all_job()
         self._remove_all_job()
         # load the brain file
         # load the brain file
         for synapse in self.brain.synapses:
         for synapse in self.brain.synapses:
@@ -58,7 +58,7 @@ class CrontabManager:
 
 
     def _remove_all_job(self):
     def _remove_all_job(self):
         """
         """
-        Remove all line in crontab that are attached to JARVIS
+        Remove all line in crontab that are attached to Kalliope
         :return:
         :return:
         """
         """
         iter = self.my_user_cron.find_comment(CRONTAB_COMMENT)
         iter = self.my_user_cron.find_comment(CRONTAB_COMMENT)
@@ -77,22 +77,22 @@ class CrontabManager:
 
 
     def _get_base_command(self):
     def _get_base_command(self):
         """
         """
-        Return the path of the entry point of Jarvis
-        Example: /home/user/jarvis/jarvis.py
-        :return: The path of the entry point script jarvis.py
+        Return the path of the entry point of Kalliope
+        Example: /home/user/kalliope/kalliope.py
+        :return: The path of the entry point script kalliope.py
         """
         """
         import inspect
         import inspect
         import os
         import os
-        # get current script directory path. We are in /an/unknown/path/jarvis/core
+        # get current script directory path. We are in /an/unknown/path/kalliope/core
         cur_script_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
         cur_script_directory = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-        # get parent dir. Now we are in /an/unknown/path/jarvis
+        # get parent dir. Now we are in /an/unknown/path/kalliope
         parent_dir = os.path.normpath(cur_script_directory + os.sep + os.pardir)
         parent_dir = os.path.normpath(cur_script_directory + os.sep + os.pardir)
-        # we add the jarvis.py file name
+        # we add the kalliope.py file name
         real_entry_point_path = parent_dir + os.sep + KALLIOPE_ENTRY_POINT_SCRIPT
         real_entry_point_path = parent_dir + os.sep + KALLIOPE_ENTRY_POINT_SCRIPT
         # We test that the file exist before return it
         # We test that the file exist before return it
-        logger.debug("Real jarvis.py path: %s" % real_entry_point_path)
+        logger.debug("Real Kalliope.py path: %s" % real_entry_point_path)
         if os.path.isfile(real_entry_point_path):
         if os.path.isfile(real_entry_point_path):
             crontab_cmd = "python %s start --brain-file %s --run-synapse " % (real_entry_point_path,
             crontab_cmd = "python %s start --brain-file %s --run-synapse " % (real_entry_point_path,
                                                                               self.brain.brain_file)
                                                                               self.brain.brain_file)
             return crontab_cmd
             return crontab_cmd
-        raise IOError("jarvis.py file not found")
+        raise IOError("kalliope.py file not found")

+ 2 - 2
core/MainController.py

@@ -22,14 +22,14 @@ class MainController:
 
 
         # create an order listener object. This last will the trigger callback before starting
         # create an order listener object. This last will the trigger callback before starting
         self.order_listener = OrderListener(self.analyse_order)
         self.order_listener = OrderListener(self.analyse_order)
-        # Wait that the jarvis trigger is pronounced by the user
+        # Wait that the kalliope trigger is pronounced by the user
         self.trigger_instance = self._get_default_trigger()
         self.trigger_instance = self._get_default_trigger()
         self.trigger_instance.start()
         self.trigger_instance.start()
         Utils.print_info("Waiting for trigger detection")
         Utils.print_info("Waiting for trigger detection")
 
 
     def callback(self):
     def callback(self):
         """
         """
-        # we have detected the hotword, we can now pause the Jarvis Trigger for a while
+        # we have detected the hotword, we can now pause the kalliope Trigger for a while
         # The user can speak out loud his order during this time.
         # The user can speak out loud his order during this time.
         :return:
         :return:
         """
         """

+ 1 - 1
core/OrderListener.py

@@ -15,7 +15,7 @@ class OrderListener(Thread):
 
 
     def __init__(self, callback=None, stt=None):
     def __init__(self, callback=None, stt=None):
         """
         """
-        This class is called after we catch the hotword that have woke up JARVIS.
+        This class is called after we catch the hotword that have woke up Kalliope.
         We now wait for an order spoken out loud by the user, translate the order into a text and run the action
         We now wait for an order spoken out loud by the user, translate the order into a text and run the action
          attached to this order from settings
          attached to this order from settings
         :param callback: callback function to call
         :param callback: callback function to call

+ 3 - 3
core/ShellGui.py

@@ -19,7 +19,7 @@ logger = logging.getLogger("kalliope")
 
 
 def signal_handler(signal, frame):
 def signal_handler(signal, frame):
     print "\n"
     print "\n"
-    Utils.print_info("Ctrl+C pressed. Killing Jarvis")
+    Utils.print_info("Ctrl+C pressed. Killing Kalliope")
     sys.exit(0)
     sys.exit(0)
 
 
 signal.signal(signal.SIGINT, signal_handler)
 signal.signal(signal.SIGINT, signal_handler)
@@ -33,7 +33,7 @@ class ShellGui:
 
 
         self.d = Dialog(dialog="dialog")
         self.d = Dialog(dialog="dialog")
 
 
-        self.d.set_background_title("Jarvis shell UI")
+        self.d.set_background_title("Kalliope shell UI")
 
 
         self.show_main_menu()
         self.show_main_menu()
 
 
@@ -44,7 +44,7 @@ class ShellGui:
         :return:
         :return:
         """
         """
 
 
-        code, tag = self.d.menu("Test your JARVIS settings from this menu",
+        code, tag = self.d.menu("Test your Kalliope settings from this menu",
                                 choices=[("TTS", "Text to Speech"),
                                 choices=[("TTS", "Text to Speech"),
                                          ("STT", "Speech to text")])
                                          ("STT", "Speech to text")])
 
 

+ 1 - 1
install/install.yml

@@ -21,7 +21,7 @@
   vars:
   vars:
     - git_url: "git@gitlab.pwit.fr:millionsfortomorrow/jarvis.git"
     - git_url: "git@gitlab.pwit.fr:millionsfortomorrow/jarvis.git"
     - temp_local_repo: "/tmp/kalliope_repo"
     - temp_local_repo: "/tmp/kalliope_repo"
-    - install_path: "/usr/lib/jarvis"
+    - install_path: "/usr/lib/kalliope"
   tasks:
   tasks:
     - name: Install packages
     - name: Install packages
       apt: name={{ item }} update_cache=yes
       apt: name={{ item }} update_cache=yes

+ 0 - 0
install/install_jarvis.sh → install/install_kalliope.sh


+ 3 - 3
kalliope.py

@@ -45,7 +45,7 @@ def main():
     # check if we want debug
     # check if we want debug
     configure_logging(debug=args.debug)
     configure_logging(debug=args.debug)
 
 
-    logger.debug("jarvis args: %s" % args)
+    logger.debug("kalliope args: %s" % args)
 
 
     # by default, no brain file is set. Use the default one: brain.yml in the root path
     # by default, no brain file is set. Use the default one: brain.yml in the root path
     brain_file = None
     brain_file = None
@@ -69,8 +69,8 @@ def main():
             crontab_manager = CrontabManager(brain_file=brain_file)
             crontab_manager = CrontabManager(brain_file=brain_file)
             crontab_manager.load_events_in_crontab()
             crontab_manager.load_events_in_crontab()
             Utils.print_success("Events loaded in crontab")
             Utils.print_success("Events loaded in crontab")
-            # then stat jarvis
-            Utils.print_success("Starting JARVIS")
+            # then start kalliope
+            Utils.print_success("Starting Kalliope")
             Utils.print_info("Press Ctrl+C for stopping")
             Utils.print_info("Press Ctrl+C for stopping")
             # catch signal for killing on Ctrl+C pressed
             # catch signal for killing on Ctrl+C pressed
             signal.signal(signal.SIGINT, signal_handler)
             signal.signal(signal.SIGINT, signal_handler)

+ 6 - 6
settings.yml

@@ -1,18 +1,18 @@
 ---
 ---
 # ---------------------------
 # ---------------------------
-# JARVIS default settings
+# Kalliope default settings
 # Use YAML syntax
 # Use YAML syntax
 # ---------------------------
 # ---------------------------
 
 
 
 
-# This is the trigger that will catch your magic work to wake up JARVIS
+# This is the trigger that will catch your magic work to wake up Kalliope
 default_trigger: "snowboy"
 default_trigger: "snowboy"
 # This is the STT that will be used by default
 # This is the STT that will be used by default
 default_speech_to_text: "google"
 default_speech_to_text: "google"
-# This is the default TTS that will be used by JARVIS to talk.
+# This is the default TTS that will be used by Kalliope to talk.
 default_text_to_speech: "pico2wave"
 default_text_to_speech: "pico2wave"
 
 
-# When jarvis detect the hotword/trigger, he will select randomly a phrase in the following list
+# When Kalliope detect the hotword/trigger, he will select randomly a phrase in the following list
 # to notify the user that he's listening for orders
 # to notify the user that he's listening for orders
 random_wake_up_answers:
 random_wake_up_answers:
   - "Oui monsieur?"
   - "Oui monsieur?"
@@ -22,9 +22,9 @@ random_wake_up_answers:
   - "J'écoute"
   - "J'écoute"
   - "Oui?"
   - "Oui?"
 
 
-# You can play a sound when jarvis detect the hotword/trigger instead of saying something from
+# You can play a sound when Kalliope detect the hotword/trigger instead of saying something from
 # the `random_wake_up_answers`.
 # the `random_wake_up_answers`.
-# Place here the full path of the sound file or just the name of the file in /usr/lib/jarvis/sounds
+# Place here the full path of the sound file or just the name of the file in /usr/lib/kalliope/sounds
 # The file must be .wav or .mp3 format. By default two file are provided: ding.wav and dong.wav
 # The file must be .wav or .mp3 format. By default two file are provided: ding.wav and dong.wav
 random_wake_up_sounds:
 random_wake_up_sounds:
   - "ding.wav"
   - "ding.wav"

+ 2 - 2
test.py

@@ -11,7 +11,7 @@ logger.setLevel(logging.DEBUG)
 
 
 # This does not work because of different encoding when using accent
 # This does not work because of different encoding when using accent
 from core import OrderAnalyser
 from core import OrderAnalyser
-# order = "jarvis régle le réveil pour sept heures et vingt minutes"
+# order = "kalliope régle le réveil pour sept heures et vingt minutes"
 # order = "mais nous de la musique"
 # order = "mais nous de la musique"
 
 
 order = "push message"
 order = "push message"
@@ -22,7 +22,7 @@ oa = OrderAnalyser(order)
 oa.start()
 oa.start()
 
 
 
 
-# user_said = "jarvis régle le réveil pour sept heures et pour vingts minutes"
+# user_said = "kalliope régle le réveil pour sept heures et pour vingts minutes"
 #
 #
 # order = "régle le réveil pour {{ hour }} heures et pour {{ minute }} minutes"
 # order = "régle le réveil pour {{ hour }} heures et pour {{ minute }} minutes"
 #
 #

+ 0 - 10
test_arg_parser.py

@@ -1,10 +0,0 @@
-import os
-
-# print help
-# cmd = "python jarvis.py -h"
-
-# start jarvis
-cmd = "python jarvis.py --start"
-
-
-os.system(cmd)

+ 0 - 161
test_nico.py

@@ -1,161 +0,0 @@
-# -*- 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
-
-
-# user_said = "maman je voudrais ecouter ACDC"
-# order = "je voudrais ecouter {{ artist_name }}"
-
-user_said = "jarvis regle le reveil pour sept heures et dix minutes please"
-order = "regle le reveil pour {{ hour }} heures et {{ minute }} minutes"
-
-
-def _is_containing_closing_bracket(sentence):
-    pattern = r"}}"
-    bool = re.search(pattern, sentence)
-    if bool is not None:
-        return True
-    return False
-
-
-def _is_containing_opening_bracket(sentence):
-    pattern = r"{{"
-    bool = re.search(pattern, sentence)
-    if bool is not None:
-        return True
-    return False
-
-
-def _is_containing_bracket(sentence):
-    pattern = r"{{|}}"
-    bool = re.search(pattern, sentence)
-    if bool is not None:
-        return True
-    return False
-
-
-def _get_list_word_in_order_without_parameter(list_word_in_order):
-    """
-    Receive a list of word with bracket like
-    ['regle', 'le', 'reveil', 'pour', '{{', 'hour', '}}', 'heures', 'et', '{{', 'minute', '}}', 'minutes']
-    Return a dict without parameter and a list of parameter place:
-
-    TODO insert example
-    :param list_word_in_order: List of string that can contain a word or brackets
-    :return: Dict
-    """
-    print list_word_in_order
-    list_word_without_bracket = list()
-    list_parameter_position_and_name = list()
-
-    index = 0   # index to count element in the list counting the brackets
-    returned_index = 1  # this is the index where the parameter is placed
-    for el in list_word_in_order:
-        if _is_containing_opening_bracket(el):
-            new_parameter = dict()
-            new_parameter["name"] = list_word_in_order[index+1]
-            new_parameter["index"] = returned_index
-            list_parameter_position_and_name.append(new_parameter)
-        else:
-            try:
-                # if the next element is not a closing bracket
-                if not _is_containing_closing_bracket(list_word_in_order[index+1]) and not \
-                        _is_containing_closing_bracket(el):
-                    # so we are not facing a parameter. we can add the word to the list
-                    list_word_without_bracket.append(el)
-                else:
-                    returned_index -= 1
-            except IndexError:
-                if not _is_containing_bracket(el):
-                    list_word_without_bracket.append(el)
-        returned_index += 1
-        index += 1
-
-    print list_word_without_bracket
-    print list_parameter_position_and_name
-    returned_dict = dict()
-    returned_dict["list_word_without_bracket"] = list_word_without_bracket
-    returned_dict["list_parameter_position_and_name"] = list_parameter_position_and_name
-    return returned_dict
-
-
-def _get_usefull_words(list_word_user_said, list_word_without_bracket):
-    first_valid_word = list_word_without_bracket[0]
-    last_word_valid_word = list_word_without_bracket[len(list_word_without_bracket)-1]
-    print first_valid_word
-    print last_word_valid_word
-
-    start_index = list_word_user_said.index(first_valid_word)
-    stop_index = list_word_user_said.index(last_word_valid_word)
-
-    new_list = list()
-    for x in (range(start_index, stop_index)):
-        new_list.append(list_word_user_said[int(x)])
-    print new_list
-
-    return new_list
-
-
-def try_match_order_in_synapse(list_word_user_said, list_word_in_order):
-    """
-    Test if what the user said match an order with brackets
-    :param list_word_user_said: List of words that the user said
-    :param list_word_in_order: List of word in the order to test, including bracket
-    :return: True if the order match
-    """
-    # first, get a list of word that composed to order without variable
-    returned_dict = _get_list_word_in_order_without_parameter(list_word_in_order)
-
-    list_word_without_bracket = returned_dict["list_word_without_bracket"]
-    parameters_position_and_name = returned_dict["list_parameter_position_and_name"]
-
-    number_of_word_in_order = len(list_word_without_bracket)
-    # if all words in the list of what the user said in in the list of word in the order
-    if len(set(list_word_without_bracket).intersection(list_word_user_said)) == number_of_word_in_order:
-        # we match the order!
-        print "order matched !"     # we can get parameters in the sentence the user said
-
-        # remove unused word in the list of word spelt by the user.
-        usefull_words_in_user_said_list = _get_usefull_words(list_word_user_said, list_word_without_bracket)
-        val_parameter = dict()
-        for el in parameters_position_and_name:
-            print el["name"]
-            print
-            val_parameter[el["name"]] = list_word_user_said[int(el["index"])]
-
-        print "The dict Var : %s" % val_parameter
-
-
-# make a list of word
-list_word_user_said = user_said.split()
-print "user said: %s" % list_word_user_said
-
-# check if the order contain bracket
-if _is_containing_bracket(order):
-    print "The order contain bracket"
-    # create a list from the order to test
-    list_word_in_order = order.split()
-    try_match_order_in_synapse(list_word_user_said, list_word_in_order)
-
-
-
-
-
-
-
-
-
-
-
-

+ 1 - 1
trigger/snowboy/snowboy.py

@@ -31,7 +31,7 @@ class Snowboy(object):
 
 
     def start(self):
     def start(self):
         """
         """
-        Start the snowboy thread and wait for a Jarvis trigger word
+        Start the snowboy thread and wait for a Kalliope trigger word
         :return:
         :return:
         """
         """
         detector = snowboydecoder.HotwordDetector(self.pmdl, sensitivity=0.5)
         detector = snowboydecoder.HotwordDetector(self.pmdl, sensitivity=0.5)