<commit_before>class App < Sinatra::Application
  get '/characters/?' do
    @characters = Character.all.limit(100).desc(:updated_at).where(:attribs.exists => true)

    haml :characters
  end

  get '/:server/:name/?' do |s,n|
    @character = Character.find_by(server: s, name: n)

    haml :character
  end

  get '/:server/:name.json' do |s,n|
    @character = Character.find_by(server: s, name: n)
    @character = @character.as_document.tap {|h| h.delete("_id")}

    content_type 'application/json'
    JSON.pretty_generate(response)
  end
end<commit_msg>Reorder /server/name routes and fix JSON output<commit_after>class App < Sinatra::Application
  get '/characters/?' do
    @characters = Character.all.limit(100).desc(:updated_at).where(:attribs.exists => true)

    haml :characters
  end

  get '/:server/:name.json' do |s,n|
    @character = Character.find_by(server: s, name: n)
    @character = @character.as_document.tap {|h| h.delete("_id")}

    content_type 'application/json'
    JSON.pretty_generate(@character)
  end

  get '/:server/:name/?' do |s,n|
    @character = Character.find_by(server: s, name: n)

    haml :character
  end
end
{'fraction_non_alphanumeric': 0.15258620689655172, 'fraction_numerical': 0.005172413793103448, 'mean_word_length': 3.8174273858921164, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1960819', 'n_tokens_mistral': 417, 'n_tokens_neox': 402, 'n_words': 89}