Class Raingrams::Tokens::Token
In: lib/raingrams/tokens/token.rb
Parent: Object
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

*   ==   eql?   inspect   new   to_gram   to_s   to_sym  

Attributes

gram  [R]  Gram form of the token

Public Class methods

Creates a new Token object with the specified gram.

[Source]

# File lib/raingrams/tokens/token.rb, line 11
      def initialize(gram)
        @gram = gram
      end

Public Instance methods

Creates an Array of the specified length containing the token.

[Source]

# File lib/raingrams/tokens/token.rb, line 22
      def *(length)
        [self] * length
      end
==(other)

Alias for eql?

Returns true if the token has the same gram as the other token, returns false otherwise.

[Source]

# File lib/raingrams/tokens/token.rb, line 30
      def eql?(other)
        if other.kind_of?(Token)
          return (@gram == other.gram)
        end

        return false
      end

Returns the String form of the token.

[Source]

# File lib/raingrams/tokens/token.rb, line 57
      def inspect
        @gram.to_s
      end

[Source]

# File lib/raingrams/tokens/token.rb, line 15
      def to_gram
        self
      end

Returns the String form of the token.

[Source]

# File lib/raingrams/tokens/token.rb, line 43
      def to_s
        @gram.to_s
      end

Returns the Symbol form of the token.

[Source]

# File lib/raingrams/tokens/token.rb, line 50
      def to_sym
        @gram.to_sym
      end

[Validate]