ansj 自定义 停用词

by Kavita Ganesan

通过Kavita Ganesan

构造自定义停用词列表的快速提示 (Quick tips for constructing custom stop word lists)

In natural language processing (NLP) and text mining applications, stop words are used to eliminate unimportant words, allowing applications to focus on the important words instead.

在自然语言处理(NLP)和文本挖掘应用程序中,停用词用于消除不重要的词,从而使应用程序专注于重要的词。

Stop words are a set of commonly used words in any language. For example, in English, “the”, “is”, and “and” would easily qualify as stop words.

停用词是一组使用任何语言的常用词。 例如,用英语,“ the”,“ is”和“ and”将很容易被视为停用词。

While there are various published stop words that one can use, in many cases these stop words are insufficient as they are not domain-specific. For example, in clinical texts, terms like “mcg” “dr.” and “patient” occur in almost every document that you come across. So, these terms may be regarded as potential stop words for clinical text mining and retrieval.

尽管可以使用各种已发布的停用词,但在许多情况下,这些停用词是不够的,因为它们不是特定于域的。 例如,在临床文本中,诸如“ mcg”,“ dr。”之类的术语 在您遇到的几乎所有文档中都会出现“耐心”的表情。 因此,这些术语可能被视为临床文本挖掘和检索的潜在停用词。

Similarly, for tweets, terms like “#”, “RT”, “@username” can be potentially regarded as stop words. The common language specific stop word list generally does not cover such domain-specific terms.

类似地,对于推文,诸如“#”,“ RT”,“ @ username”之类的词可能被视为停用词。 特定于公共语言的停用词列表通常涵盖此类特定于域的术语。

The good news is that it is actually fairly easy to construct your own domain-specific stop word list. Here are a few ways of doing it assuming you have a large corpus of text from the domain of interest, you can do one or more of the following to curate your stop word list:

好消息是,构建您自己的特定于域的停用词列表实际上相当容易。 假设您有来自感兴趣领域的大量文本,这是几种方法,您可以执行以下一项或多项操作来组织停用词列表:

1.最常用的术语作为停用词 (1. Most frequent terms as stop words)

Sum the term frequencies of each unique word (w) across all documents in your collection. Sort the terms in descending order of raw term frequency. You can take the top K terms to be your stop words.

对集合中所有文档中每个唯一单词( w )的术语频率求和。 按原始术语频率的降序对术语进行排序。 您可以将前K个词作为停用词。

You can also eliminate common English words (using a published stop list) prior to sorting so that you target the domain-specific stop words.

您还可以在排序之前消除常见的英语单词(使用已发布的停用词),以便定位特定于域的停用词。

Another option is to treat words occurring in more X% of your documents as stop words. I have found eliminating words that appear in 85% of documents to be effective in several text mining tasks. The benefit of this approach is that it is really easy to implement. The downside, however, is if you have a particularly long document, the raw term frequency from just a few documents can dominate and cause the term to be at the top. One way to resolve this is to normalize the raw term frequency using a normalizer such as the document length — the number of words in a given document.

另一种选择是将文档中X%以上出现的单词视为停用词。 我发现消除出现在文档中85%的单词在某些文本挖掘任务中是有效的。 这种方法的好处是它真的很容易实现。 但是,不利的一面是,如果您的文档特别长,那么仅几个文档中的原始术语频率就可能占主导地位,并使该术语排在最前。 解决此问题的一种方法是使用规范化程序(例如文档长度,即给定文档中的单词数)对原始术语频率进行规范化。

2.最少用词作为停用词 (2. Least frequent terms as stop words)

Just as terms that are extremely frequent could be distracting terms rather than discriminating terms, terms that are extremely infrequent may also not be useful for text mining and retrieval. For example, the username “@username” that occurs only once in a collection of tweets, may not be very useful. Other terms like “yoMateZ!” which could just be made-up terms by people again may not be useful for text mining applications.

