How to use the mlprimitives.custom.text.TextCleaner.detect_language function in mlprimitives

To help you get started, we’ve selected a few mlprimitives examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HDI-Project / MLPrimitives / tests / custom / test_text.py View on Github external
def test_detect_language_en(self):
        texts = [
            'this is an english text',
            'this is also something written in engilsh',
            'and finally something else to make sure that the language is detected'
        ]

        language = TextCleaner.detect_language(texts)

        assert language == 'en'
github HDI-Project / MLPrimitives / tests / custom / test_text.py View on Github external
def test_detect_language_es(self):
        texts = [
            'esto es un texto en español',
            'esto también está escrito en español',
            'y finalmente alguna cosa más para asegurar que el idioma es detectado'
        ]

        language = TextCleaner.detect_language(texts)

        assert language == 'es'