def test_get_list_synapse_with_raise_missing_parameters(self):
        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        fake_geolocation_parameters = {
            "longitude": 66,
            "radius": 66,
        }
        signal1 = Signal(name="geolocation",
                         parameters=fake_geolocation_parameters)
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")

        synapse1 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])
        synapse2 = Synapse(name="Synapse2",
                           neurons=[neuron3, neuron4],
                           signals=[signal2])

        synapses_list = [synapse1, synapse2]
        br = Brain(synapses=synapses_list)

        # Stubbing the Geolocation Signal with the brain
        geo = Geolocation()
        geo.brain = br

        with self.assertRaises(MissingParameter):
            geo.run()
    def test_get_not_containing_words(cls):
        signal1 = Signal(name="order",
                         parameters={
                             "matching-type": "not-contain",
                             "excluded-words": ["that", "is"]
                         })

        # get the correct list of excluded words
        expected_list_excluded_words = ["that", "is"]
        cls.assertEqual(expected_list_excluded_words,
                        OrderAnalyser.get_not_containing_words(signal=signal1))

        # assert it returns None when a str is provided and not a list
        signal1 = Signal(name="order",
                         parameters={
                             "matching-type": "not-contain",
                             "excluded_words": "that"
                         })
        cls.assertIsNone(
            OrderAnalyser.get_not_containing_words(signal=signal1))

        # assert it returns None when `excluded_words` is not provided
        signal1 = Signal(name="order",
                         parameters={"matching-type": "not-contain"})
        cls.assertIsNone(
            OrderAnalyser.get_not_containing_words(signal=signal1))
    def test_get_signal_order(cls):
        signal1 = Signal(name="order",
                         parameters="expected order in the signal")
        signal2 = Signal(name="order",
                         parameters={
                             "matching-type": "strict",
                             "text": "that is the sentence"
                         })
        signal3 = Signal(name="order",
                         parameters={
                             "matching-type": "strict",
                             "fake-value": "that is the sentence"
                         })

        # Signal order is a str
        expected_signal_order = "expected order in the signal"
        cls.assertEqual(expected_signal_order,
                        OrderAnalyser.get_signal_order(signal=signal1))

        # Signal order is a dict
        expected_signal_order = "that is the sentence"
        cls.assertEqual(expected_signal_order,
                        OrderAnalyser.get_signal_order(signal=signal2))

        # signal order is a dict and `text` element is missing
        expected_signal_order = ""  # not found !
        cls.assertEqual(expected_signal_order,
                        OrderAnalyser.get_signal_order(signal=signal3))
    def test_order_correction(self):
        # test with only stt-correction
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "thus",
                "output": "this"
            }]
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "this is my test"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test with both stt-correction and stt-correction-file
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "thus",
                "output": "this"
            }],
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "this is my order"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test with stt-correction that override stt-correction-file
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "test",
                "output": "overridden"
            }],
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "thus is my overridden"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)
Beispiel #5
0
    def test_get_matching_synapse(self):
        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")

        synapse1 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])
        synapse2 = Synapse(name="Synapse2",
                           neurons=[neuron3, neuron4],
                           signals=[signal2])
        synapse3 = Synapse(name="Synapse3",
                           neurons=[neuron2, neuron4],
                           signals=[signal3])

        all_synapse_list = [synapse1, synapse2, synapse3]

        br = Brain(synapses=all_synapse_list)

        # TEST1: should return synapse1
        spoken_order = "this is the sentence"

        # Create the matched synapse
        matched_synapse_1 = MatchedSynapse(matched_synapse=synapse1,
                                           matched_order=spoken_order,
                                           user_order=spoken_order)

        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(matched_synapse_1 in matched_synapses)

        # TEST2: should return synapse1 and 2
        spoken_order = "this is the second sentence"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 2)
        self.assertTrue(synapse1, synapse2 in matched_synapses)

        # TEST3: should empty
        spoken_order = "not a valid order"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)
