Class: Termium::Core

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/termium/core.rb

Overview

For <core>

Instance Method Summary collapse

Instance Method Details

#concept_sourcesObject

TODO: In Termium XML, each definition per lang or note can be linked to a particular source via the sourceRef number. We should utilize “source” order ID in the Glossarist object: <source order=“1” details=“ISO-2382-6 * 1987 * * * ” /> <source order=“2”

details="Ranger, Natalie * 2006 * Bureau de la traduction..." />


35
36
37
# File 'lib/termium/core.rb', line 35

def concept_sources
  source.map(&:to_concept_source)
end

#to_conceptObject

TODO: Utilize “subject” in the Glossarist object: <subject abbreviation=“YBB” details=“Compartment - ISO/IEC JTC 1 Information Technology Vocabulary” />



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/termium/core.rb', line 42

def to_concept
  concept = Glossarist::ManagedConcept.new(id: identification_number)

  language_module.map(&:to_concept).each do |localized_concept|
    # TODO: This is needed to skip the empty french entries of 10031781 and 10031778
    next if localized_concept.nil?

    localized_concept.id = identification_number
    # TODO: this should just be localized_concept.notes << universal_entry.value
    # TODO: Depends on https://github.com/glossarist/glossarist-ruby/issues/82
    localized_concept.notes << Glossarist::DetailedDefinition.new(universal_entry.value)
    localized_concept.sources = concept_sources
    concept.add_localization(localized_concept)
  end

  concept
end