Comments (1)
if (!require("pacman")) install.packages("pacman")
pacman::p_load(lexicon)
test_valence_shifter <- function(
valence_shifter_table = lexicon::hash_valence_shifters,
sentiment_tables = lexicon::available_data('hash_sentiment')[['Data']]
){
valence_words <- valence_shifter_table[['x']]
overlaps <- lapply(sentiment_tables, function(x){
sent_hash <- eval(parse(text = paste0('lexicon::', x)))
intersect(sent_hash[['x']], valence_words)
})
names(overlaps) <- sentiment_tables
class(overlaps) <- 'test_valence_shifter'
overlaps
}
print.test_valence_shifter <- function(x, ...){
class(x) <- 'list'
bads <- x[lengths(x) > 0]
if (length(bads) == 0) {
textclean:::all_good()
}
intersecting <- Map(function(x, y){
paste0(x,':\n\n - ', y, '\n')
}, names(bads), lapply(bads, function(x) paste(shQuote(x), collapse = ', ')))
cat(paste0(
"The following tables contained these words\n",
"overlapping with the supplied valence shifter table:\n\n"
))
cat(paste(unlist(intersecting), collapse = '\n\n\n'))
}
test_valence_shifter(lexicon::hash_valence_shifters)
This reveals a problem:
The following tables contained these words
overlapping with the supplied valence shifter table:
hash_sentiment_senticnet:
- "sparsely"
from lexicon.
Related Issues (20)
- hash_valence_shifters: typo in deamplification words?
- can't find hash_sentiment_inquirer in the package HOT 1
- profanity_google and profanity_voh_ahn data files removed in latest commit HOT 2
- f-word in valence shifters table? HOT 3
- Add regex arg to available_data()
- New profane list ??
- consider emotion detection function
- A profanity racial slurs list?
- Dupe profanity list words results in error HOT 1
- Preprocessing for Sentiwordnet
- lemmatizes "as" to "a"
- Additional lists/dictionaries from discon??? HOT 3
- CRAN NOTE HOT 1
- lexicon::hash_emoticons has a 3 for laugher???incomplete?
- Add cliches
- Additional lists to consider
- Remove NRC
- NA within the dataset HOT 1
- indonesian nrc HOT 2
- Error message: Failed to install/load: trinker/lexicon HOT 1
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 lexicon.