Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples of the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Symbols
Classify
TextSentences
Related Categories
Machine Learning
Text & Language Processing
Sentiment in Stories
Determine the sentiment of sentences in text
Example Notebook
Open in Cloud
Download Notebook
Sentiment of a single sentence:
I
n
[
1
]
:
=
C
l
a
s
s
i
f
y
[
"
S
e
n
t
i
m
e
n
t
"
,
"
I
a
m
h
a
p
p
y
t
o
d
a
y
"
]
O
u
t
[
1
]
=
P
o
s
i
t
i
v
e
Get the sentences in the Wikipedia article on "chicken":
I
n
[
2
]
:
=
d
a
t
a
=
T
e
x
t
S
e
n
t
e
n
c
e
s
[
W
i
k
i
p
e
d
i
a
D
a
t
a
[
"
c
h
i
c
k
e
n
"
]
]
;
Find the sentiment of each sentence:
I
n
[
3
]
:
=
C
l
a
s
s
i
f
y
[
"
S
e
n
t
i
m
e
n
t
"
,
#
]
&
/
@
d
a
t
a
/
/
S
h
o
r
t
O
u
t
[
3
]
/
/
S
h
o
r
t
=
{
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
g
a
t
i
v
e
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
2
4
3
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
,
N
e
u
t
r
a
l
}
What was the eighth sentence?
I
n
[
4
]
:
=
d
a
t
a
〚
8
〛
O
u
t
[
4
]
=
T
h
e
r
e
a
r
e
m
o
r
e
c
h
i
c
k
e
n
s
i
n
t
h
e
w
o
r
l
d
t
h
a
n
a
n
y
o
t
h
e
r
b
i
r
d
.
Here's the sentiment found for that sentence:
I
n
[
5
]
:
=
C
l
a
s
s
i
f
y
[
"
S
e
n
t
i
m
e
n
t
"
,
"
T
h
e
r
e
a
r
e
m
o
r
e
c
h
i
c
k
e
n
s
i
n
t
h
e
w
o
r
l
d
t
h
a
n
a
n
y
o
t
h
e
r
b
i
r
d
.
"
]
O
u
t
[
5
]
=
P
o
s
i
t
i
v
e
Try a variant of the sentence; still positive:
I
n
[
6
]
:
=
C
l
a
s
s
i
f
y
[
"
S
e
n
t
i
m
e
n
t
"
,
"
T
h
e
r
e
a
r
e
m
o
r
e
s
a
d
c
h
i
c
k
e
n
s
i
n
t
h
e
w
o
r
l
d
t
h
a
n
a
n
y
o
t
h
e
r
b
i
r
d
.
"
]
O
u
t
[
6
]
=
P
o
s
i
t
i
v
e
Other Documents
(
6
)
Get the sentences in Dickens's
Oliver Twist
:
I
n
[
1
]
:
=
t
d
a
t
a
=
T
e
x
t
S
e
n
t
e
n
c
e
s
[
R
e
s
o
u
r
c
e
D
a
t
a
[
"
O
l
i
v
e
r
T
w
i
s
t
"
]
]
;
Here is the number of sentences:
I
n
[
2
]
:
=
L
e
n
g
t
h
[
t
d
a
t
a
]
O
u
t
[
2
]
=
8
3
5
9
Find their sentiments:
I
n
[
3
]
:
=
s
e
n
t
=
C
l
a
s
s
i
f
y
[
"
S
e
n
t
i
m
e
n
t
"
,
#
]
&
/
@
t
d
a
t
a
;
S
h
o
r
t
[
s
e
n
t
,
5
]
O
u
t
[
3
]
/
/
S
h
o
r
t
=
{
N
e
g
a
t
i
v
e
,
P
o
s
i
t
i
v
e
,
N
e
u
t
r
a
l
,
P
o
s
i
t
i
v
e
,
N
e
u
t
r
a
l
,
N
e
g
a
t
i
v
e
,
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,
0
,
-
1
,
1
,
1
,
-
1
,
-
1
,
1
,
0
,
1
,
0
,
1
,
0
,
-
1
,
0
,
-
1
,
0
,
1
,
-
1
,
-
1
,
8
3
1
4
,
-
1
,
1
,
1
,
0
,
-
1
,
-
1
,
-
1
,
0
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
0
,
1
,
-
1
}
[
5
]
Show the "sentiment walk" of the story:
I
n
[
6
]
:
=
L
i
s
t
L
i
n
e
P
l
o
t
[
A
c
c
u
m
u
l
a
t
e
[
%
]
]
O
u
t
[
6
]
=
2
0
0
0
4
0
0
0
6
0
0
0
8
0
0
0
-
3
0
0
-
2
5
0
-
2
0
0
-
1
5
0
-
1
0
0
-
5
0
One might conclude that in the end it's a tragedy
…
Related Symbols
Classify
TextSentences
Publisher Information
Contributed by:
Stephen Wolfram