Class: Termium::EntryTerm
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Termium::EntryTerm
show all
- Includes:
- DesignationOperations
- Defined in:
- lib/termium/entry_term.rb
Overview
Constant Summary
collapse
- GEOGRAPHICAL_CODE_MAPPING =
attr_accessor :geographical_area,
:deprecated,
:plurality,
:part_of_speech,
:gender
{
"USA" => "US",
"CAN" => "CA",
"GB" => "GB",
"AUS" => "AU",
"EUR" => "EU",
}.freeze
DesignationOperations::GENDER_CODE_MAPPING, DesignationOperations::PART_OF_SPEECH_CODE_MAPPING
Instance Method Summary
collapse
#gender, #part_of_speech
Instance Method Details
#deprecated ⇒ Object
54
55
56
|
# File 'lib/termium/entry_term.rb', line 54
def deprecated
parameter.map(&:abbreviation).include?("AE")
end
|
#geographical_area ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/termium/entry_term.rb', line 41
def geographical_area
keys = GEOGRAPHICAL_CODE_MAPPING.keys
usage = parameter.select do |x|
keys.include?(x.abbreviation)
end
return nil if usage.empty?
usage.map do |x|
GEOGRAPHICAL_CODE_MAPPING[x.abbreviation]
end.join("; ")
end
|
#normative_status ⇒ Object
66
67
68
69
70
|
# File 'lib/termium/entry_term.rb', line 66
def normative_status
return "deprecated" if deprecated
order == 1 ? "preferred" : "admitted"
end
|
#plurality ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/termium/entry_term.rb', line 58
def plurality
if parameter.map(&:abbreviation).include?("PL")
"plural"
else
"singular"
end
end
|
#to_h ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/termium/entry_term.rb', line 72
def to_h
set = {
"designation" => value,
"type" => "expression",
"normative_status" => normative_status,
}
set["geographical_area"] = geographical_area if geographical_area
set["plurality"] = plurality if plurality
set["gender"] = gender if gender
set["part_of_speech"] = part_of_speech if part_of_speech
set
end
|