<commit_before>module Dlibhydra
  # DC language
  module DcLanguage
    extend ActiveSupport::Concern

    included do
      before_save :add_language_string
      # language code
      property :language, predicate: ::RDF::Vocab::DC.language,
                          multiple: true do |index|
        index.as :stored_searchable
      end

      property :language_string, predicate: ::RDF::Vocab::DC11.language,
               multiple: true do |index|
        index.as :stored_searchable, :sortable, :facetable
      end

      # This requires that the calling app has QA installed and the languages list available
      def add_language_string
        begin
          auth = Qa::Authorities::Local::FileBasedAuthority.new('languages')
          self.language_string = self.language_resource.collect { |x| auth.find(x)['term'] }
        rescue
          'You need QA installed to add language_string'
        end
      end
    end
  end
end<commit_msg>add language in addition to language code<commit_after>module Dlibhydra
  # DC language
  module DcLanguage
    extend ActiveSupport::Concern

    included do
      before_save :add_language_string
      # language code
      property :language, predicate: ::RDF::Vocab::DC.language,
                          multiple: true do |index|
        index.as :stored_searchable
      end

      property :language_string, predicate: ::RDF::Vocab::DC11.language,
               multiple: true do |index|
        index.as :stored_searchable, :sortable, :facetable
      end

      # This requires that the calling app has QA installed and the languages list available
      def add_language_string
        begin
          auth = Qa::Authorities::Local::FileBasedAuthority.new('languages')
          self.language_string = self.language.collect { |x| auth.find(x)['term'] }
        rescue
          'You need QA installed to add language_string'
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07656492498706674, 'fraction_numerical': 0.0020693222969477496, 'mean_word_length': 2.472172351885099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1458963', 'n_tokens_mistral': 545, 'n_tokens_neox': 530, 'n_words': 153}