Browse files

Allow word choosing strategy to be injected into the transformer

  • Loading branch information...
1 parent f1748e9 commit 3a203804f2b08d37c0a6505b60a854add6e871dc @georgehemmings committed May 23, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/trigram/transformer.rb
View
4 lib/trigram/transformer.rb
@@ -4,11 +4,11 @@
module Trigram
class Transformer
- def initialize(input)
+ def initialize(input, word_chooser = Proc.new { |words| words.sample })
@input = input
analysis = Analyser.analyse(input)
table = Table.new(analysis)
- @generator = Generator.new(table)
+ @generator = Generator.new(table, word_chooser)
end
def generate_new_text

0 comments on commit 3a20380

Please sign in to comment.