Concept Class Analysis (CoCA) is a method for grouping documents based on the schematic similarities in their engagement with multiple semantic directions (as measured in the previous section). This is a generalization of Correlational Class Analysis for survey data. We outline this method in more detail in our Sociological Science paper, “Concept Class Analysis: A Method for Identifying Cultural Schemas in Texts.”
The first step to use CoCA is build two or more semantic directions. For example, here are three semantic directions related to socio-economic status. Note that you must load or create word embeddings.
# build juxtaposed pairs for each semantic directions 01 <- data.frame(additions = c("rich", "richer", "affluence", "wealthy"), pairs_substracts = c("poor", "poorer", "poverty", "impoverished") ) 02 <- data.frame(additions = c("skilled", "competent", "proficient", "adept"), pairs_substracts = c("unskilled", "incompetent", "inproficient", "inept") ) 03 <- data.frame(additions = c("educated", "learned", "trained", "literate"), pairs_substracts = c("uneducated", "unlearned", "untrained", "illiterate") ) # get the vectors for each direction 01 <- get_direction(pairs_01, my_wv) sd_02 <- get_direction(pairs_02, my_wv) sd_03 <- get_direction(pairs_03, my_wv) sd_ # row bind each direction rbind(sd_01, sd_02, sd_03) sem_dirs <-
Next, we feed our document-term matrix, word embeddings matrix, and our semantic direction data.frame from above to the
CoCA(my_dtm, wv = my_wv, directions = sem_dirs) classes <-print(classes)
Finally, using the
plot() function, we can generate simple visualizations of the schematic classes found:
# this is a quick plot. # designate which module to plot with `module = ` plot(classes, module=1)