Tagged_Token objects

Share:

Description

Creation and manipulation of tagged token objects.

Usage

1
2
3

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".

Value

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

For is.Tagged_Token(), a logical.