This repository has been archived by the owner on Apr 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
59 lines (52 loc) · 2.09 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from typing import List
from pydantic import BaseModel, Field
class Response(BaseModel):
sentences: List[str]
class SPLIT_SENTENCES(BaseModel):
text: str = Field(..., description="input texts")
use_heuristic: bool = Field(True, description="use heuristic algorithms or not")
use_quotes_brackets_processing: bool = Field(
True, description="use quotes and brackets processing or not"
)
max_recover_step: int = Field(
5, description="maximum step for quote and bracket misalignment recovering"
)
max_recover_length: int = Field(
20000,
description="maximum text length to recover when quote and bracket misaligned",
)
backend: str = Field(
"pynori", description="max length of text to use morpheme feature"
)
num_workers: int = Field(
-1,
description="number of multiprocessing workers ('-1' means maximum processes)",
)
disable_gc: bool = Field(
True, description="disable garbage collecting (It helps to improve speed)"
)
class SPLIT_CHUNKS(BaseModel):
text: str = Field(..., description="input texts")
max_length: int = Field(..., description="max length of ecah chunk")
overlap: bool = Field(False, description="whether allow duplicated sentence")
use_heuristic: bool = Field(True, description="use heuristic algorithms or not")
use_quotes_brackets_processing: bool = Field(
True, description="use quotes and brackets processing or not"
)
max_recover_step: int = Field(
5, description="maximum step for quote and bracket misalignment recovering"
)
max_recover_length: int = Field(
20000,
description="maximum text length to recover when quote and bracket misaligned",
)
backend: str = Field(
"pynori", description="max length of text to use morpheme feature"
)
num_workers: int = Field(
-1,
description="number of multiprocessing workers ('-1' means maximum processes)",
)
disable_gc: bool = Field(
True, description="disable garbage collecting (It helps to improve speed)"
)