scripting (advanced)

Scripts

This option allows you to run a pre-prepared script. In the case below, sample_script.txt has requested two concordance operations, a word list, and a keywords analysis. The whole process happened without any intervention from the user, using the defaults in operation.

 

auto_batch_processing

The syntax is as suggested in the EXAMPLES visible above. (There is a sample_script.txt file in your Documents\wsmith6 folder).  First the tool required, then the necessary parameters, each surrounded by double quotes, in any order.

 

concord corpus="x:\text\dickens\hard_times.txt" node="hard" output="c:\temp\hard.cnc"

made a concordance of the hard_times.txt text file looking for the search-word hard and saved results in c:\temp\hard.cnc

concord corpus="x:\text\dickens\hard_times.txt" node="c:\temp\sws.txt" output="c:\temp\outputs.txt" 1_at_a_time="true"

made a concordance of the same text file looking for each search-word in the sws.txt file, counted the number of hits and saved results in c:\temp\outputs.txt

wordlist corpus="x:\text\shakes\oll\txt\tragedies\*.txt" output="c:\temp\shakespeare.lst"

made a word list of all the .txt text files in a folder of Shakespeare tragedies (not including sub-folders) and saved it.

keywords refcorpus="j:\temp\BNC.lst" wordlist="c:\temp\shakespeare.lst" output="j:\temp\shakespeare.kws"

made a key words list of that word list compared with a BNC word list and saved it.

 

Two additional optional parameters not visible there are:

1_at_a_time="true" and TXT_format="true".

 

If TXT_format is true, a Concord file will contain only the concordance lines, a KeyWords file only the key words and their frequencies, and a WordList file only the words and their frequencies.

 

If 1_at_a_time is true, a word-list will export separate results text file by text file.

If 1_at_a_time is true, Concord will read search words from a text file and save summary results:

concord corpus="x:\text\dickens\hard_times.txt" node="c:\temp\sws.txt" output="c:\temp\outputs.txt" 1_at_a_time="true"

produced this in c:\temp\outputs.txt:

x:\text\dickens\hard_times.txt

hard        50

soft        3

mean        54

empty        9

fred        0

book        13

north*        4

south*        2

 

collocate scripts

It is also possible to run a script requesting the collocates of each word in a word-list. This syntax

wordlist collocates of "c:\temp\shakespeare.lst" output="c:\temp\shakespeare\collocates"

tells WordSmith to compute the collocates of each word in the shakespeare.lst word-list, and save results as plain text files, one per word, in the c:\temp\shakespeare\collocates folder.  The texts to be processed are the same text files used when the word list was created (and must still be present on disk to work, of course). Settings affecting the process are shown below. The first 6 have to do with the words from the word-list, and the min. in collocate-list refers to how many collocates of each word-list word are needed (here 10) for processing to be reported. Min. total column refers to the number in the total column of a collocation display.

 

collocate_script_settings

Results look like this:

 

collocate_script_results

Here they're incomplete because I pressed the Stop button.

Each of these lists has the collocates output much as in a collocates display, but with the relationships also computed.

The process only saves results where the settings shown above are met and where the relationships also meet the requirements as in the WSConcgram settings.

 

See also : drag and drop

 

Click the Permalink button if you want to copy a link to this page.