Module Raingrams::Helpers::Commonality
In: lib/raingrams/helpers/commonality.rb
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

Included Modules

Raingrams::Helpers::Probability

Public Class methods

[Source]

# File lib/raingrams/helpers/commonality.rb, line 6
      def self.included(base)
        base.module_eval { include Raingrams::Helpers::Probability }
      end

Public Instance methods

Returns the ngrams which occur within the specified fragment and within the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 22
      def common_ngrams_from_fragment(fragment)
        ngrams_from_fragment(fragment).select { |ngram| has_ngram?(ngram) }
      end

Returns the ngrams which occur within the specified sentence and within the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 30
      def common_ngrams_from_sentence(sentence)
        ngrams_from_sentence(sentence).select { |ngram| has_ngram?(ngram) }
      end

Returns the ngrams which occur within the specified text and within the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 38
      def common_ngrams_from_text(text)
        ngrams_from_text(text).select { |ngram| has_ngram?(ngram) }
      end

Returns the ngrams which occur within the specified words and within the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 14
      def common_ngrams_from_words(words)
        ngrams_from_words(words).select { |ngram| has_ngram?(ngram) }
      end

Returns the joint probability of the common ngrams between the specified fragment and the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 46
      def fragment_commonality(fragment)
        probability_of_ngrams(common_ngrams_from_fragment(fragment))
      end

Returns the joint probability of the common ngrams between the specified sentence and the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 54
      def sentence_commonality(sentence)
        probability_of_ngrams(common_ngrams_from_sentence(sentence))
      end

Returns the joint probability of the common ngrams between the specified sentence and the model.

[Source]

# File lib/raingrams/helpers/commonality.rb, line 62
      def text_commonality(text)
        probability_of_ngrams(common_ngrams_from_text(text))
      end

[Validate]