Module ROT.StringGenerator
Random String Generator.
Learns from provided strings, and generates similar strings.
Functions
init (options) | Constructor. |
clear () | Remove all learned data |
generate () | Generate a string |
observe (s) | Observe Learn from a string |
getStats () | get Stats Get info about learned strings |
Functions
- init (options)
-
Constructor.
Called with ROT.StringGenerator:new()
Parameters:
- options A table with the following fields:
- words boolean Use word mode (default false)
- order int Number of letters/words to be used as context (default 3)
- prior number A default priority for characters/words (default 0.001)
- options A table with the following fields:
- clear ()
- Remove all learned data
- generate ()
-
Generate a string
Returns:
-
string
The generated string
- observe (s)
-
Observe
Learn from a string
Parameters:
- s string The string to observe
- getStats ()
-
get Stats
Get info about learned strings
Returns:
-
string
Number of observed strings, number of contexts, number of possible characters/words