Skip to content

Commit f22688b

Browse files
committed
improve tidy documentation
1 parent 3c105ad commit f22688b

25 files changed

+200
-70
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ Config/testthat/edition: 3
6262
Encoding: UTF-8
6363
LazyData: true
6464
Roxygen: list(markdown = TRUE)
65-
RoxygenNote: 7.2.3
65+
RoxygenNote: 7.3.1
6666
SystemRequirements: "GNU make"

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# textrecipes (development version)
22

3+
* Documentation for tidy methods for all steps has been improved to describe the return value more accurately. (#262)
4+
35
# textrecipes 1.0.6
46

57
* textfeatures has been removed from Suggests. (#255)

R/clean_levels.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@
2424
#'
2525
#' # Tidying
2626
#'
27-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
28-
#' (the selectors or variables selected), `original` (the original levels) and
29-
#' `value` (the cleaned levels) is returned.
27+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
28+
#' columns `terms`, `orginal`, `value`, and `id`:
29+
#'
30+
#' \describe{
31+
#' \item{terms}{character, the selectors or variables selected}
32+
#' \item{original}{character, the original levels}
33+
#' \item{value}{character, the cleaned levels}
34+
#' \item{id}{character, id of this step}
35+
#' }
3036
#'
3137
#' @template case-weights-not-supported
3238
#'

R/clean_names.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@
1919
#'
2020
#' # Tidying
2121
#'
22-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
23-
#' (the new clean variable names) and `value` (the original variable names).
24-
#'
22+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
23+
#' columns `terms`, `value`, and `id`:
24+
#'
25+
#' \describe{
26+
#' \item{terms}{character, the new clean variable names}
27+
#' \item{value}{character, the original variable names}
28+
#' \item{id}{character, id of this step}
29+
#' }
30+
#'
2531
#' @template case-weights-not-supported
2632
#'
2733
#' @seealso [step_clean_levels()], [recipes::step_factor2string()],

R/dummy_hash.R

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@
4343
#' @details
4444
#'
4545
#' # Tidying
46-
#'
47-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
48-
#' (the selectors or variables selected), `value` (whether a signed hashing was
49-
#' performed), `num_terms` (number of terms), and `collapse` (where columns
50-
#' collapsed).
46+
#'
47+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
48+
#' columns `terms`, `value`, `num_terms`, `collapse`, and `id`:
49+
#'
50+
#' \describe{
51+
#' \item{terms}{character, the selectors or variables selected}
52+
#' \item{value}{logical, whether a signed hashing was performed}
53+
#' \item{num_terms}{integer, number of terms}
54+
#' \item{collapse}{logical, were the columns collapsed}
55+
#' \item{id}{character, id of this step}
56+
#' }
5157
#'
5258
#' ```{r, echo = FALSE, results="asis"}
5359
#' step <- "step_dummy_hash"

R/lda.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@
2121
#'
2222
#' # Tidying
2323
#'
24-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
25-
#' (the selectors or variables selected) and `num_topics` (number of topics).
26-
#'
24+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
25+
#' columns `terms`, `num_topics`, and `id`:
26+
#'
27+
#' \describe{
28+
#' \item{terms}{character, the selectors or variables selected}
29+
#' \item{num_topics}{integer, number of topics}
30+
#' \item{id}{character, id of this step}
31+
#' }
32+
#'
2733
#' @template case-weights-not-supported
2834
#'
2935
#' @source \url{https://arxiv.org/abs/1301.3781}

R/lemma.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
#'
2424
#' # Tidying
2525
#'
26-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
27-
#' (the selectors or variables selected).
26+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
27+
#' columns `terms` and `id`:
28+
#'
29+
#' \describe{
30+
#' \item{terms}{character, the selectors or variables selected}
31+
#' \item{id}{character, id of this step}
32+
#' }
2833
#'
2934
#' @template case-weights-not-supported
3035
#'

R/ngram.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@
2929
#' the 2-grams followed by all the 3-grams.
3030
#'
3131
#' # Tidying
32-
#'
33-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
34-
#' (the selectors or variables selected).
32+
#'
33+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
34+
#' columns `terms` and `id`:
35+
#'
36+
#' \describe{
37+
#' \item{terms}{character, the selectors or variables selected}
38+
#' \item{id}{character, id of this step}
39+
#' }
3540
#'
3641
#' ```{r, echo = FALSE, results="asis"}
3742
#' step <- "step_ngram"

R/pos_filter.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@
2525
#'
2626
#' # Tidying
2727
#'
28-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
29-
#' (the selectors or variables selected) and `num_topics` (number of topics).
28+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
29+
#' columns `terms` and `id`:
30+
#'
31+
#' \describe{
32+
#' \item{terms}{character, the selectors or variables selected}
33+
#' \item{id}{character, id of this step}
34+
#' }
3035
#'
3136
#' @template case-weights-not-supported
3237
#'

R/sequence_onehot.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@
3737
#' accordingly. Characters not in the vocabulary will be encoded as 0.
3838
#'
3939
#' # Tidying
40-
#'
41-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
42-
#' (the selectors or variables selected), `vocabulary` (index) and `token` (text
43-
#' correspoding to the index).
40+
#'
41+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
42+
#' columns `terms`, `vocabulary`, `token`, and `id`:
43+
#'
44+
#' \describe{
45+
#' \item{terms}{character, the selectors or variables selected}
46+
#' \item{vocabulary}{integer, index}
47+
#' \item{token}{character, text corresponding to the index}
48+
#' \item{id}{character, id of this step}
49+
#' }
4450
#'
4551
#' @template case-weights-not-supported
4652
#'

R/stem.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
#' therefore not work reliably on ngrams or sentences.
2828
#'
2929
#' # Tidying
30-
#'
31-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
32-
#' (the selectors or variables selected) and `is_custom_stemmer` (indicate if
33-
#' custom stemmer was used).
30+
#'
31+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
32+
#' columns `terms`, `is_custom_stemmer`, and `id`:
33+
#'
34+
#' \describe{
35+
#' \item{terms}{character, the selectors or variables selected}
36+
#' \item{is_custom_stemmer}{logical, indicate if custom stemmer was used}
37+
#' \item{id}{character, id of this step}
38+
#' }
3439
#'
3540
#' @template case-weights-not-supported
3641
#'

R/stopwords.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@
3333
#' these two arguments.
3434
#'
3535
#' # Tidying
36-
#'
37-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
38-
#' (the selectors or variables selected), `value` (name of stop word list), and
39-
#' `keep` (whether stop words are removed or kept).
36+
#'
37+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
38+
#' columns `terms`, `value`, `keep`, and `id`:
39+
#'
40+
#' \describe{
41+
#' \item{terms}{character, the selectors or variables selected}
42+
#' \item{value}{character, name of stop word list}
43+
#' \item{keep}{logical, whether stop words are removed or kept}
44+
#' \item{id}{character, id of this step}
45+
#' }
4046
#'
4147
#' @template case-weights-not-supported
4248
#'

R/text_normalization.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@
2121
#'
2222
#' # Tidying
2323
#'
24-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
25-
#' (the selectors or variables selected) and `normalization_form` (type of
26-
#' normalization).
24+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
25+
#' columns `terms`, `normalization_form`, and `id`:
26+
#'
27+
#' \describe{
28+
#' \item{terms}{character, the selectors or variables selected}
29+
#' \item{normalization_form}{character, type of normalization}
30+
#' \item{id}{character, id of this step}
31+
#' }
2732
#'
2833
#' @template case-weights-not-supported
2934
#'

R/textfeature.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@
2828
#' will be thrown.
2929
#'
3030
#' # Tidying
31-
#'
32-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
33-
#' (the selectors or variables selected) and `functions` (name of feature
34-
#' functions).
31+
#'
32+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
33+
#' columns `terms`, `functions`, and `id`:
34+
#'
35+
#' \describe{
36+
#' \item{terms}{character, the selectors or variables selected}
37+
#' \item{functions}{character, name of feature functions}
38+
#' \item{id}{character, id of this step}
39+
#' }
3540
#'
3641
#' @template case-weights-not-supported
3742
#'

R/texthash.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,16 @@
3737
#'
3838
#' @details # Tidying
3939
#'
40-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
41-
#' (the selectors or variables selected) and `value` (number of terms).
42-
#'
40+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
41+
#' columns `terms`, value and `id`:
42+
#'
43+
#' \describe{
44+
#' \item{terms}{character, the selectors or variables selected}
45+
#' \item{value}{logical, is it signed?}
46+
#' \item{length}{integer, number of terms}
47+
#' \item{id}{character, id of this step}
48+
#' }
49+
#'
4350
#' ```{r, echo = FALSE, results="asis"}
4451
#' step <- "step_texthash"
4552
#' result <- knitr::knit_child("man/rmd/tunable-args.Rmd")

R/tf.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@
5454
#'
5555
#' # Tidying
5656
#'
57-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
58-
#' (the selectors or variables selected) and `value` (the weighting scheme).
57+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
58+
#' columns `terms`, `value`, and `id`:
59+
#'
60+
#' \describe{
61+
#' \item{terms}{character, the selectors or variables selected}
62+
#' \item{value}{character, the weighting scheme}
63+
#' \item{id}{character, id of this step}
64+
#' }
5965
#'
6066
#' ```{r, echo = FALSE, results="asis"}
6167
#' step <- "step_tf"

R/tfidf.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@
5151
#'
5252
#' # Tidying
5353
#'
54-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
55-
#' (the selectors or variables selected), `token` (name of the tokens),
56-
#' `weight` (the calculated IDF weight) is returned.
54+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
55+
#' columns `terms`, `token`, `weight`, and `id`:
56+
#'
57+
#' \describe{
58+
#' \item{terms}{character, the selectors or variables selected}
59+
#' \item{token}{character, name of token}
60+
#' \item{weight}{numeric, the calculated IDF weight}
61+
#' \item{id}{character, id of this step}
62+
#' }
5763
#'
5864
#' @template details-prefix
5965
#'

R/tokenfilter.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,16 @@
4343
#' limit the number of variables created.
4444
#'
4545
#' # Tidying
46-
#'
47-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
48-
#' (the selectors or variables selected) and `value` (number of unique tokens).
49-
#'
46+
#'
47+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
48+
#' columns `terms`, `value`, and `id`:
49+
#'
50+
#' \describe{
51+
#' \item{terms}{character, the selectors or variables selected}
52+
#' \item{value}{integer, number of unique tokens}
53+
#' \item{id}{character, id of this step}
54+
#' }
55+
#'
5056
#' ```{r, echo = FALSE, results="asis"}
5157
#' step <- "step_tokenfilter"
5258
#' result <- knitr::knit_child("man/rmd/tunable-args.Rmd")

R/tokenize.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,14 @@
182182
#'
183183
#' # Tidying
184184
#'
185-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
186-
#' (the selectors or variables selected) and `value` (unit of tokenization).
185+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
186+
#' columns `terms`, `value`, and `id`:
187+
#'
188+
#' \describe{
189+
#' \item{terms}{character, the selectors or variables selected}
190+
#' \item{value}{character, unit of tokenization}
191+
#' \item{id}{character, id of this step}
192+
#' }
187193
#'
188194
#' ```{r, echo = FALSE, results="asis"}
189195
#' step <- "step_tokenize"

R/tokenize_bpe.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
#'
2424
#' # Tidying
2525
#'
26-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
27-
#' (the selectors or variables selected).
26+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
27+
#' columns `terms` and `id`:
28+
#'
29+
#' \describe{
30+
#' \item{terms}{character, the selectors or variables selected}
31+
#' \item{id}{character, id of this step}
32+
#' }
2833
#'
2934
#' ```{r, echo = FALSE, results="asis"}
3035
#' step <- "step_tokenize_bpe"

R/tokenize_sentencepiece.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@
2828
#'
2929
#' # Tidying
3030
#'
31-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
32-
#' (the selectors or variables selected).
31+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
32+
#' columns `terms` and `id`:
33+
#'
34+
#' \describe{
35+
#' \item{terms}{character, the selectors or variables selected}
36+
#' \item{id}{character, id of this step}
37+
#' }
3338
#'
3439
#' @template case-weights-not-supported
3540
#'

R/tokenize_wordpiece.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
#'
2323
#' # Tidying
2424
#'
25-
#' When you [`tidy()`][tidy.recipe()] this step, a tibble with columns `terms`
26-
#' (the selectors or variables selected).
25+
#' When you [`tidy()`][tidy.recipe()] this step, a tibble is retruned with
26+
#' columns `terms` and `id`:
27+
#'
28+
#' \describe{
29+
#' \item{terms}{character, the selectors or variables selected}
30+
#' \item{id}{character, id of this step}
31+
#' }
2732
#'
2833
#' @template case-weights-not-supported
2934
#'

0 commit comments

Comments
 (0)