luga
v0.2.7

Luga เป็นคำภาษาสวาฮิลีสำหรับภาษา FastText นำเสนอเครื่องมือตรวจจับภาษาที่รวดเร็ว API ของ FastText นั้นน่าเศร้าน้อยกว่าความงามและเอกสารนั้นค่อนข้างคลุมเครือ นอกจากนี้ยังเป็นเรื่องขี้ขลาดที่เราต้องดาวน์โหลดและโหลดโมเดลด้วยตนเอง
นี่คือที่ที่ Luga เข้ามาเราเป็นนามธรรมขั้นตอนที่ไม่จำเป็นและอนุญาตให้คุณทำสิ่งหนึ่งที่แม่นยำ: การตรวจจับภาษาข้อความ
ยืนนิ่ง อยู่เงียบ - ความสัมพันธ์ระหว่างภาษาอินโด - ยูโรเปียนและภาษา Uralic โดย Minna Sundberg

python -m pip install -U luga from luga import language
print ( language ( "the world ended yesterday" ))
# Language(name='en', score=0.98)ด้วยรายการข้อความเราสามารถสร้างหน้ากากสำหรับไปป์ไลน์การกรองที่สามารถใช้ได้เช่นกับ dataframes
from luga import language
import pandas as pd
examples = [ "Jeg har ikke en rød reje" , "Det blæser en halv pelican" , "We are not robots yet" ]
languages ( texts = examples , only_language = True , to_array = True ) == "en"
# output
# array([False, False, True])
dataf = pd . DataFrame ({ "text" : examples })
dataf . loc [ lambda d : languages ( texts = d [ "text" ]. to_list (), only_language = True , to_array = True ) == "en" ]
# output
# 2 We are not robots yet
# Name: text, dtype: objectดาวน์โหลดรุ่น
wget https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin -O /tmp/lid.176.binโหลดและใช้งาน
import fasttext
PATH_TO_MODEL = '/tmp/lid.176.bin'
fmodel = fasttext . load_model ( PATH_TO_MODEL )
fmodel . predict ([ "the world has ended yesterday" ])
# ([['__label__en']], [array([0.98046654], dtype=float32)])poetry run pre-commit install # assumes git push is completed
git tag -l # lists tags
git tag v * . * . * # Major.Minor.Fix
git push origin tag v * . * . *
# to delete tag:
git tag -d v * . * . * && git push origin tag -d v * . * . *
# change project_toml and __init__.py to reflect new version artifacts.py บรรทัด 111 cast เพื่อแสดงรายการ [str] ที่ทำให้เกิดปัญหา