spirit  committed 9883b67

USE_ENCHANT changeable at runtime

  • Participants
  • Parent commits c927440
  • Branches default

Comments (0)

Files changed (2)

File guess_language/

     return UNKNOWN
-def check(words, langs, use_enchant=USE_ENCHANT):
+def check(words, langs, use_enchant=None):
     """Check what is the best match.
+    if use_enchant is None:
+        use_enchant = USE_ENCHANT
     if use_enchant:
         tag = check_with_enchant(words, langs)
         if tag:

File guess_language/

     parser = argparse.ArgumentParser(
     parser.add_argument("--encoding", dest="encoding")
+    parser.add_argument("--no-enchant", dest="use_enchant",
+                        action="store_false")
     return parser.parse_args()
                 else sys.stdin.encoding if sys.stdin.isatty() else "utf-8")
     with open(sys.stdin.fileno(), encoding=encoding) as f:
         text = "\n".join(f.readlines())
+    guess_language.USE_ENCHANT = args.use_enchant