Comments (6)
Problem is here.
Before @TommyJones will fix it, you can try to construct DTM directly with text2vec::create_dtm
function.
from textminer.
@TommyJones probably str_replace_all(doc_vec, "[^[:alnum:]]", " ")
will work. See ?base::regex
.
stringr::str_replace_all("advad ывмывм 134134 ,..?", "[^[:alnum:]]", " ")
"advad ывмывм 134134 "
from textminer.
Thank you for the feedback. As @dselivanov noted, the issue is with the
regular expression underlying the option remove_punctuation. In the short
run, you can set remove_punctuation = FALSE in the call to CreateDtm.
However, I believe Russian still has punctuation marks. So you'd have to
strip them out with a regular expression before a call to CreateDtm. (Note:
you would have to do the same if you call text2vec::create_dtm directly.)
Some example code:
character vector containing a Russian document
my_docs <- scan("https://habrahabr.ru/post/123845/", what="character",
sep="\n")
my_docs <- paste(my_docs, collapse = "\n")
remove punctuation - this regular expression will work with Russian only.
I'll find something more general to patch textmineR
my_docs <- stringr::str_replace_all(my_docs, "[^а-яА-ЯёЁa-zA-Z]", " ")
create DTM
my_dtm <- CreateDtm(my_docs, remove_punctuation = FALSE) # set other
options you may need here
I will keep this issue open until I find a general solution that works for
many languages.
On Wed, Apr 27, 2016 at 6:48 AM Dmitriy Selivanov [email protected]
wrote:
Problem is here
https://github.com/TommyJones/textmineR/blob/master/R/CreateDtm.R#L69-L74
.
Before @TommyJones https://github.com/TommyJones will fix it, you can
try to construct DTM directly with text2vec::create_dtm function.—
You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub
#20 (comment)
from textminer.
Thanks for suggestions!
remove_punctuation = FALSE
fixed the problem.
from textminer.
@dselivanov, I was playing with "_|[^\\w0-9]"
but your solution is much more elegant.
from textminer.
I've tested this successfully with Russian, Japanese, Korean, Chinese, and English. I'm going to call that good enough for now and close the issue. Please re-open it if you run into a similar issue.
from textminer.
Related Issues (20)
- Fill out implementation details in FitLdaModel and update.lda_topic_model HOT 1
- Discrepancy in topic content when summarizing and visualizing with LDAvis HOT 5
- Thinning/Lag of the sampler HOT 3
- License is not super clear HOT 4
- CalcProbCoherence algorithm unclear HOT 1
- CalcTopicModelR2 HOT 6
- Prior information on topics (e.g. Seeded LDA/Guided LDA) HOT 7
- LDAvis HOT 2
- Sparsity makes it more likely to have misses resulting in "negative probability" errors HOT 1
- FitCtmModel does not respect arguments from topicmodels::CTM HOT 2
- CalcTopicModelRsquared fails when called in FitLdaModel
- custom stop word list HOT 5
- CalcHellingerDist seems to modify in place HOT 5
- Switch to {mvrsquared}
- Choosing the numbers of topics ERROR Parallel HOT 4
- test HOT 1
- how to obtain word assignment of the original dataset? HOT 2
- vignette part 5 has error? HOT 1
- CreateTcm does not use multithreading
- How to use the Mallet in textmineR?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textminer.