Skip to content

Commit e8977eb

Browse files
committed
added unit test for extract_terms
1 parent 79be125 commit e8977eb

File tree

8 files changed

+45
-34
lines changed

8 files changed

+45
-34
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: sentimentr
22
Title: Calculate Text Polarity Sentiment
3-
Version: 0.3.0
3+
Version: 0.4.0
44
Authors@R: c(person("Tyler", "Rinker", email =
55
"[email protected]", role = c("aut", "cre")))
66
Maintainer: Tyler Rinker <[email protected]>

NEWS

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ And constructed with the following guidelines:
1717
* Bug fixes and misc changes bumps the patch
1818

1919

20-
sentimentr 0.3.0 -
20+
sentimentr 0.3.0 - 0.4.0
2121
----------------------------------------------------------------
2222

2323
BUG FIXES
@@ -36,13 +36,6 @@ MINOR FEATURES
3636
away thinking about the `comparison` argument to `update_key`.
3737

3838

39-
IMPROVEMENTS
40-
41-
42-
43-
CHANGES
44-
45-
4639
sentimentr 0.2.0 - 0.2.3
4740
----------------------------------------------------------------
4841

R/replace_emoticon.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#' @param emoticon_dt A \pkg{data.table} of emoticons (graphical representations)
77
#' and corresponding word meanings.
88
#' @param \ldots Other arguments passed to \code{.mgsub} (see
9-
#' \href{http://www.inside-r.org/packages/cran/qdap/docs/multigsub}{multigsub}
10-
#' from the \pkg{qdap} for details).
9+
#' \code{sentimentr:::.mgsub} for details).
1110
#' @return Returns a vector of strings with emoticons replaced with word
1211
#' equivalents.
1312
#' @keywords emoticon

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ Status](https://travis-ci.org/trinker/sentimentr.svg?branch=master)](https://tra
1010
[![Coverage
1111
Status](https://coveralls.io/repos/trinker/sentimentr/badge.svg?branch=master)](https://coveralls.io/r/trinker/sentimentr?branch=master)
1212
[![DOI](https://zenodo.org/badge/5398/trinker/sentimentr.svg)](https://zenodo.org/badge/latestdoi/5398/trinker/sentimentr)
13-
<a href="https://img.shields.io/badge/Version-0.3.0-orange.svg"><img src="https://img.shields.io/badge/Version-0.3.0-orange.svg" alt="Version"/></a>
14-
[![](http://cranlogs.r-pkg.org/badges/sentimentr)](https://cran.r-project.org/package=sentimentr)
13+
<a href="https://img.shields.io/badge/Version-0.4.0-orange.svg"><img src="https://img.shields.io/badge/Version-0.4.0-orange.svg" alt="Version"/></a>
1514
</p>
15+
[![](http://cranlogs.r-pkg.org/badges/sentimentr)](https://cran.r-project.org/package=sentimentr)
16+
1617
<img src="inst/sentimentr_logo/r_sentimentr.png" width="150" alt="readability Logo">
1718

1819
**sentimentr** is designed to quickly calculate text polarity sentiment
@@ -444,6 +445,15 @@ as well as [Baccianella, Esuli and Sebastiani's
444445
pacman::p_load_gh("trinker/sentimentr", "trinker/stansent")
445446
pacman::p_load(syuzhet, qdap, microbenchmark, RSentiment)
446447

448+
package 'microbenchmark' successfully unpacked and MD5 sums checked
449+
450+
The downloaded binary packages are in
451+
C:\Users\Tyler\AppData\Local\Temp\RtmpwJpARf\downloaded_packages
452+
package 'RSentiment' successfully unpacked and MD5 sums checked
453+
454+
The downloaded binary packages are in
455+
C:\Users\Tyler\AppData\Local\Temp\RtmpwJpARf\downloaded_packages
456+
447457
ase <- c(
448458
"I haven't been sad in a long time.",
449459
"I am extremely happy today.",
@@ -477,7 +487,7 @@ as well as [Baccianella, Esuli and Sebastiani's
477487
4 -0.5 0 0 0 1 3 1
478488
5 -0.5 -0.41 -0.56 -1 1 3 1
479489
6 -0.5 0.06 0.11 1 1 3 1
480-
7 -0.5 -0.38 -0.05 -1 1 2 1
490+
7 -0.5 -0.38 -0.05 0 1 2 1
481491
8 0 0 -0.14 0 0 0 -1
482492
9 -0.5 0.38 0.24 -1 -1 -3 -1
483493
sentences
@@ -529,22 +539,22 @@ is a bit slower than the fastest versions of either **sentimentr** or
529539
)
530540

531541
Unit: milliseconds
532-
expr min lq mean median
533-
stanford() 25681.7832 26316.1778 27328.7280 26950.5723
534-
sentimentr_hu_liu() 257.5393 266.1022 270.3374 274.6652
535-
sentimentr_sentiword() 999.4655 1002.5251 1019.6132 1005.5847
536-
RSentiment() 908.5591 926.2719 949.4043 943.9847
537-
syuzhet_binn() 349.5689 354.2951 367.5217 359.0213
538-
syuzhet_nrc() 674.3208 767.2540 857.4535 860.1873
539-
syuzhet_afinn() 154.9327 158.3493 160.3708 161.7658
540-
uq max neval cld
541-
28152.2003 29353.8283 3 b
542-
276.7364 278.8076 3 a
543-
1029.6870 1053.7893 3 a
544-
969.8269 995.6691 3 a
545-
376.4981 393.9748 3 a
546-
949.0198 1037.8524 3 a
547-
163.0899 164.4139 3 a
542+
expr min lq mean median
543+
stanford() 27555.9649 29336.0280 30124.1588 31116.0911
544+
sentimentr_hu_liu() 262.6678 267.3538 272.7080 272.0398
545+
sentimentr_sentiword() 1057.2413 1087.2625 1102.4927 1117.2838
546+
RSentiment() 145682.8551 148026.6238 151587.5462 150370.3924
547+
syuzhet_binn() 394.5227 439.8974 462.2086 485.2720
548+
syuzhet_nrc() 980.6292 1003.1331 1024.1288 1025.6370
549+
syuzhet_afinn() 169.6761 173.3827 181.3841 177.0894
550+
uq max neval
551+
31408.2557 31700.4203 3
552+
277.7281 283.4165 3
553+
1125.1184 1132.9531 3
554+
154539.8918 158709.3912 3
555+
496.0516 506.8311 3
556+
1045.8786 1066.1202 3
557+
187.2381 197.3868 3
548558

549559
Comparing sentimentr, syuzhet, RSentiment, and Stanford
550560
-------------------------------------------------------

inst/CITATION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ citEntry(entry = "manual",
66
author = "Tyler W. Rinker",
77
organization = "University at Buffalo/SUNY",
88
address = "Buffalo, New York",
9-
note = "version 0.3.0",
9+
note = "version 0.4.0",
1010
year = "2016",
1111
url = "http://github.com/trinker/sentimentr",
1212
textVersion = paste("Rinker, T. W. (2016).",
1313
"sentimentr: Calculate Text Polarity Sentiment",
14-
"version 0.3.0. University at Buffalo. Buffalo, New York.",
14+
"version 0.4.0. University at Buffalo. Buffalo, New York.",
1515
"http://github.com/trinker/sentimentr")
1616
)

inst/figure/unnamed-chunk-7-1.png

-56 Bytes
Loading

man/replace_emoticon.Rd

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
context("Checking extract_sentiment_terms")
2+
3+
test_that("extract_sentiment_terms extracts the terms",{
4+
5+
set.seed(10)
6+
x <- sample(cannon_reviews[[3]], 3000, TRUE)
7+
pol_words <- extract_sentiment_terms(x)
8+
expect_equal(pol_words$negative[1:3], list(character(0), "restless", character(0)))
9+
})
10+

0 commit comments

Comments
 (0)