Skip to content

pypi_1.0.0 Reduce implicit fallbacks

Latest
Compare
Choose a tag to compare
@sudoskys sudoskys released this 17 Sep 06:32
· 4 commits to main since this release
9a828e4

⚠️ Breaking change

Please check README for details of the changes.

Keep it simple, keep it stupid.

from fast_langdetect import detect

-result = detect("Olá mundo", low_memory=False)
-print(code_to_english_name(result["lang"]))  # Portuguese (Brazil) or Portuguese

+result = detect("Olá mundo", model='full', k=1) # Just use it!
+print(code_to_english_name(result[0]["lang"]))  # Portuguese (Brazil) or Portuguese
config = LangDetectConfig(
-allow_fallback=False,  # It introduces unnecessary confusion
custom_model_path=None,
cache_dir=tempfile.gettempdir(),
)

I miss allow_fallback...

You can implement the old allow_fallback func through composition, so that you can freely control the error handling logic.

try:
   return detect("Olá mundo", model='full', k=1) 
except: 
   return detect("Olá mundo", model='lite', k=1) 

What's Changed

  • fix: wrongly fallback to low memory model when model corrupted by @JackyHe398 in #20
  • 🔧 fix: bump version to 0.4.0 for new features and improvements by @sudoskys in #21
  • ♻️ refactor(tests/infer): Unify detect functions, make the API more intuitive and avoid implicit fallbacks by @sudoskys in #22

New Contributors

Full Changelog: pypi_0.3.2...pypi_1.0.0