Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,11 @@ class Detect():
|
|
| 41 |
from fast_langdetect import detect
|
| 42 |
result = detect(text=self.text, model="auto", k=1)[0]
|
| 43 |
return [result.get('lang'), abs(round(number=result.get('score') * 100, ndigits=2))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
def fasttext(self) -> list[str, float]:
|
| 45 |
import fasttext
|
| 46 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 41 |
from fast_langdetect import detect
|
| 42 |
result = detect(text=self.text, model="auto", k=1)[0]
|
| 43 |
return [result.get('lang'), abs(round(number=result.get('score') * 100, ndigits=2))]
|
| 44 |
+
def pycld2(self) -> list[str, float]:
|
| 45 |
+
import pycld2 as cld2
|
| 46 |
+
# available_languages = cld2.LANGUAGES
|
| 47 |
+
isReliable, textBytesFound, details = cld2.detect(self.text, returnVectors=False, bestEffort=True)
|
| 48 |
+
return [details[0][1], round(details[0][2], 2)]
|
| 49 |
def fasttext(self) -> list[str, float]:
|
| 50 |
import fasttext
|
| 51 |
from huggingface_hub import hf_hub_download
|