标签: text-analysis

高效的Lemmatizer,避免字典查找

我想把像'吃'这样的字符串转换成'吃','吃'.我搜索并发现了词形还原作为解决方案,但我遇到的所有lemmatizer工具都使用wordlist或字典查找.是否存在避免字典查找并提供高效率的词形变换器,可能是基于规则的词形变换器.是的,我不是在寻找"干扰者".

java text-analysis relevance lemmatization

7
推荐指数
1
解决办法
856
查看次数

在NLTK中阻止非结构化文本

我尝试了正则表达式,但我得到了数百个不相关的令牌.我只对"玩"词干感兴趣.这是我正在使用的代码:

import nltk
from nltk.book import *
f = open('tupac_original.txt', 'rU')
text = f.read()
text1 = text.split()
tup = nltk.Text(text1)
lowtup = [w.lower() for w in tup if w.isalpha()]
import sys, re
tupclean = [w for w in lowtup if not w in nltk.corpus.stopwords.words('english')]
from nltk import stem
tupstem = stem.RegexpStemmer('az$|as$|a$')
[tupstem.stem(i) for i in tupclean] 
Run Code Online (Sandbox Code Playgroud)

以上结果是;

['like', 'ed', 'young', 'black', 'like'...]
Run Code Online (Sandbox Code Playgroud)

我正在尝试清理.txt文件(全部小写,删除停用词等),将一个单词的多个拼写规范化为一个并执行频率dist/count.我知道该怎么做FreqDist,但有任何关于堵塞的问题的建议吗?

text-analysis tokenize nltk lemmatization

7
推荐指数
1
解决办法
7254
查看次数

如何使用sklearn CountVectorizer同时使用'word'和'char'分析器? - 蟒蛇

如何使用sklearn CountVectorizer同时使用'word'和'char'分析器? http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html

我可以通过单词或字符分别提取文本功能,但我如何创建charword_vectorizer?有没有办法结合矢量化器?或使用多个分析仪?

>>> from sklearn.feature_extraction.text import CountVectorizer
>>> word_vectorizer = CountVectorizer(analyzer='word', ngram_range=(1, 2), min_df=1)
>>> char_vectorizer = CountVectorizer(analyzer='char', ngram_range=(1, 2), min_df=1)
>>> x = ['this is a foo bar', 'you are a foo bar black sheep']
>>> word_vectorizer.fit_transform(x)
<2x15 sparse matrix of type '<type 'numpy.int64'>'
    with 18 stored elements in Compressed Sparse Column format>
>>> char_vectorizer.fit_transform(x)
<2x47 sparse matrix of type '<type 'numpy.int64'>'
    with 64 stored elements in Compressed Sparse Column format>
