This script counts the number of occurrences of each provided word, then creates individual columns with the number of occurrences for each word.
First download wordCountsv005.jsl from the bottom of this page
1. With your data table open, run the attached script
2. Select your column of text in the list of columns, then click "Text Column" to enter it in that role
3. Enter the words you wish to count in the words section below, separated by commas or spaces
4. (Optional) Specify other delimiters for the text column. If you modify the delimiters section, ensure that you retain a space otherwise words separated by spaces in the original text will not be considered as separate words.
Open a data table with a text column
Run script and cast "text" into the "Text Column" role.
Next, enter words to count. In this case: "something" "dark" and "side"
Upon clicking OK, three new columns are made, counting the instances of each word (ignoring case)
- This script is intended for situations in which it's important to count the number of times a word is used in free text. If presence/absence of words is needed, simply recode values greater than 1 as 1 in the generated columns. Alternatively, to create indicator columns for high frequency words, use Analyze > Consumer Research > Categorical, then use "Free Text" under the "Multiple" tab. Once run, you will have options under the Red Triangle to save indicator columns for the k most frequent words.
- The default delimiters will break apart most text, but do check for usage of other symbols; text that is immediately adjacent to symbols not specified in the delimiter section will not be parsed properly.