Beispiel #6
0
    def _get_signals(cls, signals_dict):
        """
        Get a list of Signal object from a signals dict

        :param signals_dict: Signal name or dictionary of Signal_name/Signal_parameters
        :type signals_dict: String or dict
        :return: A list of Event and/or Order
        :rtype: List

        :Example:

            signals = cls._get_signals(synapses_dict["signals"])

        .. seealso:: Event, Order
        .. warnings:: Class method and Private
        """
        signals = list()
        for signal_dict in signals_dict:
            if ConfigurationChecker().check_signal_dict(signal_dict):
                for signal_name in signal_dict:
                    new_signal = Signal(name=signal_name,
                                        parameters=signal_dict[signal_name])
                    signals.append(new_signal)

        return signals
    def test_Synapse(self):
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")

        synapse1 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])
        synapse2 = Synapse(name="Synapse2",
                           neurons=[neuron3, neuron4],
                           signals=[signal2])
        synapse3 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])

        expected_result_serialize = {
            'signals': [{
                'name': 'order',
                'parameters': 'this is the sentence'
            }],
            'neurons': [{
                'name': 'neurone1',
                'parameters': {
                    'var1': 'val1'
                }
            }, {
                'name': 'neurone2',
                'parameters': {
                    'var2': 'val2'
                }
            }],
            'name':
            'Synapse1',
            'enabled':
            True
        }

        self.assertDictEqual(expected_result_serialize, synapse1.serialize())

        self.assertTrue(synapse1.__eq__(synapse3))
        self.assertFalse(synapse1.__eq__(synapse2))
