class Greeting < Calyx::Grammar
filter :shoutycaps do |input|
input.upcase
end
start '{hello.shoutycaps} there.', 'Why, {hello} there.'
hello 'hello'
end
p Greeting.new.generate
#/Users/tariq.ali/.rvm/gems/ruby-2.1.1/gems/calyx-0.11.2/lib/calyx/registry.rb:32:
#in `mapping': wrong number of arguments (1 for 2) (ArgumentError)
# from /Users/tariq.ali/.rvm/gems/ruby-2.1.1/gems/calyx-0.11.2/lib/calyx
# /grammar.rb:52:in `filter'
# from grammar.rb:4:in `<class:Greeting>'
# from grammar.rb:3:in `<main>'
The code, however, works fine when you use the block syntax though...
greeting = Calyx::Grammar.new do
filter :shoutycaps do |input|
input.upcase
end
start '{hello.upcase} there.', 'Why, {hello} there.'
hello 'hello'
end
p greeting.generate
#"Why, hello there."
#"HELLO there."
I was attempting to see whether filters could be used as a good way to simulate "tagging" as implemented in Improv, a JavaScript library inspired by Tracery but uses "models" to help guide text-generation. I may explore this bug in the future and see if I can submit a PR later on. This is just me submitting it so that I remember this problem exists.
The code, however, works fine when you use the block syntax though...
I was attempting to see whether filters could be used as a good way to simulate "tagging" as implemented in Improv, a JavaScript library inspired by Tracery but uses "models" to help guide text-generation. I may explore this bug in the future and see if I can submit a PR later on. This is just me submitting it so that I remember this problem exists.