summary-methods: Summary methods for koRpus objects

Description Usage Arguments See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## 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 {}

unDocUMeantIt/koRpus documentation built on May 21, 2021, 9:26 p.m.