BS 0.1.0 EasySave

This commit is contained in:
2025-07-10 15:08:20 +08:00
parent 39f8320c49
commit b259b499d4
12 changed files with 197 additions and 295 deletions

View File

@@ -1,5 +1,5 @@
from pathlib import Path
from Config import *
from .Config import *
import re
from pathlib import Path
import xml.etree.ElementTree as ET
@@ -47,13 +47,13 @@ def Bytes2String(lines:List[bytes], encoding='utf-8') -> str:
return "".join(Bytes2Strings(lines, encoding))
def word_segmentation(
sentence: Union[str, light_str, Any],
sentence,
cut_all: bool = False,
HMM: bool = True,
use_paddle: bool = False
) -> Sequence[Optional[Union[Any, str]]]:
try:
import jieba
return jieba.dt.cut(UnWrapper(sentence), cut_all=cut_all, HMM=HMM, use_paddle=use_paddle)
return jieba.dt.cut(str(sentence), cut_all=cut_all, HMM=HMM, use_paddle=use_paddle)
except ImportError:
raise ValueError("jieba is not install")