def test():
    rc = ktkws.init("../data/kwsmodel.pack")
    print('init rc = %d' % (rc))
    rc = ktkws.start()
    print('start rc = %d' % (rc))
    ktkws.set_keyword(KWSID.index('기가지니'))
    rc = detect()
    print('detect rc = %d' % (rc))
    ktkws.stop()
Ejemplo n.º 2
0
def btn_test(key_word = '기가지니'):
	global btn_status
	rc = ktkws.init("../data/kwsmodel.pack")
	print ('init rc = %d' % (rc))
	rc = ktkws.start()
	print ('start rc = %d' % (rc))
	ktkws.set_keyword(KWSID.index(key_word))
	rc = btn_detect()
	print ('detect rc = %d' % (rc))
	ktkws.stop()
	return rc
def call(key_word):
    rc = ktkws.init("../data/kwsmodel.pack")
    # print ('init rc = %d' % (rc))
    rc = ktkws.start()
    # print ('start rc = %d' % (rc))
    print("KWS: 호출어 대기중")
    ktkws.set_keyword(KWSID.index(key_word))
    rc = detect()
    # print ('detect rc = %d' % (rc))
    # print ('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
    ktkws.stop()
    return rc
Ejemplo n.º 4
0
def test(key_word = '친구야'):
	rc = ktkws.init("../data/kwsmodel.pack")
	print ('init rc = %d' % (rc))
	rc = ktkws.start()
	print ('start rc = %d' % (rc))
	print ('\n호출어를 불러보세요~\n')
	ktkws.set_keyword(KWSID.index(key_word))
	rc = detect()
	print ('detect rc = %d' % (rc))
	print ('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
	ktkws.stop()
	return rc
Ejemplo n.º 5
0
def device_awake_btn(key_word='기가지니'):
    global btn_status
    rc = ktkws.init("../data/kwsmodel.pack")
    print('init rc = %d' % (rc))
    rc = ktkws.start()
    print('start rc = %d' % (rc))
    print('\n버튼을 눌러보세요~\n')
    ktkws.set_keyword(KWSID.index(key_word))
    rc = btn_detect()
    print('detect rc = %d' % (rc))
    print('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
    ktkws.stop()
    return rc
def setKTKws(key_index = 0):
    key_word = ['기가지니','지니야','친구야','자기야']
    rc = ktkws.init("/home/pi/ai-makers-kit/data/kwsmodel.pack")
    print ('init rc = %d' % (rc))
    rc = ktkws.start()
    print ('start rc = %d' % (rc))
    print ('\n호출어를 불러보세요~\n')
    ktkws.set_keyword(KWSID.index(key_word[key_index]))
    rc = ktkwsdetect()
    print ('detect rc = %d' % (rc))
    print ('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
    ktkws.stop()
    return rc
Ejemplo n.º 7
0
def btn_test(key_word='기가지니'):
    global btn_status
    rc = ktkws.init("../data/kwsmodel.pack")
    ##	print ('init rc = %d' % (rc))
    rc = ktkws.start()
    ##	print ('start rc = %d' % (rc))
    print('\n----------------------------------------------------------\n')
    print('버튼을 누르시고 말씀하세요~~\n')
    ktkws.set_keyword(KWSID.index(key_word))
    rc = btn_detect()
    ##	print ('detect rc = %d' % (rc))
    ##	print ('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
    ktkws.stop()
    return rc
def detect_wake_up_word(keyword='기가지니'):
    if not keyword in KWS_KEYWORDS:
        return False

    response_code = ktkws.init("../data/kwsmodel.pack")
    print('response_code on init = %d' % (response_code))
    response_code = ktkws.start()
    print('response_code on start = %d' % (response_code))
    print('\n호출어를 불러보세요~\n')
    ktkws.set_keyword(KWS_KEYWORDS.index(keyword))

    with MS.MicrophoneStream(RATE, CHUNK) as stream:
        audio_generator = stream.generator()

        for content in audio_generator:
            response_code = ktkws.detect(content)

            if (response_code == 1):
                MS.play_file("../data/sample_sound.wav")
                print('\n\n호출어가 정상적으로 인식되었습니다.\n\n')
                ktkws.stop()
                return True
Ejemplo n.º 9
0
def kws_stop():
    ktkws.stop()