[CWB] Text-level restricted query error

Min Qu qumino2 at gmail.com
Wed Sep 3 05:13:23 CEST 2025


Dear Stephanie,

It works perfectly following your guide! You are truly educating the CWB
community, one query at a time, and our team has learned a great deal from
your detailed and insightful reply.


Best,
Min


On Wed, Sep 3, 2025 at 3:28 AM Stephanie Evert <stefanML at collocations.de>
wrote:

>
> > I am encountering an error when I run the query `[lemma="run" &
> text_author="Muir, John, 1838-1914"]` on our CQPweb.
>
> I assume that text_author is an s-attribute. In this case, you need a
> different syntax to access its annotation
>
>         [lemma="run" & _.text_author="Muir, John, 1838-1914"]
>
> The "this" label _ refers to the current token and allows you to access
> the values of s-attributes, which are only exposed through label
> references.  I often find it more readable to specify metadata filters as a
> global constraint, e.g.
>
>         [lemma="run"] :: match.text_author="Muir, John, 1838-1914"
>
> > Does anyone know why this error might be occurring?
>
> The error message is indeed a bit cryptic. The full explanation is that
> bare references to s-attributes are allowed, but always return an integer
> code that is 0 outside a region of the specified type, and nonzero inside.
> This allows you to find tokens e.g. inside a <head> element with
>
>         [lemma="run" & head]
>
> or even the lemma "run" at the start of a sentence:
>
>         [lemma="run" & lbound(head)]
>
> where the builtin lbound() function tests appropriate bits of the integer
> code.  Another use is to find any tokens in the corpus that are not wrapped
> in an <s> element (assuming this should not happen).
>
>         [!s]
>
> In your query, text_author returns such an integer code, which cannot be
> compared with a string value.
>
> Best,
> Stephanie [educating the CWB community, one query at a time]
> _______________________________________________
> CWB mailing list
> CWB at sslmit.unibo.it
> http://liste.sslmit.unibo.it/mailman/listinfo/cwb
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20250903/4bf2053b/attachment.html>


More information about the CWB mailing list