Method: Ariel::Learner#generate_initial_candidates

Defined in:
lib/ariel/learner.rb

#generate_initial_candidatesObject

Using the seed example passed to it, generates a list of initial rule candidates for further refinement and evaluation. The Token prior to the labeled token is considered, and separate rules are generated that skip_to that token’s text or any of it’s matching wildcards.



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/ariel/learner.rb', line 68

def generate_initial_candidates
  if current_seed.label_index==0
    @candidates << Rule.new([], @direction, @exhaustive)
  else
    end_token=current_seed.tokens[current_seed.label_index-1]
    Log.debug "Creating initial candidates based on #{end_token.text}"
    @candidates<< Rule.new([[end_token.text]], @direction, @exhaustive)
    @candidates.concat(@candidates[0].generalise_feature(0))
    Log.debug "Initial candidates: #{@candidates.inspect} created"
  end
  return @candidates.size
end