Description Usage Arguments Details Value See Also Examples
View source: R/question_type.R
Transcript apply question counts.
1 2 3 4 5 6 7 8 9 10 11 12 | question_type(
text.var,
grouping.var = NULL,
neg.cont = FALSE,
percent = TRUE,
zero.replace = 0,
digits = 2,
contraction = qdapDictionaries::contractions,
bracket = "all",
amplifiers = qdapDictionaries::amplification.words,
...
)
|
text.var |
The text variable |
grouping.var |
The grouping variables. Default |
neg.cont |
logical. If |
percent |
logical. If |
zero.replace |
Value to replace 0 values with. |
digits |
Integer; number of decimal places to round when printing. |
contraction |
A two column key of contractions (column 1) and expanded
form replacements (column 2) or a vector of contractions. Default is to use
qdapDictionaries's |
bracket |
The type of bracket (and encased text) to remove. This is one
or more of the strings |
amplifiers |
A character vector of terms that increase the
intensity of a positive or negative word. Default is to use
qdapDictionaries's |
... |
Other arguments passed to |
The algorithm searches for the following interrogative words (and optionally, their negative contraction form as well):
1) whose 2) whom 3) who 4) where 5) what 6) which 7) why 8) when 9) were* 10) was* 11) does* 12) did* 13) do* 14) is 15) are* 16) will* 17) how 18) should 19) could 20) would* 21) shall 22) may 23) might* 24) must* 25) can* 26) has 27) have* 28) had* 29) ok 30) right 31) correct 32) implied do/does/did
The interrogative word that is found first (with the exception of "ok", "right"/"alright", and "correct") in the question determines the sentence type. "ok", "right"/"alright", and "correct" sentence types are determined if the sentence is a question with no other interrogative words found and "ok", "right"/"alright", or "correct" is the last word of the sentence. Those interrogative sentences beginning with the word "you", "wanna", or "want" are categorized as implying do/does/did question type, though the use of do/does/did is not explicit. Those sentence beginning with "you" followed by a select interrogative word (and or their negative counter parts) above (marked with *) or 1-2 amplifier(s) followed by the select interrogative word are categorized by the select word rather than an implied do/does/did question type. A sentence that is marked "ok" over rides an implied do/does/did label. Those with undetermined sentence type are labeled unknown.
Returns a list of:
raw |
A dataframe of the questions used in the transcript and their type. |
count |
A dataframe of total questions ( |
rnp |
Dataframe of the frequency and proportions of question types by grouping variable. |
inds |
The indices of the original text variable that contain questions. |
missing |
The row numbers of the missing data (excluded from analysis). |
percent |
The value of percent used for plotting purposes. |
zero.replace |
The value of zero.replace used for plotting purposes. |
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 33 34 35 36 37 38 39 40 41 42 | ## Not run:
## Inspect the algorithm classification
x <- c("Kate's got no appetite doesn't she?",
"Wanna tell Daddy what you did today?",
"You helped getting out a book?", "umm hum?",
"Do you know what it is?", "What do you want?",
"Who's there?", "Whose?", "Why do you want it?",
"Want some?", "Where did it go?", "Was it fun?")
left_just(preprocessed(question_type(x))[, c(2, 6)])
## Transcript/dialogue examples
(x <- question_type(DATA.SPLIT$state, DATA.SPLIT$person))
## methods
scores(x)
plot(scores(x))
counts(x)
plot(counts(x))
proportions(x)
plot(proportions(x))
truncdf(preprocessed(x), 15)
plot(preprocessed(x))
plot(x)
plot(x, label = TRUE)
plot(x, label = TRUE, text.color = "red")
question_type(DATA.SPLIT$state, DATA.SPLIT$person, percent = FALSE)
DATA[8, 4] <- "Won't I distrust you?"
question_type(DATA.SPLIT$state, DATA.SPLIT$person)
DATA <- qdap::DATA
with(DATA.SPLIT, question_type(state, list(sex, adult)))
out1 <- with(mraja1spl, question_type(dialogue, person))
## out1
out2 <- with(mraja1spl, question_type(dialogue, list(sex, fam.aff)))
## out2
out3 <- with(mraja1spl, question_type(dialogue, list(sex, fam.aff),
percent = FALSE))
plot(out3, label = TRUE, lab.digits = 3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.