[CWB] Catting result-sets

Alberto Simões ambs at di.uminho.pt
Wed Dec 22 11:32:38 CET 2010


GREAT! :)

Thank you :)

On 21/12/2010 22:53, Stefan Evert wrote:
>
> On 21 Dec 2010, at 22:08, Alberto Simões wrote:
>
>> CORPUS_A;
>> A="query1";
>> CORPUS_B;
>> B="query2";
>
> Now try
>
> 	size CORPUS_A:A;
>
> :o)
>
> The "true" names of the query results consist of corpus ID and query ("subcorpus") name, so they are
>
> 	CORPUS_A:A
> 	CORPUS_B:B
>
> which is also what "show named" tells you.  As a shorthand, you can access query results for the currently activated corpus by just giving the query name, which is what most people do in their interactive work.
>
> As a consequence, you can have multiple query results with the same short name in different corpora.  For instance:
>
> 	CORPUS_A;
> 	A="query1";
> 	CORPUS_B;
> 	A="query2";
>
> The last command doesn't overwrite the first query result (CORPUS_A:A), but rather creates a new result with the full name CORPUS_B:A.
>
>
> @Andrew:
>
>> This involves bits of the CQP code that I don't 100% understand, so Stefan may correct me, but I strongly suspect the answer is No.  The function in question is do_size (line 2895 of cqp/parse_actions.c) and it prints 0 if it is passed a null pointer. (Actually, it might be nicer for it to print something like UNDEF to make it clearer CQP did not find the data....)
>
> Yes, that's a bit odd -- probably a "bug fix" where the original behaviour was to crash. ;-)
>
> To CQP's credit, it _does_ print a big error message first:
>
>> DICKENS>  size FooBar;
>> CQP Error:
>> 	Corpus ``FooBar'' is undefined
>> 0
>
>> So it looks as if the pointer to the data structure of the query is not available when the corpus it belongs to is not activated. This makes sense; queries are lists of corpus positions, it would be odd to make those lists available when the active context is not one to which those integer lists can actually be applied.
>
> If you want to understand how query results are looked up, the interesting part is findcorpus() [l. 468ff] and LoadedCorpus() [l. 392ff] in cqp/corpmanag.c; note in particular the comment near the start of the latter function.
>
>
> Merry Christmas to everyone on the list!
> Stefan
>
> _______________________________________________
> CWB mailing list
> CWB at sslmit.unibo.it
> http://devel.sslmit.unibo.it/mailman/listinfo/cwb

-- 
Alberto Simões


More information about the CWB mailing list