Skip to content

Commit

Permalink
donttest in examples to reduce check time
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Blätte authored and Andreas Blätte committed Oct 28, 2023
1 parent 6d01cc5 commit 55c6ac9
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: polmineR
Type: Package
Title: Verbs and Nouns for Corpus Analysis
Version: 0.8.9
Date: 2023-10-27
Date: 2023-10-28
Authors@R: c(
person("Andreas", "Blaette", role = c("aut", "cre"), email = "andreas.blaette@uni-due.de", comment = c(ORCID = "0000-0001-8970-8010")),
person("Christoph", "Leonhardt", role = "ctb"),
Expand Down
6 changes: 5 additions & 1 deletion R/as.speeches.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ NULL
#' @rdname as.speeches
#' @importFrom cli cli_progress_step cli_progress_done
#' @examples
#' \dontrun{
#' use("polmineR")
#' speeches <- as.speeches(
#' "GERMAPARLMINI",
Expand All @@ -49,6 +50,7 @@ NULL
#' s_attribute_date = "date"
#' )
#' summary(speeches)
#' }
setGeneric("as.speeches", function(.Object, ...) standardGeneric("as.speeches"))

#' @exportMethod as.speeches
Expand Down Expand Up @@ -288,7 +290,8 @@ setMethod("as.speeches", "subcorpus", function(
#' a `partition` or `subcorpus`.
#' @rdname as.speeches
#' @examples
#' sp <- corpus("GERMAPARLMINI") %>%
#' \dontrun{
#' #' sp <- corpus("GERMAPARLMINI") %>%
#' as.speeches(s_attribute_name = "speaker", s_attribute_date = "date")
#'
#' sp <- corpus("GERMAPARLMINI") %>%
Expand All @@ -306,6 +309,7 @@ setMethod("as.speeches", "subcorpus", function(
#' subset = {date == "2009-11-10" & grepl("Merkel", speaker)},
#' progress = FALSE
#' )
#' }
#'
#' @importFrom RcppCWB s_attr_regions s_attr_is_sibling s_attr_is_descendent
setMethod("as.speeches", "corpus", function(
Expand Down
4 changes: 4 additions & 0 deletions R/partition_bundle.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@ NULL
#' @docType methods
#' @rdname partition_bundle-method
#' @examples
#' \dontrun{
#' use("polmineR")
#' bt2009 <- partition("GERMAPARLMINI", date = "2009-.*", regex = TRUE)
#' pb <- partition_bundle(bt2009, s_attribute = "date", progress = TRUE)
#' pb <- enrich(pb, p_attribute = "word")
#' dtm <- as.DocumentTermMatrix(pb, col = "count")
#' summary(pb)
#' pb <- partition_bundle("GERMAPARLMINI", s_attribute = "date")
#' }
#' @seealso \code{\link{partition}} and \code{\link{bundle}}
setGeneric("partition_bundle", function(.Object, ...) standardGeneric("partition_bundle"))

Expand Down Expand Up @@ -234,10 +236,12 @@ setMethod("as.partition_bundle", "list", function(.Object, ...){
#' @rdname partition_bundle-method
#' @importFrom cli cli_progress_step
#' @examples
#' \dontrun{
#' use("RcppCWB", corpus = "REUTERS")
#' pb <- corpus("REUTERS") %>%
#' context(query = "oil", p_attribute = "word") %>%
#' partition_bundle(node = FALSE, verbose = TRUE)
#' }
setMethod("partition_bundle", "context", function(.Object, node = TRUE, verbose = TRUE, progress = TRUE, mc = 1L){

stopifnot(
Expand Down
16 changes: 11 additions & 5 deletions R/phrases.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ setGeneric("as.phrases", function(.Object, ...) standardGeneric("as.phrases"))
#' @aliases phrases as.phrases
#' @export
#' @examples
#' \dontrun{
#' use(pkg = "RcppCWB", corpus = "REUTERS")
#'
#' # Derive phrases object from an ngrams object
Expand All @@ -26,6 +27,7 @@ setGeneric("as.phrases", function(.Object, ...) standardGeneric("as.phrases"))
#' as.phrases()
#'
#' phr <- as.character(reuters_phrases, p_attribute = "word")
#' }
setMethod("as.phrases", "ngrams", function(.Object){
# First, prepare data.table with token id representation of phrases to look up
li <- lapply(
Expand Down Expand Up @@ -82,6 +84,7 @@ setMethod("as.phrases", "ngrams", function(.Object){
#' @examples
#' # Derive phrases from explicitly stated CQP queries
#'
#' \dontrun{
#' cqp_phrase_queries <- c(
#' '"oil" "revenue";',
#' '"Sheikh" "Aziz";',
Expand All @@ -91,10 +94,11 @@ setMethod("as.phrases", "ngrams", function(.Object){
#' )
#' reuters_phrases <- cpos("REUTERS", cqp_phrase_queries, p_attribute = "word") %>%
#' as.phrases(corpus = "REUTERS", enc = "latin1")
#' }
#'
#' @details If \code{.Object} is a \code{matrix}, the \code{as.phrases}-method
#' will initialize a \code{phrases} object. The corpus and the encoding of the
#' corpus will be assigned to the object.
#' @details If `.Object` is a `matrix`, the `as.phrases()`-method will
#' initialize a `phrases` object. The corpus and the encoding of the corpus
#' will be assigned to the object.
setMethod("as.phrases", "matrix", function(.Object, corpus, enc = encoding(corpus)){
corpus_obj <- corpus(corpus)
new(
Expand Down Expand Up @@ -136,8 +140,9 @@ setMethod("as.character", "phrases", function(x, p_attribute){
#' from which regions / the \code{data.table} representing a decoded corpus is derived.
#' @examples
#' # Use the concatenate_phrases() function on a data.table
#'
#' lexical_units_cqp <- c(
#'
#' \dontrun{
#' #' lexical_units_cqp <- c(
#' '"Deutsche.*" "Bundestag.*";',
#' '"sozial.*" "Gerechtigkeit";',
#' '"Ausschuss" "f.r" "Arbeit" "und" "Soziales";',
Expand All @@ -154,6 +159,7 @@ setMethod("as.character", "phrases", function(x, p_attribute){
#'
#' dt[word == "Deutschen_Bundestag"]
#' dt[word == "soziale_Marktwirtschaft"]
#' }
#'
#' @export concatenate_phrases
#' @rdname phrases-class
Expand Down
2 changes: 2 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Fedora R-devel checks indicated an encoding issue in a plot. I have resolved
the underlying issue and checked all plots.

I have also cleaned up warnings from tidy for HTML and moved further examples
into 'donttest'-blocks to avoid long check times.

## Test environments

Expand Down
6 changes: 5 additions & 1 deletion man/as.speeches.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/partition_bundle-method.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions man/phrases-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55c6ac9

Please sign in to comment.