Returns the number of annotations in the corpus that match the given expression.

countMatchingAnnotations(labbcat.url, expression)

Arguments

labbcat.url

URL to the LaBB-CAT instance

expression

An expression that determines which annotations match. This must match by either id or layer.id. The expression language is currently not well defined, but is based on JavaScript syntax. e.g.

  • id == 'ew_0_456'

  • ['ew_2_456', 'ew_2_789', 'ew_2_101112'].includes(id)

  • layerId == 'orthography' && !/th[aeiou].+/.test(label)

  • graph.id == 'AdaAicheson-01.trs' && layer.id == 'orthography' && start.offset > 10.5

  • layer.id == 'utterance' && all('word').includes('ew_0_456')

  • layerId = 'utterance' && labels('orthography').includes('foo')

  • layerId = 'utterance' && labels('participant').includes('Ada')

Value

The number of annotations that match the expression.

Examples

if (FALSE) {
## count the number of topic tags that include the word 'quake'
countMatchingAnnotations(labbcat.url, "layer.id == 'topic' && /.*quake.*/.test(label)")
}