Sha256: 6ba1f872db09dc4752825709fa9522a384192c6a7b4f98739a625692aa400f91
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
require 'marky_markov' require 'oj' module MarkyMarkov class PersistentJSONDictionary < ::PersistentDictionary def initialize(*args) super(*args) @dictionary = {} @capitalized_words = [] end # No-op instead of reading from the filesystem def open_dictionary nil end def load_json(json) data = Oj.load json @depth = data['depth'] @dictionary = data['dictionary'] @capitalized_words = data['capitalized_words'] end def to_json Oj.dump( 'depth' => @depth, 'dictionary' => @dictionary, 'capitalized_words' => @capitalized_words ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-markov-0.0.1 | lib/marky_markov/persistent_json_dictionary.rb |