forked from paws-r/paws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comprehend.R
32 lines (27 loc) · 830 Bytes
/
comprehend.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Comprehend natural language processing examples
comprehend <- paws::comprehend()
# Determine the dominant language(s) in a document.
comprehend$detect_dominant_language(
Text = "Hello world!"
)
# Determine the prevailing sentiment in a batch of documents.
comprehend$batch_detect_sentiment(
TextList = list(
"Awesome!",
"OK",
"Meh",
"Terrible!"
),
LanguageCode = "en"
)
text <-
"Gatsby believed in the green light, the orgiastic future that year by
year recedes before us. It eluded us then, but that's no matter--
tomorrow we will run faster, stretch out our arms farther.... And one
fine morning-- So we beat on, boats against the current, borne back
ceaselessly into the past."
# Find named entities in a document.
comprehend$detect_entities(
Text = text,
LanguageCode = "en"
)