| """Translate english to chinese via a dict.""" |
| from typing import List, Union |
|
|
| import warnings |
|
|
| import copy |
| from gradiobee.mdx_e2c import mdx_e2c |
|
|
| warnings.simplefilter('ignore', DeprecationWarning) |
|
|
|
|
| |
| def en2zh( |
| |
| text: Union[str, List[str]], |
| ) -> List[str]: |
| |
| """Translate english to chinese via a dict. |
| |
| Args |
| text: to translate, list of str |
| |
| Returns |
| res: list of str |
| """ |
| res = copy.deepcopy(text) |
| if isinstance(text, str): |
| |
| res = [text] |
|
|
| |
| |
|
|
| |
| _ = [] |
| for line in res: |
| line_tr = [mdx_e2c(word) for word in line.split()] |
| _.append("".join(line_tr)) |
|
|
| return _ |
|
|