What Types of Information Can We Extract from a Sentence?

The answer to this question is actually illustrated by the results that the Google Cloud Natural Language API gives back when you send it a sentence:

In this tutorial, we’ll be talking about this final method, Named Entity Recognition.

library(googleLanguageR)
gl_auth("../gcloud/nlp_api_teaching.json")
gramsci <- "The subaltern classes, by definition, are not unified and cannot unite until they are able to become a 'State': their history, therefore, is intertwined with that of civil society, and thereby with the history of States and groups of States"
greenwald <- c("If fighting Israeli occupying forces is barred as 'terrorism,' and nonviolent boycotts against Israel are barred as 'anti-Semitism,' then what is considered a legitimate means for Palestinians and their allies to resist and end the decades-long, illegal Israeli occupation?","The answer is: nothing.","Palestinians are obliged to submit to Israeli occupation in a way that none of the people demanding that would ever themselves submit to occupation of their land.","All forms of resistance to Israeli occupation are deemed illegitimate.","That, manifestly, is the whole point of all of this.")
wiki <- "In June 1982, the Israel Defense Forces invaded Lebanon with the intention of rooting out the PLO."



wiki2 <- "By mid-1982, under the supervision of the Multinational Force, the Palestine Liberation Organization withdrew from Lebanon following weeks of battles in West Beirut and shortly before the massacre took place very long ago."
yarmouk <- "The largest Palestinian refugee camp in Syria has been 'transformed into a death camp' as Assad regime forces press ahead with a major offensive against Islamic State of Iraq and the Levant fighters who control the area, the United Nations has warned."
combined <- "By mid-1982, under the supervision of the Multinational Force, the Palestine Liberation Organization withdrew from Lebanon following weeks of battles in West Beirut and shortly before the massacre took place."

