diff options
author | Kyomotoi <[email protected]> | 2022-11-04 10:17:46 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2022-11-04 10:17:46 +0800 |
commit | 790e4b49e4394565aba3a76c10ed6b90ffb37c9b (patch) | |
tree | 472daeafd3733119ac029d69ad111b88caef3916 /ATRI/plugins/util | |
parent | 62a3aa46441d9f2f2e5e4857c6769d7ac99e14d9 (diff) | |
download | ATRI-790e4b49e4394565aba3a76c10ed6b90ffb37c9b.tar.gz ATRI-790e4b49e4394565aba3a76c10ed6b90ffb37c9b.tar.bz2 ATRI-790e4b49e4394565aba3a76c10ed6b90ffb37c9b.zip |
🎨 跟随基础设施变化, 优化代码
Diffstat (limited to 'ATRI/plugins/util')
-rw-r--r-- | ATRI/plugins/util/data_source.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ATRI/plugins/util/data_source.py b/ATRI/plugins/util/data_source.py index 5245518..68edc82 100644 --- a/ATRI/plugins/util/data_source.py +++ b/ATRI/plugins/util/data_source.py @@ -1,7 +1,7 @@ import re from math import floor import jieba.posseg as pseg -from typing import Union, Optional +from typing import Union from random import random, choice, randint @@ -179,7 +179,7 @@ class Yinglish: def __init__(self, context: str): self.context = context - def _to_ying(x, y, ying) -> str: + def _to_ying(self, x: str, y: str, ying: float) -> str: if random() > ying: return x if x in [",", "。"]: @@ -202,5 +202,5 @@ class Yinglish: x = "〇" * len(x) return str(choice([f"...{x}", f"....{x}", f".....{x}", f"......{x}"])) - def deal(self, ying: Optional[float] = 0.5) -> str: + def deal(self, ying: float = 0.5) -> str: return "".join([self._to_ying(x, y, ying) for x, y in pseg.cut(self.context)]) |