[CWB] Storing results for further search queries
Stefan Evert
stefanML at collocations.de
Sat May 18 11:54:20 CEST 2019
> Is there a way to save part of results as a variable and then to use it as a new query. For example after doing the following two steps in BNC:
>
> 1. [hw="nice"] "to" [class="VERB"];
> 2. count Last by hw on matchend[0];
>
> Can I somehow store only the list of words (e.g. as lemma forms) and then take that set as a search query?
That isn't possible, but you can achieve your goal with a bit of help from the Linux command-line.
A = [hw="nice"] "to" [class="VERB"];
set PrettyPrint off; # make output machine readable
group A matchend hw; # more efficient than count
You can now use the "cut" command-line utility to extract the list if verb lemmas from the frequency table. This can be done from within CQP by redirecting output to a pipe:
group A matchend hw > "| cut -f1 > verbs.txt";
And then read in the wordlist:
define $verbs < "verbs.txt";
B = [hw = $verbs & class = "VERB"] # find all instances of a verb
If you just want the general lemma frequency, this can be obtained more efficiently with the cwb-lexdecode command-line utility (but you should probably use the lemma attribute then so you only get the verb readings).
group A matchend hw > "| cut -f1 | cwb-lexdecode -P hw -f -F - BNC";
Best,
Stefan
More information about the CWB
mailing list