def initialize(draft = "")
Utility::check_types({ draft=>String }) if $DEBUG
@id = -1
@attrs = {}
@dtexts = []
@htexts = []
@kwords = nil
@score = -1
if draft.length
lines = draft.split(/\n/, -1)
num = 0
while num < lines.length
line = lines[num]
num += 1
break if line.length < 1
if line =~ /^%/
if line =~ /^%VECTOR\t/
@kwords = {} unless @kwords
fields = line.split(/\t/)
i = 1
while i < fields.length - 1
@kwords[fields[i]] = fields[i+1]
i += 2
end
elsif line =~ /^%SCORE\t/
fields = line.split(/\t/)
@score = fields[1].to_i;
end
next
end
line = line.gsub(/[ \t\r\n\v\f]+/, " ")
line = line.strip.squeeze(" ")
if idx = line.index("=")
key = line[0...idx]
value = line[idx+1...line.length]
@attrs[key] = value
end
end
while num < lines.length
line = lines[num]
num += 1
next unless line.length > 0
if line[0] == 0x9
@htexts.push(line[1...line.length]) if line.length > 1
else
@dtexts.push(line)
end
end
end
end