mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
commit
c4e37cb6c1
@ -34,6 +34,6 @@ for sample_offset in range(0, speech_length, min(stride_size, speech_length - sa
|
||||
rec_result = inference_pipeline(audio_in=speech[sample_offset: sample_offset + stride_size],
|
||||
param_dict=param_dict)
|
||||
if len(rec_result) != 0:
|
||||
final_result += rec_result['text'] + " "
|
||||
final_result += rec_result['text']
|
||||
print(rec_result)
|
||||
print(final_result)
|
||||
|
||||
@ -34,6 +34,6 @@ for sample_offset in range(0, speech_length, min(stride_size, speech_length - sa
|
||||
rec_result = inference_pipeline(audio_in=speech[sample_offset: sample_offset + stride_size],
|
||||
param_dict=param_dict)
|
||||
if len(rec_result) != 0:
|
||||
final_result += rec_result['text'] + " "
|
||||
final_result += rec_result['text']
|
||||
print(rec_result)
|
||||
print(final_result.strip())
|
||||
@ -9,6 +9,7 @@ import sys
|
||||
import time
|
||||
import copy
|
||||
import os
|
||||
import re
|
||||
import codecs
|
||||
import tempfile
|
||||
import requests
|
||||
@ -828,9 +829,16 @@ class Speech2TextParaformerOnline:
|
||||
|
||||
# Change integer-ids to tokens
|
||||
token = self.converter.ids2tokens(token_int)
|
||||
token = " ".join(token)
|
||||
|
||||
results.append(token)
|
||||
postprocessed_result = ""
|
||||
for item in token:
|
||||
if item.endswith('@@'):
|
||||
postprocessed_result += item[:-2]
|
||||
elif re.match('^[a-zA-Z]+$', item):
|
||||
postprocessed_result += item + " "
|
||||
else:
|
||||
postprocessed_result += item
|
||||
|
||||
results.append(postprocessed_result)
|
||||
|
||||
# assert check_return_type(results)
|
||||
return results
|
||||
|
||||
Loading…
Reference in New Issue
Block a user