exampleTexts | R Documentation |
Finds examples of most or least polite text in a corpus
exampleTexts(text, covar, type = c("most", "least"), num_docs = 5L)
text |
a character vector of texts. |
covar |
a vector of politeness labels (from human or model), or other covariate. |
type |
a string indicating if function should return the most or least polite texts or both. If |
num_docs |
integer of number of documents to be returned. Default is 5. |
Function returns a data.frame ranked by (more or least) politeness.
If type == 'most'
, the num_docs
most polite texts will be returned.
If type == 'least'
, the num_docs
least polite texts will be returned.
If type == 'both'
, both most and least polite text will be returned.
if num_docs
is even, half will be most and half least polite else half + 1 will be most polite.
df_polite
must have the same number of rows as the length(text)
and length(covar)
.
data.frame with texts ranked by (more or least) politeness. See details for more information.
data("phone_offers")
polite.data<-politeness(phone_offers$message, parser="none",drop_blank=FALSE)
exampleTexts(phone_offers$message,
phone_offers$condition,
type = "most",
num_docs = 5)
exampleTexts(phone_offers$message,
phone_offers$condition,
type = "least",
num_docs = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.