<div dir="ltr">Dear Stefan and Andrew,<div>thank you very much for your tutorial, that's what I was searching for. And, of course, I will do my homework :-)</div><div><br></div><div>Best,</div><div>Luigi</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-03 10:59 GMT+02:00 Stefan Evert <span dir="ltr"><<a href="mailto:stefanML@collocations.de" target="_blank">stefanML@collocations.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> tabulate A match word, match lemma;<br>
><br>
> resulting in:<br>
><br>
> word lemma<br>
> But how can I obtain the kwic in the first column, as in:<br>
><br>
> kwic word lemma<br>
<br>
</span>This sounds like you're searching for a single word. In order to obtain sentence contexts, you can use the following trick:<br>
<br>
set A target match;<br>
B = A expand to s;<br>
tabulate B match .. matchend word, target word, target lemma;<br>
<br>
The result is a TAB-delimited file with three columns where the first column contains the complete sentence context, with individual tokens separated by blanks. If you want separate left and right context:<br>
<br>
tabulate B match .. target[-1] word, target[1] .. matchend word, target word, target lemma;<br>
<br>
As Andrew has already pointed out, if you want a fixed number of context words, simply specify the desired offsets. Again, you can put the entire context in a single column by specifying a range with .. (mnemonic for tabulate: every "," in the command gives you a TAB in the output).<br>
<br>
tabulate A match[-5] .. match[-1] word, match[1] .. match[5], match word, match lemma;<br>
<br>
Exercise for the reader: modify this command so it works with matches of variable length.<br>
<br>
If you really wanted formatted kwic output as from "cat", simply "cat" the kwic lines into a text file, "tabulate" the other information into a second TAB-delimited file, then combine them with the "paste" program.<br>
<br>
Cheers,<br>
Stefan<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
CWB mailing list<br>
<a href="mailto:CWB@sslmit.unibo.it">CWB@sslmit.unibo.it</a><br>
<a href="http://devel.sslmit.unibo.it/mailman/listinfo/cwb" target="_blank">http://devel.sslmit.unibo.it/mailman/listinfo/cwb</a><br>
</div></div></blockquote></div><br></div>