py lingualytics

Python 2025-07-27

lingualytics:具有CODEMIX支持的指示分析

Lingualytics是用于处理指示文本的Python库。
Lingualytics由Pytorch,Transformers,Texthero,NLTK和Scikit-Learn等强大的图书馆提供动力。

查看我们的演示视频!

?功能

  1. 预处理

    • 删除停止字
    • 删除标点符号,并可以选择添加您自己的语言的标点符号
    • 删除小于字符限制的单词
  2. 表示

    • 从给定文本查找n-gram
  3. NLP

    • 使用Pytorch进行分类
      • 在数据上培训分类器以执行情感分析等任务
      • 用准确性,F1分数,精确度和召回等指标评估分类器
      • 使用训练有素的令牌仪来代币化文本

?易经的模型

结帐一些我们使用lingualytics培训的Codemix友好型型号

  • Bert-Base-Multlityal-Rudemixed cased-superiment
  • Bert-base-en-es-codemix cased
  • bert-base-en-hi-codemix cased

?安装

使用软件包管理器PIP安装lingualytics。

pip install lingualytics

?️用法

预处理

 from lingualytics . preprocessing import remove_lessthan , remove_punctuation , remove_stopwords
from lingualytics . stopwords import hi_stopwords , en_stopwords
from texthero . preprocessing import remove_digits
import pandas as pd
df = pd . read_csv (
   "https://*g**ithub.com/lingualytics/py-lingualytics/raw/master/datasets/SAIL_2017/Processed_Data/Devanagari/validation.txt" , header = None , sep = ' t ' , names = [ 'text' , 'label' ]
)
# pd.set_option('display.max_colwidth', None)
df [ 'clean_text' ] = df [ 'text' ]. pipe ( remove_digits ) 
                                    . pipe ( remove_punctuation ) 
                                    . pipe ( remove_lessthan , length = 3 ) 
                                    . pipe ( remove_stopwords , stopwords = en_stopwords . union ( hi_stopwords ))
print ( df )

分类

当前可用的数据集是

  • CS-EN-ES-Corpus Vilares,D。等。
  • Sail-2017 Dipankar Das。等。
  • Sub-Word-LSTM Joshi,Aditya等。
 from lingualytics . learner import Learner

learner = Learner ( model_type = 'bert' ,
                model_name = 'bert-base-multilingual-cased' ,
                dataset = 'SAIL_2017' )
learner . fit ()

自定义数据集

火车数据路径应该有3个文件

  • train.txt
  • 验证.txt
  • test.txt

任何文件都应将文本和标签在一行中,并由选项卡隔开。然后将data_dir更改为自定义数据集的路径。

查找最上方的N-Grams

 from lingualytics . representation import get_ngrams
import pandas as pd
df = pd . read_csv (
   "https://g*i*thu*b.com/jbesomi/texthero/raw/master/dataset/bbcsport.csv"
)

ngrams = get_ngrams ( df [ 'text' ], n = 2 )

print ( ngrams [: 10 ])

文档| API参考

文档是一项正在进行的工作!在这里看看它。

开发路线图

我们计划在接下来的几周内添加以下功能:

  • 语言识别(盖)
  • POS标签(POS)
  • 命名实体识别(NER)
  • 情感分析(SA)
  • 问答(QA)
  • 自然推论(NLI)
  • 主题建模(LDA)
  • 模糊的文本匹配
  • 单词感官歧义,TF-IDF,关键字提取
  • 通过不同语言的数据分发

?贡献

欢迎拉动请求。对于重大更改,请先开设一个问题,以讨论您想更改的内容。

⚖️许可证

麻省理工学院

参考

  1. Khanuja,Simran等。 “ Gluecos:代码开关NLP的评估基准。” ARXIV预印型ARXIV:2004.12376(2020)。
下载源码

通过命令行克隆项目:

git clone https://github.com/lingualytics/py-lingualytics.git