Beispiel #8
0
    def setUp(self):
        # Kill the singleton
        Singleton._instances = dict()

        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")

        self.synapse1 = Synapse(name="Synapse1",
                                neurons=[neuron1, neuron2],
                                signals=[signal1])
        self.synapse2 = Synapse(name="Synapse2",
                                neurons=[neuron3, neuron4],
                                signals=[signal2])
        self.synapse3 = Synapse(name="Synapse3",
                                neurons=[neuron2, neuron4],
                                signals=[signal3])

        self.all_synapse_list1 = [self.synapse1, self.synapse2, self.synapse3]

        self.all_synapse_list2 = [self.synapse2, self.synapse3]

        self.brain_test1 = Brain(synapses=self.all_synapse_list1)
        self.brain_test2 = Brain(synapses=self.all_synapse_list2)
        # this brain is the same as the first one
        self.brain_test3 = Brain(synapses=self.all_synapse_list1)

        self.settings_test = Settings(default_synapse="Synapse3")

        # clean the LiFO
        LIFOBuffer.lifo_list = list()
    def test_is_order_matching_signal(self):
        # Note: This is a private method, most of the test use cases are covered by `test_get_matching_synapse`

        # all lowercase
        test_order = "expected order in the signal"
        signal1 = Signal(name="order",
                         parameters="expected order in the signal")
        test_signal = signal1
        self.assertTrue(
            OrderAnalyser.is_order_matching_signal(user_order=test_order,
                                                   signal=test_signal))

        # with uppercase
        test_order = "Expected Order In The Signal"
        test_signal = signal1
        self.assertTrue(
            OrderAnalyser.is_order_matching_signal(user_order=test_order,
                                                   signal=test_signal))
    def test_get_matching_synapse(self):
        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")
        signal4 = Signal(name="order",
                         parameters={
                             "matching-type": "strict",
                             "text": "that is part of the fourth sentence"
                         })
        signal5 = Signal(name="order",
                         parameters={
                             "matching-type": "ordered-strict",
                             "text": "sentence 5 with specific order"
                         })
        signal6 = Signal(name="order",
                         parameters={
                             "matching-type": "normal",
                             "text": "matching type normal"
                         })
        signal7 = Signal(name="order",
                         parameters={
                             "matching-type": "non-existing",
                             "text": "matching type non existing"
                         })
        signal8 = Signal(name="order",
                         parameters={
                             "matching-type": "non-existing",
                             "non-existing-parameter": "will not match order"
                         })
        signal9 = Signal(
            name="order",
            parameters=
            "order that should be triggered because synapse is disabled")
        signal10 = Signal(name="order", parameters="i say this")
        signal11 = Signal(name="order", parameters="and then that")
        signal12 = Signal(name="order",
                          parameters={
                              "matching-type": "strict",
                              "text": "just 1 test",
                              "stt-correction": [{
                                  "input": "one",
                                  "output": "1"
                              }]
                          })

        synapse1 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])
        synapse2 = Synapse(name="Synapse2",
                           neurons=[neuron3, neuron4],
                           signals=[signal2])
        synapse3 = Synapse(name="Synapse3",
                           neurons=[neuron2, neuron4],
                           signals=[signal3])
        synapse4 = Synapse(name="Synapse4",
                           neurons=[neuron2, neuron4],
                           signals=[signal4])
        synapse5 = Synapse(name="Synapse5",
                           neurons=[neuron1, neuron2],
                           signals=[signal5])
        synapse6 = Synapse(name="Synapse6",
                           neurons=[neuron1, neuron2],
                           signals=[signal6])
        synapse7 = Synapse(name="Synapse7",
                           neurons=[neuron1, neuron2],
                           signals=[signal7])
        synapse8 = Synapse(name="Synapse8",
                           neurons=[neuron1, neuron2],
                           signals=[signal8])
        synapse9 = Synapse(name="Synapse9",
                           enabled=False,
                           neurons=[neuron1, neuron2],
                           signals=[signal9])
        synapse10 = Synapse(name="Synapse10",
                            neurons=[neuron1],
                            signals=[signal10, signal11])
        synapse11 = Synapse(name="Synapse11",
                            neurons=[neuron1],
                            signals=[signal12])

        all_synapse_list = [
            synapse1, synapse2, synapse3, synapse4, synapse5, synapse6,
            synapse7, synapse8, synapse9, synapse10, synapse11
        ]

        br = Brain(synapses=all_synapse_list)

        # TEST1: should return synapse1
        spoken_order = "this is the sentence"

        # Create the matched synapse
        expected_matched_synapse_1 = MatchedSynapse(matched_synapse=synapse1,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)

        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_1 in matched_synapses)

        # with defined normal matching type
        spoken_order = "matching type normal"
        expected_matched_synapse_5 = MatchedSynapse(matched_synapse=synapse6,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)

        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_5 in matched_synapses)

        # TEST2: should return synapse1 and 2
        spoken_order = "this is the second sentence"
        expected_matched_synapse_2 = MatchedSynapse(matched_synapse=synapse1,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 2)
        self.assertTrue(expected_matched_synapse_1, expected_matched_synapse_2
                        in matched_synapses)

        # TEST3: should empty
        spoken_order = "not a valid order"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST4: with matching type strict
        spoken_order = "that is part of the fourth sentence"
        expected_matched_synapse_3 = MatchedSynapse(matched_synapse=synapse4,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue(expected_matched_synapse_3 in matched_synapses)

        spoken_order = "that is part of the fourth sentence with more word"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST5: with matching type ordered strict
        spoken_order = "sentence 5 with specific order"
        expected_matched_synapse_4 = MatchedSynapse(matched_synapse=synapse5,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_4 in matched_synapses)

        spoken_order = "order specific with 5 sentence"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST6: non supported type of matching. should fallback to normal
        spoken_order = "matching type non existing"
        expected_matched_synapse_5 = MatchedSynapse(matched_synapse=synapse7,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue(expected_matched_synapse_5 in matched_synapses)

        # TEST7: should not match the disabled synapse
        spoken_order = "order that should be triggered because synapse is disabled"
        # we expect an empty list
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue(len(matched_synapses) == 0)

        # TEST8: a spoken order that match multiple time the same synapse should return the synapse only once
        spoken_order = "i say this and then that"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue("Synapse10" in matched_synapse.synapse.name
                        for matched_synapse in matched_synapses)
        self.assertTrue(len(matched_synapses) == 1)

        # TEST9: with STT correction
        spoken_order = "just one test"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue("Synapse11" in matched_synapse.synapse.name
                        for matched_synapse in matched_synapses)
        self.assertTrue(spoken_order in matched_synapse.user_order
                        for matched_synapse in matched_synapses)
        self.assertTrue(len(matched_synapses) == 1)
Beispiel #11
0
    def test_order_correction(self):
        # test with only stt-correction
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "thus",
                "output": "this"
            }]
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "this is my test"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test with both stt-correction and stt-correction-file
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "thus",
                "output": "this"
            }],
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "this is my order"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test with stt-correction that override stt-correction-file
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "test",
                "output": "overridden"
            }],
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "thus is my overridden"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test with stt-correction that override multiple words.
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "is my test",
                "output": "is overridden"
            }]
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "thus is overridden"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test stt-correction that override one word with multiple words.
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "test",
                "output": "is overridden"
            }]
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "thus is my is overridden"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test stt-correction that multiple words override files one word.
        testing_order = "thus is my test"

        signal_parameter = {
            "stt-correction": [{
                "input": "test",
                "output": "the overridden"
            }],
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "thus is my the overridden"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)

        # test stt-correction with multiple inputs words in file.
        testing_order = "hello the test"

        signal_parameter = {
            "stt-correction-file": self.correction_file_to_test
        }
        testing_signals = Signal(name="test", parameters=signal_parameter)

        expected_fixed_order = "i am order"
        self.assertEqual(
            OrderAnalyser.order_correction(order=testing_order,
                                           signal=testing_signals),
            expected_fixed_order)
