class SiSU_Sem::Tags
Public Class Methods
new(para,md)
click to toggle source
# File lib/sisu/shared_sem.rb, line 58 def initialize(para,md) @para,@md=para,md end
Public Instance Methods
all()
click to toggle source
# File lib/sisu/shared_sem.rb, line 143 def all if @md.sem_tag sem_marker_parts sem_marker_added_extra_parts end @para end
each_c()
click to toggle source
# File lib/sisu/shared_sem.rb, line 68 def each_c /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):\{|\}:[a-z]+(?:[_:.][a-z]+)*/m end
each_csc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 65 def each_csc /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):)\{|\}[:;][a-z]+(?:[_:.][a-z]+)*/m end
each_csc_ae()
click to toggle source
# File lib/sisu/shared_sem.rb, line 86 def each_csc_ae /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+)*:|[a-z]*:)\[|\][:;](?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)/m end
each_sc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 71 def each_sc /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*);\{|\};[a-z]+(?:[_:.][a-z]+)*/m end
exclude()
click to toggle source
# File lib/sisu/shared_sem.rb, line 62 def exclude /^(?:<:code>|%+ )/ end
if_pair_c()
click to toggle source
# File lib/sisu/shared_sem.rb, line 102 def if_pair_c if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m puts "#{$1}:{ #{$2} }:#{$1}" end end
if_pair_sc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 107 def if_pair_sc if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/ puts ";{ #{$1} };#{$2}" end end
match_pair_c()
click to toggle source
# File lib/sisu/shared_sem.rb, line 112 def match_pair_c matched=[] matched=rgx.pair_c.match(@para)[1] if @para =~ rgx.pair_c puts matched unless matched.nil? end
match_pair_sc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 117 def match_pair_sc matched=[] matched=rgx.pair_sc.match(@para)[1] if @para =~ rgx.pair_sc puts matched unless matched.nil? end
matching()
click to toggle source
# File lib/sisu/shared_sem.rb, line 122 def matching scan_pair_c end
pair_c()
click to toggle source
# File lib/sisu/shared_sem.rb, line 77 def pair_c /(([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\2)|:\{(.+?)\}:[a-z]+(?:[_:.][a-z]+)*)/m end
pair_csc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 74 def pair_csc /(([a-z]+(?:[_:.][a-z]+)+|[a-z]+)(?::\{(.+?)\}:\2)|([:;])\{(.+?)\}\4[a-z]+(?:[_:.][a-z]+)*)/m end
pair_sc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 80 def pair_sc /(;\{.+?\};[a-z]+(?:[_:.][a-z]+)*)/m end
print()
click to toggle source
# File lib/sisu/shared_sem.rb, line 91 def print def scan_pair_c if @para =~ rgx.pair_c matched=@para.scan(rgx.pair_c).flatten puts matched[0] unless matched[0].nil? end end def scan_pair_sc matched=@para.scan(rgx.pair_sc).flatten puts matched[0] unless matched[0].nil? end def if_pair_c if @para=~/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m puts "#{$1}:{ #{$2} }:#{$1}" end end def if_pair_sc if @para=~/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/ puts ";{ #{$1} };#{$2}" end end def match_pair_c matched=[] matched=rgx.pair_c.match(@para)[1] if @para =~ rgx.pair_c puts matched unless matched.nil? end def match_pair_sc matched=[] matched=rgx.pair_sc.match(@para)[1] if @para =~ rgx.pair_sc puts matched unless matched.nil? end def matching scan_pair_c end self end
rgx()
click to toggle source
# File lib/sisu/shared_sem.rb, line 61 def rgx def exclude /^(?:<:code>|%+ )/ end def each_csc /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):)\{|\}[:;][a-z]+(?:[_:.][a-z]+)*/m end def each_c /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*):\{|\}:[a-z]+(?:[_:.][a-z]+)*/m end def each_sc /(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]*);\{|\};[a-z]+(?:[_:.][a-z]+)*/m end def pair_csc /(([a-z]+(?:[_:.][a-z]+)+|[a-z]+)(?::\{(.+?)\}:\2)|([:;])\{(.+?)\}\4[a-z]+(?:[_:.][a-z]+)*)/m end def pair_c /(([a-z]+(?:[_:.][a-z]+)*)(?::\{(.+?)\}:\2)|:\{(.+?)\}:[a-z]+(?:[_:.][a-z]+)*)/m end def pair_sc /(;\{.+?\};[a-z]+(?:[_:.][a-z]+)*)/m end def whole_csc_ae /(([a-z]+(?:[_.][a-z]+)+|[a-z]*)(?::\[(.+?)\]:\2)|;\{(.+?)\};(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)\b)/m end def each_csc_ae /(?:;|(?:[a-z]+(?:[_:.][a-z]+)+)*:|[a-z]*:)\[|\][:;](?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)/m end self end
rm()
click to toggle source
# File lib/sisu/shared_sem.rb, line 127 def rm def sem_marker_parts unless @para =~ rgx.exclude @para.gsub!(rgx.each_csc,'') end @para end def sem_marker_added_extra_parts unless @para =~ rgx.exclude @para.gsub!(rgx.whole_csc_ae,'') if @para =~rgx.each_csc_ae STDERR.puts "WARNING semantic tagging error: #{@para}" end end @para end def all if @md.sem_tag sem_marker_parts sem_marker_added_extra_parts end @para end self end
scan_pair_c()
click to toggle source
# File lib/sisu/shared_sem.rb, line 92 def scan_pair_c if @para =~ rgx.pair_c matched=@para.scan(rgx.pair_c).flatten puts matched[0] unless matched[0].nil? end end
scan_pair_sc()
click to toggle source
# File lib/sisu/shared_sem.rb, line 98 def scan_pair_sc matched=@para.scan(rgx.pair_sc).flatten puts matched[0] unless matched[0].nil? end
sem_marker_added_extra_parts()
click to toggle source
# File lib/sisu/shared_sem.rb, line 134 def sem_marker_added_extra_parts unless @para =~ rgx.exclude @para.gsub!(rgx.whole_csc_ae,'') if @para =~rgx.each_csc_ae STDERR.puts "WARNING semantic tagging error: #{@para}" end end @para end
sem_marker_parts()
click to toggle source
# File lib/sisu/shared_sem.rb, line 128 def sem_marker_parts unless @para =~ rgx.exclude @para.gsub!(rgx.each_csc,'') end @para end
whole_csc_ae()
click to toggle source
# File lib/sisu/shared_sem.rb, line 83 def whole_csc_ae /(([a-z]+(?:[_.][a-z]+)+|[a-z]*)(?::\[(.+?)\]:\2)|;\{(.+?)\};(?:[a-z]+(?:[_:.][a-z]+)+|[a-z]+)\b)/m end