currentslab / fastlangid

fastlangid, the only language identification package that support cantonese (zh-yue), simplified (zh-hans) and traditional chinese (zh-hant)
https://pypi.org/project/fastlangid/
Apache License 2.0
38 stars 8 forks source link

ValueError with fasttext dependency #7

Open lucpotage opened 4 weeks ago

lucpotage commented 4 weeks ago

I got this error when using the lib:

File "/opt/venv/lib/python3.11/site-packages/fastlangid/langid.py", line 105, in predict
  return self._predict_text(text, supplement_threshold=supplement_threshold, k=k, prob=prob, force_second=force_second)
File "/opt/venv/lib/python3.11/site-packages/fastlangid/langid.py", line 62, in _predict_text
  labels, probs = self.model.predict(text, k=max(3, k))
File "/opt/venv/lib/python3.11/site-packages/fasttext/FastText.py", line 239, in predict
  return labels, np.array(probs, copy=False)
ValueError: Unable to avoid copy while creating an array as requested.
If using `np.array(obj, copy=False)` replace it with `np.asarray(obj)` to allow a copy when needed (no behavior change in NumPy 1.x).
For more details, see https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

But I see that the dependency was archived. What are the alternatives to detect languages?