Module: NamedEntity
- Extended by:
- Entity
- Includes:
- Segment
- Defined in:
- lib/rbbt/ner/segment/named_entity.rb
Instance Method Summary
collapse
Methods included from Segment
align, clean_sort, #end, #includes?, index, load_tsv, load_tsv_values, #make_relative, overlaps, #pull, #push, #range, #range_in, #segment_length, set_tsv_fields, sort, split, tsv, tsv_values_for_segment
Instance Method Details
#entity(params = nil) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/rbbt/ner/segment/named_entity.rb', line 31
def entity(params = nil)
format, entity = code.split(":")
entity, format = format, nil if entity.nil?
if defined? Entity and Entity.formats.include? type or Entity.formats.include? format
params ||= {}
params[:format] = format if format and params[:format].nil?
mod = (Entity.formats[type] || Entity.format[entity])
mod.setup(entity, params)
end
entity
end
|
#html ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/rbbt/ner/segment/named_entity.rb', line 20
def html
text = <<-EOF
<span class='Entity'\
#{type.nil? ? "" : " attr-entity-type='#{Array === type ? type * " " : type}'"}\
#{code.nil? ? "" : " attr-entity-code='#{Array === code ? code * " " : code}'"}\
#{score.nil? ? "" : " attr-entity-score='#{Array === score ? score * " " : score}'"}\
>#{ self }</span>
EOF
text.chomp
end
|
#report ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/rbbt/ner/segment/named_entity.rb', line 10
def report
<<-EOF
String: #{ self }
Offset: #{ offset.inspect }
Type: #{type.inspect}
Code: #{code.inspect}
Score: #{score.inspect}
EOF
end
|