一个python包,用于标记和规范主要用igbo语言编写的文本

igbo-text的Python项目详细描述


什么是igbo文本

igbo文本是一个用于标记化和规范化主要用igbo语言编写的文本的库。
这是由Ifeanyi Reuben Nkechi J.,Ugwu Chidiebere,Adegbola Tunde编写的Analysis and Representation of Igbo Text Document for a Text-Based System文中的标记化和规范化算法的实现。

安装

$ pip install igbo-text

示例

标准化

from igbo_text import IgboText

# Create IgboText class instance
igbo_text = IgboText()

# normalize text 
text = "Ọ nà-ezò nnukwu mmīri n'iro?"
normalized_text = igbo_text.normalize(text, convert_to_lower=True, remove_abbreviations=True)
print(normalized_text)

执行上述代码时,输出将为

na ezo nnukwu mmiri in iro

通过设置convert_to_lower=false,可以保留大写字符

通过将remove_缩写设置为true,可以不使用缩写

标记化

from igbo_text import IgboText

# Create IgboText class instance
igbo_text = IgboText()

# tokenize text
text = "Ndị Fàda kwènyèrè n'atọ̀ n'ime otù."
tokenized_text = igbo_text.tokenize(text)
print(tokenized_text)

当执行上述isi代码时,输出将是

[“nd_”,“fada”,“kwenyere”,“n'”,“at_”,“n'”,“ime”,“otu”,“]

您可以通过设置convert_to_lower=true将所有大写字符转换为小写字符。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为什么每次Listview都会出现线性布局?   java如何下次显示文件选择器选择的下一个图像   多线程在Java中线程死亡时ThreadPoolExecutor会发生什么   列表的java筛选器<List<String>>   从TreeViewer(SWT/Mac 10.6.8)拖动时未传递java MouseMove事件   NetBeans Java代码的完成太过迫切了   java无法打开Generated。xlsx由Apache POI提供,我将其发送到前端并从浏览器下载(消息:文件已损坏,无法打开)?   在Java中生成2d Json数组   java ClassNotFoundException:org。postgresql。作为jar文件运行项目时的驱动程序   java使用未完全初始化的“this”作为参数实例化对象   Java/Android:字面上比较两个日历对象的日期   java“x”是一个过程,当我已经在使用call时,请使用“call”   java Spring安全Google登录会话Rest服务