word_properties
- snafu.word_properties.ageOfAcquisition(subj, missing=None, data=None)[source]
Compute average age of acquisition (AoA) for fluency responses.
This function loads a dictionary of age-of-acquisition scores and computes average values for each list or participant.
- Parameters:
subj (list) – Fluency data. Can be a list of lists (non-hierarchical) or list of list of lists (hierarchical).
missing (float, optional) – Value to use for words not found in the AoA dictionary. If None, such words are excluded.
data (str) – Path to a CSV file containing AoA scores. File should have columns: ‘word’, ‘val’.
- Returns:
For hierarchical data: a tuple of (list of average AoA per individual, list of excluded words). For non-hierarchical data: a tuple of (list of AoA scores per list, list of excluded words).
- Return type:
list or tuple
- snafu.word_properties.wordFrequency(subj, missing=0.5, data=None)[source]
Compute average word frequency for fluency responses.
This function loads a word frequency dictionary from a file and computes average frequency scores for each list or participant. It supports both hierarchical and non-hierarchical fluency data.
- Parameters:
subj (list) – Fluency data. Can be a list of lists (non-hierarchical) or a list of list of lists (hierarchical).
missing (float, optional) – Value to substitute for missing words not found in the frequency dictionary (default is 0.5).
data (str) – Path to a CSV file containing word frequencies. File should have columns: ‘word’, ‘val’.
- Returns:
For hierarchical data: a tuple of (list of average frequencies per individual, list of excluded words). For non-hierarchical data: a tuple of (list of frequencies per list, list of excluded words).
- Return type:
list or tuple
- snafu.word_properties.wordStat(subj, missing=None, data=None)[source]
Compute word-level statistics (e.g., frequency or AoA) from a word-to-value dictionary.
Loads a dictionary mapping words to numeric values (e.g., frequency, AoA), then computes mean values for each list. Handles missing words either by substitution or exclusion.
- Parameters:
subj (list of list of str) – List(s) of words for which to compute statistics.
missing (float, optional) – Value to substitute for missing words. If None, missing words are excluded from computation.
data (str) – Path to a CSV file with ‘word’ and ‘val’ columns.
- Returns:
- word_vallist of float
Mean value for each list (e.g., frequency or AoA).
- words_excludedlist of list of str
Words not found in the dictionary for each list.
- Return type:
tuple