<commit_before># coding: utf-8
module Krikri::Enrichments
  ##
  # Maps string values to DCMI Type vocabulary terms.
  #
  # Mapping is performed by comparing a hash of string keys to the pre-enriched
  # value, using White Similarity comparisons to determine the closest match. If
  # a suitable match is found, a {DLPA::MAP::Controlled::DCMIType} object is
  # built from the appropriate hash value and set as the new value.
  #
  # This enrichment ignores strings without a DCMI Type match.
  #
  # @example
  #
  #   type_mapper = DcmiTypeMap.new
  #   type_mapper.enrich_value('image') # finds RDF::DCMITYPE.Image
  #   type_mapper.enrich_value('a book') # finds RDF::DCMITYPE.Text
  #   type_mapper.enrich_value('a really cool book') # => 'a really cool book'
  #
  # @example
  #
  #   type_mapper = DcmiTypeMap.new('poloriod' => RDF::DCMIType.Image)
  #   type_mapper.enrich_value('poloroid.') # finds RDF::DCMITYPE.Image
  #
  class DcmiTypeMap
    include Audumbla::FieldEnrichment

    DEFAULT_MAP = { 'image' => RDF::DCMITYPE.Image,
                    'photograph' => RDF::DCMITYPE.Image,
                    'sample book' => RDF::DCMITYPE.Image,
                    'specimen' => RDF::DCMITYPE.Image,
                    'textile' => RDF::DCMITYPE.Image,
                    'frame' => RDF::DCMITYPE.Image,
                    'costume' => RDF::DCMITYPE.Image,
                    'statue' => RDF::DCMITYPE.Image,
                    'sculpture' => RDF::DCMITYPE.Image,
                    'container' => RDF::DCMITYPE.Image,
                    'jewelry' => RDF::DCMITYPE.Image,
                    'furnishing' => RDF::DCMITYPE.Image,
                    'furniture' => RDF::DCMITYPE.Image,
                    'drawing' => RDF::DCMITYPE.Image,
                    'print' => RDF::DCMITYPE.Image,
                    'painting' => RDF::DCMITYPE.Image,
                    'illumination' => RDF::DCMITYPE.Image,
                    'poster' => RDF::DCMITYPE.Image,
                    'appliance' => RDF::DCMITYPE.Image,
                    'tool' => RDF::DCMITYPE.Image,
                    'electronic component' => RDF::DCMITYPE.Image,
                    'postcard' => RDF::DCMITYPE.Image,
                    'equipment' => RDF::DCMITYPE.Image,
                    'cartographic' => RDF::DCMITYPE.Image,
                    'notated music' => RDF::DCMITYPE.Image,
                    'mixed material' => RDF::DCMITYPE.Image,
                    'text' => RDF::DCMITYPE.Text,
                    'book' => RDF::DCMITYPE.Text,
                    'publication' => RDF::DCMITYPE.Text,
                    'magazine' => RDF::DCMITYPE.Text,
                    'journal' => RDF::DCMITYPE.Text,
                    'correspondence' => RDF::DCMITYPE.Text,
                    'writing' => RDF::DCMITYPE.Text,
                    'written' => RDF::DCMITYPE.Text,
                    'manuscript' => RDF::DCMITYPE.Text,
                    'audio' => RDF::DCMITYPE.Sound,
                    'sound' => RDF::DCMITYPE.Sound,
                    'oral history recording' => RDF::DCMITYPE.Sound,
                    'finding aid' => RDF::DCMITYPE.Collection,
                    'online collection' => RDF::DCMITYPE.Collection,
                    'electronic resource' => RDF::DCMITYPE.InteractiveResource,
                    'video game' => RDF::DCMITYPE.InteractiveResource,<commit_msg>Add mapping for "online text" to DCMI map (#272)<commit_after># coding: utf-8
module Krikri::Enrichments
  ##
  # Maps string values to DCMI Type vocabulary terms.
  #
  # Mapping is performed by comparing a hash of string keys to the pre-enriched
  # value, using White Similarity comparisons to determine the closest match. If
  # a suitable match is found, a {DLPA::MAP::Controlled::DCMIType} object is
  # built from the appropriate hash value and set as the new value.
  #
  # This enrichment ignores strings without a DCMI Type match.
  #
  # @example
  #
  #   type_mapper = DcmiTypeMap.new
  #   type_mapper.enrich_value('image') # finds RDF::DCMITYPE.Image
  #   type_mapper.enrich_value('a book') # finds RDF::DCMITYPE.Text
  #   type_mapper.enrich_value('a really cool book') # => 'a really cool book'
  #
  # @example
  #
  #   type_mapper = DcmiTypeMap.new('poloriod' => RDF::DCMIType.Image)
  #   type_mapper.enrich_value('poloroid.') # finds RDF::DCMITYPE.Image
  #
  class DcmiTypeMap
    include Audumbla::FieldEnrichment

    DEFAULT_MAP = { 'image' => RDF::DCMITYPE.Image,
                    'photograph' => RDF::DCMITYPE.Image,
                    'sample book' => RDF::DCMITYPE.Image,
                    'specimen' => RDF::DCMITYPE.Image,
                    'textile' => RDF::DCMITYPE.Image,
                    'frame' => RDF::DCMITYPE.Image,
                    'costume' => RDF::DCMITYPE.Image,
                    'statue' => RDF::DCMITYPE.Image,
                    'sculpture' => RDF::DCMITYPE.Image,
                    'container' => RDF::DCMITYPE.Image,
                    'jewelry' => RDF::DCMITYPE.Image,
                    'furnishing' => RDF::DCMITYPE.Image,
                    'furniture' => RDF::DCMITYPE.Image,
                    'drawing' => RDF::DCMITYPE.Image,
                    'print' => RDF::DCMITYPE.Image,
                    'painting' => RDF::DCMITYPE.Image,
                    'illumination' => RDF::DCMITYPE.Image,
                    'poster' => RDF::DCMITYPE.Image,
                    'appliance' => RDF::DCMITYPE.Image,
                    'tool' => RDF::DCMITYPE.Image,
                    'electronic component' => RDF::DCMITYPE.Image,
                    'postcard' => RDF::DCMITYPE.Image,
                    'equipment' => RDF::DCMITYPE.Image,
                    'cartographic' => RDF::DCMITYPE.Image,
                    'notated music' => RDF::DCMITYPE.Image,
                    'mixed material' => RDF::DCMITYPE.Image,
                    'text' => RDF::DCMITYPE.Text,
                    'book' => RDF::DCMITYPE.Text,
                    'publication' => RDF::DCMITYPE.Text,
                    'magazine' => RDF::DCMITYPE.Text,
                    'journal' => RDF::DCMITYPE.Text,
                    'correspondence' => RDF::DCMITYPE.Text,
                    'writing' => RDF::DCMITYPE.Text,
                    'written' => RDF::DCMITYPE.Text,
                    'manuscript' => RDF::DCMITYPE.Text,
                    'electronic text' => RDF::DCMITYPE.Text,
                    'audio' => RDF::DCMITYPE.Sound,
                    'sound' => RDF::DCMITYPE.Sound,
                    'oral history recording' => RDF::DCMITYPE.Sound,
                    'finding aid' => RDF::DCMITYPE.Collection,
                    'online collection' => RDF::DCMITYPE.Collection,
                    'electronic resource' => RDF::DCMITYPE.InteractiveResource,
                    'video game' => RDF::DCMITYPE.InteractiveResource,
{'fraction_non_alphanumeric': 0.1292803250145096, 'fraction_numerical': 0.0007254788160185723, 'mean_word_length': 1.808883455582722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 92, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4318544', 'n_tokens_mistral': 2274, 'n_tokens_neox': 2158, 'n_words': 392}