polyglot icon indicating copy to clipboard operation
polyglot copied to clipboard

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

Open blasco opened this issue 6 years ago • 3 comments

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 avatar Dec 11 '19 08:12 blasco

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?

blasco avatar Dec 11 '19 09:12 blasco

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

robertour avatar May 31 '20 12:05 robertour

@robertour that should be documented

seyfer avatar Oct 09 '23 09:10 seyfer