lib/twitter_ebooks/model.rb
# Finds relevant and slightly relevant tokenized sentences to input
# comparing non-stopword token overlaps
# @param sentences [Array<Array<Integer>>]
# @param input [String]
# @return [Array<Array<Array<Integer>>, Array<Array<Integer>>>]
Finds relevant and slightly relevant tokenized sentences to input
comparing non-stopword token overlaps
Finds relevant and slightly relevant tokenized sentences to input comparing non - stopword token overlaps
def find_relevant(sentences, input)
      relevant = []
      slightly_relevant = []
      tokenized = NLP.tokenize(input).map(&:downcase)
      sentences.each do |sent|
        tokenized.each do |token|
          if sent.map { |tiki| @tokens[tiki].downcase }.include?(token)
            relevant << sent unless NLP.stopword?(token)
            slightly_relevant << sent
          end
        end
      end
      [relevant, slightly_relevant]
    end
def find_relevant ( sentences , input ) relevant = [ ] slightly_relevant = [ ] tokenized = NLP . tokenize ( input ) . map ( & :downcase ) sentences . each do | sent | tokenized . each do | token | if sent . map { | tiki | @tokens [ tiki ] . downcase } . include? ( token ) relevant << sent unless NLP . stopword? ( token ) slightly_relevant << sent end end end [ relevant , slightly_relevant ] end
Finds relevant and slightly relevant tokenized sentences to input
comparing non-stopword token overlaps
Finds relevant and slightly relevant tokenized sentences to input comparing non - stopword token overlaps
None
Array<Array<Array<Integer>>, Array<Array<Integer>>>
sentences
input
None