textutils 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +2 -1
- data/lib/textutils.rb +1 -0
- data/lib/textutils/reader/code_reader.rb +21 -6
- data/lib/textutils/reader/hash_reader.rb +20 -6
- data/lib/textutils/reader/hash_reader_v2.rb +2 -2
- data/lib/textutils/reader/line_reader.rb +28 -30
- data/lib/textutils/reader/line_reader_v2.rb +1 -1
- data/lib/textutils/reader/values_reader.rb +5 -5
- data/lib/textutils/title.rb +19 -1
- data/lib/textutils/title_mapper.rb +159 -0
- data/lib/textutils/version.rb +1 -1
- data/test/{cl_all.txt → data/cl_all.txt} +0 -0
- data/test/helper.rb +0 -1
- data/test/test_address_helper.rb +1 -1
- data/test/test_asciify.rb +1 -1
- data/test/test_fixture_reader.rb +5 -5
- data/test/test_hypertext_helper.rb +1 -1
- data/test/test_slugify.rb +1 -1
- data/test/test_taglist.rb +1 -1
- data/test/test_title_finder.rb +1 -1
- data/test/test_title_helper.rb +1 -1
- data/test/test_title_mapper.rb +3 -2
- data/test/test_unicode_helper.rb +1 -1
- data/test/test_values_reader.rb +7 -7
- metadata +17 -16
data/Manifest.txt
CHANGED
@@ -32,9 +32,10 @@ lib/textutils/reader/values_reader.rb
|
|
32
32
|
lib/textutils/reader/values_reader_v2.rb
|
33
33
|
lib/textutils/sanitizier.rb
|
34
34
|
lib/textutils/title.rb
|
35
|
+
lib/textutils/title_mapper.rb
|
35
36
|
lib/textutils/utils.rb
|
36
37
|
lib/textutils/version.rb
|
37
|
-
test/cl_all.txt
|
38
|
+
test/data/cl_all.txt
|
38
39
|
test/helper.rb
|
39
40
|
test/test_address_helper.rb
|
40
41
|
test/test_asciify.rb
|
data/lib/textutils.rb
CHANGED
@@ -6,15 +6,30 @@ class CodeReader
|
|
6
6
|
|
7
7
|
include LogUtils::Logging
|
8
8
|
|
9
|
-
def
|
10
|
-
@path = path
|
11
|
-
|
9
|
+
def self.from_file( path )
|
12
10
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
13
11
|
## - see textutils/utils.rb
|
14
|
-
|
15
|
-
|
12
|
+
code = File.read_utf8( path )
|
13
|
+
self.from_string( code )
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.from_string( code )
|
17
|
+
CodeReader.new( code: code )
|
16
18
|
end
|
17
19
|
|
20
|
+
|
21
|
+
def initialize( arg )
|
22
|
+
if arg.is_a?( String ) ## old style (deprecated) - pass in filepath as string
|
23
|
+
path = arg
|
24
|
+
logger.info "CodeReader.new - deprecated API - use CodeReader.from_file() instead"
|
25
|
+
@code = File.read_utf8( path )
|
26
|
+
else ## assume it's a hash
|
27
|
+
opts = arg
|
28
|
+
@code = opts[:code]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
18
33
|
def eval( klass )
|
19
34
|
klass.class_eval( @code )
|
20
35
|
|
@@ -26,4 +41,4 @@ class CodeReader
|
|
26
41
|
# end
|
27
42
|
end
|
28
43
|
|
29
|
-
end # class CodeReader
|
44
|
+
end # class CodeReader
|
@@ -7,14 +7,28 @@ class HashReader
|
|
7
7
|
|
8
8
|
include LogUtils::Logging
|
9
9
|
|
10
|
-
def
|
11
|
-
@path = path
|
12
|
-
|
10
|
+
def self.from_file( path )
|
13
11
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
14
12
|
## - see textutils/utils.rb
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
text = File.read_utf8( path )
|
14
|
+
self.from_string( text )
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_string( text )
|
18
|
+
HashReader.new( text: text )
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize( arg )
|
22
|
+
|
23
|
+
if arg.is_a?( String ) ## old style (deprecated) - pass in filepath as string
|
24
|
+
path = arg
|
25
|
+
logger.info "HashReader.new - deprecated API - use HashReader.from_file() instead"
|
26
|
+
text = File.read_utf8( path )
|
27
|
+
else ## assume it's a hash
|
28
|
+
opts = arg
|
29
|
+
text = opts[:text]
|
30
|
+
end
|
31
|
+
|
18
32
|
### hack for syck yaml parser (e.g.ruby 1.9.2) (cannot handle !!null)
|
19
33
|
## change it to !null to get plain nil
|
20
34
|
## w/ both syck and psych/libyml
|
@@ -32,7 +32,7 @@ class HashReaderV2
|
|
32
32
|
|
33
33
|
def each
|
34
34
|
path = "#{include_path}/#{name_real_path}.yml"
|
35
|
-
reader = HashReader.
|
35
|
+
reader = HashReader.from_file( path )
|
36
36
|
|
37
37
|
logger.info "parsing data '#{name}' (#{path})..."
|
38
38
|
|
@@ -46,7 +46,7 @@ class HashReaderV2
|
|
46
46
|
|
47
47
|
def each_typed
|
48
48
|
path = "#{include_path}/#{name_real_path}.yml"
|
49
|
-
reader = HashReader.
|
49
|
+
reader = HashReader.from_file( path )
|
50
50
|
|
51
51
|
logger.info "parsing data '#{name}' (#{path})..."
|
52
52
|
|
@@ -1,60 +1,58 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
##
|
4
|
-
## fix/todo: move to/merge into LineReader itself
|
5
|
-
# e.g. use fromString c'tor ??? or similar??
|
6
|
-
|
7
3
|
# fix: move into TextUtils namespace/module!!
|
8
4
|
|
9
5
|
|
10
6
|
class StringLineReader
|
7
|
+
## fix/todo:
|
8
|
+
## remove - deprecated/obsolete - do NOT use
|
9
|
+
## use LineReader.from_string
|
11
10
|
|
12
11
|
include LogUtils::Logging
|
13
12
|
|
14
|
-
def initialize(
|
15
|
-
|
13
|
+
def initialize( text )
|
14
|
+
logger.info "StringLineReader.new - deprecated API - use LineReader.from_string() instead"
|
15
|
+
@reader = LineReader.from_string( text )
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
def each_line
|
20
|
-
@
|
21
|
-
|
22
|
-
if line =~ /^\s*#/
|
23
|
-
# skip komments and do NOT copy to result (keep comments secret!)
|
24
|
-
logger.debug 'skipping comment line'
|
25
|
-
next
|
26
|
-
end
|
27
|
-
|
28
|
-
if line =~ /^\s*$/
|
29
|
-
# kommentar oder leerzeile überspringen
|
30
|
-
logger.debug 'skipping blank line'
|
31
|
-
next
|
32
|
-
end
|
33
|
-
|
34
|
-
# remove leading and trailing whitespace
|
35
|
-
line = line.strip
|
36
|
-
|
19
|
+
@reader.each_line do |line|
|
37
20
|
yield( line )
|
38
21
|
end # each lines
|
39
22
|
end # method each_line
|
40
|
-
|
41
23
|
end
|
42
24
|
|
43
25
|
|
26
|
+
|
44
27
|
class LineReader
|
45
28
|
|
46
29
|
include LogUtils::Logging
|
47
30
|
|
48
|
-
def
|
49
|
-
@path = path
|
50
|
-
|
31
|
+
def self.from_file( path )
|
51
32
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
52
33
|
## - see textutils/utils.rb
|
53
|
-
|
34
|
+
text = File.read_utf8( path )
|
35
|
+
self.from_string( text )
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.from_string( text )
|
39
|
+
LineReader.new( text: text )
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def initialize( arg )
|
44
|
+
if arg.is_a?( String ) ## old style (deprecated) - pass in filepath as string
|
45
|
+
path = arg
|
46
|
+
logger.info "LineReader.new - deprecated API - use LineReader.from_file() instead"
|
47
|
+
@text = File.read_utf8( path )
|
48
|
+
else ## assume it's a hash
|
49
|
+
opts = arg
|
50
|
+
@text = opts[:text]
|
51
|
+
end
|
54
52
|
end
|
55
53
|
|
56
54
|
def each_line
|
57
|
-
@
|
55
|
+
@text.each_line do |line|
|
58
56
|
|
59
57
|
# comments allow:
|
60
58
|
# 1) ##### (shell/ruby style)
|
@@ -55,7 +55,7 @@ class ValuesReader
|
|
55
55
|
def initialize( arg, more_attribs={} )
|
56
56
|
@more_attribs = more_attribs
|
57
57
|
|
58
|
-
### todo/fix: rename @
|
58
|
+
### todo/fix: rename @text to @text !!!!
|
59
59
|
|
60
60
|
if arg.is_a?( String ) ## old style (deprecated) - pass in filepath as string
|
61
61
|
path = arg
|
@@ -66,14 +66,14 @@ class ValuesReader
|
|
66
66
|
# check what is the best convention (follow ???)
|
67
67
|
if path =~ /\n/m
|
68
68
|
logger.info "ValuesReader.new - deprecated API - use ValuesReader.from_string() instead"
|
69
|
-
@
|
69
|
+
@text = path.dup # make a duplicate ?? why? why not?
|
70
70
|
else
|
71
71
|
logger.info "ValuesReader.new - deprecated API - use ValuesReader.from_file() instead"
|
72
|
-
@
|
72
|
+
@text = File.read_utf8( @path )
|
73
73
|
end
|
74
74
|
else ## assume it's a hash
|
75
75
|
opts = arg
|
76
|
-
@
|
76
|
+
@text = opts[:text]
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -102,7 +102,7 @@ class ValuesReader
|
|
102
102
|
last_header = nil
|
103
103
|
|
104
104
|
|
105
|
-
@
|
105
|
+
@text.each_line do |line|
|
106
106
|
|
107
107
|
## allow alternative comment lines
|
108
108
|
## e.g. -- comment or
|
data/lib/textutils/title.rb
CHANGED
@@ -7,19 +7,31 @@
|
|
7
7
|
# or rename to KeyMapping?, KeyMapper?, KeyTable? etc.
|
8
8
|
|
9
9
|
|
10
|
+
######
|
11
|
+
## todo/check:
|
12
|
+
### remove - use TitleMapper instead
|
13
|
+
## deprecated/obsolete - do NOT use will get removed
|
14
|
+
|
15
|
+
|
10
16
|
module TextUtils
|
11
17
|
module TitleTable
|
12
18
|
|
13
19
|
####
|
14
20
|
## fix: turn it into a class w/ methods
|
15
21
|
#
|
16
|
-
#e.g t =
|
22
|
+
#e.g t =TitleMapper.new( records, name ) # e.g. name='team'
|
17
23
|
# t.map!( line )
|
18
24
|
# t.find_key!( line )
|
19
25
|
# etc.
|
26
|
+
#
|
27
|
+
# see textutils/title_mapper.rb
|
28
|
+
#
|
29
|
+
# deprecate code here!!! - move to new TitleMapper class
|
20
30
|
|
21
31
|
|
22
32
|
def build_title_table_for( records )
|
33
|
+
LogUtils::Logger.root.info " build_title_table_for - deprecated API - use TitleMapper.new instead"
|
34
|
+
|
23
35
|
## build known tracks table w/ synonyms e.g.
|
24
36
|
#
|
25
37
|
# [[ 'wolfsbrug', [ 'VfL Wolfsburg' ]],
|
@@ -72,6 +84,8 @@ end
|
|
72
84
|
|
73
85
|
|
74
86
|
def find_key_for!( name, line )
|
87
|
+
LogUtils::Logger.root.info " find_key_for! #{name} - deprecated API - use TitleMapper.find_key! instead"
|
88
|
+
|
75
89
|
regex = /@@oo([^@]+?)oo@@/ # e.g. everything in @@ .... @@ (use non-greedy +? plus all chars but not @, that is [^@])
|
76
90
|
|
77
91
|
upcase_name = name.upcase
|
@@ -92,6 +106,8 @@ end
|
|
92
106
|
|
93
107
|
|
94
108
|
def find_keys_for!( name, line ) # NB: keys (plural!) - will return array
|
109
|
+
LogUtils::Logger.root.info " find_keys_for! #{name} - deprecated API - use TitleMapper.find_keys! instead"
|
110
|
+
|
95
111
|
counter = 1
|
96
112
|
keys = []
|
97
113
|
|
@@ -109,6 +125,8 @@ end
|
|
109
125
|
|
110
126
|
|
111
127
|
def map_titles_for!( name, line, title_table )
|
128
|
+
LogUtils::Logger.root.info " map_titles_for! #{name} - deprecated API - use TitleMapper.map_titles! instead"
|
129
|
+
|
112
130
|
title_table.each do |rec|
|
113
131
|
key = rec[0]
|
114
132
|
values = rec[1]
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
## see textutils/title.rb
|
5
|
+
## for existing code
|
6
|
+
## move over here
|
7
|
+
|
8
|
+
####
|
9
|
+
## fix: turn it into a class w/ methods
|
10
|
+
#
|
11
|
+
#e.g t =TitleMapper.new( records, name ) # e.g. name='team'
|
12
|
+
# t.map!( line )
|
13
|
+
# t.find_key!( line )
|
14
|
+
# etc.
|
15
|
+
|
16
|
+
|
17
|
+
module TextUtils
|
18
|
+
|
19
|
+
class TitleMapper ## todo/check: rename to NameMapper ? why? why not??
|
20
|
+
|
21
|
+
include LogUtils::Logging
|
22
|
+
|
23
|
+
attr_reader :known_titles ## rename to mapping or mappings or just titles - why? why not?
|
24
|
+
|
25
|
+
def initialize( records, tag )
|
26
|
+
@known_titles = build_title_table_for( records ) ## build mapping lookup table
|
27
|
+
|
28
|
+
## todo: rename tag to attrib or attrib_name - why ?? why not ???
|
29
|
+
@tag = tag # e.g. tag name use for @@brewery@@ @@team@@ etc.
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def map_titles!( line ) ## rename to just map! - why?? why not???
|
34
|
+
@known_titles.each do |rec|
|
35
|
+
key = rec[0]
|
36
|
+
values = rec[1]
|
37
|
+
map_title_for!( @tag, line, key, values )
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def find_key!( line )
|
43
|
+
find_key_for!( @tag, line )
|
44
|
+
end
|
45
|
+
|
46
|
+
def find_keys!( line ) # NB: keys (plural!) - will return array
|
47
|
+
counter = 1
|
48
|
+
keys = []
|
49
|
+
|
50
|
+
key = find_key_for!( "#{@tag}#{counter}", line )
|
51
|
+
while key.present?
|
52
|
+
keys << key
|
53
|
+
counter += 1
|
54
|
+
key = find_key_for!( "#{@tag}#{counter}", line )
|
55
|
+
end
|
56
|
+
keys
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
private
|
61
|
+
def build_title_table_for( records )
|
62
|
+
|
63
|
+
#### fix/todo:
|
64
|
+
### reorder - sort by largest strings etc.
|
65
|
+
## do NOT use lookup w/ array per key; use 1:1 one key per lookup
|
66
|
+
## -> lets us sort by find largest first
|
67
|
+
|
68
|
+
|
69
|
+
## build known tracks table w/ synonyms e.g.
|
70
|
+
#
|
71
|
+
# [[ 'wolfsbrug', [ 'VfL Wolfsburg' ]],
|
72
|
+
# [ 'augsburg', [ 'FC Augsburg', 'Augi2', 'Augi3' ]],
|
73
|
+
# [ 'stuttgart', [ 'VfB Stuttgart' ]] ]
|
74
|
+
|
75
|
+
known_titles = []
|
76
|
+
|
77
|
+
records.each_with_index do |rec,index|
|
78
|
+
|
79
|
+
title_candidates = []
|
80
|
+
title_candidates << rec.title
|
81
|
+
|
82
|
+
title_candidates += rec.synonyms.split('|') if rec.synonyms.present?
|
83
|
+
|
84
|
+
|
85
|
+
## check if title includes subtitle e.g. Grand Prix Japan (Suzuka Circuit)
|
86
|
+
# make subtitle optional by adding title w/o subtitle e.g. Grand Prix Japan
|
87
|
+
|
88
|
+
titles = []
|
89
|
+
title_candidates.each do |t|
|
90
|
+
titles << t
|
91
|
+
if t =~ /\(.+\)/
|
92
|
+
extra_title = t.gsub( /\(.+\)/, '' ) # remove/delete subtitles
|
93
|
+
extra_title.strip! # strip leading n trailing withspaces too!
|
94
|
+
titles << extra_title
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
## NB: sort here by length (largest goes first - best match)
|
100
|
+
# exclude code and key (key should always go last)
|
101
|
+
titles = titles.sort { |left,right| right.length <=> left.length }
|
102
|
+
|
103
|
+
## escape for regex plus allow subs for special chars/accents
|
104
|
+
titles = titles.map { |title| TextUtils.title_esc_regex( title ) }
|
105
|
+
|
106
|
+
## NB: only include code field - if defined
|
107
|
+
titles << rec.code if rec.respond_to?(:code) && rec.code.present?
|
108
|
+
|
109
|
+
known_titles << [ rec.key, titles ]
|
110
|
+
|
111
|
+
logger.debug " #{rec.class.name}[#{index+1}] #{rec.key} >#{titles.join('|')}<"
|
112
|
+
end
|
113
|
+
|
114
|
+
known_titles
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
def map_title_for!( tag, line, key, values )
|
119
|
+
|
120
|
+
downcase_tag = tag.downcase
|
121
|
+
|
122
|
+
values.each do |value|
|
123
|
+
## nb: \b does NOT include space or newline for word boundry (only alphanums e.g. a-z0-9)
|
124
|
+
## (thus add it, allows match for Benfica Lis. for example - note . at the end)
|
125
|
+
|
126
|
+
## check add $ e.g. (\b| |\t|$) does this work? - check w/ Benfica Lis.$
|
127
|
+
regex = /\b#{value}(\b| |\t|$)/ # wrap with world boundry (e.g. match only whole words e.g. not wac in wacker)
|
128
|
+
if line =~ regex
|
129
|
+
logger.debug " match for #{downcase_tag} >#{key}< >#{value}<"
|
130
|
+
# make sure @@oo{key}oo@@ doesn't match itself with other key e.g. wacker, wac, etc.
|
131
|
+
line.sub!( regex, "@@oo#{key}oo@@ " ) # NB: add one space char at end
|
132
|
+
return true # break out after first match (do NOT continue)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
return false
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
def find_key_for!( tag, line )
|
140
|
+
regex = /@@oo([^@]+?)oo@@/ # e.g. everything in @@ .... @@ (use non-greedy +? plus all chars but not @, that is [^@])
|
141
|
+
|
142
|
+
upcase_tag = tag.upcase
|
143
|
+
downcase_tag = tag.downcase
|
144
|
+
|
145
|
+
if line =~ regex
|
146
|
+
value = "#{$1}"
|
147
|
+
logger.debug " #{downcase_tag}: >#{value}<"
|
148
|
+
|
149
|
+
line.sub!( regex, "[#{upcase_tag}]" )
|
150
|
+
|
151
|
+
return $1
|
152
|
+
else
|
153
|
+
return nil
|
154
|
+
end
|
155
|
+
end # method find_key_for!
|
156
|
+
|
157
|
+
|
158
|
+
end # class TitleMapper
|
159
|
+
end # module TextUtils
|
data/lib/textutils/version.rb
CHANGED
File without changes
|
data/test/helper.rb
CHANGED
data/test/test_address_helper.rb
CHANGED
data/test/test_asciify.rb
CHANGED
data/test/test_fixture_reader.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
|
4
|
-
class TestFixtureReader <
|
4
|
+
class TestFixtureReader < Minitest::Test
|
5
5
|
|
6
6
|
def test_read
|
7
|
-
path = "#{TextUtils.root}/test/cl_all.txt"
|
7
|
+
path = "#{TextUtils.root}/test/data/cl_all.txt"
|
8
8
|
puts "[TestFixtureReader.test_read] path: #{path}"
|
9
|
-
|
10
|
-
reader = FixtureReader.
|
11
|
-
|
9
|
+
|
10
|
+
reader = FixtureReader.from_file( path )
|
11
|
+
|
12
12
|
ary = [
|
13
13
|
'europe-champions-league!/leagues',
|
14
14
|
'europe-champions-league!/2011_12/cl',
|
data/test/test_slugify.rb
CHANGED
data/test/test_taglist.rb
CHANGED
data/test/test_title_finder.rb
CHANGED
data/test/test_title_helper.rb
CHANGED
data/test/test_title_mapper.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'helper'
|
5
5
|
|
6
6
|
|
7
|
-
class TestTitleMapper <
|
7
|
+
class TestTitleMapper < Minitest::Test
|
8
8
|
|
9
9
|
WineryStruct = Struct.new(:key, :title, :synonyms)
|
10
10
|
|
@@ -32,7 +32,8 @@ class TestTitleMapper < MiniTest::Unit::TestCase
|
|
32
32
|
['andreaspolsterer', [ 'Weingut Andreas B\. Polsterer', 'Andreas B\. Polsterer \(1970\)', 'Andreas B\. Polsterer' ]]
|
33
33
|
]
|
34
34
|
|
35
|
-
|
35
|
+
mapper = TextUtils::TitleMapper.new( titles_in, 'winery' )
|
36
|
+
titles_out = mapper.known_titles
|
36
37
|
|
37
38
|
puts 'titles_out:'
|
38
39
|
pp titles_out
|
data/test/test_unicode_helper.rb
CHANGED
data/test/test_values_reader.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
require 'helper'
|
10
10
|
|
11
|
-
class TestValuesReader <
|
11
|
+
class TestValuesReader < Minitest::Test
|
12
12
|
|
13
13
|
def test_header
|
14
14
|
txt =<<EOS
|
@@ -28,7 +28,7 @@ Schwechater Zwickl, 5.4%, 12.5°, 45.0 kcal/100ml
|
|
28
28
|
|
29
29
|
EOS
|
30
30
|
|
31
|
-
reader = ValuesReader.
|
31
|
+
reader = ValuesReader.from_string( txt )
|
32
32
|
|
33
33
|
i = 0
|
34
34
|
reader.each_line do |attribs, values|
|
@@ -80,7 +80,7 @@ EOS
|
|
80
80
|
|
81
81
|
pp txt
|
82
82
|
|
83
|
-
reader = ValuesReader.
|
83
|
+
reader = ValuesReader.from_string( txt )
|
84
84
|
|
85
85
|
i = 0
|
86
86
|
reader.each_line do |attribs, values|
|
@@ -146,7 +146,7 @@ weitra, Weitra Bräu Bierwerkstatt|Brauerei Weitra *, 1321, www.bierwerkstatt.at
|
|
146
146
|
egger, Privatbrauerei Fritz Egger **, 1978, www.egger-bier.at, 3105 Unterradlberg // Tiroler Straße 18
|
147
147
|
EOS
|
148
148
|
|
149
|
-
reader = ValuesReader.
|
149
|
+
reader = ValuesReader.from_string( txt )
|
150
150
|
|
151
151
|
i = 0
|
152
152
|
reader.each_line do |attribs, values|
|
@@ -236,7 +236,7 @@ EOS
|
|
236
236
|
brands: Zwettler
|
237
237
|
EOS
|
238
238
|
|
239
|
-
reader = ValuesReader.
|
239
|
+
reader = ValuesReader.from_string( txt )
|
240
240
|
|
241
241
|
i = 0
|
242
242
|
reader.each_line do |attribs, values|
|
@@ -283,7 +283,7 @@ manunited, Manchester United|Man Utd|Manchester U., MUN, city:manchester
|
|
283
283
|
liverpool, Liverpool|Liverpool FC|FC Liverpool, LIV, city:liverpool
|
284
284
|
EOS
|
285
285
|
|
286
|
-
reader = ValuesReader.
|
286
|
+
reader = ValuesReader.from_string( txt )
|
287
287
|
|
288
288
|
i = 0
|
289
289
|
reader.each_line do |attribs, values|
|
@@ -318,7 +318,7 @@ Ottakringer (Gold Fassl) Pils, 4.6 %, 11.2°
|
|
318
318
|
Ottakringer (Gold Fassl) Pur {Bio}, 5.2 %, 11.8°, bio
|
319
319
|
EOS
|
320
320
|
|
321
|
-
reader = ValuesReader.
|
321
|
+
reader = ValuesReader.from_string( txt )
|
322
322
|
|
323
323
|
i = 0
|
324
324
|
reader.each_line do |attribs, values|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: props
|
16
|
-
requirement: &
|
16
|
+
requirement: &79823580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *79823580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: logutils
|
27
|
-
requirement: &
|
27
|
+
requirement: &79823050 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *79823050
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rubyzip
|
38
|
-
requirement: &
|
38
|
+
requirement: &79822760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *79822760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &79822540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *79822540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rdoc
|
60
|
-
requirement: &
|
60
|
+
requirement: &79822210 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,18 +65,18 @@ dependencies:
|
|
65
65
|
version: '4.0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *79822210
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: hoe
|
71
|
-
requirement: &
|
71
|
+
requirement: &79821880 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '3.
|
76
|
+
version: '3.13'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *79821880
|
80
80
|
description: textutils - Text Filters, Helpers, Readers and More
|
81
81
|
email: ruby-talk@ruby-lang.org
|
82
82
|
executables: []
|
@@ -120,9 +120,10 @@ files:
|
|
120
120
|
- lib/textutils/reader/values_reader_v2.rb
|
121
121
|
- lib/textutils/sanitizier.rb
|
122
122
|
- lib/textutils/title.rb
|
123
|
+
- lib/textutils/title_mapper.rb
|
123
124
|
- lib/textutils/utils.rb
|
124
125
|
- lib/textutils/version.rb
|
125
|
-
- test/cl_all.txt
|
126
|
+
- test/data/cl_all.txt
|
126
127
|
- test/helper.rb
|
127
128
|
- test/test_address_helper.rb
|
128
129
|
- test/test_asciify.rb
|