Class: MedAttrib

Inherits:
Object
  • Object
show all
Defined in:
lib/medattrib.rb

Instance Method Summary collapse

Instance Method Details

#parse(text) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/medattrib.rb', line 57

def parse (text)

#    text = REXML::Text.new(text, true, nil, false).to_s # escape special characters
  taggersExceptDoseAmount = [StrengthTagger.new,
              StrengthUnitTagger.new,
              DoseFormTagger.new,
              DoseAmountListTagger.new,
              RouteTagger.new,
              IndicationTagger.new,
              FrequencyTagger.new,
              TimingTagger.new,
              SubstitutionTagger.new,
              RefillTagger.new,
              DurationTagger.new,
              DispenseQuantityTagger.new]
             
  tags = []
  taggersExceptDoseAmount.each {|tagger| tags += tagger.parse_main text}
  as = Standoff::AnnotatedString.new(:signal => text, :tags => tags)
  DoseAmountTagger.new.parse_annotated_string as
  
  partial_xml = as.to_s
  as

end