lib/moo_ebooks/model.rb
# Generates a response by looking for related sentences
# in the corpus and building a smaller generator from these
# @param input [String]
# @param limit [Integer] characters available for response
# @param sentences [Array<Array<Integer>>]
# @return [String]
Generates a response by looking for related sentences
in the corpus and building a smaller generator from these
Generates a response by looking for related sentences in the corpus and building a smaller generator from these
def reply(input, limit = 140, sentences = @mentions)
      relevant, slightly_relevant = find_relevant(sentences, input)
      if relevant.length >= 3
        generator = SuffixGenerator.build(relevant)
        update(limit, generator)
      elsif slightly_relevant.length >= 5
        generator = SuffixGenerator.build(slightly_relevant)
        update(limit, generator)
      else
        update(limit)
      end
    end
def reply ( input , limit = 140 , sentences = @mentions ) relevant , slightly_relevant = find_relevant ( sentences , input ) if relevant . length >= 3 generator = SuffixGenerator . build ( relevant ) update ( limit , generator ) elsif slightly_relevant . length >= 5 generator = SuffixGenerator . build ( slightly_relevant ) update ( limit , generator ) else update ( limit ) end end
Generates a response by looking for related sentences
in the corpus and building a smaller generator from these
Generates a response by looking for related sentences in the corpus and building a smaller generator from these
# Prefer mentions
None
String
input
limit
characters available for response
characters available for response
sentences
None