Create a sentence style identifier. This uses the approach described by Asana on their blog https://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/. This approach encodes 32 bits of information (so 2^32 ~= 4 billion possibilities) and in theory can be remapped to an integer if you really wanted to.

sentence(
  n = 1,
  style = "snake",
  past = FALSE,
  global = TRUE,
  use_openssl = NULL
)

Arguments

n

number of ids to return. If NULL, it instead returns the generating function

style

Style to join words with. Can be one of "Pascal", "camel", "snake", "kebab", "dot", "title", "sentence", "lower", "upper", "constant" or "spongemock"

past

Use the past tense for verbs (e.g., slurped or jogged rather than slurping or jogging)

global

Use global random number generator that responds to set.seed (see random_id for details, but note that the default here is different).

use_openssl

Use openssl for random number generation when using a non-global generator (see random_id for details)

Author

Rich FitzJohn

Examples

# Generate an identifier
ids::sentence()
#> [1] "26_gaudy_flamingos_ambling_effortlessly"

# Generate a bunch
ids::sentence(10)
#>  [1] "30_puzzled_phoenixes_racing_clumsily"        
#>  [2] "24_exotic_snakes_hurrying_vainly"            
#>  [3] "12_remarkable_reindeers_sailing_gladly"      
#>  [4] "15_gorgeous_elves_chewing_urgently"          
#>  [5] "19_astonishing_donkeys_creeping_purposefully"
#>  [6] "28_goofy_skunks_slurping_madly"              
#>  [7] "20_happy_woodchucks_scampering_urgently"     
#>  [8] "2_incredible_phoenixes_squirming_foolishly"  
#>  [9] "22_daffy_gnomes_hurrying_gladly"             
#> [10] "22_psychotic_newts_munching_curiously"       

# As with adjective_animal, use "style" to control punctuation
ids::sentence(style = "Camel")
#> [1] "24ThunderingLizardsWanderingFervently"
ids::sentence(style = "dot")
#> [1] "20.delightful.armadillos.jumping.drudgingly"
ids::sentence(style = "Title")
#> [1] "15 Adventurous Gnus Hobbling Colorfully"

# Change the tense of the verb:
set.seed(1)
ids::sentence()
#> [1] "26_gaudy_flamingos_ambling_effortlessly"
set.seed(1)
ids::sentence(past = TRUE)
#> [1] "26_gaudy_flamingos_ambled_effortlessly"

# Pass n = NULL to bind arguments to a function
id <- ids::sentence(NULL, past = TRUE, style = "dot")
id()
#> [1] "30.jazzy.giraffes.flopped.owlishly"
id(10)
#>  [1] "28.goofy.skunks.slurped.madly"            
#>  [2] "20.happy.woodchucks.scampered.urgently"   
#>  [3] "2.incredible.phoenixes.squirmed.foolishly"
#>  [4] "22.daffy.gnomes.hurried.gladly"           
#>  [5] "22.psychotic.newts.munched.curiously"     
#>  [6] "11.joyous.dogs.hurried.unabashedly"       
#>  [7] "23.remarkable.oxes.wandered.unaccountably"
#>  [8] "15.obnoxious.dragons.sprinted.madly"      
#>  [9] "11.daffy.lizards.wade.vainly"             
#> [10] "8.cuddly.moles.juggled.fervently"