<commit_before>module Kaui
  class TagDefinitionsController < ApplicationController
    # GET /tag_definitions
    # GET /tag_definitions.json
    def index
      @tag_definitions = TagDefinition.all

      respond_to do |format|
        format.html # index.html.erb
        format.json { render :json => @tag_definitions }
      end
    end

    # GET /tag_definitions/1
    # GET /tag_definitions/1.json
    def show
      @tag_definition = TagDefinition.find(params[:id])

      respond_to do |format|
        format.html # show.html.erb
        format.json { render :json => @tag_definition }
      end
    end

    # GET /tag_definitions/new
    # GET /tag_definitions/new.json
    def new
      @tag_definition = TagDefinition.new

      respond_to do |format|
        format.html # new.html.erb
        format.json { render :json => @tag_definition }
      end
    end

    # GET /tag_definitions/1/edit
    def edit<commit_msg>tag_definitions: improve error handling for index page<commit_after>module Kaui
  class TagDefinitionsController < Kaui::EngineController
    # GET /tag_definitions
    # GET /tag_definitions.json
    def index
      begin
        @tag_definitions = TagDefinition.all
      rescue => e
        flash[:error] = "Error while retrieving tag definitions: #{as_string(e)}"
        @tag_definitions = []
      end

      respond_to do |format|
        format.html # index.html.erb
        format.json { render :json => @tag_definitions }
      end
    end

    # GET /tag_definitions/1
    # GET /tag_definitions/1.json
    def show
      @tag_definition = TagDefinition.find(params[:id])

      respond_to do |format|
        format.html # show.html.erb
        format.json { render :json => @tag_definition }
      end
    end

    # GET /tag_definitions/new
    # GET /tag_definitions/new.json
    def new
      @tag_definition = TagDefinition.new

      respond_to do |format|
        format.html # new.html.erb
        format.json { render :json => @tag_definition }
      end
    end

    # GET /tag_definitions/1/edit
    def edit
{'fraction_non_alphanumeric': 0.08760890609874153, 'fraction_numerical': 0.002904162633107454, 'mean_word_length': 2.2861685214626393, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '3395099', 'n_tokens_mistral': 640, 'n_tokens_neox': 625, 'n_words': 149}