Skip to content

Commit

Permalink
Merge pull request #139 from ziliwang/master
Browse files Browse the repository at this point in the history
real quiet mode
  • Loading branch information
aboSamoor committed Mar 20, 2018
2 parents ea2476f + 8d74897 commit 7cd48c2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions polyglot/detect/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ def detect(self, text):
if not reliable:
self.reliable = False
reliable, index, top_3_choices = cld2.detect(t, bestEffort=True)

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.")

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.")

self.languages = [Language(x) for x in top_3_choices]
self.language = self.languages[0]
Expand Down

0 comments on commit 7cd48c2

Please sign in to comment.