Spaces:
Sleeping
Sleeping
import pytest | |
from obsei.analyzer.classification_analyzer import ( | |
ZeroShotClassificationAnalyzer, | |
TextClassificationAnalyzer, | |
) | |
from obsei.analyzer.ner_analyzer import TransformersNERAnalyzer, SpacyNERAnalyzer | |
from obsei.analyzer.pii_analyzer import ( | |
PresidioEngineConfig, | |
PresidioModelConfig, | |
PresidioPIIAnalyzer, | |
) | |
from obsei.analyzer.sentiment_analyzer import VaderSentimentAnalyzer | |
from obsei.analyzer.translation_analyzer import TranslationAnalyzer | |
from obsei.preprocessor.text_cleaner import TextCleaner | |
from obsei.preprocessor.text_splitter import TextSplitter | |
def zero_shot_analyzer(): | |
return ZeroShotClassificationAnalyzer( | |
model_name_or_path="typeform/mobilebert-uncased-mnli", | |
) | |
def text_classification_analyzer(): | |
return TextClassificationAnalyzer( | |
model_name_or_path="obsei-ai/sell-buy-intent-classifier-bert-mini", | |
) | |
def vader_analyzer(): | |
return VaderSentimentAnalyzer() | |
def trf_ner_analyzer(): | |
return TransformersNERAnalyzer( | |
model_name_or_path="dbmdz/bert-large-cased-finetuned-conll03-english", | |
tokenizer_name="bert-base-cased", | |
) | |
def spacy_ner_analyzer(): | |
return SpacyNERAnalyzer( | |
model_name_or_path="en_core_web_sm", | |
) | |
def translate_analyzer(): | |
return TranslationAnalyzer( | |
model_name_or_path="Helsinki-NLP/opus-mt-hi-en", batch_size=1 | |
) | |
def pii_analyzer(): | |
return PresidioPIIAnalyzer( | |
engine_config=PresidioEngineConfig( | |
nlp_engine_name="spacy", | |
models=[PresidioModelConfig(model_name="en_core_web_lg", lang_code="en")], | |
) | |
) | |
def text_cleaner(): | |
return TextCleaner() | |
def text_splitter(): | |
return TextSplitter() | |