Learn R Programming

NLP (version 0.3-0)

Tagged_Token: Tagged_Token objects

Description

Creation and manipulation of tagged token objects.

Usage

Tagged_Token(token, tag)
as.Tagged_Token(x)
is.Tagged_Token(x)

Value

For Tagged_Token() and as.Tagged_Token(), a tagged token object (of class "Tagged_Token").

For is.Tagged_Token(), a logical.

Arguments

token, tag

character vectors giving tokens and the corresponding tags.

x

an R object.

Details

A tagged token is a pair with “slots” ‘token’ and ‘tag’, giving the token and the corresponding tag.

Tagged token objects provide sequences (allowing positional access) of single tagged tokens. They have class "Tagged_Token".

Subscripting tagged token objects via [ extracts subsets of tagged tokens; subscripting via $ extracts character vectors with the sequence of values of the named slot.

There are several additional methods for class "Tagged_Token": print() and format() (which concatenate tokens and tags separated by /); c() combines tagged token objects (or objects coercible to these using as.Tagged_Token()), and as.list() and as.data.frame() coerce, respectively, to lists (of single tagged token objects) and data frames (with tagged tokens and slots corresponding to rows and columns).

Tagged_Token() creates tagged token objects from the given sequences of tokens and tags, which must have the same length.

as.Tagged_Token() coerces to tagged token objects, with a method for TextDocument objects using tagged_words().

is.Tagged_Token() tests whether an object inherits from class "Tagged_Token".