<commit_before>require_dependency 'stash_datacite/application_controller'

module StashDatacite
  class SubjectsController < ApplicationController

    # GET /subjects/new
    def new
      @subject = Subject.new
    end

    # POST /subjects
    def create
      @resource = StashEngine::Resource.find(params[:resource_id])
      subjects_array = subject_params[:subject].split(/[ ,]+/)
      subjects_array.each do |sub|
        unless Subject.where('subject LIKE ?', sub).exists?
          @resource.subjects << Subject.create(subject: sub)
        end
      end
      @subjects = @resource.subjects.pluck(:subject).join(', ')<commit_msg>remove empty space<commit_after>require_dependency 'stash_datacite/application_controller'

module StashDatacite
  class SubjectsController < ApplicationController
    # GET /subjects/new
    def new
      @subject = Subject.new
    end

    # POST /subjects
    def create
      @resource = StashEngine::Resource.find(params[:resource_id])
      subjects_array = subject_params[:subject].split(/[ ,]+/)
      subjects_array.each do |sub|
        unless Subject.where('subject LIKE ?', sub).exists?
          @resource.subjects << Subject.create(subject: sub)
        end
      end
      @subjects = @resource.subjects.pluck(:subject).join(', ')
{'fraction_non_alphanumeric': 0.1119751166407465, 'fraction_numerical': 0.0, 'mean_word_length': 3.26158940397351, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '7386861', 'n_tokens_mistral': 374, 'n_tokens_neox': 366, 'n_words': 74}