To generate fulltext output, different templates can be used with a behavior
that depends on the type of a corpus. get_type will return the type of
corpus if it is a specialized one, or NULL.
get_type(.Object)
# S4 method for class 'corpus'
get_type(.Object)
# S4 method for class 'character'
get_type(.Object)
# S4 method for class 'partition_bundle'
get_type(.Object)
# S4 method for class 'subcorpus_bundle'
get_type(.Object)When generating a partition, the corpus type will be prefixed to the class
that is generated (separated by underscore). If the corpus type is not
NULL, a class inheriting from the partition-class is instantiated. Note
that at this time, only plpr_partition and press_partition is
implemented.
use("polmineR")
#> ✔ corpus loaded: GERMAPARLMINI (version: 0.1.0 | build date: 2023-04-16)
use(pkg = "RcppCWB", corpus = "REUTERS")
#> ✔ corpus loaded: REUTERS
get_type("GERMAPARLMINI")
#> [1] "plpr"
p <- partition("GERMAPARLMINI", date = "2009-10-28")
#> ... get cpos and strucs
get_type(p)
#> [1] "plpr"
is(p)
#> [1] "plpr_partition" "partition" "count" "slice"
#> [5] "textstat" "corpus"
pb <- partition_bundle("GERMAPARLMINI", s_attribute = "date")
#> ℹ s-attribute "date" has values: yes
#> ℹ get regions and get values
#> ✔ get regions and get values [7ms]
#>
#> ℹ instantiate objects (n = 5)
#> ✔ instantiate objects (n = 5) [9ms]
#>
#> ℹ assign names
#> ✔ assign names [6ms]
#>
get_type(pb)
#> [1] "plpr"
get_type("REUTERS") # returns NULL - no specialized corpus
#> NULL