Class: FastText::Model
- Inherits:
-
Object
- Object
- FastText::Model
- Defined in:
- lib/fasttext/model.rb
Direct Known Subclasses
Instance Method Summary collapse
- #dimension ⇒ Object
-
#initialize(**options) ⇒ Model
constructor
A new instance of Model.
- #quantized? ⇒ Boolean
- #save_model(path) ⇒ Object
- #sentence_vector(text) ⇒ Object
- #subword_id(subword) ⇒ Object
- #subwords(word) ⇒ Object
- #word_id(word) ⇒ Object
- #word_vector(word) ⇒ Object
- #words(include_freq: false) ⇒ Object
Constructor Details
#initialize(**options) ⇒ Model
Returns a new instance of Model.
3 4 5 |
# File 'lib/fasttext/model.rb', line 3 def initialize(**) @options = end |
Instance Method Details
#dimension ⇒ Object
7 8 9 |
# File 'lib/fasttext/model.rb', line 7 def dimension m.dimension end |
#quantized? ⇒ Boolean
11 12 13 |
# File 'lib/fasttext/model.rb', line 11 def quantized? m.quantized? end |
#save_model(path) ⇒ Object
15 16 17 |
# File 'lib/fasttext/model.rb', line 15 def save_model(path) m.save_model(path) end |
#sentence_vector(text) ⇒ Object
32 33 34 |
# File 'lib/fasttext/model.rb', line 32 def sentence_vector(text) m.sentence_vector(prep_text(text)) end |
#subword_id(subword) ⇒ Object
40 41 42 |
# File 'lib/fasttext/model.rb', line 40 def subword_id(subword) m.subword_id(subword) end |
#subwords(word) ⇒ Object
44 45 46 |
# File 'lib/fasttext/model.rb', line 44 def subwords(word) m.subwords(word) end |
#word_id(word) ⇒ Object
36 37 38 |
# File 'lib/fasttext/model.rb', line 36 def word_id(word) m.word_id(word) end |
#word_vector(word) ⇒ Object
28 29 30 |
# File 'lib/fasttext/model.rb', line 28 def word_vector(word) m.word_vector(word) end |
#words(include_freq: false) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/fasttext/model.rb', line 19 def words(include_freq: false) words, freqs = m.words if include_freq words.zip(freqs).to_h else words end end |