tc211-termbase 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/README.adoc +44 -16
- data/lib/tc211/termbase/concept.rb +16 -1
- data/lib/tc211/termbase/metadata_section.rb +3 -3
- data/lib/tc211/termbase/term.rb +21 -6
- data/lib/tc211/termbase/terminology_sheet.rb +4 -5
- data/lib/tc211/termbase/terms_section.rb +8 -5
- data/lib/tc211/termbase/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334d85a474eb94b302357c87554a846b3fe012d4c98ee5c0121aa4bf22941d21
|
4
|
+
data.tar.gz: d6b10206e2cf51a3d47bbdd2354931c90249557812a24ac7baf117f0f0e0c28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e7c5ed2adcac0d139fb2742471962d988ba66c7cb96ddb207fdfc29f4f5ea966a42c784c2f2714154fcd05df7c9785ef19cb44d9c399f0cdd8348c6077aa640
|
7
|
+
data.tar.gz: a5221df6f00e231d31d8fbe66b3faa76dcbc6caee4995b62a43e908ec7100fa74ac85af29c7f45fa00fd0c9b3106c1af48684ab4c99566f433467bad25306c24
|
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tc211-termbase (0.1.
|
4
|
+
tc211-termbase (0.1.1)
|
5
5
|
creek
|
6
6
|
iso-639
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
11
|
+
addressable (2.6.0)
|
12
12
|
public_suffix (>= 2.0.2, < 4.0)
|
13
|
-
creek (2.4.
|
14
|
-
http (~>
|
13
|
+
creek (2.4.4)
|
14
|
+
http (~> 4.0)
|
15
15
|
nokogiri (>= 1.7.0)
|
16
16
|
rubyzip (>= 1.0.0)
|
17
17
|
diff-lcs (1.3)
|
18
18
|
domain_name (0.5.20180417)
|
19
19
|
unf (>= 0.0.5, < 1.0.0)
|
20
|
-
http (
|
20
|
+
http (4.1.1)
|
21
21
|
addressable (~> 2.3)
|
22
22
|
http-cookie (~> 1.0)
|
23
23
|
http-form_data (~> 2.0)
|
@@ -27,10 +27,10 @@ GEM
|
|
27
27
|
http-form_data (2.1.1)
|
28
28
|
http_parser.rb (0.6.0)
|
29
29
|
iso-639 (0.2.8)
|
30
|
-
mini_portile2 (2.
|
31
|
-
nokogiri (1.
|
32
|
-
mini_portile2 (~> 2.
|
33
|
-
public_suffix (3.0
|
30
|
+
mini_portile2 (2.4.0)
|
31
|
+
nokogiri (1.10.3)
|
32
|
+
mini_portile2 (~> 2.4.0)
|
33
|
+
public_suffix (3.1.0)
|
34
34
|
rake (10.5.0)
|
35
35
|
rspec (3.8.0)
|
36
36
|
rspec-core (~> 3.8.0)
|
@@ -38,17 +38,17 @@ GEM
|
|
38
38
|
rspec-mocks (~> 3.8.0)
|
39
39
|
rspec-core (3.8.0)
|
40
40
|
rspec-support (~> 3.8.0)
|
41
|
-
rspec-expectations (3.8.
|
41
|
+
rspec-expectations (3.8.3)
|
42
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
43
|
rspec-support (~> 3.8.0)
|
44
44
|
rspec-mocks (3.8.0)
|
45
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
46
|
rspec-support (~> 3.8.0)
|
47
47
|
rspec-support (3.8.0)
|
48
|
-
rubyzip (1.2.
|
48
|
+
rubyzip (1.2.3)
|
49
49
|
unf (0.1.4)
|
50
50
|
unf_ext
|
51
|
-
unf_ext (0.0.7.
|
51
|
+
unf_ext (0.0.7.6)
|
52
52
|
|
53
53
|
PLATFORMS
|
54
54
|
ruby
|
@@ -60,4 +60,4 @@ DEPENDENCIES
|
|
60
60
|
tc211-termbase!
|
61
61
|
|
62
62
|
BUNDLED WITH
|
63
|
-
1.17.
|
63
|
+
1.17.3
|
data/README.adoc
CHANGED
@@ -1,37 +1,65 @@
|
|
1
|
-
=
|
1
|
+
= ISO/TC 211 Termbase programs
|
2
2
|
|
3
|
-
|
3
|
+
This gem is used for the creation and deployment of the ISO/TC 211 Termbase
|
4
|
+
located at https://terms.isotc211.com.
|
4
5
|
|
5
|
-
|
6
|
+
The repository for the site is located at:
|
6
7
|
|
7
|
-
|
8
|
+
* https://github.com/riboseinc/terms.isotc211.com
|
8
9
|
|
9
|
-
|
10
|
+
== Install
|
11
|
+
|
12
|
+
Add this line to your Gemfile:
|
13
|
+
|
14
|
+
[source,ruby]
|
15
|
+
----
|
10
16
|
gem 'tc211-termbase'
|
11
|
-
|
17
|
+
----
|
12
18
|
|
13
19
|
And then execute:
|
14
20
|
|
15
|
-
|
21
|
+
[source,sh]
|
22
|
+
----
|
23
|
+
$ bundle
|
24
|
+
----
|
16
25
|
|
17
26
|
Or install it yourself as:
|
18
27
|
|
19
|
-
|
28
|
+
[source,sh]
|
29
|
+
----
|
30
|
+
$ gem install tc211-termbase
|
31
|
+
----
|
32
|
+
|
20
33
|
|
21
34
|
== Usage
|
22
35
|
|
23
|
-
|
36
|
+
The gem comes with the following executables:
|
37
|
+
|
38
|
+
* `tc211-termbase-xlsx2yaml`: used to extract terms from the official
|
39
|
+
ISO/TC 211 terminology workbook, into ConceptYAML and TermYAML files.
|
40
|
+
|
41
|
+
|
42
|
+
=== Using `tc211-termbase-xlsx2yaml`
|
43
|
+
|
44
|
+
Run the following command:
|
45
|
+
|
46
|
+
[source,sh]
|
47
|
+
----
|
48
|
+
$ tc211-termbase-xlsx2yaml [termbase.xlsx]
|
49
|
+
----
|
24
50
|
|
25
|
-
|
51
|
+
Where,
|
26
52
|
|
27
|
-
|
53
|
+
* the ConceptCollection YAML will be created at `[termbase.yaml]` at
|
54
|
+
the current working directory;
|
28
55
|
|
29
|
-
|
56
|
+
* ConceptYAML files for each concept (each concept identified by a unique "`Term-ID`")
|
57
|
+
are created under the `concepts/` directory (based on the current working directory).
|
58
|
+
i.e. `concepts/concept-338.yaml`.
|
30
59
|
|
31
|
-
== Contributing
|
32
60
|
|
33
|
-
|
61
|
+
== Credits
|
34
62
|
|
35
|
-
|
63
|
+
This program is created and maintained by Ribose (the ISO/TC 211 Registration Authority)
|
64
|
+
in conjunction with the ISO/TC 211 Terminology Management Group (TMG).
|
36
65
|
|
37
|
-
Everyone interacting in the Tc211::Termbase project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/riboseinc/tc211-termbase/blob/master/CODE_OF_CONDUCT.md).
|
@@ -3,6 +3,7 @@ module Tc211::Termbase
|
|
3
3
|
class Concept < Hash
|
4
4
|
attr_accessor :id
|
5
5
|
attr_accessor :terms
|
6
|
+
DEFAULT_LANGUAGE = "eng"
|
6
7
|
|
7
8
|
def initialize(options={})
|
8
9
|
terms = options.delete(:terms) || []
|
@@ -19,8 +20,22 @@ class Concept < Hash
|
|
19
20
|
self[term.language_code] = term
|
20
21
|
end
|
21
22
|
|
23
|
+
def default_term
|
24
|
+
if self[DEFAULT_LANGUAGE]
|
25
|
+
self[DEFAULT_LANGUAGE]
|
26
|
+
else
|
27
|
+
puts "[tc211-termbase] term (lang: #{keys.first}, ID: #{id}) is missing a corresponding English term, probably needs updating."
|
28
|
+
self[keys.first]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def to_hash
|
23
|
-
|
33
|
+
default_hash = {
|
34
|
+
"term" => default_term.term,
|
35
|
+
"termid" => id
|
36
|
+
}
|
37
|
+
|
38
|
+
self.inject(default_hash) do |acc, (lang, term)|
|
24
39
|
acc.merge!(lang => term.to_hash)
|
25
40
|
end
|
26
41
|
end
|
@@ -33,9 +33,9 @@ class MetadataSection < SheetSection
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.match_header(row)
|
36
|
-
puts "row #{row}"
|
36
|
+
# puts "row #{row}"
|
37
37
|
row.inject(true) do |acc, (key, value)|
|
38
|
-
puts
|
38
|
+
# puts"#{key}, #{value}"
|
39
39
|
if GLOSSARY_HEADER_ROW_MATCH[key]
|
40
40
|
acc && GLOSSARY_HEADER_ROW_MATCH[key].include?(value)
|
41
41
|
else
|
@@ -53,7 +53,7 @@ class MetadataSection < SheetSection
|
|
53
53
|
attribute = {}
|
54
54
|
|
55
55
|
structure.each_pair do |key, value|
|
56
|
-
puts
|
56
|
+
# puts"#{key}, #{value}, #{row[key]}"
|
57
57
|
attribute_key = value
|
58
58
|
attribute_value = row[key]
|
59
59
|
next if attribute_value.nil?
|
data/lib/tc211/termbase/term.rb
CHANGED
@@ -32,9 +32,10 @@ class Term
|
|
32
32
|
@examples = []
|
33
33
|
@notes = []
|
34
34
|
|
35
|
-
puts "options #{options.inspect}"
|
35
|
+
# puts "options #{options.inspect}"
|
36
36
|
|
37
37
|
options.each_pair do |k, v|
|
38
|
+
v = v.strip if v.is_a?(String)
|
38
39
|
next unless v
|
39
40
|
case k
|
40
41
|
when /^example/
|
@@ -42,7 +43,7 @@ class Term
|
|
42
43
|
when /^note/
|
43
44
|
@notes << v
|
44
45
|
else
|
45
|
-
puts
|
46
|
+
# puts"Key #{k}"
|
46
47
|
key = k.gsub("-", "_")
|
47
48
|
self.send("#{key}=", v)
|
48
49
|
end
|
@@ -54,7 +55,7 @@ class Term
|
|
54
55
|
ATTRIBS.inject({}) do |acc, attrib|
|
55
56
|
value = self.send(attrib)
|
56
57
|
unless value.nil?
|
57
|
-
acc.merge(attrib => value)
|
58
|
+
acc.merge(attrib.to_s => value)
|
58
59
|
else
|
59
60
|
acc
|
60
61
|
end
|
@@ -64,8 +65,15 @@ class Term
|
|
64
65
|
# entry-status
|
65
66
|
## Must be one of notValid valid superseded retired
|
66
67
|
def entry_status=(value)
|
67
|
-
|
68
|
-
|
68
|
+
case value
|
69
|
+
when "有效的", "käytössä", "действующий", "válido"
|
70
|
+
value = "valid"
|
71
|
+
when "korvattu", "reemplazado"
|
72
|
+
value = "superseded"
|
73
|
+
when "информация отсутствует" # "information absent"!?
|
74
|
+
value = "retired"
|
75
|
+
when %w(notValid valid superseded retired)
|
76
|
+
# do nothing
|
69
77
|
end
|
70
78
|
@entry_status = value
|
71
79
|
end
|
@@ -73,8 +81,15 @@ class Term
|
|
73
81
|
# classification
|
74
82
|
## Must be one of the following: preferred admitted deprecated
|
75
83
|
def classification=(value)
|
76
|
-
|
84
|
+
case value
|
85
|
+
when ""
|
86
|
+
value = "admitted"
|
87
|
+
when "认可的", "допустимый", "admitido"
|
88
|
+
value = "admitted"
|
89
|
+
when "首选的", "suositettava", "suositeltava", "рекомендуемый", "preferente"
|
77
90
|
value = "preferred"
|
91
|
+
when %w(preferred admitted deprecated)
|
92
|
+
# do nothing
|
78
93
|
end
|
79
94
|
@classification = value
|
80
95
|
end
|
@@ -58,14 +58,13 @@ class TerminologySheet
|
|
58
58
|
@sections = []
|
59
59
|
sections_raw.each_with_index do |x,i|
|
60
60
|
|
61
|
-
puts "--------- Section #{i} ------"
|
62
61
|
section = if MetadataSection.match_header(x[0])
|
63
|
-
puts "
|
64
|
-
puts "rows: #{x.inspect}"
|
62
|
+
puts "--------- Section #{i} is a MetadataSection ---------"
|
63
|
+
# puts "rows: #{x.inspect}"
|
65
64
|
MetadataSection.new(x)
|
66
65
|
else
|
67
|
-
puts "
|
68
|
-
puts "rows: #{x.inspect}"
|
66
|
+
puts "--------- Section #{i} is a TermsSection ---------"
|
67
|
+
# puts "rows: #{x.inspect}"
|
69
68
|
TermsSection.new(x, {language_code: language_code})
|
70
69
|
end
|
71
70
|
|
@@ -18,11 +18,14 @@ class TermsSection < SheetSection
|
|
18
18
|
TERM_BODY_COLUMN_MAP = {
|
19
19
|
"Term_ID" => "id",
|
20
20
|
"Term" => "term",
|
21
|
-
"Term
|
22
|
-
|
21
|
+
"Term .OPERATING LANGUAGE." => "term",
|
22
|
+
# In the English sheet, column is named "Term Abbreviation"
|
23
|
+
"Term Abbreviation" => "abbrev",
|
24
|
+
# In other sheets, column named "Term_Abbreviation"
|
25
|
+
"Term_Abbreviation .OPERATING LANGUAGE." => "abbrev",
|
23
26
|
"Country code" => "country-code",
|
24
27
|
"Definition" => "definition",
|
25
|
-
"Term
|
28
|
+
"Term .OPERATING LANGUAGE - ALTERNATIVE CHARACTER SET." => "alt",
|
26
29
|
"Term in English" => nil,
|
27
30
|
"Entry Status" => "entry-status",
|
28
31
|
## Must be one of 'notValid' 'valid' 'superseded' 'retired'
|
@@ -84,7 +87,7 @@ class TermsSection < SheetSection
|
|
84
87
|
cleaned_value = value.gsub(/\s+/, ' ')
|
85
88
|
|
86
89
|
matches = TERM_BODY_COLUMN_MAP.map do |key, value|
|
87
|
-
puts "key #{key}, value #{value}"
|
90
|
+
# puts "key #{key}, value #{value}"
|
88
91
|
if cleaned_value[Regexp.new("^#{key}")]
|
89
92
|
[key, value]
|
90
93
|
end
|
@@ -121,7 +124,7 @@ class TermsSection < SheetSection
|
|
121
124
|
attributes = {}
|
122
125
|
|
123
126
|
structure.each_pair do |key, value|
|
124
|
-
puts "#{key}, #{value}, #{row[key]}"
|
127
|
+
# puts "#{key}, #{value}, #{row[key]}"
|
125
128
|
attribute_key = value
|
126
129
|
attribute_value = row[key]
|
127
130
|
next if attribute_value.nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tc211-termbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-639
|
@@ -129,8 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
|
-
|
133
|
-
rubygems_version: 2.7.7
|
132
|
+
rubygems_version: 3.0.3
|
134
133
|
signing_key:
|
135
134
|
specification_version: 4
|
136
135
|
summary: Build scripts for the ISO/TC 211 Termbase
|