[CWB] Basic sort on structural attribute

Stefan Evert stefanML at collocations.de
Fri Oct 20 18:18:39 CEST 2017


> On 20 Oct 2017, at 17:04, Ruprecht von Waldenfels <ruprecht.waldenfels at gmx.net> wrote:
> 
> a basic question: how do I sort on a structural attribute?
> 
> Something like the following doesn't seem to work.
> 
> "in" sort by match.meta_year
> 
> with meta_year being a structural attribute ( i.e., an xml element enclosing a stretch of text).

Short answer: you can't.

Long answer: you can't because p-attributes and s-attributes use entirely different data structures and API functions. The code underlying "sort" and "count" commands only handles p-attributes; we don't plan to extend it to s-attributes because it's more than complicated enough already as it is. The code underlying "group" includes special branches for s-attributes because users often want to be able to do frequency counts for them.

Ziggurat is going to put and end to this divide between p-attributes and s-attributes, but it's still some way off …

Best,
Stefan

PS: If you really need to sort by an s-attribute, you can use a clever combination of "tabulate", Unix "sort" and "undump".  Let me know if you want a longer explanation of this approach. 



More information about the CWB mailing list