Senti Strength Java Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 12

SentiStrength Java User Manual
                        


java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/ text
i+don't+hate+you.
Contents

!
"#$%&!
!
'!
(&)
(&'*+)
(&#')
%&)
,-
.-
/0,'#-
/1
21
3&4
#5'&64
37
8&'7
3&'#7
(5965::967
'5::67
'5:67
:'7
%7
%#;
%;
<&;
(';
0=
%=
%&=
=
8
!
Quick start
Windows, Linux
   >          ?    @
A?@?A?
A?'5
2#6
 @#&'@'#B
?
 (    "#    C$          &      
%&5(:0:6
 5    6  0      $          
>    5"#6        C$  #        
2*+#
    5"#6 
CDD###@D::#:::
 ##$#
#5"#
#6
 ! "#$
%&
Mac
   >          ?    @
A?@?A?
A?'5
2#6
 @#&'@'#B
?
 50E6
 /    ##$     # 5 6    
          ?  5$  #  (>  6
!#&
     #    #       
 ! "#$%&
Sentiment classification tasks
&&
F#

)
Classify a single text
text [text to process]
C&#'GB::
/'$#
GB::B:8$
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/ text
i+love+your+dog.
#):
Classify all lines of text in a file for sentiment [includes accuracy
evaluations]
input [filename]
8*'+#'H&
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/ input
myfile.txt
0#'##'

/$'G
$!&/
DD''
(:/
'#
Classify texts in a column within a file or folder
<$&'#&'$#
&'5
6
annotateCol [col # 1..] (classify text in col, result at line end)
inputFolder [foldername] (all files in folder will be *annotated*)
fileSubstring [text] (string must be present in files to annotate)
Ok to overwrite files [overwrite]
/''5$6'
/''$'
#'#'
&#''8$
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/
annotateCol 1 inputFolder C:/textfiles/ fileSubstring txt
Listen at a port for texts to classify
listen [port number to listen at - call OR
&$$
7&'
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/
listen 81 trinary
-
&,%8C,%8$
#7I#,%#'
&JJ http://127.0.0.1:81/love%20you
#):5G'65:'65
'6
Run interactively from the command line
568$
java -jar c:\SentiStrength.jar cmd sentidata C:/SentiStrength_Data/
#&0K
#''L
Process stdin and send to stdout
stdin (can also set options and sentidata folder). E.g.,
java -jar c:\SentiStrength.jar stdin sentidata C:/SentiStrength_Data/
#&#
M#M#:
%&'
''
 textCol *='+
:&'
#?

whilenull
DD
N
M$#
Import the JAR file to run within your Java program
/O5*+6
56
&H
K
package !"
import#
publicclass$$%
publicstaticvoid!$&'
()*+,-./!-
0"/!!!1-
$2%&'3313/*$$4531
3313266/676631338
$$main2%
(9*:-
$$$new$$
9
0"/!!!-

$2&'3313/*$$4531338
$22
!;"
$"!out$!$!$32/3
$"!out$!$!$323
8
8
'
$$-)$$
$$-9$$
%717
$2)&'3313/*$$4531338
-)2)2
$29&'3313/*$$4$4538
0-9292
/17*
$4/!4-)-)!$!$
$4/!4-9-9!$!$
P8#>5
#6
1
Improving the accuracy of SentiStrength
Basic manual improvements
/C$QR
#&
&'#.
S'&##
'K#
4
Optimise sentiment strengths of existing sentiment terms
%##'##!$&(
'&
5O9==6&&'#'
&#>%##'##!$&(#
#&/
#&
optimise [Filename for optimal term strengths (e.g.
EmotionLookupTable2.txt)]
###
'#&#
##8$
java -jar c:/SentiStrength.jar minImprovement 3 input
C:/twitter4242.txt optimise
C:/twitter4242OptimalSentimentLookupTable.txt
#56'5
$6/5
!6'
#<&$
)-'&9==9=!
#/#!>
/#O!
HT#'
#$''
%&#
java -jar c:/SentiStrength.jar input C:/twitter4242.txt
EmotionLookupTable C:/twitter4242OptimalSentimentLookupTable.txt
Suggest new sentiment terms (from terms in misclassified texts)
#%##'##!$&(
'&
5O9==6&&'#'
&##%##'##!$&(
0
#&
termWeights

'&%
.(0?FP(0?F
#
##&
''8$
java -jar c:/SentiStrength.jar input C:/twitter4242.txt
termWeights
#56'5$
6
7
)&#/'$.(0?F
F#'
&#<&$#QR##&
'G$:)'
'&5G!$:)65G)$:96.(0?F#!:
5'&6):5&6#90
.(0?F
P(0?F.(0?F&
Options:
Explain the classification
explain
0&&
'8$
java -jar SentiStrength.jar text i+don't+hate+you. explain
Only classify text near specified keywords
keywords [comma-separated list - sentiment only classified close to
these]
wordsBeforeKeywords [words to classify before keyword (default 4)]
wordsAfterKeywords [words to classify after keyword (default 4)]
Classify positive (1 to 5) and negative (-1 to -5) sentiment strength
separately
$P
:
=
Use trinary classification (positive-negative-neutral)
trinary (report positive-negative-neutral classification instead)
#):5G'65:'6
5'6
Use binary classification (positive-negative)
binary (report positive-negative classification instead)
#):5G'65:'6
5'6
Use a single positive-negative scale classification
scale (report single -4 to +4 classification instead)
#):-:5G'65:'6
5'6
;
Location of linguistic data folder
sentidata [folder for SentiStrength data (end in slash, no spaces)]
Location of sentiment term weights
EmotionLookupTable [filename (default: EmotionLookupTable.txt or
SentimentLookupTable.txt)].
Location of output folder
<*#56+
File name extension for output
&*':&5A&6+
Classification algorithm parameters
##
alwaysSplitWordsAtApostrophes (split words when an apostrophe is
met – important for languages that merge words with ‘, like French
(e.g., t’aime -> t ‘ aime with this option t’aime without))
noBoosters (ignore sentiment booster words (e.g., very))
noNegatingPositiveFlipsEmotion (don't use negating words to flip
+ve words)
noNegatingNegativeNeutralisesEmotion (don't use negating words to
neuter -ve words)
negatedWordStrengthMultiplier (strength multiplier when negated
(default=0.5))
maxWordsBeforeSentimentToNegate (max words between negator &
sentiment word (default 0))
noIdioms (ignore idiom list)
questionsReduceNeg (-ve sentiment reduced in questions)
noEmoticons (ignore emoticon list)
exclamations2 (exclamation marks count them as +2 if not -ve
sentence)
mood [-1,0,1](interpretation of neutral emphasis (e.g., miiike;
hello!!). -1 means neutral emphasis interpreted as –ve; 1 means
interpreted as +ve; 0 means emphasis ignored)
noMultiplePosWords (don't allow multiple +ve words to increase +ve
sentiment)
noMultipleNegWords (don't allow multiple -ve words to increase -ve
sentiment)
noIgnoreBoosterWordsAfterNegatives (don't ignore boosters after
negating words)
noDictionary (don't try to correct spellings using the dictionary
by deleting duplicate letters from unknown words to make known
words)
noDeleteExtraDuplicateLetters (don't delete extra duplicate
letters in words even when they are impossible, e.g., heyyyy)
[this option does not check if the new word is legal, in contrast
to the above option]
illegalDoubleLettersInWordMiddle [letters never duplicate in word
middles] this is a list of characters that never occur twice in
succession. For English the following list is used (default):
ahijkquvxyz Never include w in this list as it often occurs in www
=
illegalDoubleLettersAtWordEnd [letters never duplicate at word
ends] this is a list of characters that never occur twice in
succession at the end of a word. For English the following list is
used (default): achijkmnpqruvwxyz
noMultipleLetters (don't use the presence of additional letters in
a word to boost sentiment)
Additional considerations
Language issues
/#0(//
<7U7
'<7/8#$
##U7B$
#5.#0P//D0(//#"#6
Long texts
&
&##5#6#
S3(0%/$
/9V
'$#
"9W2$5#
6
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/ text
I+hate+frogs+but+love+dogs.+Do+You+like. sentenceCombineTot
paragraphCombineTot trinary
/9#
8$5I#6
java -jar SentiStrength.jar sentidata C:/SentiStrength_Data/ text
I+hate+frogs+but+love+dogs.+Do+You+like. sentenceCombineTot
paragraphCombineTot trinary negativeMultiplier 1
Machine learning evaluations


train ('60
'9==G'&:$
java -jar SentiStrength.jar train input C:\1041MySpace.txt
C
=:I
;=X$=X
;#;=X
=C



#''#$
5$$#
Y#'
#$*
2'


Evaluation options
all ('0.

tot 3'
'F
iterations [number of 10-fold iterations (default 1)] 
0)=
F#
minImprovement [min extra correct class. to change sentiment
weights (default 2)] &
'>#
multi [# duplicate term strength optimisations to change sentiment
weights (default 1)] :/
$#
#
'C
$
java -jar SentiStrength.jar multi 8 input C:\1041MySpace.txt iterations
2
%&+,#-,###
./
##5$'
8%&6
.#),#/Z'&#
'5:965:968'

.[OP[O&
0#1#)$/#$'#
#'
java -jar SentiStrength.jar input C:\1041MySpace.txt iterations 30
B'#
8=::
!
.#-,###/:
CDD#D#D(:A568$

8%&56
BS##
''#
#8%&
.#$/#
8&
&#H&'##
/5.(6
5.(D6/
#5."6

.
(
.
(D

P
(
P
(D

.
"
.
"D

P
"
P
"D

19) =1!4!7 49- =4!-)=- ==7 =;17) ;; =;9;1;
H&'##/
#
5.(6.85..8?6

.( P( ..8 P.8 ..8? P.8?
=1)7)7! =1)9-
/

/
 =-=9)4; =)!79)
/')=#)#$
#

Page 1 of 12 - Senti Strength Java Manual
Page 2 of 12 - Senti Strength Java Manual
Page 3 of 12 - Senti Strength Java Manual
Page 4 of 12 - Senti Strength Java Manual
Page 5 of 12 - Senti Strength Java Manual
Page 6 of 12 - Senti Strength Java Manual
Page 7 of 12 - Senti Strength Java Manual
Page 8 of 12 - Senti Strength Java Manual
Page 9 of 12 - Senti Strength Java Manual
Page 10 of 12 - Senti Strength Java Manual
Page 11 of 12 - Senti Strength Java Manual
Page 12 of 12 - Senti Strength Java Manual

Navigation menu