Class Raingrams::NgramSet
In: lib/raingrams/ngram_set.rb
Parent: Set
Model TrigramModel BigramModel QuadgramModel PentagramModel HexagramModel Model TrigramModel BigramModel QuadgramModel PentagramModel HexagramModel RuntimeError PrefixFrequencyMissing Set NgramSet Array Ngram Token StopSentence StartSentence Unknown ProbabilityTable Tokens Commonality Random Similarity Frequency Probability Helpers OpenModel OpenVocabulary Raingrams dot/f_1.png

Methods

Public Instance methods

[Source]

# File lib/raingrams/ngram_set.rb, line 30
    def ends_with(gram)
      select { |ngram| ngram.ends_with?(gram) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 34
    def including(gram)
      select { |ngram| ngram.include?(gram) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 42
    def including_all(*grams)
      select { |ngram| ngram.includes_all?(*grams) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 38
    def including_any(*grams)
      select { |ngram| ngram.includes_any?(*grams) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 22
    def postfixed_by(postfix)
      select { |ngram| ngram.postfixed_by?(postfix) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 18
    def prefixed_by(prefix)
      select { |ngram| ngram.prefixed_by?(prefix) }
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 8
    def select(&block)
      selected_ngrams = self.class.new

      each do |ngram|
        selected_ngrams << ngram if block.call(ngram)
      end

      return selected_ngrams
    end

[Source]

# File lib/raingrams/ngram_set.rb, line 26
    def starts_with(gram)
      select { |ngram| ngram.starts_with?(gram) }
    end

[Validate]