plu_ral()
now accepts vectors for argumentsn
andpl
.- e.g.
plu_ral(c("word", "phrase"), n = c(1, 2))
returnsc("word", "phrases")
.
- e.g.
- Fixed an error where the plural forms of "octopus" and "platypus" were mixed up.
- The
plu_ral()
argumentn_fn
is now deprecated. plu_stick()
is now defunct.
- Added staticexport of
plu_ralize()
.- This allows you to include
plu_ralize()
in your package without depending onplu
, using thestaticimports
package.
- This allows you to include
- Update Roxygen version to avoid CRAN NOTE.
- Modest speed improvements to
plu_ralize()
.- This propagates to
plu_ral()
andplu_more()
, which useplu_ralize()
internally.
- This propagates to
- Deprecated
plu_stick()
in favor ofknitr::combine_words()
orglue::glue_collapse()
.
plu_ral()
now supports arbitrary delimiters for special sequences.plu_ral("attorney [general]", open = "[", close = "]")
produces "attorneys general".
plu_ral()
now supports {braced|pipe} sequences of indefinite length.plu_ral("{one|two|three|more}", n = 3)
produces "three".plu_ral("{one|two|three|more}", n = 50)
produces "more".- The delimiters of these sequences can be changed with
open
andclose
.
- Modest speed improvements to
plu_ralize()
.- This propagates to
plu_ral()
andplu_more()
, which useplu_ralize()
internally.
- This propagates to
plu_ral()
now correctly handles {braced} strings that contain sentence breaks.- Previously, sentence breaks would break the {braced} string and apply normal pluralization to its contents.
plu_ral()
now correctly handles {braced|pipe} sequences whenpl
is set toFALSE
.plu_ral("{singular|plural}", pl = FALSE)
now returns"singular"
instead of incorrectly returning"plural"
.
plu_ralize()
now correctly handles ALL-CAPS words where their lowercase equivalent has an irregular plural.plu_ralize("CHILD")
now returns"CHILDs"
instead of incorrectly returning"Children"
.
is_capital(strict = TRUE)
now correctly handles non-character inputs.is_capital(1, strict = TRUE)
no returnsFALSE
instead of incorrectly returningNA
.
- Error messages now use
crayon
if it is installed. - Deprecated arguments to
plu::stick()
now produce errors. - Removed dependencies on
rlang
andstringi
. - Gained dependency on
backports
.
-
plu::more()
limits a vector to the firstn
elements with a message for remaining elements.- This can be useful for providing messages to users without an overwhelming amount of detail.
plu::more(letters, max = 2)
yieldsc("a", "b", "24 more characters")
.
-
The convenience function
get_fun()
finds a function using a character string or unquoted function name, with or without colons. -
plu::ral()
now ensures that the capitalization of a phrase stays the same after pluralizing.plu::ral("A sentence.")
now results in "Sentences." rather than "sentences."
-
Convenience functions around capitalization have been added:
is_capital()
tests if a character (or string of characters) is capital or lowercase.is_capitalized()
tests if the first alphabetic character in a string is capital.capitalize()
converts the first alphabetic character in a string to capital.- Unlike
tools::toTitleCase()
orstringr::str_to_sentence()
, this does not change the capitalization of any subsequent characters.
- Unlike
plu::stick()
'soxford
now defaults toFALSE
rather than depending on the user's environment.
plu::stick()
'ssyndeton
is now deprecated in favor of explicitly settingsep
andconj
.plu::stick()
'sfn
and...
are now deprecated in favor of applying a function tox
before passing it intoplu::stick()
.
- Added a
pkgdown
site. - Added an ORCID to
DESCRIPTION
.
- Allow braces to be used within words.
- "cact{us|i}" -> "cactus", "cacti"
- "antenna{|e}" -> "antenna", "antennae"
- Remove cross-reference to glue to avoid CRAN NOTE.
- Add AGID copyright information to package documentation (
?plu
). - Minor speed improvements to regular pluralization rules.
- Bug fixes when calling
plu::ral()
from inside other functions.
- Initial release.