| | |
| | | from funasr.utils.datadir_writer import DatadirWriter |
| | | from funasr.register import tables |
| | | from funasr.models.ctc.ctc import CTC |
| | | from funasr.utils.load_utils import load_audio_and_text_image_video, extract_fbank |
| | | from funasr.utils.load_utils import load_audio_text_image_video, extract_fbank |
| | | |
| | | |
| | | @tables.register("model_classes", "monotonicaligner") |
| | |
| | | meta_data = {} |
| | | # extract fbank feats |
| | | time1 = time.perf_counter() |
| | | audio_list, text_token_int_list = load_audio_and_text_image_video(data_in, |
| | | audio_list, text_token_int_list = load_audio_text_image_video(data_in, |
| | | fs=frontend.fs, |
| | | audio_fs=kwargs.get("fs", 16000), |
| | | data_type=kwargs.get("data_type", "sound"), |
| | |
| | | text_postprocessed, time_stamp_postprocessed, _ = postprocess_utils.sentence_postprocess(token, timestamp) |
| | | result_i = {"key": key[i], "text": text_postprocessed, |
| | | "timestamp": time_stamp_postprocessed, |
| | | } |
| | | # ibest_writer["token"][key[i]] = " ".join(token) |
| | | ibest_writer["timestamp_list"][key[i]] = time_stamp_postprocessed |
| | | ibest_writer["timestamp_str"][key[i]] = timestamp_str |
| | | } |
| | | results.append(result_i) |
| | | |
| | | if ibest_writer: |
| | | # ibest_writer["token"][key[i]] = " ".join(token) |
| | | ibest_writer["timestamp_list"][key[i]] = time_stamp_postprocessed |
| | | ibest_writer["timestamp_str"][key[i]] = timestamp_str |
| | | |
| | | return results, meta_data |