nlp_result <- gl_nlp(c(wiki2,yarmouk,combined))
## 2019-02-20 17:25:20 -- annotateText: 222 characters
## 2019-02-20 17:25:20 -- annotateText: 251 characters
## 2019-02-20 17:25:21 -- annotateText: 208 characters
nlp_result$entities
## [[1]]
## # A tibble: 8 x 9
##   name  type  salience mid   wikipedia_url magnitude score beginOffset
##   <chr> <chr>    <dbl> <chr> <chr>             <dbl> <dbl>       <int>
## 1 batt… EVENT   0.149  <NA>  <NA>                0.1  -0.1         142
## 2 Leba… LOCA…   0.0978 /m/0… https://en.w…       0     0           115
## 3 mass… EVENT   0.128  <NA>  <NA>                0     0           188
## 4 Mult… ORGA…   0.141  <NA>  <NA>                0     0            42
## 5 Pale… ORGA…   0.0978 /m/0… https://en.w…       0     0            67
## 6 place OTHER   0.125  <NA>  <NA>                0.1  -0.1         202
## 7 supe… OTHER   0.231  <NA>  <NA>                0     0            23
## 8 West… LOCA…   0.0303 /m/0… https://en.w…       0     0           153
## # ... with 1 more variable: mention_type <chr>
## 
## [[2]]
## # A tibble: 11 x 9
##    name  type  salience mid   wikipedia_url magnitude score beginOffset
##    <chr> <chr>    <dbl> <chr> <chr>             <dbl> <dbl>       <int>
##  1 area  LOCA…   0.0466 <NA>  <NA>                0     0           215
##  2 Assad PERS…   0.0395 /m/0… https://en.w…       0     0            90
##  3 deat… LOCA…   0.0746 <NA>  <NA>                0     0            75
##  4 figh… PERS…   0.216  <NA>  <NA>                0.1   0           190
##  5 Isla… ORGA…   0.0123 /m/0… https://en.w…       0     0           153
##  6 offe… OTHER   0.0613 <NA>  <NA>                0.4  -0.4         135
##  7 Pale… LOCA…   0.145  /m/0… https://en.w…       0     0            12
##  8 refu… LOCA…   0.260  <NA>  <NA>                0.7   0.7          24
##  9 regi… PERS…   0.0666 <NA>  <NA>                0.1  -0.1          96
## 10 Syria LOCA…   0.0580 /m/0… https://en.w…       0     0            40
## 11 Unit… ORGA…   0.0196 /m/0… https://en.w…       0.1  -0.1         225
## # ... with 1 more variable: mention_type <chr>
## 
## [[3]]
## # A tibble: 8 x 9
##   name  type  salience wikipedia_url mid   magnitude score beginOffset
##   <chr> <chr>    <dbl> <chr>         <chr>     <dbl> <dbl>       <int>
## 1 batt… EVENT   0.0657 <NA>          <NA>        0.1  -0.1         142
## 2 Leba… LOCA…   0.116  https://en.w… /m/0…       0     0           115
## 3 mass… EVENT   0.117  <NA>          <NA>        0     0           188
## 4 Mult… ORGA…   0.125  <NA>          <NA>        0     0            42
## 5 Pale… ORGA…   0.126  https://en.w… /m/0…       0     0            67
## 6 place OTHER   0.114  <NA>          <NA>        0.1  -0.1         202
## 7 supe… OTHER   0.297  <NA>          <NA>        0     0            23
## 8 West… LOCA…   0.0391 https://en.w… /m/0…       0     0           153
## # ... with 1 more variable: mention_type <chr>
nlp_result$tokens
## [[1]]
##          content beginOffset   tag         aspect         case
## 1             By           0   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 2       mid-1982           3  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 3              ,          11 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
## 4          under          13   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 5            the          19   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 6    supervision          23  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 7             of          35   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 8            the          38   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 9  Multinational          42   ADJ ASPECT_UNKNOWN CASE_UNKNOWN
## 10         Force          56  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 11             ,          61 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
## 12           the          63   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 13     Palestine          67  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 14    Liberation          77  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 15  Organization          88  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 16      withdrew         101  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 17          from         110   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 18       Lebanon         115  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 19     following         123  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 20         weeks         133  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 21            of         139   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 22       battles         142  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 23            in         150   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 24          West         153  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 25        Beirut         158  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 26           and         165  CONJ ASPECT_UNKNOWN CASE_UNKNOWN
## 27       shortly         169   ADV ASPECT_UNKNOWN CASE_UNKNOWN
## 28        before         177   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 29           the         184   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 30      massacre         188  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 31          took         197  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 32         place         202  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 33          very         208   ADV ASPECT_UNKNOWN CASE_UNKNOWN
## 34          long         213   ADV ASPECT_UNKNOWN CASE_UNKNOWN
## 35           ago         218   ADV ASPECT_UNKNOWN CASE_UNKNOWN
## 36             .         221 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
##            form         gender         mood         number         person
## 1  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 2  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 3  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 4  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 5  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 6  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 7  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 8  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 9  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 10 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 11 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 12 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 13 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 14 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 15 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 16 FORM_UNKNOWN GENDER_UNKNOWN   INDICATIVE NUMBER_UNKNOWN PERSON_UNKNOWN
## 17 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 18 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 19 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 20 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 21 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 22 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 23 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 24 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 25 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 26 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 27 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 28 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 29 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 30 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 31 FORM_UNKNOWN GENDER_UNKNOWN   INDICATIVE NUMBER_UNKNOWN PERSON_UNKNOWN
## 32 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 33 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 34 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 35 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 36 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
##            proper         reciprocity         tense         voice
## 1  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 2  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 3  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 4  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 5  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 6  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 7  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 8  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 9  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 10 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 11 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 12 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 13         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 14         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 15         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 16 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST VOICE_UNKNOWN
## 17 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 18         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 19 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 20 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 21 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 22 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 23 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 24         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 25         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 26 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 27 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 28 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 29 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 30 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 31 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST VOICE_UNKNOWN
## 32 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 33 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 34 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 35 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 36 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
##    headTokenIndex  label         value
## 1              15   PREP            By
## 2               0   POBJ      mid-1982
## 3              15      P             ,
## 4              15   PREP         under
## 5               5    DET           the
## 6               3   POBJ   supervision
## 7               5   PREP            of
## 8               9    DET           the
## 9               9   AMOD Multinational
## 10              6   POBJ         Force
## 11             15      P             ,
## 12             14    DET           the
## 13             14     NN     Palestine
## 14             14     NN    Liberation
## 15             15  NSUBJ  Organization
## 16             15   ROOT      withdraw
## 17             15   PREP          from
## 18             16   POBJ       Lebanon
## 19             15   PREP        follow
## 20             18   POBJ          week
## 21             19   PREP            of
## 22             20   POBJ        battle
## 23             21   PREP            in
## 24             24     NN          West
## 25             22   POBJ        Beirut
## 26             19     CC           and
## 27             30 ADVMOD       shortly
## 28             30   MARK        before
## 29             29    DET           the
## 30             30  NSUBJ      massacre
## 31             19   CONJ          take
## 32             30   DOBJ         place
## 33             33 ADVMOD          very
## 34             34 ADVMOD          long
## 35             30 ADVMOD           ago
## 36             15      P             .
## 
## [[2]]
##        content beginOffset   tag         aspect         case         form
## 1          The           0   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 2      largest           4   ADJ ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 3  Palestinian          12   ADJ ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 4      refugee          24  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 5         camp          32  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 6           in          37   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 7        Syria          40  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 8          has          46  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 9         been          50  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 10           '          55 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 11 transformed          56  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 12        into          68   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 13           a          73   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 14       death          75  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 15        camp          81  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 16           '          85 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 17          as          87   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 18       Assad          90  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 19      regime          96  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 20      forces         103  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 21       press         110  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 22       ahead         116   ADV ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 23        with         122   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 24           a         127   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 25       major         129   ADJ ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 26   offensive         135  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 27     against         145   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 28     Islamic         153  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 29       State         161  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 30          of         167   ADP ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 31        Iraq         170  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 32         and         175  CONJ ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 33         the         179   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 34      Levant         183  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 35    fighters         190  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 36         who         199  PRON ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 37     control         203  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 38         the         211   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 39        area         215  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 40           ,         219 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 41         the         221   DET ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 42      United         225  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 43     Nations         232  NOUN ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 44         has         240  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 45      warned         244  VERB ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
## 46           .         250 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN FORM_UNKNOWN
##            gender         mood         number         person
## 1  GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 2  GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 3  GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 4  GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 5  GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 6  GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 7  GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 8  GENDER_UNKNOWN   INDICATIVE       SINGULAR          THIRD
## 9  GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 10 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 11 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 12 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 13 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 14 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 15 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 16 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 17 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 18 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 19 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 20 GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 21 GENDER_UNKNOWN   INDICATIVE       SINGULAR PERSON_UNKNOWN
## 22 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 23 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 24 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 25 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 26 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 27 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 28 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 29 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 30 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 31 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 32 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 33 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 34 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 35 GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 36 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN          THIRD
## 37 GENDER_UNKNOWN   INDICATIVE NUMBER_UNKNOWN PERSON_UNKNOWN
## 38 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 39 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 40 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 41 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 42 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 43 GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 44 GENDER_UNKNOWN   INDICATIVE       SINGULAR          THIRD
## 45 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 46 GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
##            proper         reciprocity         tense         voice
## 1  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 2  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 3  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 4  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 5  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 6  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 7          PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 8  PROPER_UNKNOWN RECIPROCITY_UNKNOWN       PRESENT VOICE_UNKNOWN
## 9  PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST VOICE_UNKNOWN
## 10 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 11 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST       PASSIVE
## 12 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 13 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 14 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 15 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 16 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 17 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 18         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 19 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 20 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 21 PROPER_UNKNOWN RECIPROCITY_UNKNOWN       PRESENT VOICE_UNKNOWN
## 22 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 23 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 24 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 25 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 26 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 27 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 28         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 29         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 30 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 31         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 32 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 33 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 34         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 35 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 36 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 37 PROPER_UNKNOWN RECIPROCITY_UNKNOWN       PRESENT VOICE_UNKNOWN
## 38 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 39 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 40 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 41 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 42         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 43         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 44 PROPER_UNKNOWN RECIPROCITY_UNKNOWN       PRESENT VOICE_UNKNOWN
## 45 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST       PASSIVE
## 46 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
##    headTokenIndex     label       value
## 1               4       DET         The
## 2               4      AMOD       large
## 3               4      AMOD Palestinian
## 4               4        NN     refugee
## 5              10 NSUBJPASS        camp
## 6               4      PREP          in
## 7               5      POBJ       Syria
## 8              10       AUX        have
## 9              10   AUXPASS          be
## 10             10         P           '
## 11             10      ROOT   transform
## 12             10      PREP        into
## 13             14       DET           a
## 14             14        NN       death
## 15             11      POBJ        camp
## 16             14         P           '
## 17             20      MARK          as
## 18             19        NN       Assad
## 19             19        NN      regime
## 20             20     NSUBJ       force
## 21             10     ADVCL       press
## 22             20    ADVMOD       ahead
## 23             20      PREP        with
## 24             25       DET           a
## 25             25      AMOD       major
## 26             22      POBJ   offensive
## 27             25      PREP     against
## 28             28        NN     Islamic
## 29             26      POBJ       State
## 30             28      PREP          of
## 31             29      POBJ        Iraq
## 32             28        CC         and
## 33             34       DET         the
## 34             34        NN      Levant
## 35             28      CONJ     fighter
## 36             36     NSUBJ         who
## 37             34     RCMOD     control
## 38             38       DET         the
## 39             36      DOBJ        area
## 40             38         P           ,
## 41             42       DET         the
## 42             42        NN      United
## 43             44     NSUBJ     Nations
## 44             44       AUX        have
## 45             38     RCMOD        warn
## 46             10         P           .
## 
## [[3]]
##          content beginOffset   tag         aspect         case
## 1             By           0   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 2       mid-1982           3  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 3              ,          11 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
## 4          under          13   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 5            the          19   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 6    supervision          23  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 7             of          35   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 8            the          38   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 9  Multinational          42   ADJ ASPECT_UNKNOWN CASE_UNKNOWN
## 10         Force          56  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 11             ,          61 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
## 12           the          63   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 13     Palestine          67  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 14    Liberation          77  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 15  Organization          88  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 16      withdrew         101  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 17          from         110   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 18       Lebanon         115  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 19     following         123  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 20         weeks         133  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 21            of         139   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 22       battles         142  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 23            in         150   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 24          West         153  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 25        Beirut         158  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 26           and         165  CONJ ASPECT_UNKNOWN CASE_UNKNOWN
## 27       shortly         169   ADV ASPECT_UNKNOWN CASE_UNKNOWN
## 28        before         177   ADP ASPECT_UNKNOWN CASE_UNKNOWN
## 29           the         184   DET ASPECT_UNKNOWN CASE_UNKNOWN
## 30      massacre         188  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 31          took         197  VERB ASPECT_UNKNOWN CASE_UNKNOWN
## 32         place         202  NOUN ASPECT_UNKNOWN CASE_UNKNOWN
## 33             .         207 PUNCT ASPECT_UNKNOWN CASE_UNKNOWN
##            form         gender         mood         number         person
## 1  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 2  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 3  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 4  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 5  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 6  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 7  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 8  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 9  FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 10 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 11 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 12 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 13 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 14 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 15 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 16 FORM_UNKNOWN GENDER_UNKNOWN   INDICATIVE NUMBER_UNKNOWN PERSON_UNKNOWN
## 17 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 18 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 19 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 20 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 21 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 22 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN         PLURAL PERSON_UNKNOWN
## 23 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 24 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 25 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 26 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 27 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 28 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 29 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
## 30 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 31 FORM_UNKNOWN GENDER_UNKNOWN   INDICATIVE NUMBER_UNKNOWN PERSON_UNKNOWN
## 32 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN       SINGULAR PERSON_UNKNOWN
## 33 FORM_UNKNOWN GENDER_UNKNOWN MOOD_UNKNOWN NUMBER_UNKNOWN PERSON_UNKNOWN
##            proper         reciprocity         tense         voice
## 1  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 2  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 3  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 4  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 5  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 6  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 7  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 8  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 9  PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 10 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 11 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 12 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 13         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 14         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 15         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 16 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST VOICE_UNKNOWN
## 17 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 18         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 19 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 20 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 21 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 22 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 23 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 24         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 25         PROPER RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 26 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 27 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 28 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 29 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 30 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 31 PROPER_UNKNOWN RECIPROCITY_UNKNOWN          PAST VOICE_UNKNOWN
## 32 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
## 33 PROPER_UNKNOWN RECIPROCITY_UNKNOWN TENSE_UNKNOWN VOICE_UNKNOWN
##    headTokenIndex  label         value
## 1              15   PREP            By
## 2               0   POBJ      mid-1982
## 3              15      P             ,
## 4              15   PREP         under
## 5               5    DET           the
## 6               3   POBJ   supervision
## 7               5   PREP            of
## 8               9    DET           the
## 9               9   AMOD Multinational
## 10              6   POBJ         Force
## 11             15      P             ,
## 12             14    DET           the
## 13             14     NN     Palestine
## 14             14     NN    Liberation
## 15             15  NSUBJ  Organization
## 16             15   ROOT      withdraw
## 17             15   PREP          from
## 18             16   POBJ       Lebanon
## 19             15   PREP        follow
## 20             18   POBJ          week
## 21             19   PREP            of
## 22             20   POBJ        battle
## 23             21   PREP            in
## 24             24     NN          West
## 25             22   POBJ        Beirut
## 26             19     CC           and
## 27             30 ADVMOD       shortly
## 28             30   MARK        before
## 29             29    DET           the
## 30             30  NSUBJ      massacre
## 31             19   CONJ          take
## 32             30   DOBJ         place
## 33             15      P             .
nlp_result$classifyText
## # A tibble: 2 x 2
##   name                                       confidence
##   <chr>                                           <dbl>
## 1 /Sensitive Subjects                              0.91
## 2 /People & Society/Social Issues & Advocacy       0.6
nlp_result$sentences[[1]]$score
## [1] -0.5
nlp_result$sentences[[2]]$score
## [1] -0.5
y_trans <- gl_translate(yarmouk, "es")
## 2019-02-20 17:25:21 -- Translating text: 251 characters -
y_trans$translatedText
## [1] "El mayor campo de refugiados palestinos en Siria se ha 'transformado en un campo de muerte' cuando las fuerzas del régimen de Assad siguen adelante con una ofensiva importante contra el Estado Islámico de Irak y los combatientes del Levante que controlan el área, advirtieron las Naciones Unidas."
# Using tidyverse (dplyr and readr) from this cell onwards
library(tidyverse)
doc_nouns <- list()