正如非常频繁使用的术语可能会分散注意力而不是区分术语一样,非常不常用的术语也可能不适用于文本挖掘和检索。 例如,在一组推文中仅出现一次的用户名“ @username”可能不是很有用。 其他术语如“ yoMateZ!” 可能只是人们再次编造的术语,对于文本挖掘应用程序可能没有用。

Note: certain terms like “yaaaaayy!!” can often be normalized to standard forms such as “yay”.

注意 :某些术语,例如“ yaaaaayy !!” 通常可以标准化为标准格式,例如“是”。

However, despite all the normalization, if a term still has a frequency count of one you could remove it. This could significantly reduce your overall feature space.

但是,尽管进行了所有归一化,但是如果一个术语的频率计数仍为1,则可以将其删除。 这可能会大大减少您的整体功能空间。

3.低IDF词作为停用词 (3. Low IDF terms as stop words)

Inverse document frequency (IDF) refers to the inverse fraction of documents in your collection that contains a specific term (ti). Let us say:

反向文档频率(IDF)指集合中包含特定术语( ti )的文档的反向比例。 让我们说:

  • you have N documents

    你有N个文件

  • term ti occurred in M of the N documents.

    ti一词出现在N个文档中的M个中。

The IDF of ti is thus computed as:

因此, ti的IDF计算为:

So, the more documents ti appears in, the lower the IDF score. This means terms that appear in every document will have an IDF score of 0.

因此, ti出现的文件越多, IDF得分就越低。 这意味着出现在每个文档中的术语的IDF得分均为0。

If you rank each ti in your collection by its IDF score in descending order, you can treat the bottom K terms with the lowest IDF scores to be your stop words.

如果按IDF分数按降序对集合中的每个ti进行排名,则可以将IDF分数最低的后 K个词作为停用词。

Again, you can also eliminate common English words using a published stop list prior to sorting so that you target the domain-specific low IDF words. This is not necessary if your K is large enough that it will prune both general stop words as well as domain-specific stop words. You will find more information about IDFs here.

同样,您还可以在排序之前使用已发布的停止列表消除常见的英语单词,从而定位特定域的低IDF单词 。 如果您的K足够大,可以修剪一般停用词和特定于域的停用词,则没有必要。 您可以在此处找到有关IDF的更多信息。

那么,停词会帮助我完成任务吗? (So, would stop words help my task?)

How would you know if removing domain specific stop words would be helpful in your case? Easy — test it on a subset of your data. See if whatever measure of accuracy and performance improves, stays constant, or degrades. If it degrades, needless to say, don’t do it unless the degradation is negligible and you see gains in other forms such as a decrease in size of model, or the ability to process things in memory.

您怎么知道删除特定于域的停用词是否对您有帮助? 轻松-在数据的子集上对其进行测试。 查看准确性和性能的任何衡量指标是否得到改善,保持不变或降低。 如果它降级了,不用说,除非降级可以忽略不计,否则您就不要这样做,您会看到其他形式的收益,例如模型尺寸的减小或处理内存中事物的能力。

翻译自: https://www.freecodecamp.org/news/quick-tips-for-constructing-custom-stop-word-lists-c22b40a25169/

ansj 自定义 停用词

