Merge pull request #532 from alibaba-damo-academy/dev_lhn
Dev lhn
| | |
| | | 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) |
| File was renamed from egs_modelscope/asr/paraformer/speech_paraformer_asr_nat-zh-cn-16k-common-vocab8404-online/infer.py |
| | |
| | | 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()) |
| | |
| | | import time |
| | | import copy |
| | | import os |
| | | import re |
| | | import codecs |
| | | import tempfile |
| | | import requests |
| | |
| | | |
| | | # Change integer-ids to tokens |
| | | token = self.converter.ids2tokens(token_int) |
| | | token = " ".join(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(token) |
| | | results.append(postprocessed_result) |
| | | |
| | | # assert check_return_type(results) |
| | | return results |