sportdb-parser 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Manifest.txt +1 -0
- data/lib/sportdb/parser/fbtok/main.rb +8 -8
- data/lib/sportdb/parser/token-status.rb +38 -0
- data/lib/sportdb/parser/token.rb +7 -30
- data/lib/sportdb/parser/version.rb +1 -1
- data/lib/sportdb/parser.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d3ea1789627c1b9380ab692b8731f0f8143d43fe20353a3b9b9413da0ef1876
|
4
|
+
data.tar.gz: f5a15299064a88cebcb7ebc7e4b56fc985e78c0f654d9c86347fa299d9cd5133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 489259813cc34fc38fb8a16bda45ac6785c8f2d0ee148caf458c014fe4754e1f360985f37f8132f0212dd89b427c09d2cf6a0054853e6217a814dde5ea2de222
|
7
|
+
data.tar.gz: 3280fc2ebc7db55a9182abc0e7ef23e7d9689758b64741e4824c642a6ad89b4e16eae5d52c666ec75c295919607d255f55ebaa63e1ad68ad95dc1e6717812a6b
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -12,6 +12,7 @@ lib/sportdb/parser/outline_reader.rb
|
|
12
12
|
lib/sportdb/parser/parser.rb
|
13
13
|
lib/sportdb/parser/token-date.rb
|
14
14
|
lib/sportdb/parser/token-score.rb
|
15
|
+
lib/sportdb/parser/token-status.rb
|
15
16
|
lib/sportdb/parser/token-text.rb
|
16
17
|
lib/sportdb/parser/token.rb
|
17
18
|
lib/sportdb/parser/version.rb
|
@@ -3,7 +3,7 @@ module Fbtok
|
|
3
3
|
def self.main( args=ARGV )
|
4
4
|
|
5
5
|
opts = {
|
6
|
-
debug:
|
6
|
+
debug: false,
|
7
7
|
metal: false,
|
8
8
|
file: nil,
|
9
9
|
}
|
@@ -12,14 +12,14 @@ def self.main( args=ARGV )
|
|
12
12
|
parser.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
13
13
|
|
14
14
|
|
15
|
-
parser.on( "-q", "--quiet",
|
16
|
-
"less debug output/messages - default is (#{!opts[:debug]})" ) do |debug|
|
17
|
-
opts[:debug] = false
|
18
|
-
end
|
19
|
-
# parser.on( "--verbose", "--debug",
|
20
|
-
# "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
|
21
|
-
# opts[:debug] = true
|
15
|
+
# parser.on( "-q", "--quiet",
|
16
|
+
# "less debug output/messages - default is (#{!opts[:debug]})" ) do |debug|
|
17
|
+
# opts[:debug] = false
|
22
18
|
# end
|
19
|
+
parser.on( "--verbose", "--debug",
|
20
|
+
"turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
|
21
|
+
opts[:debug] = true
|
22
|
+
end
|
23
23
|
|
24
24
|
parser.on( "--metal",
|
25
25
|
"turn off typed parse tree; show to the metal tokens"+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
## (match) status
|
3
|
+
## note: english usage - cancelled (in UK), canceled (in US)
|
4
|
+
##
|
5
|
+
## add more variants - why? why not?
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
STATUS_RE = %r{
|
11
|
+
\[
|
12
|
+
### allow long forms with note/comment for some stati
|
13
|
+
(?: (?<status> awarded
|
14
|
+
|
|
15
|
+
annulled
|
16
|
+
|
|
17
|
+
abandoned
|
18
|
+
) [ ;,]* (?<status_note> [^\]]+ )
|
19
|
+
[ ]*
|
20
|
+
)
|
21
|
+
|
|
22
|
+
## short from only (no note/comments)
|
23
|
+
(?<status>
|
24
|
+
cancelled|canceled|can\.
|
25
|
+
|
|
26
|
+
abandoned|abd\.
|
27
|
+
|
|
28
|
+
postponed
|
29
|
+
|
|
30
|
+
awarded|awd\.
|
31
|
+
|
|
32
|
+
replay
|
33
|
+
|
|
34
|
+
annulled
|
35
|
+
)
|
36
|
+
\]
|
37
|
+
}ix
|
38
|
+
|
data/lib/sportdb/parser/token.rb
CHANGED
@@ -100,33 +100,6 @@ MINUTE_RE = %r{
|
|
100
100
|
}ix
|
101
101
|
|
102
102
|
|
103
|
-
## (match) status
|
104
|
-
## note: english usage - cancelled (in UK), canceled (in US)
|
105
|
-
##
|
106
|
-
## add more variants - why? why not?
|
107
|
-
|
108
|
-
STATUS_RE = %r{
|
109
|
-
(?<status>
|
110
|
-
\b
|
111
|
-
(?:
|
112
|
-
cancelled|canceled|can\.
|
113
|
-
|
|
114
|
-
abandoned|abd\.
|
115
|
-
|
|
116
|
-
postponed
|
117
|
-
|
|
118
|
-
awarded|awd\.
|
119
|
-
|
|
120
|
-
replay
|
121
|
-
)
|
122
|
-
(?=[ \]]|$)
|
123
|
-
)}ix
|
124
|
-
|
125
|
-
## todo/check: remove loakahead assertion here - why require space?
|
126
|
-
## note: \b works only after non-alphanum
|
127
|
-
## to make it work with awd. (dot) "custom" lookahead neeeded
|
128
|
-
|
129
|
-
|
130
103
|
## goal types
|
131
104
|
# (pen.) or (pen) or (p.) or (p)
|
132
105
|
## (o.g.) or (og)
|
@@ -146,8 +119,8 @@ GOAL_OG_RE = %r{
|
|
146
119
|
|
147
120
|
|
148
121
|
|
149
|
-
RE = Regexp.union(
|
150
|
-
|
122
|
+
RE = Regexp.union( STATUS_RE,
|
123
|
+
TIMEZONE_RE,
|
151
124
|
TIME_RE,
|
152
125
|
DURATION_RE, # note - duration MUST match before date
|
153
126
|
DATE_RE,
|
@@ -216,7 +189,11 @@ def tokenize_with_errors( line, typed: false,
|
|
216
189
|
elsif m[:text]
|
217
190
|
[:text, m[:text]] ## keep pos - why? why not?
|
218
191
|
elsif m[:status] ## (match) status e.g. cancelled, awarded, etc.
|
219
|
-
|
192
|
+
if m[:status_note] ## includes note? e.g. awarded; originally 2-0
|
193
|
+
[:status, m[:status], {note:m[:status_note]}]
|
194
|
+
else
|
195
|
+
[:status, m[:status]]
|
196
|
+
end
|
220
197
|
elsif m[:time]
|
221
198
|
if typed
|
222
199
|
## unify to iso-format
|
data/lib/sportdb/parser.rb
CHANGED
@@ -23,6 +23,7 @@ require_relative 'parser/version'
|
|
23
23
|
require_relative 'parser/token-score'
|
24
24
|
require_relative 'parser/token-date'
|
25
25
|
require_relative 'parser/token-text'
|
26
|
+
require_relative 'parser/token-status'
|
26
27
|
require_relative 'parser/token'
|
27
28
|
require_relative 'parser/lang'
|
28
29
|
require_relative 'parser/parser'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportdb-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocos
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/sportdb/parser/parser.rb
|
97
97
|
- lib/sportdb/parser/token-date.rb
|
98
98
|
- lib/sportdb/parser/token-score.rb
|
99
|
+
- lib/sportdb/parser/token-status.rb
|
99
100
|
- lib/sportdb/parser/token-text.rb
|
100
101
|
- lib/sportdb/parser/token.rb
|
101
102
|
- lib/sportdb/parser/version.rb
|