文本建模常用的预处理方法
来源:互联网 发布:诱导交友app源码 编辑:程序博客网 时间:2024/06/15 08:18
最近看文本建模,给一大段文本,如何建模???
以MeTa代码为例:
[[analyzers]] method = "ngram-word" ngram = 1 [[analyzers.filter]] type = "whitespace-tokenizer" [[analyzers.filter]] type = "lowercase" [[analyzers.filter]] type = "alpha" [[analyzers.filter]] type = "length" min = 2 max = 35 [[analyzers.filter]] type = "list" file = "lemur-stopwords.txt" [[analyzers.filter]] type = "porter2-stemmer"
This tells MeTA how to process the text before indexing the documents. “ngram=1” configures MeTA to use unigrams (single words). Each “[[analyzers.filter]]” tag defines a text filter that applies a special function on the text. These filters are being “chained” together; text will first be processed by a whitespace tokenizer which separates words based on white spaces, then all the tokenized words will be converted to lowercase. This is followed by a couple of filters that end up with stopword removal and stemming. These filters can be usually changed depending on the application. For more information on how to use and configure the filters in MeTA see MeTA's Analyzers and Filters documentation.
1、分词:使用空格(type = "whitespace-tokenizer")作为分割符号,方法是1-gram,即一个空格分一个词,如果是2-gram,则是两个空格分一个词;汉语有专门的分词工具。
2、字母转换为小写:type = "lowercase" ,便于将Me和me看做同一个词。
3、可以根据不同的应用,选择其他过滤器,如type = "length" 、type = "alpha"等。
4、去停顿词和功能词:file = "lemur-stopwords.txt",简单说是没有任何含义的词汇(a、about、above、上午、下午、中午),中英文都有相应的词集。
5、词干分析:type = "porter2-stemmer",看下面就懂了。
abandon abandon
abandoned abandon
abandoning abandon
abandonment abandon
abandons abandon
(2-5对应于前段时间做的微博分析,则是转换所有图片为picture、转换所有超链接为http等处理,一定要做适合自己的过滤)
6、筛选有用词汇:通过信息增益、CHI-test或其他TF-IDF等方法
文本建模系列会不断更新。。。。
1 0
- 文本建模常用的预处理方法
- 文本建模常用的预处理方法——特征选择方法(CHI和IG)
- 文本建模常用的预处理方法——删除停顿词和stem操作的处理顺序
- 常用的数据预处理方法
- sklearn中常用的数据预处理方法
- 【Trick】数据预处理的常用方法
- 数学建模的常用模型和方法
- 常用背景建模方法的一句话总结
- 数学建模的常用模型和方法
- 在数学建模中常用的方法
- 几种简单的文本数据预处理方法
- 一些常用python预处理方法
- 一些常用python预处理方法
- 预处理的一下常用方法#ifdef\#if\#define
- python中常用的九种预处理方法分享
- python中常用的九种预处理方法分享
- 基于背景建模方法处理视频(常用的函数)
- 文本预处理
- 网站发送邮件及群发的两种方法
- MP3芯片介绍
- WebView详细介绍
- 调用有道词典查词
- PHP中错误模块简介
- 文本建模常用的预处理方法
- 物联网操作系统HelloX开发者入门指南
- 排序算法总结---冒泡排序
- 滚动页面时DIV到顶部时fixed(原生js实现)
- 设计模式-外观模式
- this is a test
- 教程——基于HLS实现FIR滤波器
- 网络编程 select epoll
- ubuntu下安装XAMPP