[CWB] Find number of texts

Stefan Evert stefanML at collocations.de
Thu Oct 18 16:31:57 CEST 2018



> On 18 Oct 2018, at 15:18, Meier-Vieracker, Simon <simon.meier at tu-berlin.de> wrote:
> 
> in CQPweb, for every query result the number of texts, in which the pattern was found, is displayed, e.g.
> 
>> "Your query “*gerücht*” returned 163 matches in 148 different texts
> 
> How can I do this in CWB?

Assuming you have properly indexed the corpus for CQPweb (with unique <text_id>) and are using Linux or Mac, you can use a command-line trick:

	A = ".*gerücht.*" %c;
	size A; # number of hits

	set PrettyPrint off; # essential, otherwise you get count + 1
	group A match text_id > "| wc -l"; # number of distinct text IDs

A faster solution that should work everywhere:

	B = A expand to s;
	size B; # number of texts

Best,
Stefan



More information about the CWB mailing list