Module: FastText
- Defined in:
- lib/fasttext.rb,
lib/fasttext/model.rb,
lib/fasttext/version.rb,
lib/fasttext/classifier.rb,
lib/fasttext/vectorizer.rb
Defined Under Namespace
Classes: Classifier, Error, Model, Vectorizer
Constant Summary
collapse
- VERSION =
"0.4.0"
Class Method Summary
collapse
Class Method Details
.load_model(path) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/fasttext.rb', line 17
def load_model(path)
m = Ext::Model.new
m.load_model(path)
model =
if m.supervised?
FastText::Classifier.new
else
FastText::Vectorizer.new
end
model.instance_variable_set("@m", m)
model
end
|
.train_supervised(**options) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/fasttext.rb', line 30
def train_supervised(**options)
input = options.delete(:input)
model = FastText::Classifier.new(**options)
model.fit(input)
model
end
|
.train_unsupervised(**options) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/fasttext.rb', line 37
def train_unsupervised(**options)
input = options.delete(:input)
model = FastText::Vectorizer.new(**options)
model.fit(input)
model
end
|