Module: Scrappy::Trainer
- Included in:
- Agent
- Defined in:
- lib/scrappy/learning/trainer.rb
Instance Method Summary collapse
-
#train(*samples) ⇒ Object
Generates visual patterns.
-
#train_xpath(*samples) ⇒ Object
Generate XPath fragments.
Instance Method Details
#train(*samples) ⇒ Object
Generates visual patterns
4 5 6 7 8 |
# File 'lib/scrappy/learning/trainer.rb', line 4 def train *samples RDF::Graph.new( samples.inject([]) do |triples, sample| triples + train_sample( sample ).triples end ) end |
#train_xpath(*samples) ⇒ Object
Generate XPath fragments
11 12 13 14 15 |
# File 'lib/scrappy/learning/trainer.rb', line 11 def train_xpath *samples RDF::Graph.new( samples.inject([]) do |triples, sample| triples + train_sample(sample, true).triples end ) end |