Class: Quarry::Model
- Inherits:
-
Object
- Object
- Quarry::Model
- Defined in:
- lib/quarry_rb/model/model.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #add_text_example(text, category_name) ⇒ Object
-
#classifier=(c) ⇒ Object
def classifier @model.get_classifier end.
- #classify(example) ⇒ Object
- #classify_text(text) ⇒ Object
- #data_set ⇒ Object
- #data_set=(ds) ⇒ Object
-
#initialize(m = nil) ⇒ Model
constructor
A new instance of Model.
- #process_text(text, create_features = true) ⇒ Object
- #rank(example) ⇒ Object
- #rank_text(text) ⇒ Object
- #rank_text_names(text) ⇒ Object
- #text_pipeline ⇒ Object
- #text_pipeline=(t) ⇒ Object
- #train(example) ⇒ Object
- #train_text(text) ⇒ Object
Constructor Details
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/quarry_rb/model/model.rb', line 3 def model @model end |
Instance Method Details
#add_text_example(text, category_name) ⇒ Object
54 55 56 |
# File 'lib/quarry_rb/model/model.rb', line 54 def add_text_example(text, category_name) @model.add_text_example(text, category_name) end |
#classifier=(c) ⇒ Object
def classifier
@model.get_classifier
end
21 22 23 |
# File 'lib/quarry_rb/model/model.rb', line 21 def classifier=(c) @model.set_classifier(c.classifier) end |
#classify(example) ⇒ Object
42 43 44 |
# File 'lib/quarry_rb/model/model.rb', line 42 def classify(example) @model.classify(example) end |
#classify_text(text) ⇒ Object
46 47 48 |
# File 'lib/quarry_rb/model/model.rb', line 46 def classify_text(text) @model.classify_text(text) end |
#data_set ⇒ Object
8 9 10 |
# File 'lib/quarry_rb/model/model.rb', line 8 def data_set @data_set ||= Quarry::DataSet::DataSet.new(@model.get_data_set) end |
#data_set=(ds) ⇒ Object
12 13 14 15 |
# File 'lib/quarry_rb/model/model.rb', line 12 def data_set=(ds) @model.set_data_set(ds.data_set) @data_set = ds end |
#process_text(text, create_features = true) ⇒ Object
50 51 52 |
# File 'lib/quarry_rb/model/model.rb', line 50 def process_text(text, create_features = true) DataSet::Example.new(@model.process_text(text, create_features), data_set) end |
#rank(example) ⇒ Object
58 59 60 |
# File 'lib/quarry_rb/model/model.rb', line 58 def rank(example) @model.rank(example) end |
#rank_text(text) ⇒ Object
62 63 64 |
# File 'lib/quarry_rb/model/model.rb', line 62 def rank_text(text) @model.rank_text(text) end |
#rank_text_names(text) ⇒ Object
66 67 68 |
# File 'lib/quarry_rb/model/model.rb', line 66 def rank_text_names(text) @model.rank_text_names(text) end |
#text_pipeline ⇒ Object
25 26 27 |
# File 'lib/quarry_rb/model/model.rb', line 25 def text_pipeline @text_pipeline ||= TextPipeline.new(@model.get_text_pipeline) end |
#text_pipeline=(t) ⇒ Object
29 30 31 32 |
# File 'lib/quarry_rb/model/model.rb', line 29 def text_pipeline=(t) @model.set_text_pipeline(t.text_pipeline) @text_pipeline = t end |
#train(example) ⇒ Object
34 35 36 |
# File 'lib/quarry_rb/model/model.rb', line 34 def train(example) @model.train(example) end |
#train_text(text) ⇒ Object
38 39 40 |
# File 'lib/quarry_rb/model/model.rb', line 38 def train_text(text) @model.train_text(text) end |