我在使用 google voice_recognition api 时遇到了这个问题。它会自动过滤掉坏词并返回类似“F***”或“P******”的字符串
这是我的代码。我的代码中没有错误,但请帮助我如何从音频中获取原始转换后的文本。
from gtts import gTTS
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print('Ready...')
r.pause_threshold = 1
r.adjust_for_ambient_noise(source, duration=1)
audio = r.listen(source)
command = r.recognize_google(audio).lower()
print('You said: ' + command + '\n')
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Unity3D 中的 Microsoft Azure 认知服务语音转文本 SDK 构建一个简单的应用程序。我已经按照这个教程学习了,效果很好。本教程的唯一问题是语音转文本是通过按钮激活的。当您按下按钮时,它将在整个句子期间进行转录,并且您必须再次按下该按钮才能再次转录。我的问题是,我希望程序在 Unity 中运行后立即开始转录,而不是每次我想转录句子时都必须按一个按钮。
这是代码。
public async void ButtonClick()
{
// Creates an instance of a speech config with specified subscription key and service region.
// Replace with your own subscription key and service region (e.g., "westus").
var config = SpeechConfig.FromSubscription("[My API Key]", "westus");
// Make sure to dispose the recognizer after use!
using (var recognizer = new SpeechRecognizer(config))
{
lock (threadLocker)
{
waitingForReco = true;
}
// Starts speech recognition, and …
Run Code Online (Sandbox Code Playgroud) speech-recognition azure unity-game-engine azure-language-understanding azure-cognitive-services
如何评估 ASR(自动语音识别)中的 WER(单词错误率)?
例如,如果我有 ASR 的句子和输出(人工参考翻译)。
我知道这个方程,但我不知道如何计算。计算WER时是否输入逗号、句号等标点符号?
以及单词的 sub、ins 和 del。有具体重量吗?他们每个人什么时候在等式中计算?
任何人都知道我们如何计算 ASR 的 WER.. 请给我一个例子,以便我可以在我的应用程序中的多个句子中计算 ASR 的 WER
下面是代码,
import json
import os
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
import azure.cognitiveservices.speech as speechsdk
def main(filename):
container_name="test-container"
print(filename)
blob_service_client = BlobServiceClient.from_connection_string("DefaultEndpoint")
container_client=blob_service_client.get_container_client(container_name)
blob_client = container_client.get_blob_client(filename)
with open(filename, "wb") as f:
data = blob_client.download_blob()
data.readinto(f)
speech_key, service_region = "1234567", "eastus"
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
audio_input = speechsdk.audio.AudioConfig(filename=filename)
print("Audio Input:-",audio_input)
speech_config.speech_recognition_language="en-US"
speech_config.request_word_level_timestamps()
speech_config.enable_dictation()
speech_config.output_format = speechsdk.OutputFormat(1)
speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_input)
print("speech_recognizer:-",speech_recognizer)
#result = speech_recognizer.recognize_once()
all_results = []
def handle_final_result(evt):
all_results.append(evt.result.text)
done = False
def stop_cb(evt):
#print('CLOSING on {}'.format(evt))
speech_recognizer.stop_continuous_recognition()
global done …
Run Code Online (Sandbox Code Playgroud) 我正在使用 webrtcvad 和 pydub 处理音频文件。任何片段的分割都是通过句子的沉默来进行的。有什么方法可以在字级边界条件下完成分割吗?(在每个说出的单词之后)?如果librosa/ffmpeg/pydub有这样的功能,每个人声可以分割吗?但分割后,我需要人声的开始和结束时间,准确地说是人声部分在原始文件中的位置。ffmpeg 分割的一种简单解决方案或方法也定义为:
https://gist.github.com/vadimkantorov/00bf4fbe4323360722e3d2220cc2915e
但这也是通过沉默进行分割,并且对于每个填充数或帧大小,分割是不同的。我正在尝试按声音分开。例如,我已手动完成此操作,原始文件、拆分词及其在 json 中的时间位置位于链接下提供的文件夹中:
www.mediafire.com/file/u4ojdjezmw4vocb/attached_problem.tar.gz
我的ubuntu20有声音,可以播放任何音频;但问题是当我使用语音识别时,alsa 无法正常工作。我在 Windows 中使用了语音识别,这很痛苦,但它有效。我已经安装了 pyaudio,...所以是的,这不是库问题。
我已经做好了:
1.Reinstalling alsa and pulseAudio.
2.Checking which program is using sound card.
3.Trying to specific device to be used in Microphone().
Run Code Online (Sandbox Code Playgroud)
当我使用时:python -c "import pyaudio;audio=pyaudio.PyAudio();print([audio.get_device_info_by_index(i) for i in range(audio.get_device_count())])"
返回:
ALSA lib pcm_dsnoop.c:604:(snd_pcm_dsnoop_open) unable to create IPC semaphore
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib …
Run Code Online (Sandbox Code Playgroud) 我正在训练 Pytorch 模型。一段时间后,即使进行随机播放,除了一些有限张量之外,模型还只包含 NaN 值:
tensor([[[ nan, nan, nan, ..., nan, nan, nan],
[ nan, nan, nan, ..., nan, nan, nan],
[ nan, nan, nan, ..., nan, nan, nan],
...,
[ 1.4641, 0.0360, -1.1528, ..., -2.3592, -2.6310, 6.3893],
[ nan, nan, nan, ..., nan, nan, nan],
[ nan, nan, nan, ..., nan, nan, nan]]],
device='cuda:0', grad_fn=<AddBackward0>)
Run Code Online (Sandbox Code Playgroud)
detector_anomaly 函数返回:
File "TestDownload.py", line 701, in <module>
main(learning_rate, batch_size, epochs, experiment)
File "TestDownload.py", line 635, in main
train(model, device, train_loader, criterion, optimizer, scheduler, …
Run Code Online (Sandbox Code Playgroud) with
我正在创建一个语音助手项目,但其中的命令行出现问题。
我写的代码是这样的
import speech_recognition as sr
import win32com.client
speaker = win32com.client.Dispatch("SAPI.SpVoice")
def say(text):
speaker.Speak(f"{text}")
def takeCommand():
r = sr.Recognizer()
with sr.Microphone as source:
r.pause_threshold = 1
audio = r.listen(source)
query = r.recognize_google(audio, language="en-in")
print(f"User said: {query}")
return query
if __name__ == "__main__":
print("VS Code")
say("Hello I am Jarvis A.I.")
while 1:
print("listening...")
text = takeCommand()
say(text)
Run Code Online (Sandbox Code Playgroud)
它总是得到的错误是这样的
VS Code
listening...
Traceback (most recent call last):
File "f:\Jarvis AI\main.py", line 23, in <module>
text = takeCommand()
^^^^^^^^^^^^^
File "f:\Jarvis AI\main.py", …
Run Code Online (Sandbox Code Playgroud) 有没有人有资源从哪里学习使用Delphi的SAPI?
如何使用Delphi应用程序的语音识别?
谢谢.
我正在尝试根据我发现的这篇论文(http://arxiv.org/pdf/1003.4083.pdf)来计算MFCC算法,所以到目前为止我所做的是:
步骤1)预先强调
步骤2)框架
步骤3)Hamming窗口
步骤4)快速傅立叶变换
步骤5)Mel滤波器组处理
步骤6):离散余弦变换
基本上,我采用Mel Bank滤波器并将它们乘以实际的原始信号.然后,我对这些结果执行了FFT,如下所示:
第1帧的FFT:
然后我计算了FFT的DCT,其结果如下所示:
第1帧的DCT:
到目前为止这看起来是否正确?有没有办法让我检查一下,以便我知道我正朝着正确的方向前进?
另外,我需要得到13个系数,但我不知道如何确定这些系数中的哪一个.我得到256个值,所以我采取前13个值吗?或者,我能获得总能量吗?
我希望有一个人可以帮助我.