一个python包,它在文本上运行一系列操作来修饰一个语料库

textnormaliser的Python项目详细描述


text-normaliser

一个python包,它在文本上运行一系列操作来修饰语料库。

CircleCIPyPi version

存在理由:思想气球:

这允许文本在被发送到矢量模型之前变得正常化。对文本进行一系列的文本检查、预处理和修饰操作,去除不重要的数据,并从基于规则的模型中嵌入新的信息。

建筑:三角尺:

text-normaliser有两种主要的操作模式,检查是否包含该行,然后在处理该行后将其标准化。为了确定是否应包括该行,将进行以下检查:

  • letter filtering,它接受文本,除去英语拉丁字符以外的所有字符,并检查结果的长度是否合适。
  • 语言筛选,它接受文本,并基于字符ngram模型确定文本是否为英语。 如果这两个检查都通过,则执行以下正常化操作:
  • 实体标记,它接受文本并用它们的类型(例如金钱、日期或人)标记文本中的所有实体。
  • 词性标记,它接受文本并对单词的类型(例如形容词或名词)进行标记。这不会标记按实体标记分组的任何内容。
  • 小写,将所有文本小写以删除flair。
  • html解码,将html编码字符解码为unicode。

相依关系:带子午线的地球仪:

安装:收件箱托盘:

任何安装的主要要求都基于scrapy和splash,请参见下面的本地和基于云的选项。

局部

  1. 运行python setup.py --install
  2. 运行python -m spacy download en
  3. 运行python -m unittest discover -v进行单元测试。

通过PYPI

  1. 运行pip install textnormaliser
  2. 运行python -m spacy download en

用法示例:eyes:

为了使文本语料库正常化,请执行以下操作:

textnormaliser [corpus-file][output-file]

结果将是一个新的文本输出文件,该文件已正常化。假设您有以下输入文件:

European authorities fined Google a record $5.1 billion on Wednesday for abusing its power in the mobile phone market and ordered the company to alter its practices

Yeah, as a Libertarian who leans left socially but right in other areas (used to be fiscally, but the right isn't about smaller government anymore!) I can personally attest to the fact that calling us names just makes us more determined to dig in and shore up.

You don't win people over by calling them stupid and telling them they are wrong.  You win them over by convincing them that there is something new and better.

这将导致以下结果:

norp_european nns_authorities vbd_fined org_google a nn_record money__5_1_billion in_on date_wednesday in_for vbg_abusing prp$_its nn_power in_in dt_the jj_mobile nn_phone nn_market cc_and vbd_ordered dt_the nn_company to_to vb_alter prp$_its nns_practices
uh_yeah , in_as a norp_libertarian wp_who vbz_leans vbn_left rb_socially cc_but rb_right in_in jj_other nns_areas ( vbn_used to_to vb_be rb_fiscally , cc_but dt_the nn_right vbz_is rb_n't rb_about jjr_smaller nn_government rb_anymore ! ) i md_can rb_personally vb_attest to_to dt_the nn_fact in_that vbg_calling prp_us rb_names rb_just vbz_makes prp_us rbr_more jj_determined to_to vb_dig in_in cc_and vb_shore rp_up .
prp_you vbp_do rb_n't vb_win nns_people in_over in_by vbg_calling prp_them jj_stupid cc_and vbg_telling prp_them prp_they vbp_are jj_wrong . prp_you vbp_win prp_them rp_over in_by vbg_convincing prp_them in_that ex_there vbz_is nn_something jj_new cc_and jjr_better .

许可证:备注:

该项目在MIT许可下可用。

致谢

  • 自述标题中的图标是名词项目中变色龙设计的text

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

推荐PyPI第三方库


热门话题
java提供了大量的Quartz工作线程   来自SOAPException的java抛出超时异常   java通过REST web服务同步PostgreSQL过程调用   java Hibernate:在关联表中设置值   javaimapidlechanneladapterjavax。邮政AuthenticationFailedException:[警报]同时连接太多   JavaApacheStorm:stormkafkamonitor脚本引发异常   java将jar链接到战争   Matlab与Java的集成方法   安卓公司。谷歌。ads.AdView未能实例化java。lang.ClassNotFoundException:org。json。JSONException   “String forecastStr=mForecastAdapter.getItem(position);”行中出现java错误阳光工程   java如何将Mono中的列表属性作为流量进行操作?   java DecimalFormat类不必要地给出整数   java@IfProfileValue两个spring配置文件   java如何使用SwingWorker创建多线程?   java从扩展SwingWorker的内部类触发事件   java二叉树高度实现