<commit_before>-# NB: rdf_types will be an array of strings from search results (['dbpedia', 'book', 'foaf' ... ])
- type = type || image.class.rdf_types + (image.rdf_types || []) rescue nil
- type = type.join(' ').strip rescue type

- style = style || nil

- icon_class = case type
  - when /musical/i then 'icon-music'
  - when /athlete/i then 'icon-trophy'
  - when /office/i then 'icon-briefcase'
  - when /writer/i then 'icon-pencil'
  - when /scientist/i then 'icon-beaker'
  - when /politician/i then 'icon-bullhorn'
  - when /artist/i then 'icon-picture'
  - when /person/i then 'icon-user'
  - when /organi[sz]ation/i then 'icon-group'
  - when /agent/i then 'icon-user-md'

  - when /film/i then 'icon-film'
  - when /book/i then 'icon-book'
  - when /software/i then 'icon-save'
  - when /map/i then 'icon-globe'
  - when /periodical/i then 'icon-copy'
  - when /musical/i then 'icon-music'
  - when /(audio)?visual/i then 'icon-facetime-video'
  - when /audio/i then 'icon-volume-down'
  - when /resource/i then 'icon-file'

  - when /country/i then 'icon-flag'
  - when /populated/i then 'icon-road'
  - when /settlement/i then 'icon-home'
  - when /protected/i then 'icon-leaf'
  - when /place/i then 'icon-map-marker'
  - when /concept/i then 'icon-cloud'

  - else 'icon-question-sign'

- if url = image.dbpedia.thumbnail.first rescue nil
  %img{:src => url, :onError => "imgFallback(this, '#{icon_class}', '#{style}');"}

- else
  %i{:class => icon_class, :style => style}<commit_msg>Fix rdf_type selection in image partial<commit_after>-# TODO: refactor me into a helper!
- image = image

- if image.nil?
- elsif image.rdf_types.is_a? Hash then rdf_types = image.rdf_types.values.flatten
- else rdf_types = image.rdf_types

- type = type || rdf_types || image.class.rdf_types.values.flatten
- type = type.uniq.join(' ').strip rescue type

- style = style || nil

- icon_class = case type
  - when /musical/i then 'icon-music'
  - when /athlete/i then 'icon-trophy'
  - when /office/i then 'icon-briefcase'
  - when /writer/i then 'icon-pencil'
  - when /scientist/i then 'icon-beaker'
  - when /politician/i then 'icon-bullhorn'
  - when /artist/i then 'icon-picture'
  - when /person/i then 'icon-user'
  - when /organi[sz]ation/i then 'icon-group'
  - when /corporate/i then 'icon-group'
  - when /agent/i then 'icon-user-md'

  - when /film/i then 'icon-film'
  - when /book/i then 'icon-book'
  - when /software/i then 'icon-save'
  - when /map/i then 'icon-globe'
  - when /periodical/i then 'icon-copy'
  - when /musical/i then 'icon-music'
  - when /(audio)?visual/i then 'icon-facetime-video'
  - when /audio/i then 'icon-volume-down'
  - when /resource/i then 'icon-file'

  - when /country/i then 'icon-flag'
  - when /populated/i then 'icon-road'
  - when /settlement/i then 'icon-home'
  - when /protected/i then 'icon-leaf'
  - when /place/i then 'icon-map-marker'
  - when /concept/i then 'icon-cloud'

  - else 'icon-question-sign'

- if url = image.dbpedia.thumbnail.first rescue nil
  %img{:src => url, :onError => "imgFallback(this, '#{icon_class}', '#{style}');"}

- else
  %i{:class => icon_class, :style => style}
{'fraction_non_alphanumeric': 0.1640228426395939, 'fraction_numerical': 0.0, 'mean_word_length': 2.9167701863354036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7018644', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1188, 'n_words': 311}