getMatchingAnnotations: Gets a list of annotations that match a particular pattern.

View source: R/getMatchingAnnotations.R

getMatchingAnnotationsR Documentation

Gets a list of annotations that match a particular pattern.

Description

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

Usage

getMatchingAnnotations(
  labbcat.url,
  expression,
  page.length = NULL,
  page.number = NULL
)

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')

page.length

The maximum number of IDs to return, or null to return all

page.number

The zero-based page number to return, or null to return the first page

Details

The results can be exhaustive, by omitting page.length and page.number, or they can be a subset (a 'page') of results, by given page.length and page.number values.

Value

A list of annotations.

See Also

countMatchingAnnotations

Examples

## Not run: 
## define the LaBB-CAT URL
labbcat.url <- "https://labbcat.canterbury.ac.nz/demo/"

## get all topic annotations whose label includes the word 'quake'
quake.topics <- getMatchingAnnotations(
                   labbcat.url, "layer.id == 'topic' && /.*quake.*/.test(label)")

## End(Not run)


nzilbb.labbcat documentation built on July 26, 2023, 6:08 p.m.