aboSamoor / polyglot

Multilingual text (NLP) processing toolkit
http://polyglot-nlp.com
Other
2.31k stars 337 forks source link

quiet option in Detector doesn't seem to be working. #211

Open blasco opened 4 years ago

blasco commented 4 years ago

I've added the quite parameter:

    detector = Detector(string, quiet=True)

Still I get this printed out:

Detector is not able to detect the language reliably.

Is there a way to disable these logs?

blasco commented 4 years ago

I've checked the code and it doesn't match with the code in the latest commit of this repository. Here in github is correct, but in the version installed with pip install I can see:

      if not reliable and not self.quiet:
        raise UnknownLanguage("Try passing a longer snippet of text")
      else:
        logger.warning("Detector is not able to detect the language reliably.")

in polyglot/detect/base.py

Here in the repository:


      if not self.quiet:
        if not reliable:
          raise UnknownLanguage("Try passing a longer snippet of text")
        else:
          logger.warning("Detector is not able to detect the language reliably.")

Is there a way to update this so installing with pip results in the latest version?

robertour commented 4 years ago

You can use the code in the repo directly. Or, you can do it the hackish way for now:

from polyglot.detect.base import logger
logger.disabled = True
seyfer commented 12 months ago

@robertour that should be documented