R/utils.R

Defines functions .document_id

.document_id <-
function(a)
{
    ## Determine the first non-missing id of a document annotation in a,
    ## or the next available id if there if there is no such id.
    id <- a$id[a$type == "document"]
    if(length(id))
        id <- id[!is.na(id)]
    if(length(id))
        id[1L]
    else
        next_id(a$id)
}

Try the NLPutils package in your browser

Any scripts or data that you put into this service are public.

NLPutils documentation built on May 31, 2023, 8:54 p.m.