for (doc_num in c(1,2,3)) {
  doc_nouns[[doc_num]] <- nlp_result$entities[[doc_num]] %>% filter(mention_type == "PROPER") %>% filter(salience > 0.5)
}

docs_with_lebanon <- c()
for (doc_num in c(1,2,3)) {
  docs_with_lebanon <- c(docs_with_lebanon, "Lebanon" %in% doc_nouns[[doc_num]]$name)
}
nlp_result$entities
## [[1]]
## # A tibble: 8 x 9
##   name  type  salience mid   wikipedia_url magnitude score beginOffset
##   <chr> <chr>    <dbl> <chr> <chr>             <dbl> <dbl>       <int>
## 1 batt… EVENT   0.149  <NA>  <NA>                0.1  -0.1         142
## 2 Leba… LOCA…   0.0978 /m/0… https://en.w…       0     0           115
## 3 mass… EVENT   0.128  <NA>  <NA>                0     0           188
## 4 Mult… ORGA…   0.141  <NA>  <NA>                0     0            42
## 5 Pale… ORGA…   0.0978 /m/0… https://en.w…       0     0            67
## 6 place OTHER   0.125  <NA>  <NA>                0.1  -0.1         202
## 7 supe… OTHER   0.231  <NA>  <NA>                0     0            23
## 8 West… LOCA…   0.0303 /m/0… https://en.w…       0     0           153
## # ... with 1 more variable: mention_type <chr>
## 
## [[2]]
## # A tibble: 11 x 9
##    name  type  salience mid   wikipedia_url magnitude score beginOffset
##    <chr> <chr>    <dbl> <chr> <chr>             <dbl> <dbl>       <int>
##  1 area  LOCA…   0.0466 <NA>  <NA>                0     0           215
##  2 Assad PERS…   0.0395 /m/0… https://en.w…       0     0            90
##  3 deat… LOCA…   0.0746 <NA>  <NA>                0     0            75
##  4 figh… PERS…   0.216  <NA>  <NA>                0.1   0           190
##  5 Isla… ORGA…   0.0123 /m/0… https://en.w…       0     0           153
##  6 offe… OTHER   0.0613 <NA>  <NA>                0.4  -0.4         135
##  7 Pale… LOCA…   0.145  /m/0… https://en.w…       0     0            12
##  8 refu… LOCA…   0.260  <NA>  <NA>                0.7   0.7          24
##  9 regi… PERS…   0.0666 <NA>  <NA>                0.1  -0.1          96
## 10 Syria LOCA…   0.0580 /m/0… https://en.w…       0     0            40
## 11 Unit… ORGA…   0.0196 /m/0… https://en.w…       0.1  -0.1         225
## # ... with 1 more variable: mention_type <chr>
## 
## [[3]]
## # A tibble: 8 x 9
##   name  type  salience wikipedia_url mid   magnitude score beginOffset
##   <chr> <chr>    <dbl> <chr>         <chr>     <dbl> <dbl>       <int>
## 1 batt… EVENT   0.0657 <NA>          <NA>        0.1  -0.1         142
## 2 Leba… LOCA…   0.116  https://en.w… /m/0…       0     0           115
## 3 mass… EVENT   0.117  <NA>          <NA>        0     0           188
## 4 Mult… ORGA…   0.125  <NA>          <NA>        0     0            42
## 5 Pale… ORGA…   0.126  https://en.w… /m/0…       0     0            67
## 6 place OTHER   0.114  <NA>          <NA>        0.1  -0.1         202
## 7 supe… OTHER   0.297  <NA>          <NA>        0     0            23
## 8 West… LOCA…   0.0391 https://en.w… /m/0…       0     0           153
## # ... with 1 more variable: mention_type <chr>
UN_speeches <- read_csv("corpora/UNGDC_2017_ascii.csv")
## Parsed with column specification:
## cols(
##   id = col_integer(),
##   folder_name = col_character(),
##   file_name = col_character(),
##   file_prefix = col_character(),
##   session_num = col_integer(),
##   year = col_integer(),
##   country_code = col_character(),
##   text = col_character(),
##   res = col_integer(),
##   res_count = col_integer()
## )
entity_list = list()
trump_list = list()
num_speeches = nrow(UN_speeches)
# could check *all* speeches, using: for (i in 1:num_speeches) {}
# here we'll just check two (already could be fairly expensive
# if you pass the free tier), and only send the first 500 chars
for (speech_num in 3:4){
  cur_speech <- UN_speeches[speech_num,"text"]
  cur_speech_head <- substr(cur_speech, 1, 500)
  cur_result <- gl_nlp(cur_speech_head)
  cur_entities <- cur_result$entities
  entity_list[[speech_num]] <- cur_entities
  has_trump <- "Trump" %in% cur_entities
  trump_list[[speech_num]] <- has_trump
}
## 2019-02-20 17:25:23 -- annotateText: 499 characters
## 2019-02-20 17:25:23 -- annotateText: 500 characters
print(entity_list)
## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## [[3]][[1]]
## # A tibble: 13 x 9
##    name  type  salience mid   wikipedia_url magnitude score beginOffset
##    <chr> <chr>    <dbl> <fct> <fct>             <dbl> <dbl>       <int>
##  1 case  OTHER  0.0718  <NA>  <NA>                0     0           140
##  2 chal… OTHER  0.0829  <NA>  <NA>                0.7  -0.7          87
##  3 hand  OTHER  0.0191  <NA>  <NA>                0.2   0.2         392
##  4 huma… PERS…  0.207   <NA>  <NA>                0.4  -0.4          36
##  5 issu… OTHER  0.0255  <NA>  <NA>                0.1  -0.1         266
##  6 prog… OTHER  0.0134  <NA>  <NA>                0.9   0.9         476
##  7 pros… OTHER  0.00844 <NA>  <NA>                0.9  -0.9         369
##  8 scie… OTHER  0.0134  <NA>  <NA>                0.8   0.8         488
##  9 times OTHER  0.469   <NA>  <NA>                0.1  -0.1           9
## 10 times OTHER  0.469   <NA>  <NA>                0.1  -0.1         213
## 11 times OTHER  0.0434  <NA>  <NA>                0.9   0.9           9
## 12 times OTHER  0.0434  <NA>  <NA>                0.9   0.9         213
## 13 world LOCA…  0.0454  <NA>  <NA>                1.3   0.2         414
## # ... with 1 more variable: mention_type <chr>
## 
## 
## [[4]]
## [[4]][[1]]
## # A tibble: 31 x 9
##    name  type  salience mid   wikipedia_url magnitude score beginOffset
##    <chr> <chr>    <dbl> <chr> <chr>             <dbl> <dbl>       <int>
##  1 chal… OTHER  0.00459 <NA>  <NA>                0     0           319
##  2 choi… OTHER  0.0428  <NA>  <NA>                0     0            83
##  3 comm… OTHER  0.00432 <NA>  <NA>                0     0           354
##  4 deve… OTHER  0.0310  <NA>  <NA>                1     0.4         275
##  5 doubt OTHER  0.0143  <NA>  <NA>                0     0           213
##  6 Gene… ORGA…  0.0173  /m/0… https://en.w…       0     0           137
##  7 issu… OTHER  0.0131  <NA>  <NA>                0     0           235
##  8 lif   OTHER  0.00686 <NA>  <NA>                0.1   0.1         497
##  9 life  OTHER  0.0143  <NA>  <NA>                0.1   0.1         194
## 10 link  OTHER  0.107   <NA>  <NA>                0     0           159
## # ... with 21 more rows, and 1 more variable: mention_type <chr>
trump_vec <- unlist(trump_list)
print(which(trump_vec))
## integer(0)