[CWB] Structural Attributes

Maarten Janssen maartenpt at gmail.com
Tue Nov 18 14:21:55 CET 2014


Dear all,

Structural attributes are very sparsely documented, yet very useful when working with, say, individual texts with a year indication. Here are two things I cannot figure out whether they are possible with structural attributes:

(1) When using a (potentially) complex CQL it would be useful to be able to restrict that whole query to texts of a specific year, say

[word=".*ion"] []{3,5} [pos="V.*"] :: text_year="1900"

yet this does not work since structural attributes always seem to need an anchor - is there a way to specify something like this directly without anchoring one of the elements? (which would be the somewhat artificial a:[word=".*ion"] []{3,5} [pos="V.*"] :: a.text_year="1900")

(2) Is there any way to sort results on structural attributes? Nothing of the things I tries works, the most obvious being: 
	
	Matches = [word="in.*"];
	sort Matches by text_year;

Maarten

ps : an observation that might be useful for some: the int-cast only works if the structural attribute is a number in the XML - so

a:"in.*" :: int(a.text_year) > 1850 

only works for <text year=1900>, not for <text year="1900">

unfortunately, this makes it impossible to use approximate year indications, often encoded as <text year="[1900]">



More information about the CWB mailing list