Class: Inferx::Category::Complementary

Inherits:
Inferx::Category show all
Defined in:
lib/inferx/category/complementary.rb

Instance Attribute Summary

Attributes inherited from Inferx::Category

#key, #name, #size

Instance Method Summary collapse

Methods inherited from Inferx::Category

#all, #get, #initialize, ready_for, #scores

Constructor Details

This class inherits a constructor from Inferx::Category

Instance Method Details

#ejectObject

Eject the words from the training data of the category.

Parameters:

  • words (Array<String>)

    an array of words



23
# File 'lib/inferx/category/complementary.rb', line 23

alias eject untrain

#injectObject

Inject the words to the training data of the category.

Parameters:

  • words (Array<String>)

    an array of words



10
# File 'lib/inferx/category/complementary.rb', line 10

alias inject train

#train(words) ⇒ Object

Enhance the training data of other categories giving words.

Parameters:

  • words (Array<String>)

    an array of words



36
37
38
# File 'lib/inferx/category/complementary.rb', line 36

def train(words)
  @categories.except(@name).inject(words)
end

#untrain(words) ⇒ Object

Attenuate the training data of other categories giving words.

Parameters:

  • words (Array<String>)

    an array of words



43
44
45
# File 'lib/inferx/category/complementary.rb', line 43

def untrain(words)
  @categories.except(@name).eject(words)
end