【问题标题】:Is there a way to make the input as speech to text with Python speech recognition by using voice to answer the questions有没有办法通过使用语音回答问题,通过 Python 语音识别将输入作为语音到文本
【发布时间】:2021-06-04 18:23:03
【问题描述】:

我正在尝试通过对文本输入使用语音来回答问题来创建一个数学测验目前这就是我得到的有没有办法让我使用我的语音来回答问题?

import random


score=0

for question_num in range(1, 5):
    ops = ['+', '-', '*']
    rand=random.randint(1,10)
    rand2=random.randint(1,10)
    operation = random.choice(ops)
    maths = eval(str(rand) + operation + str(rand2))
    print('\nQuestion number: {}'.format(question_num))
    print ("The question is",rand,operation,rand2)

    ans=int(input ("What is your answer:"))
    if ans==maths:
        print ("Correct")
        score=score+1
    else:
        print ("Incorrect. The actual answer ",maths)

【问题讨论】:

    标签: python math speech-recognition voice


    【解决方案1】:

    这里有一些选择:

    1. Google Cloud Speech-to-Text API
    2. Sphinx OSS Speech Recognition Toolkit
    3. Wit.ai NLP API
    4. Houndify Speech Recognition API
    5. Azure Cognitive Speech Services

    This 库提供了一个包含大多数这些 API here 的示例。您可以尝试将其应用于您的用例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-08
      • 1970-01-01
      • 1970-01-01
      • 2022-12-11
      • 2011-05-10
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多