perseverations
- snafu.perseverations.perseverations(l)[source]
Count the number of perseverations (repeated items) in fluency data.
Computes the number of repeated responses per list. If the input is hierarchical (e.g., per subject with multiple lists), the function returns the mean number of perseverations per subject.
- Parameters:
l (list) – Fluency data: a list of lists (or list of list of lists) of responses.
- Returns:
A list of perseveration counts per list, or mean per subject if hierarchical.
- Return type:
list of float or list of list of float
- snafu.perseverations.perseverationsList(l)[source]
Identify repeated (perseverated) items in fluency lists.
Handles both hierarchical (list of lists of lists) and flat (list of lists) formats. For each list, returns the unique items that occur more than once.
- Parameters:
l (list) – A list of lists (or list of list of lists) representing fluency responses.
- Returns:
A list of lists where each inner list contains the items repeated in the corresponding fluency list.
- Return type:
list