Learn R Programming

qdap (version 0.2.5)

formality: Formality Score

Description

Transcript apply formality score by grouping variable(s) and optionally plot the breakdown of the model.

Usage

formality(text.var, grouping.var = NULL,
    sort.by.formality = TRUE, digits = 2, ...)

Arguments

text.var
The text variable (or an object from pos, pos.by or formality. Passing the later three ob
grouping.var
The grouping variables. Default NULL generates one word list for all text. Also takes a single grouping variable or a list of 1 or more grouping variables.
sort.by.formality
logical. If TRUE orders the results by formality score.
digits
The number of digits displayed.
...
Other arguments passed to pos.by.

Value

  • A list containing at the following components:
  • textThe text variable
  • POStaggedRaw part of speech for every word of the text variable
  • POSpropPart of speech proportion for every word of the text variable
  • POSfreqPart of speech count for every word of the text variable
  • pos.by.freqThe part of speech count for every word of the text variable by grouping variable(s)
  • pos.by.propThe part of speech proportion for every word of the text variable by grouping variable(s)
  • form.freq.byThe nine broad part of speech categories count for every word of the text variable by grouping variable(s)
  • form.prop.byThe nine broad part of speech categories proportion for every word of the text variable by grouping variable(s)
  • formalityFormality scores by grouping variable(s)
  • pos.reshapedAn expanded formality scores output (grouping, word.count, pos & form.class) by word

Warning

Heylighen & Dewaele(2002) state, "At present, a sample would probably need to contain a few hundred words for the measure to be minimally reliable. For single sentences, the F-value should only be computed for purposes of illustration".

Details

Heylighen & Dewaele(2002)'s formality score is calculated as: $$F = 50(\frac{n_{f}-n_{c}}{N} + 1)$$ Where: $$f = \left {noun, \;adjective, \;preposition, \;article\right }$$ $$c = \left {pronoun, \;verb, \;adverb, \;interjection\right }$$ $$N = \sum{(f \;+ \;c \;+ \;conjunctions)}$$

References

Heylighen, F., & Dewaele, J.M. (2002). Variation in the contextuality of language: An empirical measure. Context in Context, Special issue of Foundations of Science, 7 (3), 293-340.

Examples

Run this code
with(DATA, formality(state, person))
(x1 <- with(DATA, formality(state, list(sex, adult))))
plot(x1)
plot(x1, short.names = TRUE)
data(rajPOS) #A data set consisting of a pos list object
x2 <- with(raj, formality(rajPOS, act))
plot(x2)
x3 <- with(raj, formality(rajPOS, person))
plot(x3, bar.colors="Dark2")
plot(x3, bar.colors=c("Dark2", "Set1"))
x4 <- with(raj, formality(rajPOS, list(person, act)))
plot(x4, bar.colors=c("Dark2", "Set1"))

rajDEM <- key_merge(raj, raj.demographics) #merge demographics with transcript.
x5 <- with(rajDEM, formality(rajPOS, sex))
plot(x5, bar.colors="RdBu")
x6 <- with(rajDEM, formality(rajPOS, list(fam.aff, sex)))
plot(x6, bar.colors="RdBu")
x7 <- with(rajDEM, formality(rajPOS, list(died, fam.aff)))
plot(x7, bar.colors="RdBu",  point.cex=2, point.pch = 3)
x8 <- with(rajDEM, formality(rajPOS, list(died, sex)))
plot(x8, bar.colors="RdBu",  point.cex=2, point.pch = "|")

names(x8)
colsplit2df(x8$formality)

#pass an object from pos or pos.by
ltruncdf(with(raj, formality(x8 , list(act, person))), 6, 4)

Run the code above in your browser using DataLab