Skip to content

Commit

Permalink
Prepare for resubmission (v3)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgherard committed Feb 11, 2021
1 parent a370984 commit 3760408
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 19 deletions.
2 changes: 1 addition & 1 deletion R/perplexity.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#' # compute their perplexities on the training and test corpora.
#' # We use Shakespeare's "A Midsummer Night's Dream" as test.
#'
#' \dontrun{
#' \donttest{
#' train <- much_ado
#' test <- midsummer
#'
Expand Down
2 changes: 1 addition & 1 deletion R/sample_sentences.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' # Sample sentences from 8-gram Kneser-Ney model trained on Shakespeare's
#' # "Much Ado About Nothing"
#'
#' \dontrun{
#' \donttest{
#'
#' ### Prepare the model and set seed
#' freqs <- kgram_freqs(much_ado, 8, .tknz_sent = tknz_sent)
Expand Down
15 changes: 15 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## Resubmission (v3)

This resubmission addresses two issues pointed out in previous submission:

1. Unnecessary use of dontrun{} in examples.
2. Always make sure to reset to user's options().

My response:

1. There are four examples marked with `\dontrun{}`, in `?sample_sentences`, `?perplexity` and `?kgram_freqs`. The examples in `?sample_sentences` and `?perplexity` require >5s on some machines, thus I have replaced `\dontrun{}` with `\donttest{}`. The two examples marked with `\dontrun{}` in `kgram_freqs` require (i) a mock file which does not exist and (ii) internet connection. Following the CRAN guide to Writing R Extensions, I left the `\dontrun{}` directive for these examples:

«Thus, example code not included in \dontrun must be executable! In addition, it should not use any system-specific features or require special facilities (such as Internet access or write permission to specific directories).»

2. In the vignette (c.f. inst/doc/kgrams.R) I was setting plot margins with `par()` without resetting them to the original user's value. Fixed this.

## Resubmission (v2)

Changes from previous version:
Expand Down
10 changes: 6 additions & 4 deletions docs/articles/kgrams.html

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

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pkgdown: 1.6.1
pkgdown_sha: ~
articles:
kgrams: kgrams.html
last_built: 2021-02-07T21:32Z
last_built: 2021-02-11T11:06Z
urls:
reference: https://vgherard.github.io/kgrams//reference
article: https://vgherard.github.io/kgrams//articles
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/perplexity.html

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

14 changes: 9 additions & 5 deletions docs/reference/sample_sentences.html

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

2 changes: 1 addition & 1 deletion man/perplexity.Rd

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

2 changes: 1 addition & 1 deletion man/sample_sentences.Rd

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

7 changes: 4 additions & 3 deletions vignettes/kgrams.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,13 @@ FUN <- function(D, N) {
perplexity(midsummer, model = kn)
}
P_grid <- lapply(2:5, function(N) sapply(D_grid, FUN, N = N))
par(mar = c(2, 2, 1, 1))
oldpar <- par(mar = c(2, 2, 1, 1))
plot(D_grid, P_grid[[1]], type = "n", xlab = "D", ylab = "Perplexity", ylim = c(300, 500))
lines(D_grid, P_grid[[1]], col = "red")
lines(D_grid, P_grid[[2]], col = "chartreuse")
lines(D_grid, P_grid[[3]], col = "blue",)
lines(D_grid, P_grid[[4]], col = "black",)
lines(D_grid, P_grid[[3]], col = "blue")
lines(D_grid, P_grid[[4]], col = "black")
par(oldpar)
```

We see that the optimal choices for `D` are close to its maximum allowed value
Expand Down

0 comments on commit 3760408

Please sign in to comment.