Sha256: afb190b934ac9202a81e7956027b55efa7f5fa7c9f4a91638de6ed340919959f
Contents?: true
Size: 868 Bytes
Versions: 8
Compression:
Stored size: 868 Bytes
Contents
# ext require "fasttext/ext" # stdlib require "tempfile" # modules require "fasttext/model" require "fasttext/classifier" require "fasttext/vectorizer" require "fasttext/version" module FastText class Error < StandardError; end class << self 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 def train_supervised(**options) input = options.delete(:input) model = FastText::Classifier.new(**options) model.fit(input) model end def train_unsupervised(**options) input = options.delete(:input) model = FastText::Vectorizer.new(**options) model.fit(input) model end end end
Version data entries
8 entries across 8 versions & 1 rubygems