Skip to content

Commit cca76f0

Browse files
committed
updated vignettes
1 parent ef932f1 commit cca76f0

File tree

6 files changed

+289
-26
lines changed

6 files changed

+289
-26
lines changed

vignettes/CA_Intro.Rmd

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
title: ConversationAlign Intro
3+
author: Jamie Reilly, Ben Sacks, Ginny Ulichney, Gus Cooney, Chelsea Helion
4+
date: "`r format(Sys.Date(), '%B %d, %Y')`"
5+
show_toc: true
6+
slug: ConversationAlign
7+
output:
8+
rmarkdown::html_vignette:
9+
toc: yes
10+
vignette: >
11+
%\VignetteEngine{knitr::rmarkdown}
12+
%\VignetteIndexEntry{ConversationAlign Intro}
13+
%\VignetteEncoding{UTF-8}
14+
---
15+
16+
```{r, include = FALSE}
17+
knitr::opts_chunk$set(
18+
collapse = TRUE,
19+
comment = "#>"
20+
)
21+
```
22+
23+
# Intro to ConversationAlign
24+
A good conversation is a cooperative endeavor where both parties modify the form and content of their own production to align with each other. This is a phenomenon known as alignment. People align across many dimensions including the words they choose and the affective tenor of their prosody. ``ConversationAlign`` measures dynamics of lexical use between conversation partners across more than 40 semantic, lexical, phonological, and affective dimensions. Before launching into your analyses, there are some important use caveats to consider.
25+
26+
## Caveats for Using ConversationAlign
27+
- Language analyses often proliferate in complexity. Spend the extra time to keep careful records and a logical organization system (e.g., smart filenaming, variable keys, a formalized processing pipeline).
28+
- ``ConversationAlign`` only works on dyadic language transcripts (i.e., 2-person dialogues).
29+
- ``ConversationAlign`` does NOT parse turns automatically. The software will aggregate all words produced by one speaker across sentences and rows until a switch occurs in the 'speaker' column.
30+
- ``ConversationAlign`` will strip punctuation and other special characters automatically.
31+
- ``ConversationAlign`` will split/vectorize your text into a one-word-per-row format, retaining all variable labels.
32+
- ``ConversationAlign`` will retain all meta-data throughout text processing (e.g., timestamps, grouping variables). ``ConversationAlign`` is pretty good at detecting and repairing unconventional font encoding systems, but it will not catch everything, You will find all sorts of hidden junk when you copy/paste interview transcripts from random websites are from YouTube. Inspect your transcripts to make sure they are what you think they are before launching into a complex computational analysis.
33+
34+
## Prepare your Transcripts Outside of the Package
35+
- Save each conversation transcript as a separate file (``*.txt``, ``*.csv``, or Otter ``*.ai``).
36+
- Be deliberate about your filenaming convention. Each transcript's filename will become its unique document identifier (Event_ID) when importing into ``ConversationAlign``. <br>
37+
- Store all the transcripts you want to analyze in the same folder (e.g., '/my_transcripts).
38+
- Your transcript folder and analysis scripts should ideally exist within the same directory.
39+
- Each raw comversation transcript **MUST** nominally contain at least two columns, talker/interlocutor and text.
40+
- Name your talker/interlocutor column as 'Interlocutor', 'Speaker', or 'Participant' (not case sensitive).
41+
- Name your text column as 'Text', 'Utterance', or 'Turn' (not case sensitive).
42+
43+
# Installation
44+
Install and load the development version of `ConversationAlign` from [GitHub](https://github.com/) using the `devtools` package.
45+
```{r, message=FALSE, warning=F}
46+
# Check if devtools is installed, if not install it
47+
if (!require("devtools", quietly = TRUE)) {
48+
install.packages("devtools")
49+
}
50+
51+
# Load devtools
52+
library(devtools)
53+
54+
# Check if ConversationAlign is installed, if not install from GitHub
55+
if (!require("ConversationAlign", quietly = TRUE)) {
56+
devtools::install_github("Reilly-ConceptsCognitionLab/ConversationAlign")
57+
}
58+
59+
# Load SemanticDistance
60+
library(ConversationAlign)
61+
```
62+
63+
## Calibaration Transcripts Included in `ConversationAlign`
64+
``ConversationAlign``contains two sample conversation transcripts that are pre-load when you call the package. These are:
65+
**MaronGross_2013:** Interview transcript of Marc Maron and Terry Gross on NPR (2013). <br>
66+
**NurseryRhymes:** Three nursery rhymes looping same phrases formatted as conversations, cleaned, and aligned to illustrate how the formatting pipeline reshaopes conversation transcripts.
67+
68+
### NurseryRhymes
69+
```{r, eval=T, message=F, warning=F}
70+
knitr::kable(head(NurseryRhymes, 20), format = "simple")
71+
str(NurseryRhymes)
72+
```
73+
74+
### Maron-Gross Interview
75+
Here's one from a 2013 NPR interview (USA) between Marc Maron and Terry Gross, titled [Marc Maron: A Life Fueled By 'Panic And Dread'](https://www.npr.org/transcripts/179014321).<br>
76+
```{r}
77+
knitr::kable(head(MaronGross_2013, 20), format = "simple")
78+
str(MaronGross_2013)
79+
```
80+
81+
# Caveat emptor
82+
Any analysis of language comes with assumptions and potential bias. For example, there are some instances where a researcher might care about morphemes and grammatical elements such as 'the', 'a', 'and', etc.. The default for ConversationAlign is to omit these as stopwords and to average across all open class words (e.g., nouns, verbs) in each turn by interlocutor. There are some specific cases where this can all go wrong. Here are some things to consider: <br>
83+
84+
1. <span style="color:red;">Stopwords </span>: ``ConversationAlign`` omits stopwords by default applying a customized stopword list, ``Temple_Stopwords25``. [CLICK HERE](https://osf.io/dc5k7) to inspect the list. This stopword list includes greetings, idioms, filler words, numerals, and pronouns.
85+
86+
2. <span style="color:red;">Lemmatization </span>: The package will lemmatize your language transcripts by default. Lemmatization transforms inflected forms (e.g., standing, stands) into their root or dictionary entry (e.g., stand). This helps for yoking offline values (e.g., happiness, concreteness) to each word and also entails what NLP folks refer to as 'term aggregation'. However, sometimes you might NOT want to lemmatize. You can easily change this option by using the argument, "lemmatize=FALSE," to the clean_dyads function below. <br>
87+
88+
3. <span style="color:red;">Sample Size Issue 1: Exchange Count</span>: The program derives correlations and AUC for each dyad as metrics of alignment. For very brief conversations (<30 turns), the likelihood of unstable or unreliable estimates is high. <br>
89+
90+
4. <span style="color:red;">Sample Size Issue 2 </span>: matching to lookup database: ConversationAlign works by yoking values from a lookup database to each word in your language transcript. Some variables have lots of values characterizing many English words. Other variables (e.g., age of acquisition) only cover about 30k words. When a word in your transcript does not have a 'match' in the lookup datase, ConversationAlign will return an NA which will not go into the average of the words for that interlocutor and turn. This can be dangerous when there are many missing values. Beware! <br>
91+
92+
5. <span style="color:red;">Compositionality </span>: ConversationAlign is a caveman in its complexity. It matches a value to each word as if that word is an island. Phenomena like polysemy (e.g., bank) and the modulation of one word by an intensifier (e.g., very terrible) are not handled. This is a problem for many of the affective measures but not for lexical variables like word length. <br>
93+
94+
95+
# Background and Supporting Materials
96+
97+
1. **Preprint** <br>
98+
Our PsyArXiv preprint describing the method(s) in greater detail is referenced as:
99+
Sacks, B., Ulichney, V., Duncan, A., Helion, C., Weinstein, S., Giovannetti, T., ... Reilly, J. (2025, March 12). *ConversationAlign: Open-Source Software for Analyzing Patterns of Lexical Use and Alignment in Conversation Transcripts*. [Click Here](https://osf.io/preprints/psyarxiv/7xqnp_v1) to read our preprint. It was recently invited for revision at Behavior Rsearch Methods. We will update when/if eventually accepted there! <br>
100+
101+
2. **Methods for creating internal lookup database** <br>
102+
ConversationAlign contains a large, internal lexical lookup_database. [Click Here](https://reilly-lab.github.io/ConversationAlign_LookupDatabaseCreation.html) to see how we created this by merging other offline psycholinguistic databases into one. <br>
103+
104+
3. **Variable Key for ConversationAlign** <br>
105+
ConversationAlign currently allows users to compute alignment dynamics across 30 different lexical, affective, and semantic dimensions.[Click Here](https://reilly-lab.github.io/ConversationAlign_VariableLookupKey.pdf) to link to a variable key. <br>
106+
107+
# References
108+
Lewis, David D., et al. (2004) "Rcv1: A new benchmark collection for text categorization research." Journal of machine learning research 5: 361-397.
109+
110+
111+

vignettes/CA_Step1_Read.Rmd

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: CA Step 1 Read_Dyads
3+
subtitle: Read and Format Data for ConversationAlign
4+
author: Jamie Reilly, Ben Sacks, Ginny Ulichney, Gus Cooney, Chelsea Helion
5+
date: "`r Sys.Date()`"
6+
show_toc: true
7+
slug: ConversationAlign Read
8+
output:
9+
rmarkdown::html_vignette:
10+
toc: yes
11+
vignette: >
12+
%\VignetteEngine{knitr::rmarkdown}
13+
%\VignetteIndexEntry{CA Step 1 Read_Dyads}
14+
%\VignetteEncoding{UTF-8}
15+
---
16+
17+
```{r, include = FALSE}
18+
knitr::opts_chunk$set(
19+
collapse = TRUE,
20+
comment = "#>"
21+
)
22+
```
23+
24+
# Installation
25+
Install and load the development version of `ConversationAlign` from [GitHub](https://github.com/) using the `devtools` package.
26+
```{r, message=FALSE, warning=F, echo=F}
27+
# Check if devtools is installed, if not install it
28+
if (!require("devtools", quietly = TRUE)) {
29+
install.packages("devtools")
30+
}
31+
32+
# Load devtools
33+
library(devtools)
34+
35+
# Check if ConversationAlign is installed, if not install from GitHub
36+
if (!require("ConversationAlign", quietly = TRUE)) {
37+
devtools::install_github("Reilly-ConceptsCognitionLab/ConversationAlign")
38+
}
39+
40+
# Load SemanticDistance
41+
library(ConversationAlign)
42+
```
43+
44+
# Prep_Data

vignettes/CA_Step2_Prep.Rmd

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: CA Step 2 Prep Data
3+
subtitle: prep_dyads()
4+
author: Jamie Reilly, Ben Sacks, Ginny Ulichney, Gus Cooney, Chelsea Helion
5+
date: "`r format(Sys.Date(), '%B %d, %Y')`"
6+
show_toc: true
7+
slug: ConversationAlign Prep
8+
output:
9+
rmarkdown::html_vignette:
10+
toc: yes
11+
vignette: |
12+
%\VignetteEngine{knitr::rmarkdown}
13+
%\VignetteIndexEntry{ConversationAlign Step_2 Prep_Dyads}
14+
%\VignetteEncoding{UTF-8}
15+
---
16+
17+
Install and load the development version of `ConversationAlign` from [GitHub](https://github.com/) using the `devtools` package.
18+
```{r, message=FALSE, warning=F, echo=F}
19+
# Check if devtools is installed, if not install it
20+
if (!require("devtools", quietly = TRUE)) {
21+
install.packages("devtools")
22+
}
23+
24+
# Load devtools
25+
library(devtools)
26+
27+
# Check if ConversationAlign is installed, if not install from GitHub
28+
if (!require("ConversationAlign", quietly = TRUE)) {
29+
devtools::install_github("Reilly-ConceptsCognitionLab/ConversationAlign")
30+
}
31+
32+
# Load SemanticDistance
33+
library(ConversationAlign)
34+
```
35+
36+
## prep_dyads()
37+
``prep_dyads()`` uses numerous regex to clean and format the data your just read into R in the previous step. ``ConversationAlign`` applies an ordered sequence of cleaning steps on the road toward vectorizing your original text into a one-word-per row format. These steps include: converting all text to lowercase, expanding contractions, omitting all non-alphabetic characters (e.g., numbers, punctuation, line breaks). In addition to text cleaning, users guide options for stopword removal and lemmatization. During formatting ``prep_dyads()`` will prompt you to select up to three variables for computing alignment on. This works by joining values from a large internal lookup database to each word in your language transcript. ``prep_dyads()`` is customizable via the following arguments.
38+
39+
### Stopword removal
40+
There are two important arguments regarding stopword removal. ``omit_stops`` specifies whether or not to remove stopwords. ``which_stopwords`` specifies which stopword list you would like to apply with the default being ``Temple_stops25``. The full list of choices is: ``none``, ``SMART_stops``, ``CA_orig_stops``. ``MIT_stops``, and ``Temple_stops25``. Stopword removal is an important, yet also controversial step in text cleaning. <br>
41+
42+
### Lemmatization
43+
``ConversationAlign`` calls the ``textstem`` package as a dependency to lemmatize your language transcript. This converts morphologiocal derivatives to their root forms. The default is lemmatize=T. Sometimes you want to retain language output in its native form. If this is the case, change the argument in clean_dyads to lemmatize=F. ``clean_dyads()`` outputs word count metrics pre/post cleaning by dyad and interlocutor. This can be useful if you are interested in whether one person just doesn't produce many words or produces a great deal of empty utterances. <br>
44+
45+
### Dimension Selection
46+
This is where the magic happens. ``prep_dyads()`` will yoke published norms for up to 45 possible dimensions to every content word in your transcript. This join is executed by merging your vectorized conversation transcript with a huge internal lexical database with norms spanning over 100k English words. ``prep_dyads()`` will prompt you to select anywhere from 1 to 3 target dimensions at a time. Enter the number corresponding to each dimension of interest separated by spaces and then hit enter (e.g., 10 14 19) ``ConversationAlign`` will append a published norm if available (e.g., concreteness, word length) to every running word in your transcript. These quantitative values are used in the subsequent ``summarize_dyads()`` step to compute alignment. <br>
47+

vignettes/CA_Step3_Summarize.Rmd

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: CA Step 3 Summarize Dyads
3+
subtitle: summarize_dyads()
4+
author: Jamie Reilly, Ben Sacks, Ginny Ulichney, Gus Cooney, Chelsea Helion
5+
date: "`r format(Sys.Date(), '%B %d, %Y')`"
6+
show_toc: true
7+
slug: ConversationAlign Summarize
8+
output:
9+
rmarkdown::html_vignette:
10+
toc: yes
11+
vignette: |
12+
%\VignetteEngine{knitr::rmarkdown}
13+
%\VignetteIndexEntry{CA Step 3 Summarize Dyads}
14+
%\VignetteEncoding{UTF-8}
15+
---
16+
17+
```{r, include = FALSE}
18+
knitr::opts_chunk$set(
19+
collapse = TRUE,
20+
comment = "#>"
21+
)
22+
```
23+
24+
```{r, message=FALSE, warning=F, echo=F}
25+
# Check if devtools is installed, if not install it
26+
if (!require("devtools", quietly = TRUE)) {
27+
install.packages("devtools")
28+
}
29+
30+
# Load devtools
31+
library(devtools)
32+
33+
# Check if ConversationAlign is installed, if not install from GitHub
34+
if (!require("ConversationAlign", quietly = TRUE)) {
35+
devtools::install_github("Reilly-ConceptsCognitionLab/ConversationAlign")
36+
}
37+
38+
# Load SemanticDistance
39+
library(ConversationAlign)
40+
```
41+
42+
## summarize_dyads()
43+
`

vignettes/CA_Step4_Analytics.Rmd

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: CA Step 4 Corpus Analytics
3+
subtitle: corpus_analytics()
4+
author: Jamie Reilly, Ben Sacks, Ginny Ulichney, Gus Cooney, Chelsea Helion
5+
date: "`r format(Sys.Date(), '%B %d, %Y')`"
6+
show_toc: true
7+
slug: ConversationAlign Analytics
8+
output:
9+
rmarkdown::html_vignette:
10+
toc: yes
11+
vignette: >
12+
%\VignetteEngine{knitr::rmarkdown}
13+
%\VignetteIndexEntry{CA Step 4 Corpus Analytics}
14+
%\VignetteEncoding{UTF-8}
15+
---
16+
17+
```{r, include = FALSE}
18+
knitr::opts_chunk$set(
19+
collapse = TRUE,
20+
comment = "#>"
21+
)
22+
```
23+
24+
```{r, message=FALSE, warning=F, echo=F}
25+
# Check if devtools is installed, if not install it
26+
if (!require("devtools", quietly = TRUE)) {
27+
install.packages("devtools")
28+
}
29+
30+
# Load devtools
31+
library(devtools)
32+
33+
# Check if ConversationAlign is installed, if not install from GitHub
34+
if (!require("ConversationAlign", quietly = TRUE)) {
35+
devtools::install_github("Reilly-ConceptsCognitionLab/ConversationAlign")
36+
}
37+
38+
# Load SemanticDistance
39+
library(ConversationAlign)
40+
```
41+
42+
# Generate corpus analytics
43+
44+
`

vignettes/my-vignette.Rmd

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)