termium 0.1.4 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +13 -0
- data/.github/workflows/{release.yaml → release.yml} +6 -3
- data/Gemfile +8 -0
- data/README.adoc +140 -6
- data/lib/termium/abbreviation.rb +4 -4
- data/lib/termium/cli.rb +6 -1
- data/lib/termium/core.rb +40 -19
- data/lib/termium/entry_term.rb +7 -6
- data/lib/termium/extract.rb +16 -5
- data/lib/termium/extract_language.rb +3 -3
- data/lib/termium/language_module.rb +15 -6
- data/lib/termium/parameter.rb +2 -2
- data/lib/termium/source.rb +4 -4
- data/lib/termium/source_ref.rb +2 -2
- data/lib/termium/subject.rb +3 -3
- data/lib/termium/textual_support.rb +6 -4
- data/lib/termium/universal_entry.rb +3 -3
- data/lib/termium/version.rb +1 -1
- data/lib/termium.rb +7 -3
- data/termium.gemspec +10 -14
- metadata +10 -52
- data/.github/workflows/main.yml +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38f41bac67c56e9aa6ec73f6ec79b729216cfdd677ed27d7317ea1bcd2363bc0
|
4
|
+
data.tar.gz: b69ed20d7a04e49f815a2714c4dc2d3c290af3ecce2b89f8eba9d63bedd85a09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cdfffe9d0e84f8af6a8724b82233646ac43351b9fa3107941de8a3754e5fe664c06bcf8841db0fe43aee606c7c66fef3c2dc29c0c2a137bba37125ed24dc83
|
7
|
+
data.tar.gz: 386cf6b5a8658f7a91686771f083558ef31483c3fd961cdb58860082505ba8d3fc066b684dc35157607438b36886d99689b36e245ccd71fb9d549de5673303f7
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
uses: relaton/support/.github/workflows/rake.yml@main
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
1
3
|
name: release
|
2
4
|
|
3
5
|
on:
|
@@ -5,17 +7,18 @@ on:
|
|
5
7
|
inputs:
|
6
8
|
next_version:
|
7
9
|
description: |
|
8
|
-
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
9
12
|
required: true
|
10
13
|
default: 'skip'
|
11
14
|
repository_dispatch:
|
12
15
|
types: [ do-release ]
|
13
16
|
|
17
|
+
|
14
18
|
jobs:
|
15
19
|
release:
|
16
|
-
uses:
|
20
|
+
uses: relaton/support/.github/workflows/release.yml@main
|
17
21
|
with:
|
18
22
|
next_version: ${{ github.event.inputs.next_version }}
|
19
23
|
secrets:
|
20
24
|
rubygems-api-key: ${{ secrets.GLOSSARIST_CI_RUBYGEMS_API_KEY }}
|
21
|
-
pat_token: ${{ secrets.GLOSSARIST_CI_PAT_TOKEN }}
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -6,20 +6,73 @@ The Termium Ruby gem parses export data formats from the
|
|
6
6
|
https://www.btb.termiumplus.gc.ca[TERMIUM Plus]
|
7
7
|
terminology database service from the Government of Canada.
|
8
8
|
|
9
|
+
== WARNING - Termium XML output requires manual correction
|
10
|
+
|
11
|
+
The default Termium XML output is invalid where the term domains using angular
|
12
|
+
brackets have the "greater than" sign not escaped:
|
13
|
+
|
14
|
+
[source,xml]
|
15
|
+
----
|
16
|
+
<textualSupport order="1" type="DEF">
|
17
|
+
<value><artificial intelligence> operation that allows the firing of a rule, or the
|
18
|
+
invocation of a program or a subprogram</value>
|
19
|
+
<sourceRef order="1" />
|
20
|
+
</textualSupport>
|
21
|
+
----
|
22
|
+
|
23
|
+
The remedy is to manually escape the "greater than" sign using a find/replace or a regular expression:
|
24
|
+
|
25
|
+
[source,ruby]
|
26
|
+
----
|
27
|
+
string.gsub(/<([^>]+)>/, '<\1>')
|
28
|
+
----
|
29
|
+
|
30
|
+
Results in:
|
31
|
+
|
32
|
+
[source,xml]
|
33
|
+
----
|
34
|
+
<textualSupport order="1" type="DEF">
|
35
|
+
<value><artificial intelligence> operation that allows the firing of a rule, or the
|
36
|
+
invocation of a program or a subprogram</value>
|
37
|
+
<sourceRef order="1" />
|
38
|
+
</textualSupport>
|
39
|
+
----
|
40
|
+
|
41
|
+
|
9
42
|
|
10
43
|
== Commands
|
11
44
|
|
12
|
-
`termium convert`:: Convert a TERMIUM Plus export XML file to a Glossarist dataset
|
45
|
+
`termium convert`:: Convert a TERMIUM Plus export XML file to a Paneron Glossarist dataset.
|
13
46
|
|
14
47
|
|
15
|
-
===
|
48
|
+
=== `termium convert`
|
49
|
+
|
50
|
+
==== Purpose
|
51
|
+
|
52
|
+
This command converts a TERMIUM Plus export XML (`<ns2:termium_extract>`) file
|
53
|
+
to a Paneron Glossarist dataset.
|
54
|
+
|
55
|
+
The resulting dataset will look like this:
|
56
|
+
|
57
|
+
[source]
|
58
|
+
----
|
59
|
+
{OUTPUT_PATH}/
|
60
|
+
├── concepts/
|
61
|
+
│ ├── {CONCEPT_ID}.yaml
|
62
|
+
│ ├── ...
|
63
|
+
├── localized_concepts/
|
64
|
+
├── {LOCALIZED_CONCEPT_ID}.yaml
|
65
|
+
├── ...
|
66
|
+
----
|
67
|
+
|
68
|
+
==== Usage
|
16
69
|
|
17
70
|
[source,sh]
|
18
71
|
----
|
19
|
-
$ termium convert -i INPUT_XML_FILE [-o OUTPUT_PATH]
|
72
|
+
$ termium convert -i INPUT_XML_FILE [-o OUTPUT_PATH] [-o DATE_ACCEPTED]
|
20
73
|
----
|
21
74
|
|
22
|
-
|
75
|
+
==== Options
|
23
76
|
|
24
77
|
[cols="a,a",options="header"]
|
25
78
|
|===
|
@@ -28,7 +81,7 @@ $ termium convert -i INPUT_XML_FILE [-o OUTPUT_PATH]
|
|
28
81
|
|`-i`, `--input-path`
|
29
82
|
|
|
30
83
|
Source path to TERMIUM Plus XML export file.
|
31
|
-
The file needs to start with the `<
|
84
|
+
The file needs to start with the `<ns2:termium_extract>` element.
|
32
85
|
|
33
86
|
|`-o`, `--output-path`
|
34
87
|
|
|
@@ -36,14 +89,95 @@ Destination path to Glossarist dataset directory.
|
|
36
89
|
If the directory doesn't exist it will be created.
|
37
90
|
If not provided, defaults to the basename of the input file, e.g. `foo/bar.xml` will export to `foo/bar/`.
|
38
91
|
|
92
|
+
|`--date-accepted`
|
93
|
+
|
|
94
|
+
Date of acceptance for the dataset. This fills in the `date_accepted` value of
|
95
|
+
the universal concept (which is exported to a YAML file).
|
96
|
+
|
39
97
|
|===
|
40
98
|
|
41
99
|
|
100
|
+
==== Examples
|
101
|
+
|
102
|
+
The data structures of these files can be seen in the following examples.
|
103
|
+
|
104
|
+
|
105
|
+
.Sample of `{CONCEPT_ID}.yaml`
|
106
|
+
[example]
|
107
|
+
====
|
108
|
+
This is `88a7dd87-6199-3516-9cec-f4cd79ff09c6.yaml`.
|
109
|
+
|
110
|
+
[source,yaml]
|
111
|
+
----
|
112
|
+
---
|
113
|
+
data:
|
114
|
+
identifier: '2120638'
|
115
|
+
localized_concepts:
|
116
|
+
eng: e114ee44-e601-5623-9099-48cfc2be2224
|
117
|
+
fre: 9a7b88cb-4ee6-5d59-89bb-230425a3c96a
|
118
|
+
related: []
|
119
|
+
date_accepted: 2015-05-01
|
120
|
+
status: valid
|
121
|
+
id: 88a7dd87-6199-3516-9cec-f4cd79ff09c6
|
122
|
+
----
|
123
|
+
====
|
124
|
+
|
125
|
+
.Sample of `{LOCALIZED_CONCEPT_ID}.yaml`
|
126
|
+
[example]
|
127
|
+
====
|
128
|
+
This is `e114ee44-e601-5623-9099-48cfc2be2224.yaml`.
|
129
|
+
|
130
|
+
[source,yaml]
|
131
|
+
----
|
132
|
+
---
|
133
|
+
data:
|
134
|
+
dates: []
|
135
|
+
definition:
|
136
|
+
- content: layer whose nodes directly communicate with external systems
|
137
|
+
examples: []
|
138
|
+
id: '2120638'
|
139
|
+
notes:
|
140
|
+
- content: 'visible layer: term and definition standardized by ISO/IEC [ISO/IEC
|
141
|
+
2382-34:1999].'
|
142
|
+
- content: 34.02.09 (2382)
|
143
|
+
sources:
|
144
|
+
- origin:
|
145
|
+
ref: ISO/IEC 2382-34:1999
|
146
|
+
type: lineage
|
147
|
+
status: identical
|
148
|
+
- origin:
|
149
|
+
ref: Ranger, Natalie * 2006 * Bureau de la traduction / Translation Bureau *
|
150
|
+
Services linguistiques / Linguistic Services * Bur. dir. Centre de traduction
|
151
|
+
et de terminologie / Dir's Office Translation and Terminology Centre * Div.
|
152
|
+
Citoyenneté et Protection civile / Citizen. & Emergency preparedness Div.
|
153
|
+
* Normalisation terminologique / Terminology Standardization
|
154
|
+
type: lineage
|
155
|
+
status: identical
|
156
|
+
terms:
|
157
|
+
- type: expression
|
158
|
+
normative_status: preferred
|
159
|
+
designation: visible layer
|
160
|
+
grammar_info:
|
161
|
+
- preposition: false
|
162
|
+
participle: false
|
163
|
+
adj: false
|
164
|
+
verb: false
|
165
|
+
adverb: false
|
166
|
+
noun: false
|
167
|
+
gender: []
|
168
|
+
number:
|
169
|
+
- singular
|
170
|
+
language_code: eng
|
171
|
+
----
|
172
|
+
====
|
173
|
+
|
174
|
+
|
175
|
+
|
42
176
|
== Library
|
43
177
|
|
44
178
|
=== Usage
|
45
179
|
|
46
|
-
This gem makes heavy use of the `
|
180
|
+
This gem makes heavy use of the `lutaml-model` classes for XML serialization.
|
47
181
|
|
48
182
|
The following code converts the Termium extract into a Glossarist dataset.
|
49
183
|
|
data/lib/termium/abbreviation.rb
CHANGED
@@ -6,9 +6,9 @@ require_relative "designation_operations"
|
|
6
6
|
|
7
7
|
module Termium
|
8
8
|
# For <abbreviation>
|
9
|
-
class Abbreviation <
|
10
|
-
attribute :order,
|
11
|
-
attribute :value,
|
9
|
+
class Abbreviation < Lutaml::Model::Serializable
|
10
|
+
attribute :order, :integer
|
11
|
+
attribute :value, :string
|
12
12
|
attribute :source_ref, SourceRef
|
13
13
|
attribute :parameter, Parameter, collection: true
|
14
14
|
include DesignationOperations
|
@@ -35,7 +35,7 @@ module Termium
|
|
35
35
|
set = {
|
36
36
|
"designation" => value,
|
37
37
|
"type" => "abbreviation",
|
38
|
-
"normative_status" => deprecated ? "deprecated" : "preferred"
|
38
|
+
"normative_status" => deprecated ? "deprecated" : "preferred",
|
39
39
|
}
|
40
40
|
|
41
41
|
# if geographical_area
|
data/lib/termium/cli.rb
CHANGED
@@ -9,6 +9,7 @@ module Termium
|
|
9
9
|
|
10
10
|
option :input_file, aliases: :i, required: true, desc: "Path to TERMIUM Plus XML extract"
|
11
11
|
option :output_file, aliases: :o, desc: "Output file path"
|
12
|
+
option :date_accepted, desc: "Date of acceptance for the dataset"
|
12
13
|
|
13
14
|
no_commands do
|
14
15
|
def input_file_as_path(input_file)
|
@@ -50,7 +51,11 @@ module Termium
|
|
50
51
|
puts "Size of TERMIUM dataset: #{termium_extract.core.size}"
|
51
52
|
|
52
53
|
puts "Converting to Glossarist..."
|
53
|
-
|
54
|
+
convert_options = {}
|
55
|
+
if options[:date_accepted]
|
56
|
+
convert_options[:date_accepted] = Date.parse(options[:date_accepted]).iso8601
|
57
|
+
end
|
58
|
+
glossarist_col = termium_extract.to_concept(convert_options)
|
54
59
|
# pp glossarist_col.first
|
55
60
|
|
56
61
|
output_path = output_dir_as_path(options[:output_file], input_path)
|
data/lib/termium/core.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "uuidtools"
|
3
4
|
require_relative "language_module"
|
4
5
|
require_relative "subject"
|
5
6
|
require_relative "universal_entry"
|
@@ -7,13 +8,13 @@ require_relative "source"
|
|
7
8
|
|
8
9
|
module Termium
|
9
10
|
# For <core>
|
10
|
-
class Core <
|
11
|
-
attribute :identification_number,
|
12
|
-
attribute :dissemination_level,
|
11
|
+
class Core < Lutaml::Model::Serializable
|
12
|
+
attribute :identification_number, :string
|
13
|
+
attribute :dissemination_level, :string
|
13
14
|
|
14
15
|
attribute :language_module, LanguageModule, collection: true
|
15
16
|
attribute :subject, Subject
|
16
|
-
attribute :universal_entry, UniversalEntry
|
17
|
+
attribute :universal_entry, UniversalEntry, collection: true
|
17
18
|
attribute :source, Source, collection: true
|
18
19
|
|
19
20
|
xml do
|
@@ -36,25 +37,45 @@ module Termium
|
|
36
37
|
source.map(&:to_concept_source)
|
37
38
|
end
|
38
39
|
|
40
|
+
# Deterministic v4 UUID by using the number string
|
41
|
+
def uuid(str = identification_number)
|
42
|
+
UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, str).to_s
|
43
|
+
end
|
44
|
+
|
39
45
|
# TODO: Utilize "subject" in the Glossarist object:
|
40
46
|
# <subject abbreviation="YBB"
|
41
47
|
# details="Compartment - ISO/IEC JTC 1 Information Technology Vocabulary" />
|
42
|
-
def to_concept
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
localized_concept.notes << Glossarist::DetailedDefinition.new(universal_entry.value)
|
53
|
-
localized_concept.sources = concept_sources
|
54
|
-
concept.add_localization(localized_concept)
|
55
|
-
end
|
48
|
+
def to_concept(options = {})
|
49
|
+
Glossarist::ManagedConcept.new.tap do |concept|
|
50
|
+
# The way to set the universal concept's identifier: data.identifier
|
51
|
+
concept.id = identification_number
|
52
|
+
|
53
|
+
concept.uuid = uuid
|
54
|
+
|
55
|
+
# Assume no related concepts
|
56
|
+
concept.related = []
|
57
|
+
concept.status = "valid"
|
56
58
|
|
57
|
-
|
59
|
+
if options[:date_accepted]
|
60
|
+
concept.date_accepted = options[:date_accepted]
|
61
|
+
end
|
62
|
+
|
63
|
+
language_module.map do |lang_mod|
|
64
|
+
localized_concept = lang_mod.to_concept(options)
|
65
|
+
|
66
|
+
# TODO: This is needed to skip the empty french entries of 10031781 and 10031778
|
67
|
+
next if localized_concept.nil?
|
68
|
+
|
69
|
+
localized_concept.id = identification_number
|
70
|
+
localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}")
|
71
|
+
|
72
|
+
universal_entry.each do |entry|
|
73
|
+
localized_concept.notes << entry.value
|
74
|
+
end
|
75
|
+
localized_concept.sources = concept_sources
|
76
|
+
concept.add_localization(localized_concept)
|
77
|
+
end
|
78
|
+
end
|
58
79
|
end
|
59
80
|
end
|
60
81
|
end
|
data/lib/termium/entry_term.rb
CHANGED
@@ -7,9 +7,9 @@ require_relative "designation_operations"
|
|
7
7
|
|
8
8
|
module Termium
|
9
9
|
# For <entryTerm>
|
10
|
-
class EntryTerm <
|
11
|
-
attribute :order,
|
12
|
-
attribute :value,
|
10
|
+
class EntryTerm < Lutaml::Model::Serializable
|
11
|
+
attribute :order, :integer
|
12
|
+
attribute :value, :string
|
13
13
|
attribute :source_ref, SourceRef
|
14
14
|
attribute :abbreviation, Abbreviation, collection: true
|
15
15
|
attribute :parameter, Parameter, collection: true
|
@@ -19,9 +19,9 @@ module Termium
|
|
19
19
|
root "entryTerm"
|
20
20
|
map_attribute "order", to: :order
|
21
21
|
map_attribute "value", to: :value
|
22
|
-
map_element "abbreviation", to: :abbreviation
|
23
22
|
map_element "sourceRef", to: :source_ref
|
24
23
|
map_element "parameter", to: :parameter
|
24
|
+
map_element "abbreviation", to: :abbreviation
|
25
25
|
end
|
26
26
|
|
27
27
|
# attr_accessor :geographical_area,
|
@@ -35,8 +35,9 @@ module Termium
|
|
35
35
|
"CAN" => "CA",
|
36
36
|
"GB" => "GB",
|
37
37
|
"AUS" => "AU",
|
38
|
-
"EUR" => "EU"
|
38
|
+
"EUR" => "EU",
|
39
39
|
}.freeze
|
40
|
+
|
40
41
|
def geographical_area
|
41
42
|
keys = GEOGRAPHICAL_CODE_MAPPING.keys
|
42
43
|
usage = parameter.select do |x|
|
@@ -72,7 +73,7 @@ module Termium
|
|
72
73
|
set = {
|
73
74
|
"designation" => value,
|
74
75
|
"type" => "expression",
|
75
|
-
"normative_status" => normative_status
|
76
|
+
"normative_status" => normative_status,
|
76
77
|
}
|
77
78
|
|
78
79
|
set["geographical_area"] = geographical_area if geographical_area
|
data/lib/termium/extract.rb
CHANGED
@@ -5,23 +5,34 @@ require_relative "core"
|
|
5
5
|
|
6
6
|
module Termium
|
7
7
|
# For <extract>
|
8
|
-
class Extract <
|
9
|
-
attribute :language,
|
8
|
+
class Extract < Lutaml::Model::Serializable
|
9
|
+
attribute :language, :string
|
10
10
|
attribute :extract_language, ExtractLanguage, collection: true
|
11
11
|
attribute :core, Core, collection: true
|
12
12
|
|
13
13
|
xml do
|
14
14
|
root "termium_extract"
|
15
|
-
# namespace
|
15
|
+
# namespace "http://termium.tpsgc-pwgsc.gc.ca/schemas/2012/06/Termium", "ns2"
|
16
16
|
|
17
17
|
map_attribute "language", to: :language
|
18
18
|
map_element "extractLanguage", to: :extract_language
|
19
19
|
map_element "core", to: :core
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
# xml do
|
23
|
+
# root "termium_extract"
|
24
|
+
# namespace "http://termium.tpsgc-pwgsc.gc.ca/schemas/2012/06/Termium", "ns2"
|
25
|
+
|
26
|
+
# map_attribute "language", to: :language, namespace: nil
|
27
|
+
# map_element "extractLanguage", to: :extract_language, namespace: nil
|
28
|
+
# map_element "core", to: :core, namespace: nil
|
29
|
+
# end
|
30
|
+
|
31
|
+
def to_concept(options = {})
|
23
32
|
coll = Glossarist::ManagedConceptCollection.new
|
24
|
-
coll.managed_concepts = core.map
|
33
|
+
coll.managed_concepts = core.map do |managed_concept|
|
34
|
+
managed_concept.to_concept(options)
|
35
|
+
end
|
25
36
|
coll
|
26
37
|
end
|
27
38
|
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Termium
|
4
4
|
# For <extractLanguage>
|
5
|
-
class ExtractLanguage <
|
6
|
-
attribute :language,
|
7
|
-
attribute :order,
|
5
|
+
class ExtractLanguage < Lutaml::Model::Serializable
|
6
|
+
attribute :language, :string
|
7
|
+
attribute :order, :integer
|
8
8
|
xml do
|
9
9
|
root "extractLanguage"
|
10
10
|
map_attribute "language", to: :language
|
@@ -5,8 +5,8 @@ require_relative "textual_support"
|
|
5
5
|
|
6
6
|
module Termium
|
7
7
|
# For <languageModule>
|
8
|
-
class LanguageModule <
|
9
|
-
attribute :language,
|
8
|
+
class LanguageModule < Lutaml::Model::Serializable
|
9
|
+
attribute :language, :string
|
10
10
|
attribute :entry_term, EntryTerm, collection: true
|
11
11
|
attribute :textual_support, TextualSupport, collection: true
|
12
12
|
xml do
|
@@ -42,7 +42,7 @@ module Termium
|
|
42
42
|
|
43
43
|
LANGUAGE_CODE_MAPPING = {
|
44
44
|
"en" => "eng",
|
45
|
-
"fr" => "fre"
|
45
|
+
"fr" => "fre",
|
46
46
|
}.freeze
|
47
47
|
|
48
48
|
def designations
|
@@ -59,7 +59,8 @@ module Termium
|
|
59
59
|
"terms" => designations.map(&:to_h),
|
60
60
|
"definition" => [{ content: definition }],
|
61
61
|
"notes" => notes,
|
62
|
-
"examples" => examples
|
62
|
+
"examples" => examples,
|
63
|
+
"entry_status" => "valid",
|
63
64
|
}
|
64
65
|
|
65
66
|
src["domain"] = domain if domain
|
@@ -67,11 +68,19 @@ module Termium
|
|
67
68
|
src
|
68
69
|
end
|
69
70
|
|
70
|
-
def to_concept
|
71
|
+
def to_concept(options = {})
|
71
72
|
x = to_h
|
72
73
|
return nil unless x
|
73
74
|
|
74
|
-
Glossarist::LocalizedConcept.new(x)
|
75
|
+
Glossarist::LocalizedConcept.new(x).tap do |concept|
|
76
|
+
# Fill in register parameters
|
77
|
+
if options[:date_accepted]
|
78
|
+
puts options[:date_accepted].inspect
|
79
|
+
concept.date_accepted = options[:date_accepted]
|
80
|
+
end
|
81
|
+
|
82
|
+
puts concept.inspect
|
83
|
+
end
|
75
84
|
end
|
76
85
|
end
|
77
86
|
end
|
data/lib/termium/parameter.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Termium
|
4
4
|
# For <parameter>
|
5
|
-
class Parameter <
|
5
|
+
class Parameter < Lutaml::Model::Serializable
|
6
6
|
# <parameter abbreviation="NORM"/>
|
7
|
-
attribute :abbreviation,
|
7
|
+
attribute :abbreviation, :string
|
8
8
|
xml do
|
9
9
|
root "parameter"
|
10
10
|
map_attribute "abbreviation", to: :abbreviation
|
data/lib/termium/source.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Termium
|
4
4
|
# For <source>
|
5
|
-
class Source <
|
5
|
+
class Source < Lutaml::Model::Serializable
|
6
6
|
ISO_BIB_REGEX = /\AISO-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze
|
7
7
|
ISOIEC_BIB_REGEX = /\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s+.*/.freeze
|
8
8
|
|
9
|
-
attribute :order,
|
10
|
-
attribute :details,
|
9
|
+
attribute :order, :integer
|
10
|
+
attribute :details, :string
|
11
11
|
xml do
|
12
12
|
root "source"
|
13
13
|
map_attribute "order", to: :order
|
@@ -28,7 +28,7 @@ module Termium
|
|
28
28
|
Glossarist::ConceptSource.new({
|
29
29
|
"type" => "lineage",
|
30
30
|
"ref" => content,
|
31
|
-
"status" => "identical"
|
31
|
+
"status" => "identical",
|
32
32
|
})
|
33
33
|
end
|
34
34
|
end
|
data/lib/termium/source_ref.rb
CHANGED
data/lib/termium/subject.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
module Termium
|
4
4
|
# For <subject>
|
5
|
-
class Subject <
|
6
|
-
attribute :abbreviation,
|
7
|
-
attribute :details,
|
5
|
+
class Subject < Lutaml::Model::Serializable
|
6
|
+
attribute :abbreviation, :string
|
7
|
+
attribute :details, :string
|
8
8
|
|
9
9
|
# <subject abbreviation="YBB" details="Compartment - ISO/IEC JTC 1 Information Technology Vocabulary"/>
|
10
10
|
xml do
|
@@ -4,10 +4,10 @@ require_relative "source_ref"
|
|
4
4
|
|
5
5
|
module Termium
|
6
6
|
# For <textualSupport>
|
7
|
-
class TextualSupport <
|
8
|
-
attribute :order,
|
9
|
-
attribute :type,
|
10
|
-
attribute :value,
|
7
|
+
class TextualSupport < Lutaml::Model::Serializable
|
8
|
+
attribute :order, :integer
|
9
|
+
attribute :type, :string
|
10
|
+
attribute :value, :string
|
11
11
|
attribute :source_ref, SourceRef
|
12
12
|
xml do
|
13
13
|
root "textualSupport"
|
@@ -32,6 +32,7 @@ module Termium
|
|
32
32
|
end
|
33
33
|
|
34
34
|
EXAMPLE_REGEX = /\AEx[ea]mples?\s*:\s*/.freeze
|
35
|
+
|
35
36
|
def is_example?
|
36
37
|
value_cleaned.match(EXAMPLE_REGEX)
|
37
38
|
end
|
@@ -53,6 +54,7 @@ module Termium
|
|
53
54
|
end
|
54
55
|
|
55
56
|
DEFINITION_REGEX = /\A<(.+?)>\s*/.freeze
|
57
|
+
|
56
58
|
def value_definition
|
57
59
|
value_cleaned.gsub(DEFINITION_REGEX, "")
|
58
60
|
end
|
@@ -5,9 +5,9 @@ require_relative "parameter"
|
|
5
5
|
|
6
6
|
module Termium
|
7
7
|
# For <universalEntry>
|
8
|
-
class UniversalEntry <
|
9
|
-
attribute :order,
|
10
|
-
attribute :value,
|
8
|
+
class UniversalEntry < Lutaml::Model::Serializable
|
9
|
+
attribute :order, :integer
|
10
|
+
attribute :value, :string
|
11
11
|
attribute :source_ref, SourceRef
|
12
12
|
attribute :parameter, Parameter
|
13
13
|
|
data/lib/termium/version.rb
CHANGED
data/lib/termium.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "glossarist"
|
4
|
-
|
5
|
-
require "
|
6
|
-
|
4
|
+
|
5
|
+
require "lutaml/model"
|
6
|
+
require "lutaml/model/xml_adapter/nokogiri_adapter"
|
7
|
+
|
8
|
+
Lutaml::Model::Config.configure do |config|
|
9
|
+
config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
|
10
|
+
end
|
7
11
|
|
8
12
|
module Termium
|
9
13
|
class Error < StandardError; end
|
data/termium.gemspec
CHANGED
@@ -12,10 +12,10 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.authors = ["Ribose"]
|
13
13
|
spec.email = ["open.source@ribose.com"]
|
14
14
|
|
15
|
-
spec.summary
|
15
|
+
spec.summary =
|
16
16
|
"Parser for the TERMIUM Plus terminology database of the Government of Canada"
|
17
|
-
spec.homepage
|
18
|
-
spec.license
|
17
|
+
spec.homepage = "https://github.com/glossarist/termium"
|
18
|
+
spec.license = "BSD-2-Clause"
|
19
19
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -23,19 +23,15 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
24
24
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
26
|
-
spec.files
|
27
|
-
|
26
|
+
spec.files = all_files_in_git
|
27
|
+
.reject { |f| f.match(%r{\A(?:test|spec|features|bin|\.)/}) }
|
28
28
|
|
29
|
-
spec.bindir
|
30
|
-
spec.executables
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
-
spec.add_dependency "glossarist", "~> 2.
|
34
|
-
spec.add_dependency "
|
33
|
+
spec.add_dependency "glossarist", "~> 2.2"
|
34
|
+
spec.add_dependency "lutaml-model"
|
35
35
|
spec.add_dependency "thor"
|
36
|
-
|
37
|
-
spec.add_development_dependency "pry", "~> 0.14.0"
|
38
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
39
|
-
spec.add_development_dependency "rspec", "~> 3.10"
|
40
|
-
spec.add_development_dependency "rubocop"
|
36
|
+
spec.add_dependency "uuidtools"
|
41
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: termium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.2
|
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: 2024-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glossarist
|
@@ -16,16 +16,16 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: lutaml-model
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -53,55 +53,13 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.14.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.14.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '13.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '13.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.10'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.10'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
56
|
+
name: uuidtools
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - ">="
|
102
60
|
- !ruby/object:Gem::Version
|
103
61
|
version: '0'
|
104
|
-
type: :
|
62
|
+
type: :runtime
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
@@ -116,8 +74,8 @@ executables:
|
|
116
74
|
extensions: []
|
117
75
|
extra_rdoc_files: []
|
118
76
|
files:
|
119
|
-
- ".github/workflows/
|
120
|
-
- ".github/workflows/release.
|
77
|
+
- ".github/workflows/rake.yml"
|
78
|
+
- ".github/workflows/release.yml"
|
121
79
|
- ".gitignore"
|
122
80
|
- ".rspec"
|
123
81
|
- CODE_OF_CONDUCT.md
|
@@ -165,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
123
|
- !ruby/object:Gem::Version
|
166
124
|
version: '0'
|
167
125
|
requirements: []
|
168
|
-
rubygems_version: 3.3.
|
126
|
+
rubygems_version: 3.3.27
|
169
127
|
signing_key:
|
170
128
|
specification_version: 4
|
171
129
|
summary: Parser for the TERMIUM Plus terminology database of the Government of Canada
|
data/.github/workflows/main.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
|
8
|
-
pull_request:
|
9
|
-
|
10
|
-
jobs:
|
11
|
-
build:
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
name: Ruby ${{ matrix.ruby }}
|
14
|
-
strategy:
|
15
|
-
matrix:
|
16
|
-
ruby:
|
17
|
-
- '3.1.2'
|
18
|
-
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@v3
|
21
|
-
- name: Set up Ruby
|
22
|
-
uses: ruby/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
bundler-cache: true
|
26
|
-
- name: Run the default task
|
27
|
-
run: bundle exec rake
|