<commit_before># Encoding: utf-8

class SearchLanguages
  @languages = {
                  af: 'afrikaans',
                  ar: 'arabic',
                  be: 'belarusian',
                  bg: 'bulgrian',
                  ca: 'català',
                  ce: 'čečenský',
                  da: 'danske',
                  de: 'deutsch',
                  el: 'greek',
                  en: 'english',
                  es: 'español',
                  fa: 'persian',
                  fi: 'suomi',
                  fr: 'français',
                  he: 'hebrew',
                  hi: 'hindi',
                  hr: 'hrvatska',
                  hu: 'magyar',
                  is: 'icelandic',
                  it: 'italiano',
                  ku: 'kurdish',
                  nl: 'nederlands',
                  no: 'norsk',
                  pl: 'polskie',
                  pt: 'português',
                  ro: 'română',
                  ru: 'russian',
                  sk: 'slovenský',
                  sl: 'slovenskih',
                  sr: 'srpski',
                  sv: 'svensk',
                  uk: 'ukrainian',
                  zh: 'chinese'
                  }

  def self.collection_for_dropdown(i18n_language=:en)
    @languages.keys.map {|l| [l.to_s, I18n.t(l, scope: 'iso_639_1', locale: i18n_language).capitalize]}
  end

  def self.search_strings(iso)
    {
    iso_start: iso.to_s+' %',
    iso:       '% '+iso.to_s+' %',
    en_name:   '%'+I18n.t(iso, scope: 'iso_639_1', locale: :en)+'%',
    de_name:   '%'+I18n.t(iso, scope: 'iso_639_1', locale: :de)+'%',
    own_name:  '%'+@languages[iso.to_sym]+'%'
    }
  end
end<commit_msg>Sorts the languages for select in the profile search<commit_after># Encoding: utf-8

class SearchLanguages
  @languages = {
                  af: 'afrikaans',
                  ar: 'arabic',
                  be: 'belarusian',
                  bg: 'bulgrian',
                  ca: 'català',
                  ce: 'čečenský',
                  da: 'danske',
                  de: 'deutsch',
                  el: 'greek',
                  en: 'english',
                  es: 'español',
                  fa: 'persian',
                  fi: 'suomi',
                  fr: 'français',
                  he: 'hebrew',
                  hi: 'hindi',
                  hr: 'hrvatska',
                  hu: 'magyar',
                  is: 'icelandic',
                  it: 'italiano',
                  ku: 'kurdish',
                  nl: 'nederlands',
                  no: 'norsk',
                  pl: 'polskie',
                  pt: 'português',
                  ro: 'română',
                  ru: 'russian',
                  sk: 'slovenský',
                  sl: 'slovenskih',
                  sr: 'srpski',
                  sv: 'svensk',
                  uk: 'ukrainian',
                  zh: 'chinese'
                  }

  def self.collection_for_dropdown(i18n_language=:en)
    language_array = @languages.keys.map {|language| [language.to_s, I18n.t(language, scope: 'iso_639_1', locale: i18n_language).capitalize]}
    most_used_languages = [ ['', '----------'], ['en', I18n.t('en', scope: 'iso_639_1').capitalize], ['de', I18n.t('de', scope: 'iso_639_1').capitalize], ["", "----------"] ]
    most_used_languages + language_array.sort {|a,b| a[1] <=> b[1]}
  end

  def self.search_strings(iso)
    {
    iso_start: iso.to_s+' %',
    iso:       '% '+iso.to_s+' %',
    en_name:   '%'+I18n.t(iso, scope: 'iso_639_1', locale: :en)+'%',
    de_name:   '%'+I18n.t(iso, scope: 'iso_639_1', locale: :de)+'%',
    own_name:  '%'+@languages[iso.to_sym]+'%'
    }
  end
end
{'fraction_non_alphanumeric': 0.1561816192560175, 'fraction_numerical': 0.016411378555798686, 'mean_word_length': 1.2123411978221417, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2243388', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1198, 'n_words': 232}