Beispiel #12
0
    def test_get_matching_synapse(self):
        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")
        signal4 = Signal(name="order",
                         parameters={
                             "matching-type": "strict",
                             "text": "that is part of the fourth sentence"
                         })
        signal5 = Signal(name="order",
                         parameters={
                             "matching-type": "ordered-strict",
                             "text": "sentence 5 with specific order"
                         })
        signal6 = Signal(name="order",
                         parameters={
                             "matching-type": "normal",
                             "text": "matching type normal"
                         })
        signal7 = Signal(name="order",
                         parameters={
                             "matching-type": "non-existing",
                             "text": "matching type non existing"
                         })
        signal8 = Signal(name="order",
                         parameters={
                             "matching-type": "non-existing",
                             "non-existing-parameter": "will not match order"
                         })

        synapse1 = Synapse(name="Synapse1",
                           neurons=[neuron1, neuron2],
                           signals=[signal1])
        synapse2 = Synapse(name="Synapse2",
                           neurons=[neuron3, neuron4],
                           signals=[signal2])
        synapse3 = Synapse(name="Synapse3",
                           neurons=[neuron2, neuron4],
                           signals=[signal3])
        synapse4 = Synapse(name="Synapse4",
                           neurons=[neuron2, neuron4],
                           signals=[signal4])
        synapse5 = Synapse(name="Synapse5",
                           neurons=[neuron1, neuron2],
                           signals=[signal5])
        synapse6 = Synapse(name="Synapse6",
                           neurons=[neuron1, neuron2],
                           signals=[signal6])
        synapse7 = Synapse(name="Synapse6",
                           neurons=[neuron1, neuron2],
                           signals=[signal7])
        synapse8 = Synapse(name="Synapse6",
                           neurons=[neuron1, neuron2],
                           signals=[signal8])

        all_synapse_list = [
            synapse1, synapse2, synapse3, synapse4, synapse5, synapse6,
            synapse7, synapse8
        ]

        br = Brain(synapses=all_synapse_list)

        # TEST1: should return synapse1
        spoken_order = "this is the sentence"

        # Create the matched synapse
        expected_matched_synapse_1 = MatchedSynapse(matched_synapse=synapse1,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)

        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_1 in matched_synapses)

        # with defined normal matching type
        spoken_order = "matching type normal"
        expected_matched_synapse_5 = MatchedSynapse(matched_synapse=synapse6,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)

        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_5 in matched_synapses)

        # TEST2: should return synapse1 and 2
        spoken_order = "this is the second sentence"
        expected_matched_synapse_2 = MatchedSynapse(matched_synapse=synapse1,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 2)
        self.assertTrue(expected_matched_synapse_1, expected_matched_synapse_2
                        in matched_synapses)

        # TEST3: should empty
        spoken_order = "not a valid order"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST4: with matching type strict
        spoken_order = "that is part of the fourth sentence"
        expected_matched_synapse_3 = MatchedSynapse(matched_synapse=synapse4,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue(expected_matched_synapse_3 in matched_synapses)

        spoken_order = "that is part of the fourth sentence with more word"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST5: with matching type ordered strict
        spoken_order = "sentence 5 with specific order"
        expected_matched_synapse_4 = MatchedSynapse(matched_synapse=synapse5,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertEqual(len(matched_synapses), 1)
        self.assertTrue(expected_matched_synapse_4 in matched_synapses)

        spoken_order = "order specific with 5 sentence"
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertFalse(matched_synapses)

        # TEST6: non supported type of matching. should fallback to normal
        spoken_order = "matching type non existing"
        expected_matched_synapse_5 = MatchedSynapse(matched_synapse=synapse7,
                                                    matched_order=spoken_order,
                                                    user_order=spoken_order)
        matched_synapses = OrderAnalyser.get_matching_synapse(
            order=spoken_order, brain=br)
        self.assertTrue(expected_matched_synapse_5 in matched_synapses)