<commit_before>class AnnotationsController < ApplicationController
  include DC::Access

  layout false

  before_action :login_required, :except => [:index, :show, :print,:cors_options]
  skip_before_action :verify_authenticity_token

  # In the workspace, request a listing of annotations.
  def index
    annotations = current_document.annotations_with_authors(current_account)
    json annotations
  end

  def show
    return not_found unless current_annotation
    respond_to do |format|
      format.json do
        @response = current_annotation.canonical(:include_image_url => true, :include_document_url => true)
        cache_page @response if current_annotation.cacheable?
        json_response<commit_msg>Cache JSON, not Ruby, for annotations too<commit_after>class AnnotationsController < ApplicationController
  include DC::Access

  layout false

  before_action :login_required, :except => [:index, :show, :print,:cors_options]
  skip_before_action :verify_authenticity_token

  # In the workspace, request a listing of annotations.
  def index
    annotations = current_document.annotations_with_authors(current_account)
    json annotations
  end

  def show
    return not_found unless current_annotation
    respond_to do |format|
      format.json do
        @response = current_annotation.canonical(:include_image_url => true, :include_document_url => true)
        cache_page.to_json @response if current_annotation.cacheable?
        json_response
{'fraction_non_alphanumeric': 0.06453804347826086, 'fraction_numerical': 0.0, 'mean_word_length': 4.579545454545454, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6875711', 'n_tokens_mistral': 408, 'n_tokens_neox': 386, 'n_words': 107}