Subscribe Bookmark RSS Feed
julian

Staff

Joined:

Jun 25, 2014

Word Counts to Columns

7809_Screen Shot 2014-12-24 at 11.18.20 AM.png

This script counts the number of occurrences of each provided word, then creates individual columns with the number of occurrences for each word.

Usage

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.

Example:

    Open a data table with a text column

7810_Screen Shot 2014-12-24 at 11.18.06 AM.png

Run script and cast "text" into the "Text Column" role.

Next, enter words to count. In this case: "something"  "dark" and "side"

7811_Screen Shot 2014-12-24 at 11.18.35 AM.png

Upon clicking OK, three new columns are made, counting the instances of each word (ignoring case)

7812_Screen Shot 2014-12-24 at 11.18.58 AM.png

Notes:


- 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.

Article Tags
Contributors