示例#1
0
def test_hello_err(data):
    """Testing the exception raised by `hello`"""
    with pytest.raises(TypeError) as exc:
        hello(data)
    assert str(exc.value) == "Unable to greet " + str(data)
示例#2
0

def remove_stopword(recognized_data):
    #отделяем команду от остального текста
    text = recognized_data.split()
    stop_words = list(get_stop_words('ru'))
    nltkstop = list(stopwords.words('russian'))
    stop_words.extend(nltkstop)  #объеденяем слова в списке для удаления
    filtered_words = [word for word in text
                      if word not in stop_words]  #убираем лишние слова
    filtered_words = str(" ".join(filtered_words))
    print(filtered_words)
    recog_in_commands(filtered_words)


def recog_in_commands(filtered_words):
    lemtext = mystem.lemmatize(filtered_words)  #приводим к общей форме
    lemtext = "".join(lemtext)
    lentxt = lemtext.split()
    command_with_name(lentxt)


if __name__ == '__main__':

    p = pyaudio.PyAudio()

    hello()

    while True:
        say_print()
示例#3
0
def test_hello(data, expected):
    """Testing the output of `hello`"""
    assert hello(data) == expected
示例#4
0
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 12:15:28 2019

@author: giles
"""

import greetings

greetings.hi_2()

greetings.hello()

greetings.hi('Alison')