Esempio n. 1
0
from talon import Context, Module, speech_system

mod = Module()


@mod.action_class
class Actions:
    def engine_sleep():
        """Sleep the engine"""
        speech_system.engine_mimic("go to sleep"),

    def engine_wake():
        """Wake the engine"""
        speech_system.engine_mimic("wake up"),

    def engine_mimic(cmd: str):
        """Sends phrase to engine"""
        speech_system.engine_mimic(cmd)
Esempio n. 2
0
    step4 = fuse_num(step3)
    print('step1', step1)
    print('step2', step2)
    print('step3', step3)
    print('step4', step4)
    return step4[0]
assert(test_num([1, 'hundred', 'thousand', 'and', 5, 'thousand', 'and', 6, 'thousand']) == 1050006000)
assert(test_num([1, 'hundred', 'and', 5, 'thousand']) == 105000)
assert(test_num([1, 'thousand', 'thousand']) == 1000000)
assert(test_num([1, 'million', 5, 'hundred', 1, 'thousand']) == 1501000)
assert(test_num([1, 'million', 5, 'hundred', 'and', 1, 'thousand', 1, 'hundred', 'and', 6]) == 1501106)
assert(test_num([1, 'million', 1, 1]) == 10000011)
assert(test_num([1, 'million', 10, 10]) == 100001010)
"""

module = Module()


@module.capture
def natural_number(m) -> int:
    """Naturally-spoken number. E.g. "five hundred", "twenty four"."""


@module.capture
def optional_number(m) -> int or None:
    """Optional number. If not spoken, defaults to `None`."""


ctx = Context()