Learn R Programming

koRpus (version 0.11-5)

taggedText: Getter/setter methods for koRpus objects

Description

These methods should be used to get or set values of tagged text objects generated by koRpus functions like treetag() or tokenize().

Usage

taggedText(obj, add.desc = FALSE, doc_id = FALSE)

# S4 method for kRp.taggedText taggedText(obj, add.desc = FALSE, doc_id = FALSE)

taggedText(obj) <- value

# S4 method for kRp.taggedText taggedText(obj) <- value

# S4 method for kRp.taggedText [(x, i, j)

# S4 method for kRp.taggedText [(x, i, j) <- value

# S4 method for kRp.taggedText [[(x, i)

# S4 method for kRp.taggedText [[(x, i) <- value

# S4 method for kRp.taggedText describe(obj)

# S4 method for kRp.taggedText describe(obj) <- value

# S4 method for kRp.taggedText language(obj)

# S4 method for kRp.taggedText language(obj) <- value

is.taggedText(obj)

fixObject(obj, doc_id = NA)

# S4 method for kRp.taggedText fixObject(obj, doc_id = NA)

tif_as_tokens_df(tokens)

# S4 method for kRp.taggedText tif_as_tokens_df(tokens)

Arguments

obj

An arbitrary R object.

add.desc

Logical, determines whether the desc column should be re-written with descriptions for all POS tags.

doc_id

Logical (except for fixObject), if TRUE the doc_id column will be a factor with the respective value of the desc slot, i.\,e., the document ID will be preserved in the data.frame. If used with fixObject, can be a character string to set the document ID manually (the default NA will preserve existing values and not overwrite them).

value

The new value to replace the current with.

x

An object of class kRp.taggedText or kRp.hyphen.

i

Defines the row selector ([) or the name to match ([[).

j

Defines the column selector.

tokens

An object of class kRp.tagged.

Details

  • taggedText() returns the TT.res slot.

  • describe() returns the desc slot.

  • language() returns the lang slot.

  • [/[[ Can be used as a shortcut to index the results of taggedText().

  • fixObject returns the same object upgraded to the object structure of this package version (e.g., new columns, changed names, etc.).

  • tif_as_tokens_df returns the TT.res slot in a TIF[1] compliant format, i.e., doc_id is not a factor but a character vector.

References

[1] Text Interchange Formats (https://github.com/ropensci/tif)

Examples

Run this code
# NOT RUN {
taggedText(tagged.txt)
# }

Run the code above in your browser using DataLab