Comments (6)
Fixed using lapply
from pattern.nlp.
Use lapply and next data.table::rbindlist
from pattern.nlp.
Hey, I'm trying to apply this solution to my own data set, but it doesn't seem to work.
I have a list that looks like this:
list("deze man in haalt alvast de eu vlag weg en zet de russische in de plaats <U+30FC> ",
"solidariteit cubaitalië on point nu nog europa onderling be ",
"bezoekersrichtlijn ggz geen algehele bezoekersstop ggz samen met hebben we een aangepaste richtlijn op",
"bij het om gebuiken ze het blijkbaar om op hun luie gat te liggen of achterstallig onderhoud van het",
"app die in vele talen kan vertellen of je echt tekenen van hebt test ")
And tried to use lapply and the function created by frederatic:
sentiments <- lapply(try, sentiment_function)
However this gives me 5 dataframes with the correct columns, but it contains gibberish. For example the polarity column = ÿþ0�ÿþ
When I use the function on just 1 string:
pattern_sentiment(try[[5]], language = "dutch")
it does seem to work.
I'm not very familiar with lapply, so not quite sure what I'm doing wrong.
from pattern.nlp.
It's been a while, but I think this was my code.
Did you assign the function to a variable like below?
sentiment_function <- function(x) {
pattern_sentiment(x, language="dutch")
}
sentiments <- lapply(LISTNAME, sentiment_function)
U should get a list called sentiments that has the scores for every sentence. I used a dataframe instead, so got a dataframe as output. And then just bind the original tweets dataframe with the sentiment dataframe. Hope it works.
from pattern.nlp.
Hey,
That does indeed work, however for some reason it wraps the numbers in unexpected symbols like this:
I guess I can extract the contents with something like stringr, but it just seems odd to me that it behaves this way.
from pattern.nlp.
Quick google showed it might be a bug. Maybe these links help:
How to remove display of strange characters in R-Markdown chunk output?
Github Issue
from pattern.nlp.
Related Issues (13)
- issues the installing HOT 11
- Cannot use := to add columns to a null data.table (no columns), HOT 2
- Dutch sentiment analysis not working HOT 7
- PyhtonInR not available anymore HOT 1
- Installation on R 3.3.2 HOT 3
- Error when the input string does not contain any token HOT 2
- issue while installing pattern.nlp in R HOT 20
- Error installation Python HOT 1
- I can't install the package HOT 4
- Error in pyExec HOT 3
- Installation error HOT 13
- Both R and Python are 64-bit but the installation fails with 32 vs 64 bit error HOT 5
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 pattern.nlp.