>>> char_vectorizer.get_feature_names()
[u' ', …
Run Code Online (Sandbox Code Playgroud)

python machine-learning text-analysis analyzer scikit-learn

7
推荐指数
1
解决办法
9137
查看次数

如何使用文本分析来调查问卷调查?

我是一个学生团队的"程序员",旨在调查我的文法学校的满意度和一般问题.我们有一个基于1-6的量表构建的问题,我们通过我在python中编写的图表软件来解释这些答案.

现在,<textarea>在我们的问号结束时,人们可以随心所欲地使用它.我目前正在考虑如何使这些数据可用(我们不想阅读超过800多个答案).

如何在Python中使用文本分析来调查学生写的内容?我想到了一种方法来"标记"任何写下来的句子,例如:

I don't like being in school. [wellbeing][negative]
I have way too much homework. [homework][much]
I think there should be more interesting projects. [projects][more]
Run Code Online (Sandbox Code Playgroud)

有没有可行的方法来获得它?使用现有的标记化器是否有意义?

谢谢你的帮助!

python statistics computer-science text-analysis lexical-analysis

6
推荐指数
1
解决办法
844
查看次数

动态主题模型有没有高效的python库,最好是扩展Gensim?

我正在尝试使用主题模型对twitter流数据进行建模.Gensim是一款易于使用的解决方案,其简洁性令人印象深刻.它有一个真正的LSI在线实现,但不适用于LDA.对于像twitter这样不断变化的内容流,动态主题模型是理想的选择.有没有办法,甚至是黑客 - 一种实施甚至是一种策略,我可以利用这种方式将Gensim用于此目的?

是否有任何其他python实现派生(最好)来自Gensim或独立?我更喜欢python,因为我想尽快开始,但如果有一些最佳解决方案,请提及它.

谢谢.

python text-analysis lda gensim topic-modeling

6
推荐指数
1
解决办法
3359
查看次数

Big Text Corpus打破了tm_map

在过去的几天里,我一直在打破这个.我搜索了所有的SO档案,并尝试了建议的解决方案,但似乎无法让这个工作.我在诸如2000 06,1995 -99等文件夹中有一组txt文档,并且想要运行一些基本的文本挖掘操作,例如创建文档术语矩阵和术语文档矩阵以及基于单词的共同位置进行一些操作.我的脚本适用于较小的语料库,但是,当我使用更大的语料库进行尝试时,它会让我失望.我已经粘贴了一个这样的文件夹操作的代码.

library(tm) # Framework for text mining.
library(SnowballC) # Provides wordStem() for stemming.
library(RColorBrewer) # Generate palette of colours for plots.
library(ggplot2) # Plot word frequencies.
library(magrittr)
library(Rgraphviz)
library(directlabels)

setwd("/ConvertedText")
txt <- file.path("2000 -06")

docs<-VCorpus(DirSource(txt, encoding = "UTF-8"),readerControl = list(language = "UTF-8"))
docs <- tm_map(docs, content_transformer(tolower), mc.cores=1)
docs <- tm_map(docs, removeNumbers, mc.cores=1)
docs <- tm_map(docs, removePunctuation, mc.cores=1)
docs <- tm_map(docs, stripWhitespace, mc.cores=1)
docs <- tm_map(docs, removeWords, stopwords("SMART"), mc.cores=1)
docs <- tm_map(docs, removeWords, stopwords("en"), mc.cores=1)
#corpus creation complete

setwd("/ConvertedText/output") …
Run Code Online (Sandbox Code Playgroud)

r text-analysis text-mining tm term-document-matrix

6
推荐指数
1
解决办法
6527
查看次数

如何使用SQL(BigQuery)计算TF / IDF

我正在对reddit注释进行文本分析,并且我想在BigQuery中计算TF-IDF。

sql text-analysis google-bigquery

6
推荐指数
2
解决办法
1616
查看次数

自动从列中提取拼写不匹配的字符串并在R中替换它们

我有一个巨大的数据集,类似于下面发布的列

NameofEmployee <- c(x, y, z, a)
Region <- c("Pune", "Orissa", "Orisa", "Poone")
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,在Region列中,"Pune"区域以两种不同的方式拼写 - 即"Pune"和"Poona".

同样,"奥里萨"拼写为"奥里萨"和"奥里萨".

我有多个区域实际上是相同的但是拼写方式不同.这会在分析数据时引起问题.

我想在R的帮助下自动获得这些不匹配拼写的列表.
我还想自动用正确的拼写替换拼写.

string r text-analysis

6
推荐指数
2
解决办法
172
查看次数

Python Context Free Grammar和PCFG生成基准测试?

我知道在Python中有一些用于通用CFG和PCFG的函数; 然而它们似乎都有不同的速度.

例如:NLTK,PyParsing.

是否有最近的基准测试比较与速度和内存使用相关的各种属性?

python nlp text-analysis nltk context-free-grammar

5
推荐指数
1
解决办法
644
查看次数

在原始文本上或在引理/词干过程之后计算单词 n-gram?

我正在考虑在原始文本上使用 word n-grams 技术。但我有一个疑问:

在文本上应用引理/词干后,使用单词 n-gram 是否有意义?如果不是,为什么我应该只在原始文件上使用单词 n-gram?什么是优点和缺点?

information-retrieval text-analysis stemming lemmatization n-gram

5
推荐指数
1
解决办法
1495
查看次数