-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* The
hash_sentiment_senticnett
dictionary contained "sparsely" whi…
…ch is also contained in `hash_valence_shifters`. This term has been dropped from the `hash_sentiment_senticnett` dictionary. See # 12 for more info.
- Loading branch information
Tyler Rinker
committed
Oct 19, 2018
1 parent
657f750
commit ae5779e
Showing
10 changed files
with
105 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: lexicon | ||
Title: Lexicons for Text Analysis | ||
Version: 1.1.2 | ||
Version: 1.1.3 | ||
Maintainer: Tyler Rinker <[email protected]> | ||
Description: A collection of lexical hash tables, dictionaries, and word lists. | ||
Depends: R (>= 3.2.2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.