Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ 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 |
-
|
| 45 |
import pycld2 as cld2
|
| 46 |
# available_languages = cld2.LANGUAGES
|
| 47 |
isReliable, textBytesFound, details = cld2.detect(self.text, returnVectors=False, bestEffort=True)
|
|
@@ -76,7 +76,7 @@ def detect_language(input_text: str, used_libraries: list[str]) -> tuple[str, st
|
|
| 76 |
if 'pycld2' in used_libraries:
|
| 77 |
detections.append(['pycld2'] + detectinstance.pycld2())
|
| 78 |
if 'fastlangdetect' in used_libraries:
|
| 79 |
-
detections.append([
|
| 80 |
print(detections)
|
| 81 |
return detections
|
| 82 |
|
|
|
|
| 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)
|
|
|
|
| 76 |
if 'pycld2' in used_libraries:
|
| 77 |
detections.append(['pycld2'] + detectinstance.pycld2())
|
| 78 |
if 'fastlangdetect' in used_libraries:
|
| 79 |
+
detections.append(['fastlangdetect'] + detectinstance.fastlangdetect())
|
| 80 |
print(detections)
|
| 81 |
return detections
|
| 82 |
|