mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
Merge pull request #44 from fangd123/dev
better asr text result with json style output
This commit is contained in:
commit
96d637a58b
@ -3,6 +3,7 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
@ -637,8 +638,9 @@ def inference_modelscope(
|
|||||||
postprocessed_result[2]
|
postprocessed_result[2]
|
||||||
if len(word_lists) > 0:
|
if len(word_lists) > 0:
|
||||||
text_postprocessed_punc, punc_id_list = text2punc(word_lists, 20)
|
text_postprocessed_punc, punc_id_list = text2punc(word_lists, 20)
|
||||||
text_postprocessed_punc_time_stamp = "predictions: {} time_stamp: {}".format(
|
text_postprocessed_punc_time_stamp = json.dumps({"predictions": text_postprocessed_punc,
|
||||||
text_postprocessed_punc, time_stamp_postprocessed)
|
"time_stamp": time_stamp_postprocessed},
|
||||||
|
ensure_ascii=False)
|
||||||
else:
|
else:
|
||||||
text_postprocessed_punc = ""
|
text_postprocessed_punc = ""
|
||||||
punc_id_list = []
|
punc_id_list = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user