Minor fixes
Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
parent
3730a884b0
commit
709fb36701
17 changed files with 73 additions and 60 deletions
|
|
@ -11,14 +11,14 @@ from good_ai import use_model, log_argument, log_metric
|
|||
from good_ai.utilities.clean import clean
|
||||
|
||||
|
||||
@log_metric('text_length', calculate=lambda text: len(text))
|
||||
@log_argument('text', expected_type=str, validator=lambda t: len(t) > 0)
|
||||
@use_model(model_key, version="latest")
|
||||
@log_argument('text', validator=lambda t: len(t) > 0)
|
||||
def predict_domain(
|
||||
text: str, model: Pipeline, cut_off_probability: float = 0.2
|
||||
) -> List[DomainPrediction]:
|
||||
assert 0 <= cut_off_probability <= 1
|
||||
|
||||
log_metric('text_length', len(text))
|
||||
|
||||
cleaned = clean(text, convert_to_ascii=True)
|
||||
text = re.sub(r"[^a-zA-Z0-9]", " ", cleaned)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue