summary {koRpus}R Documentation

Summary methods for koRpus objects

Description

Summary method for S4 objects of classes kRp.lang, kRp.readability, kRp.text, or kRp.TTR.

Usage

summary(object, ...)

## S4 method for signature 'kRp.lang'
summary(object)

## S4 method for signature 'kRp.TTR'
summary(object, flat = FALSE)

## S4 method for signature 'kRp.readability'
summary(object, flat = FALSE)

## S4 method for signature 'kRp.text'
summary(object, index = NA, feature = NULL, flat = FALSE)

Arguments

object

An object of class, kRp.lang, kRp.readability, kRp.text, or kRp.TTR.

...

Further options, depending on the object class.

flat

Logical, if TRUE and feature="lex_div" or "readability", a named vector of main results is returned. For objects containig more than one doc_id, defaults to TRUE automatically and returns a data frame with named rows.

index

Either a vector indicating which rows should be considered as transformed for the statistics, or the name of a particular transformation that was previously done to the object, if more than one transformation was applied. If NA, all rows where "equal" is FALSE are used. Only valid for objects providing a diff feature.

feature

A character string naming a feature present in the object, to trigger a summary regarding that feature. Currently only "freq", "lex_div", and "readability" are implemented.

See Also

kRp.lang, kRp.readability, kRp.text, kRp.TTR

Examples

## Not run: 
summary(guess.lang("/home/user/data/some.txt", udhr.path="/home/user/data/udhr_txt/"))

## End(Not run)
# code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
  sample_file <- file.path(
    path.package("koRpus"), "examples", "corpus", "Reality_Winner.txt"
  )
  tokenized.obj <- tokenize(
    txt=sample_file,
    lang="en"
  )
  ld.results <- lex.div(tokenized.obj, char=c())
  summary(ld.results)
  summary(ld.results, flat=TRUE)
} else {}
# code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
  sample_file <- file.path(
    path.package("koRpus"), "examples", "corpus", "Reality_Winner.txt"
  )
  tokenized.obj <- tokenize(
    txt=sample_file,
    lang="en"
  )
  rdb.results <- readability(tokenized.obj, index="fast")
  summary(rdb.results)
  summary(rdb.results, flat=TRUE)
} else {}
# code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
  sample_file <- file.path(
    path.package("koRpus"), "examples", "corpus", "Reality_Winner.txt"
  )
  tokenized.obj <- tokenize(
    txt=sample_file,
    lang="en"
  )
  # this will look more useful when you
  # can use treetag() instead of tokenize()
  summary(tokenized.obj)
} else {}

[Package koRpus version 0.13-8 Index]