From 6811ac91f21a434fc7d967c11e1b20f33918c6ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 19 Mar 2012 22:07:29 -0400 Subject: v3: 3.2 branch is main (v3dv --> v3); dev (v3dv) branch directories removed * v3dv (3.2) "merged" into v3 (previously 3.1) (& removed) * conf/sisu/v3dv --> conf/sisu/v3 * data/sisu/v3dv --> data/sisu/v3 * lib/sisu/v3dv --> lib/sisu/v3 * bin/sisu* (v3dv references changed to v3) * (--dev modifier (superfluous for the time being) runs main v3 branch) --- lib/sisu/v3/epub_concordance.rb | 93 ++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 43 deletions(-) (limited to 'lib/sisu/v3/epub_concordance.rb') diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index c2a289a2..e2e5bb5c 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -69,7 +69,7 @@ module SiSU_EPUB_Concordance class Source def initialize(opt) @opt=opt - @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt) end def read begin @@ -85,21 +85,21 @@ module SiSU_EPUB_Concordance SiSU_Screen::Ansi.new(@md.opt.cmd,"wc (word count) is off, concordance will be processed for all files including those over the max set size of: #{wordmax} words").warn unless @md.opt.cmd =~/q/ SiSU_EPUB_Concordance::Source::Words.new(@particulars).songsheet end - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure end end private - class Doc_title + class DocTitle include SiSU_Viz #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) require_relative 'epub' # epub.rb def initialize(particulars) @particulars,@md=particulars,particulars.md - @data=SiSU_EPUB::Source::XHtml_environment.new(particulars).tuned_file_instructions - @vz=SiSU_Env::Get_init.instance.skin + @data=SiSU_EPUB::Source::XHTML_Environment.new(particulars).tuned_file_instructions + @vz=SiSU_Env::GetInit.instance.skin txt_path=%{#{@md.dir_out}} - SiSU_Env::Info_skin.new(@md).select + SiSU_Env::InfoSkin.new(@md).select @fnb=@md.fnb @lex_button=%{SiSU home -->} @doc_details =<|\w+|[a-zA-Z]+}mi - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error end end def songsheet begin + #fix to use + p __LINE__.to_s + ':' + __FILE__ + p "#{@path}/content/#{@md.fn[:epub_concord]}" + p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w') map_para - rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error ensure @file_concordance.close end @@ -202,7 +206,10 @@ WOK @word_map={} @dal_array.each do |line| if defined? line.ocn - if line.is =~/heading/ and line.ln==4; @seg=line.name + if (line.is ==:heading \ + || line.is ==:heading_insert) \ + && line.ln==4 + @seg=line.name end if line.ocn.to_s =~/\d+/; toy=line.ocn.to_s end @@ -210,46 +217,46 @@ WOK and toy !~/^0$/ line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match for word in line.obj.scan(@rgx_scanlist) #%take in word or other match - word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') - word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') - word.gsub!(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''). + gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,''). + gsub(/#{Mx[:gl_o]}#[0-9]+#{Mx[:gl_c]}/,''). + gsub(/^\S$/,'') word=nil if word.empty? word=nil if word =~@rxp_excluded0 #watch word=nil if word =~@rxp_excluded1 #watch word=nil if word =~/^\S$/ if word - word.gsub!(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' ') - word.gsub!(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,'') - word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,'') - word.gsub!(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,'') - word.gsub!(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,'') - word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,''); word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') - word.gsub!(/<\/?\S+?>/,'') - word.gsub!(/^\@+/,'') - word.strip! - word.gsub!(/#{Mx[:tc_p]}.+/,'') - word.gsub!(/[\.,;:"]$/,'') - word.gsub!(/["]/,'') - word.gsub!(/^\s*[\(]/,'') - word.gsub!(/[\(]\s*$/,'') - word.gsub!(/^(?:See|e\.?g\.?).+/,'') - word.gsub!(/^\s*[.,;:]\s*/,'') - word.strip! - word.gsub!(/^\(?[a-zA-Z]\)$/,'') - word.gsub!(/^\d+(st|nd|rd|th)$/,'') - word.gsub!(/^(\d+\.?)+$/, '') - word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') - word.gsub!(/:name#\S+/,'') - word.gsub!(/^\S$/,'') + word=word.gsub(/#{Mx[:br_nl]}|#{Mx[:br_line]}/,' '). + gsub(/#{Mx[:fa_o]}[a-z]{1,7}#{Mx[:fa_o_c]}|#{Mx[:fa_c_o]}[a-z]{1,7}#{Mx[:fa_c]}/,''). + gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}:[0-9a-f]{32}|[0-9a-f]{64}:[0-9a-f]{64})#{Mx[:mk_c]}/,''). + gsub(/#{Mx[:mk_o]}(?:[0-9a-f]{32}|[0-9a-f]{64})#{Mx[:mk_c]}/,''). + gsub(/#{Mx[:en_a_o]}(?:\d|[*+])*|#{Mx[:en_b_o]}(?:\d|[*+])*|#{Mx[:en_a_c]}|#{Mx[:en_b_c]}/mi,''). + gsub(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'').gsub(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,''). + gsub(/<\/?\S+?>/,''). + gsub(/^\@+/,''). + strip. + gsub(/#{Mx[:tc_p]}.+/,''). + gsub(/[\.,;:"]$/,''). + gsub(/["]/,''). + gsub(/^\s*[\(]/,''). + gsub(/[\(]\s*$/,''). + gsub(/^(?:See|e\.?g\.?).+/,''). + gsub(/^\s*[.,;:]\s*/,''). + strip. + gsub(/^\(?[a-zA-Z]\)$/,''). + gsub(/^\d+(st|nd|rd|th)$/,''). + gsub(/^(\d+\.?)+$/, ''). + gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,''). + gsub(/:name#\S+/,''). + gsub(/^\S$/,'') word=nil if word =~/^\S$/ word=nil if word =~/^\s*$/ #watch if word unless word =~/[A-Z][A-Z]/ \ or word =~/\w+\s\w+/ - word.capitalize! + word=word.capitalize end @freq[word] +=1 @word_map[word] ||= [] @@ -272,7 +279,7 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_concordance << SiSU_EPUB_Concordance::Source::Doc_title.new(@particulars).create + @file_concordance << SiSU_EPUB_Concordance::Source::DocTitle.new(@particulars).create alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @file_concordance << '

' alph.each {|x| @file_concordance << %{#{x}, }} -- cgit v1.2.3