ansj 自定义 停用词_构造自定义停用词列表的快速提示相关推荐

  1. 自定义注解 实现自定义消息_实现自定义的未来

    自定义注解 实现自定义消息 上一次我们学习了java.util.concurrent.Future<T>背后的原理 . 我们还发现, Future<T>通常由库或框架返回. 但 ...

  2. 如何设置自定义任务栏图标_轻松自定义Windows 7任务栏图标

    如何设置自定义任务栏图标 Would you like to fully customize your Windows 7 icons without having to manually chang ...

  3. 自定义音频播放器_创建自定义HTML5音频播放器

    自定义音频播放器 在本教程中,我将向您介绍HTML5音频,并向您展示如何创建自己的播放器. 如果您想走捷径,请查看Envato市场上可用的现成的HTML5音频播放器 . 它使您可以从各种来源创建播放列 ...

  4. 词云中去重复的词_李清照特别经典的词,把相思写得淋漓尽致,读一次心疼一次...

    李清照是我国著名的女词人,为我们留下了许多精美的作品,但是她的人生却是几位的坎坷.遭在1101年时她与赵明诚结婚,是人们眼中的天作之合,后来她的父亲蒙受冤屈,而她不得已不还乡,时常与丈夫分离.不能与相 ...

  5. 计算机社团成立大会主持稿四个主持人,团委成立大会主持词_社团成立大会主持词范文...

    [www.scabjd.com--主持词] 主持词网免费发布社团成立大会主持词范文,更多社团成立大会主持词范文相关信息请访问主持词网. [导语]主持词重要的是要突出活动主旨并贯穿始终.确定活动主题以后 ...

  6. 拜日式精准引导词_拜日式引导词

    ​我们直接站立在垫子最前端.以三组拜日来开始我们今天的热身.山式站立在垫子前端. 双手胸前合十.站立祈祷式.双脚双腿并拢.双腿用力向内夹紧.臀部收紧.深吸气,呼气,掌心向内翻转,带动身体向下. 吸气双 ...

  7. 词向量构造 - 词袋模型

    对于机器学习任务而言,不管是什么类型的数据(语言,声音,图像,视频),都必须转化为数值型数据,一般均为向量或者矩阵.自然语言处理,经过了一个长期的发展过程,近几年取得了重大的突破.自然语言处理的突破主 ...

  8. 敏感词过滤之——自定义构建查询词库与快速查询实现

    关于敏感词过滤的一点思考与实践 业务场景 思考与研究 逻辑分析 代码实现(php) 构建敏感词树 分割字符串 敏感词树长分支的递归实现 读取敏感词库 敏感词树的查询 查询实现 调用 测试.分析与总结 ...

  9. java类中自定义函数的调用_关于方法:自定义类中对函数的未解析引用

    我无法解决看似微不足道的问题.我的问题可能是缺乏对Kotlin语言的经验(和理解).不过,我将需要帮助. 我做了一个自定义类,其中包含一个自定义函数.看起来很简单,但是当我尝试使用此功能时,我一直收到 ...

最新文章

  1. 初玩树莓派所遇见的坑
  2. SpringBoot使用velocity模板引擎
  3. mongodb 入门 启动mongodb 无法启动 问题 非正常关闭
  4. Qt消息机制与window程序消息的对比分析
  5. C# 9 新特性——init only setter
  6. Structured Exception Handling
  7. org.slf4j.Logger中isTraceEnabled(),isDebugEnabled(),isInfoEnabled(),isWarnEnabled(),isErrorEnabled()
  8. Lvs别样的自动部署监控shell脚本
  9. wps怎么做时间线_时间不够用怎么办?如何做才会更高效
  10. python读取mysql数据库行数_使用python读取mysql数据库并进行数据的操作
  11. 光棍节程序员闯关秀 小游戏
  12. 29 岁成为阿里巴巴 P8,工作前 5 年完成晋升 3 连跳,他如何做到?
  13. springboot办公OA考勤请假系统java
  14. kindle电子书转PDF,结合calibre工具和DeDRM_tools使用
  15. AutoVue 21.0.1新版本特性:支持在没有Applets的浏览器中运行
  16. mysql-8xxx遇坑后的安装
  17. ubuntu16.04录制4K屏软件使用备注
  18. C#:实现 Van Eck‘s sequence范·艾克序列算法(附完整源码)
  19. Centos7安装(四)抓包工具wireshark源码编译安装
  20. Shell bash和sh区别

热门文章

  1. 0309随堂笔记 银行转帐功能 对向封装 1615278206
  2. 控件的事件 1124
  3. web-使用wsgiref模块模拟web框架
  4. Java Virtual Machine报错:A Java Exception has occured
  5. Linux Shell 操作命令 ls
  6. TextBox控件的DataBindings属性
  7. 引人瞩目的 CSS 变量(CSS Variable)
  8. 浅谈 Python 中的 __init__ 和 __new__
  9. Mono for Android—初体验之“电话拨号器”
  10. ExpandableListActivity列表嵌套列表