module SpintaxParser
Overview
A mixin to parse "spintax", a text format used for automated article generation. Can handle nested spintax, and can count the total number of unique variations.
class String
include SpintaxParser
end
Defined in:
spintax_parser.crspintax_parser/version.cr
Constant Summary
-
SPINTAX_PATTERN =
/\{([^{}]*)\}/
-
VERSION =
"0.1.0"
Instance Method Summary
-
#count_spintax_variations
Returns count of variations for spintax.
-
#unspin(random = Random::DEFAULT)
Returns the unspun version of some spintext.
Instance Method Detail
def count_spintax_variations
#
Returns count of variations for spintax.
"{Fred|George} is {blue|red}.".count_spintax_variations
> 4
Returns the unspun version of some spintext.
"{Fred|George} is {blue|red}.".unspin
> "Fred is red."