termium 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +5 -1
- data/.gitignore +5 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +189 -0
- data/Gemfile +7 -6
- data/README.adoc +4 -4
- data/Rakefile +1 -1
- data/lib/termium/abbreviation.rb +1 -5
- data/lib/termium/cli.rb +5 -3
- data/lib/termium/core.rb +4 -6
- data/lib/termium/designation_operations.rb +2 -2
- data/lib/termium/entry_term.rb +2 -7
- data/lib/termium/extract.rb +3 -14
- data/lib/termium/extract_language.rb +1 -1
- data/lib/termium/language_module.rb +4 -6
- data/lib/termium/namespace.rb +10 -0
- data/lib/termium/parameter.rb +1 -1
- data/lib/termium/source.rb +3 -3
- data/lib/termium/source_ref.rb +1 -1
- data/lib/termium/subject.rb +1 -1
- data/lib/termium/textual_support.rb +3 -5
- data/lib/termium/universal_entry.rb +1 -4
- data/lib/termium/version.rb +1 -1
- data/lib/termium.rb +16 -22
- data/termium.gemspec +3 -2
- metadata +13 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c6b7569853f4c7b83bced60d4788ea5e3e82d72813640ed7320e34fa20f36b0
|
|
4
|
+
data.tar.gz: eb30221b2e85f057a4fc5dd109cec31318fc89bdc06493c6573b80b8a142680b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4192d75896042ea78ebf75b0571e80c4a937f6cb1deaf5ba0636978475be202491a3c439f5a58634f13382fa2efb3681169432eda2e4f2c875e98b210f59d5c4
|
|
7
|
+
data.tar.gz: 51f3424870aa511c10b424c7082198e67d5e21c8a91308d4ba027e44127eaafc1fdc9027b80102594020bed3d0e1ab664d7384915f18e4254a87d9876134ae19
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
name: release
|
|
4
4
|
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
id-token: write
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
5
10
|
on:
|
|
6
11
|
workflow_dispatch:
|
|
7
12
|
inputs:
|
|
@@ -14,7 +19,6 @@ on:
|
|
|
14
19
|
repository_dispatch:
|
|
15
20
|
types: [ do-release ]
|
|
16
21
|
|
|
17
|
-
|
|
18
22
|
jobs:
|
|
19
23
|
release:
|
|
20
24
|
uses: relaton/support/.github/workflows/release.yml@main
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
inherit_from:
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
|
+
- .rubocop_todo.yml
|
|
6
|
+
|
|
7
|
+
inherit_mode:
|
|
8
|
+
merge:
|
|
9
|
+
- Exclude
|
|
10
|
+
|
|
11
|
+
# local repo-specific modifications
|
|
12
|
+
# ...
|
|
13
|
+
plugins:
|
|
14
|
+
- rubocop-rspec
|
|
15
|
+
- rubocop-performance
|
|
16
|
+
- rubocop-rake
|
|
17
|
+
|
|
18
|
+
AllCops:
|
|
19
|
+
TargetRubyVersion: 3.0
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2026-03-24 03:26:08 UTC using RuboCop version 1.86.0.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
Gemspec/RequireMFA:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'termium.gemspec'
|
|
14
|
+
|
|
15
|
+
# Offense count: 1
|
|
16
|
+
Gemspec/RequiredRubyVersion:
|
|
17
|
+
Exclude:
|
|
18
|
+
- 'termium.gemspec'
|
|
19
|
+
|
|
20
|
+
# Offense count: 1
|
|
21
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
22
|
+
# Configuration parameters: IndentationWidth.
|
|
23
|
+
Layout/AssignmentIndentation:
|
|
24
|
+
Exclude:
|
|
25
|
+
- 'lib/termium/cli.rb'
|
|
26
|
+
|
|
27
|
+
# Offense count: 1
|
|
28
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
29
|
+
# Configuration parameters: EnforcedStyle.
|
|
30
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
|
31
|
+
Layout/EmptyLinesAroundBlockBody:
|
|
32
|
+
Exclude:
|
|
33
|
+
- 'spec/termium_spec.rb'
|
|
34
|
+
|
|
35
|
+
# Offense count: 1
|
|
36
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
37
|
+
# Configuration parameters: EnforcedStyle.
|
|
38
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
39
|
+
Layout/EmptyLinesAroundModuleBody:
|
|
40
|
+
Exclude:
|
|
41
|
+
- 'lib/termium.rb'
|
|
42
|
+
|
|
43
|
+
# Offense count: 1
|
|
44
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
45
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
46
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
47
|
+
# SupportedColonStyles: key, separator, table
|
|
48
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
49
|
+
Layout/HashAlignment:
|
|
50
|
+
Exclude:
|
|
51
|
+
- 'lib/termium/cli.rb'
|
|
52
|
+
|
|
53
|
+
# Offense count: 1
|
|
54
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
55
|
+
# Configuration parameters: EnforcedStyle.
|
|
56
|
+
# SupportedStyles: normal, indented_internal_methods
|
|
57
|
+
Layout/IndentationConsistency:
|
|
58
|
+
Exclude:
|
|
59
|
+
- 'termium.gemspec'
|
|
60
|
+
|
|
61
|
+
# Offense count: 1
|
|
62
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
63
|
+
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment, AllowRBSInlineAnnotation, AllowSteepAnnotation.
|
|
64
|
+
Layout/LeadingCommentSpace:
|
|
65
|
+
Exclude:
|
|
66
|
+
- 'Rakefile'
|
|
67
|
+
|
|
68
|
+
# Offense count: 15
|
|
69
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
70
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
71
|
+
# URISchemes: http, https
|
|
72
|
+
Layout/LineLength:
|
|
73
|
+
Exclude:
|
|
74
|
+
- 'lib/termium/cli.rb'
|
|
75
|
+
- 'lib/termium/core.rb'
|
|
76
|
+
- 'lib/termium/language_module.rb'
|
|
77
|
+
- 'lib/termium/subject.rb'
|
|
78
|
+
- 'lib/termium/textual_support.rb'
|
|
79
|
+
- 'spec/termium_spec.rb'
|
|
80
|
+
- 'termium.gemspec'
|
|
81
|
+
|
|
82
|
+
# Offense count: 1
|
|
83
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
84
|
+
# Configuration parameters: EnforcedStyle.
|
|
85
|
+
# SupportedStyles: final_newline, final_blank_line
|
|
86
|
+
Layout/TrailingEmptyLines:
|
|
87
|
+
Exclude:
|
|
88
|
+
- 'lib/termium.rb'
|
|
89
|
+
|
|
90
|
+
# Offense count: 2
|
|
91
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
92
|
+
# Configuration parameters: AllowInHeredoc.
|
|
93
|
+
Layout/TrailingWhitespace:
|
|
94
|
+
Exclude:
|
|
95
|
+
- 'lib/termium/cli.rb'
|
|
96
|
+
|
|
97
|
+
# Offense count: 3
|
|
98
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
99
|
+
Metrics/AbcSize:
|
|
100
|
+
Exclude:
|
|
101
|
+
- 'lib/termium/cli.rb'
|
|
102
|
+
- 'lib/termium/core.rb'
|
|
103
|
+
- 'lib/termium/entry_term.rb'
|
|
104
|
+
|
|
105
|
+
# Offense count: 4
|
|
106
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
107
|
+
Metrics/MethodLength:
|
|
108
|
+
Max: 23
|
|
109
|
+
|
|
110
|
+
# Offense count: 2
|
|
111
|
+
# Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
|
|
112
|
+
# AllowedMethods: call
|
|
113
|
+
# WaywardPredicates: infinite?, nonzero?
|
|
114
|
+
Naming/PredicateMethod:
|
|
115
|
+
Exclude:
|
|
116
|
+
- 'lib/termium/abbreviation.rb'
|
|
117
|
+
- 'lib/termium/entry_term.rb'
|
|
118
|
+
|
|
119
|
+
# Offense count: 4
|
|
120
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
121
|
+
# NamePrefix: is_, has_, have_, does_
|
|
122
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
123
|
+
# AllowedMethods: is_a?
|
|
124
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
125
|
+
Naming/PredicatePrefix:
|
|
126
|
+
Exclude:
|
|
127
|
+
- 'lib/termium/textual_support.rb'
|
|
128
|
+
|
|
129
|
+
# Offense count: 4
|
|
130
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
131
|
+
RSpec/EmptyLineAfterFinalLet:
|
|
132
|
+
Exclude:
|
|
133
|
+
- 'spec/termium/extract_spec.rb'
|
|
134
|
+
- 'spec/termium_spec.rb'
|
|
135
|
+
|
|
136
|
+
# Offense count: 1
|
|
137
|
+
# Configuration parameters: CountAsOne.
|
|
138
|
+
RSpec/ExampleLength:
|
|
139
|
+
Max: 8
|
|
140
|
+
|
|
141
|
+
# Offense count: 1
|
|
142
|
+
# Configuration parameters: AllowedPatterns.
|
|
143
|
+
# AllowedPatterns: ^expect_, ^assert_
|
|
144
|
+
RSpec/NoExpectationExample:
|
|
145
|
+
Exclude:
|
|
146
|
+
- 'spec/termium_spec.rb'
|
|
147
|
+
|
|
148
|
+
# Offense count: 2
|
|
149
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
150
|
+
Security/IoMethods:
|
|
151
|
+
Exclude:
|
|
152
|
+
- 'lib/termium/cli.rb'
|
|
153
|
+
- 'spec/termium_spec.rb'
|
|
154
|
+
|
|
155
|
+
# Offense count: 1
|
|
156
|
+
Style/ItAssignment:
|
|
157
|
+
Exclude:
|
|
158
|
+
- 'spec/spec_helper.rb'
|
|
159
|
+
|
|
160
|
+
# Offense count: 4
|
|
161
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
162
|
+
Style/RedundantFreeze:
|
|
163
|
+
Exclude:
|
|
164
|
+
- 'lib/termium/source.rb'
|
|
165
|
+
- 'lib/termium/textual_support.rb'
|
|
166
|
+
|
|
167
|
+
# Offense count: 2
|
|
168
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
169
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
170
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
171
|
+
Style/StringLiterals:
|
|
172
|
+
Exclude:
|
|
173
|
+
- 'termium.gemspec'
|
|
174
|
+
|
|
175
|
+
# Offense count: 1
|
|
176
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
177
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
178
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
179
|
+
Style/TrailingCommaInArguments:
|
|
180
|
+
Exclude:
|
|
181
|
+
- 'spec/support/shared_examples.rb'
|
|
182
|
+
|
|
183
|
+
# Offense count: 2
|
|
184
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
185
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
|
186
|
+
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
187
|
+
Style/TrailingCommaInHashLiteral:
|
|
188
|
+
Exclude:
|
|
189
|
+
- 'lib/termium/designation_operations.rb'
|
data/Gemfile
CHANGED
|
@@ -4,10 +4,11 @@ source "https://rubygems.org"
|
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
gem "
|
|
8
|
-
gem "
|
|
7
|
+
gem "canon"
|
|
8
|
+
gem "lutaml-model", github: "lutaml/lutaml-model", ref: "main"
|
|
9
9
|
gem "rake", "~> 13.0"
|
|
10
|
-
gem "rspec"
|
|
11
|
-
gem "rubocop"
|
|
12
|
-
gem "rubocop-performance"
|
|
13
|
-
gem "
|
|
10
|
+
gem "rspec"
|
|
11
|
+
gem "rubocop"
|
|
12
|
+
gem "rubocop-performance"
|
|
13
|
+
gem "rubocop-rake"
|
|
14
|
+
gem "rubocop-rspec"
|
data/README.adoc
CHANGED
|
@@ -58,11 +58,11 @@ The resulting dataset will look like this:
|
|
|
58
58
|
----
|
|
59
59
|
{OUTPUT_PATH}/
|
|
60
60
|
├── concepts/
|
|
61
|
-
│
|
|
62
|
-
│
|
|
61
|
+
│ ├── {CONCEPT_ID}.yaml
|
|
62
|
+
│ ├── ...
|
|
63
63
|
├── localized_concepts/
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
├── {LOCALIZED_CONCEPT_ID}.yaml
|
|
65
|
+
├── ...
|
|
66
66
|
----
|
|
67
67
|
|
|
68
68
|
==== Usage
|
data/Rakefile
CHANGED
data/lib/termium/abbreviation.rb
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "source_ref"
|
|
4
|
-
require_relative "parameter"
|
|
5
|
-
require_relative "designation_operations"
|
|
6
|
-
|
|
7
3
|
module Termium
|
|
8
4
|
# For <abbreviation>
|
|
9
5
|
class Abbreviation < Lutaml::Model::Serializable
|
|
@@ -20,7 +16,7 @@ module Termium
|
|
|
20
16
|
# <parameter abbreviation="NORM" />
|
|
21
17
|
|
|
22
18
|
xml do
|
|
23
|
-
|
|
19
|
+
element "abbreviation"
|
|
24
20
|
map_attribute "order", to: :order
|
|
25
21
|
map_attribute "value", to: :value
|
|
26
22
|
map_element "sourceRef", to: :source_ref
|
data/lib/termium/cli.rb
CHANGED
|
@@ -7,7 +7,8 @@ module Termium
|
|
|
7
7
|
class Cli < Thor
|
|
8
8
|
desc "convert", "Convert TERMIUM entries into a Glossarist dataset"
|
|
9
9
|
|
|
10
|
-
option :input_file, aliases: :i, required: true,
|
|
10
|
+
option :input_file, aliases: :i, required: true,
|
|
11
|
+
desc: "Path to TERMIUM Plus XML extract"
|
|
11
12
|
option :output_file, aliases: :o, desc: "Output file path"
|
|
12
13
|
option :date_accepted, desc: "Date of acceptance for the dataset"
|
|
13
14
|
|
|
@@ -46,14 +47,15 @@ module Termium
|
|
|
46
47
|
input_path = input_file_as_path(options[:input_file])
|
|
47
48
|
|
|
48
49
|
puts "Reading TERMIUM export file: #{input_path.relative_path_from(Dir.pwd)}"
|
|
49
|
-
termium_extract = Termium::Extract.from_xml(
|
|
50
|
+
termium_extract = Termium::Extract.from_xml(File.read(input_path.expand_path))
|
|
50
51
|
|
|
51
52
|
puts "Size of TERMIUM dataset: #{termium_extract.core.size}"
|
|
52
53
|
|
|
53
54
|
puts "Converting to Glossarist..."
|
|
54
55
|
convert_options = {}
|
|
55
56
|
if options[:date_accepted]
|
|
56
|
-
convert_options[:date_accepted] =
|
|
57
|
+
convert_options[:date_accepted] =
|
|
58
|
+
Date.parse(options[:date_accepted]).iso8601
|
|
57
59
|
end
|
|
58
60
|
glossarist_col = termium_extract.to_concept(convert_options)
|
|
59
61
|
# pp glossarist_col.first
|
data/lib/termium/core.rb
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "uuidtools"
|
|
4
|
-
require_relative "language_module"
|
|
5
|
-
require_relative "subject"
|
|
6
|
-
require_relative "universal_entry"
|
|
7
|
-
require_relative "source"
|
|
8
4
|
|
|
9
5
|
module Termium
|
|
10
6
|
# For <core>
|
|
@@ -18,7 +14,9 @@ module Termium
|
|
|
18
14
|
attribute :source, Source, collection: true
|
|
19
15
|
|
|
20
16
|
xml do
|
|
21
|
-
|
|
17
|
+
element "core"
|
|
18
|
+
ordered
|
|
19
|
+
|
|
22
20
|
map_attribute "disseminationLevel", to: :dissemination_level
|
|
23
21
|
map_attribute "identificationNumber", to: :identification_number
|
|
24
22
|
map_element "languageModule", to: :language_module
|
|
@@ -70,7 +68,7 @@ module Termium
|
|
|
70
68
|
localized_concept.uuid = uuid("#{identification_number}-#{lang_mod.language}")
|
|
71
69
|
|
|
72
70
|
universal_entry.each do |entry|
|
|
73
|
-
localized_concept.notes << entry.value
|
|
71
|
+
localized_concept.notes << Glossarist::DetailedDefinition.new(content: entry.value)
|
|
74
72
|
end
|
|
75
73
|
localized_concept.sources = concept_sources
|
|
76
74
|
concept.add_localization(localized_concept)
|
|
@@ -6,7 +6,7 @@ module Termium
|
|
|
6
6
|
PART_OF_SPEECH_CODE_MAPPING = {
|
|
7
7
|
"ADJ" => "adj",
|
|
8
8
|
"N" => "noun",
|
|
9
|
-
"V" => "verb"
|
|
9
|
+
"V" => "verb",
|
|
10
10
|
}.freeze
|
|
11
11
|
def part_of_speech
|
|
12
12
|
value = parameter.detect do |x|
|
|
@@ -19,7 +19,7 @@ module Termium
|
|
|
19
19
|
GENDER_CODE_MAPPING = {
|
|
20
20
|
"F" => "f",
|
|
21
21
|
"M" => "m",
|
|
22
|
-
"EPI" => "c" # this means "Epicine"
|
|
22
|
+
"EPI" => "c", # this means "Epicine"
|
|
23
23
|
}.freeze
|
|
24
24
|
def gender
|
|
25
25
|
value = parameter.detect do |x|
|
data/lib/termium/entry_term.rb
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "source_ref"
|
|
4
|
-
require_relative "abbreviation"
|
|
5
|
-
require_relative "parameter"
|
|
6
|
-
require_relative "designation_operations"
|
|
7
|
-
|
|
8
3
|
module Termium
|
|
9
4
|
# For <entryTerm>
|
|
10
5
|
class EntryTerm < Lutaml::Model::Serializable
|
|
@@ -16,9 +11,9 @@ module Termium
|
|
|
16
11
|
include DesignationOperations
|
|
17
12
|
|
|
18
13
|
xml do
|
|
19
|
-
|
|
14
|
+
element "entryTerm"
|
|
20
15
|
map_attribute "order", to: :order
|
|
21
|
-
map_attribute "value", to: :value
|
|
16
|
+
map_attribute "value", to: :value, value_map: { to: { empty: :empty } }
|
|
22
17
|
map_element "sourceRef", to: :source_ref
|
|
23
18
|
map_element "parameter", to: :parameter
|
|
24
19
|
map_element "abbreviation", to: :abbreviation
|
data/lib/termium/extract.rb
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "extract_language"
|
|
4
|
-
require_relative "core"
|
|
5
|
-
|
|
6
3
|
module Termium
|
|
7
4
|
# For <extract>
|
|
8
5
|
class Extract < Lutaml::Model::Serializable
|
|
@@ -11,23 +8,15 @@ module Termium
|
|
|
11
8
|
attribute :core, Core, collection: true
|
|
12
9
|
|
|
13
10
|
xml do
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
element "termium_extract"
|
|
12
|
+
ordered
|
|
13
|
+
namespace Namespace
|
|
16
14
|
|
|
17
15
|
map_attribute "language", to: :language
|
|
18
16
|
map_element "extractLanguage", to: :extract_language
|
|
19
17
|
map_element "core", to: :core
|
|
20
18
|
end
|
|
21
19
|
|
|
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
20
|
def to_concept(options = {})
|
|
32
21
|
coll = Glossarist::ManagedConceptCollection.new
|
|
33
22
|
coll.managed_concepts = core.map do |managed_concept|
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "entry_term"
|
|
4
|
-
require_relative "textual_support"
|
|
5
|
-
|
|
6
3
|
module Termium
|
|
7
4
|
# For <languageModule>
|
|
8
5
|
class LanguageModule < Lutaml::Model::Serializable
|
|
9
6
|
attribute :language, :string
|
|
10
7
|
attribute :entry_term, EntryTerm, collection: true
|
|
11
8
|
attribute :textual_support, TextualSupport, collection: true
|
|
9
|
+
|
|
12
10
|
xml do
|
|
13
|
-
|
|
11
|
+
element "languageModule"
|
|
14
12
|
map_attribute "language", to: :language
|
|
15
13
|
map_element "entryTerm", to: :entry_term
|
|
16
14
|
map_element "textualSupport", to: :textual_support
|
|
@@ -75,11 +73,11 @@ module Termium
|
|
|
75
73
|
Glossarist::LocalizedConcept.new(x).tap do |concept|
|
|
76
74
|
# Fill in register parameters
|
|
77
75
|
if options[:date_accepted]
|
|
78
|
-
puts options[:date_accepted].inspect
|
|
76
|
+
# puts options[:date_accepted].inspect
|
|
79
77
|
concept.date_accepted = options[:date_accepted]
|
|
80
78
|
end
|
|
81
79
|
|
|
82
|
-
puts concept.inspect
|
|
80
|
+
# puts concept.inspect
|
|
83
81
|
end
|
|
84
82
|
end
|
|
85
83
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Termium
|
|
4
|
+
class Namespace < Lutaml::Xml::Namespace
|
|
5
|
+
uri "http://termium.tpsgc-pwgsc.gc.ca/schemas/2012/06/Termium"
|
|
6
|
+
prefix_default "ns2"
|
|
7
|
+
element_form_default :unqualified
|
|
8
|
+
attribute_form_default :unqualified
|
|
9
|
+
end
|
|
10
|
+
end
|
data/lib/termium/parameter.rb
CHANGED
data/lib/termium/source.rb
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
module Termium
|
|
4
4
|
# For <source>
|
|
5
5
|
class Source < Lutaml::Model::Serializable
|
|
6
|
-
ISO_BIB_REGEX = /\AISO-([\d-]+)\s+\*\s+(\d{4})\s
|
|
7
|
-
ISOIEC_BIB_REGEX = /\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s
|
|
6
|
+
ISO_BIB_REGEX = /\AISO-([\d-]+)\s+\*\s+(\d{4})\s+.*/
|
|
7
|
+
ISOIEC_BIB_REGEX = /\AISO-IEC-([\d-]+)\s+\*\s+(\d{4})\s+.*/
|
|
8
8
|
|
|
9
9
|
attribute :order, :integer
|
|
10
10
|
attribute :details, :string
|
|
11
11
|
xml do
|
|
12
|
-
|
|
12
|
+
element "source"
|
|
13
13
|
map_attribute "order", to: :order
|
|
14
14
|
map_attribute "details", to: :details
|
|
15
15
|
end
|
data/lib/termium/source_ref.rb
CHANGED
data/lib/termium/subject.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Termium
|
|
|
8
8
|
|
|
9
9
|
# <subject abbreviation="YBB" details="Compartment - ISO/IEC JTC 1 Information Technology Vocabulary"/>
|
|
10
10
|
xml do
|
|
11
|
-
|
|
11
|
+
element "subject"
|
|
12
12
|
map_attribute "abbreviation", to: :abbreviation
|
|
13
13
|
map_attribute "details", to: :details
|
|
14
14
|
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "source_ref"
|
|
4
|
-
|
|
5
3
|
module Termium
|
|
6
4
|
# For <textualSupport>
|
|
7
5
|
class TextualSupport < Lutaml::Model::Serializable
|
|
@@ -10,7 +8,7 @@ module Termium
|
|
|
10
8
|
attribute :value, :string
|
|
11
9
|
attribute :source_ref, SourceRef
|
|
12
10
|
xml do
|
|
13
|
-
|
|
11
|
+
element "textualSupport"
|
|
14
12
|
map_attribute "order", to: :order
|
|
15
13
|
map_attribute "type", to: :type
|
|
16
14
|
map_element "value", to: :value
|
|
@@ -31,7 +29,7 @@ module Termium
|
|
|
31
29
|
end
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
EXAMPLE_REGEX = /\AEx[ea]mples?\s*:\s
|
|
32
|
+
EXAMPLE_REGEX = /\AEx[ea]mples?\s*:\s*/
|
|
35
33
|
|
|
36
34
|
def is_example?
|
|
37
35
|
value_cleaned.match(EXAMPLE_REGEX)
|
|
@@ -53,7 +51,7 @@ module Termium
|
|
|
53
51
|
value_cleaned.gsub(EXAMPLE_REGEX, "")
|
|
54
52
|
end
|
|
55
53
|
|
|
56
|
-
DEFINITION_REGEX = /\A<(.+?)>\s
|
|
54
|
+
DEFINITION_REGEX = /\A<(.+?)>\s*/
|
|
57
55
|
|
|
58
56
|
def value_definition
|
|
59
57
|
value_cleaned.gsub(DEFINITION_REGEX, "")
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "source_ref"
|
|
4
|
-
require_relative "parameter"
|
|
5
|
-
|
|
6
3
|
module Termium
|
|
7
4
|
# For <universalEntry>
|
|
8
5
|
class UniversalEntry < Lutaml::Model::Serializable
|
|
@@ -18,7 +15,7 @@ module Termium
|
|
|
18
15
|
# </universalEntry>
|
|
19
16
|
|
|
20
17
|
xml do
|
|
21
|
-
|
|
18
|
+
element "universalEntry"
|
|
22
19
|
map_attribute "order", to: :order
|
|
23
20
|
map_element "value", to: :value
|
|
24
21
|
map_element "sourceRef", to: :source_ref
|
data/lib/termium/version.rb
CHANGED
data/lib/termium.rb
CHANGED
|
@@ -2,28 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
require "glossarist"
|
|
4
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
|
|
11
|
-
|
|
12
5
|
module Termium
|
|
13
6
|
class Error < StandardError; end
|
|
14
|
-
end
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
autoload :Version, "termium/version"
|
|
9
|
+
autoload :Extract, "termium/extract"
|
|
10
|
+
autoload :ExtractLanguage, "termium/extract_language"
|
|
11
|
+
autoload :Core, "termium/core"
|
|
12
|
+
autoload :Abbreviation, "termium/abbreviation"
|
|
13
|
+
autoload :DesignationOperations, "termium/designation_operations"
|
|
14
|
+
autoload :EntryTerm, "termium/entry_term"
|
|
15
|
+
autoload :LanguageModule, "termium/language_module"
|
|
16
|
+
autoload :Parameter, "termium/parameter"
|
|
17
|
+
autoload :Namespace, "termium/namespace"
|
|
18
|
+
autoload :Source, "termium/source"
|
|
19
|
+
autoload :SourceRef, "termium/source_ref"
|
|
20
|
+
autoload :Subject, "termium/subject"
|
|
21
|
+
autoload :TextualSupport, "termium/textual_support"
|
|
22
|
+
autoload :UniversalEntry, "termium/universal_entry"
|
|
23
|
+
end
|
data/termium.gemspec
CHANGED
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
22
|
spec.metadata["source_code_uri"] = spec.homepage
|
|
23
23
|
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
|
24
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
24
25
|
|
|
25
26
|
# Specify which files should be added to the gem when it is released.
|
|
26
27
|
spec.files = all_files_in_git
|
|
@@ -30,8 +31,8 @@ Gem::Specification.new do |spec|
|
|
|
30
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
31
32
|
spec.require_paths = ["lib"]
|
|
32
33
|
|
|
33
|
-
spec.add_dependency "glossarist", "~> 2.
|
|
34
|
-
spec.add_dependency "lutaml-model"
|
|
34
|
+
spec.add_dependency "glossarist", "~> 2.3.5"
|
|
35
|
+
spec.add_dependency "lutaml-model", "~> 0.8.0"
|
|
35
36
|
spec.add_dependency "thor"
|
|
36
37
|
spec.add_dependency "uuidtools"
|
|
37
38
|
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.4.0
|
|
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: 2026-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: glossarist
|
|
@@ -16,28 +16,28 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.
|
|
19
|
+
version: 2.3.5
|
|
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.3.5
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: lutaml-model
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- - "
|
|
31
|
+
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
33
|
+
version: 0.8.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- - "
|
|
38
|
+
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 0.8.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: thor
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -78,6 +78,8 @@ files:
|
|
|
78
78
|
- ".github/workflows/release.yml"
|
|
79
79
|
- ".gitignore"
|
|
80
80
|
- ".rspec"
|
|
81
|
+
- ".rubocop.yml"
|
|
82
|
+
- ".rubocop_todo.yml"
|
|
81
83
|
- CODE_OF_CONDUCT.md
|
|
82
84
|
- Gemfile
|
|
83
85
|
- README.adoc
|
|
@@ -92,6 +94,7 @@ files:
|
|
|
92
94
|
- lib/termium/extract.rb
|
|
93
95
|
- lib/termium/extract_language.rb
|
|
94
96
|
- lib/termium/language_module.rb
|
|
97
|
+
- lib/termium/namespace.rb
|
|
95
98
|
- lib/termium/parameter.rb
|
|
96
99
|
- lib/termium/source.rb
|
|
97
100
|
- lib/termium/source_ref.rb
|
|
@@ -108,6 +111,7 @@ metadata:
|
|
|
108
111
|
homepage_uri: https://github.com/glossarist/termium
|
|
109
112
|
source_code_uri: https://github.com/glossarist/termium
|
|
110
113
|
bug_tracker_uri: https://github.com/glossarist/termium/issues
|
|
114
|
+
rubygems_mfa_required: 'true'
|
|
111
115
|
post_install_message:
|
|
112
116
|
rdoc_options: []
|
|
113
117
|
require_paths:
|
|
@@ -123,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
123
127
|
- !ruby/object:Gem::Version
|
|
124
128
|
version: '0'
|
|
125
129
|
requirements: []
|
|
126
|
-
rubygems_version: 3.
|
|
130
|
+
rubygems_version: 3.5.22
|
|
127
131
|
signing_key:
|
|
128
132
|
specification_version: 4
|
|
129
133
|
summary: Parser for the TERMIUM Plus terminology database of the Government of Canada
|