get_sentence

0th

Percentile

Access sentence-level annotations

Access sentence-level annotations

Usage
get_sentence(annotation)
Arguments
annotation

an annotation object

Value

Returns an object of class c("tbl_df", "tbl", "data.frame") containing one row for every sentence in the corpus.

The returned data frame includes at a minimum the following columns:

  • "id" - integer. Id of the source document.

  • "sid" - integer. Sentence id.

The coreNLP backend also currently returns a column "sentiment" that gives a score from 0 (most negative) to 4 (most positive) for how positive the tone of the sentence is predicted to be.

References

Manning, Christopher D., Mihai Surdeanu, John Bauer, Jenny Finkel, Steven J. Bethard, and David McClosky. 2014. The Stanford CoreNLP Natural Language Processing Toolkit. In: Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 55-60.

Socher, Richard, et al. "Recursive deep models for semantic compositionality over a sentiment treebank." Proceedings of the conference on empirical methods in natural language processing (EMNLP). Vol. 1631. 2013.

Aliases
  • get_sentence
Examples
# NOT RUN {
# how do the predicted sentiment scores change across the years?
require(dplyr)
get_sentence(obama) %>%
  group_by(id) %>%
  summarize(mean(sentiment), se = sd(sentiment) / sqrt(n()))

# }
Documentation reproduced from package cleanNLP, version 1.10.0, License: LGPL-2

Community examples

Looks like there are no examples yet.