<commit_before><div id ="main-container" class="container">
    <%= form_tag(controller: "home", action: "manipulate", method: "post") do %>
      <div class="row">
        <div class="col-xs-5">
          <%= text_area_tag(:initial_text, nil, :class => ['initial-text-box'], :placeholder => "Text to manipulate", rows: 15, cols: 55) %>
        </div>
        <div class="col-xs-5">
          <p>1. Add some text to start with</p>
          <p>2. Choose a manipulation procedure and click 'Add Manipulation'</p>
          <p>3. (You can add as many procedures as you like)</p>
          <p>4. (Some manipulations require a secondary text: Splicers, Swappers, Replacers)</p>
          <p>5. When done, click 'Manipulate Text'</p>
          <p>6. (Not filling in the secondary text boxes will cause an error - just go back in your browser if this happens)</p>
          <p>7. (Swappers, Splicers and Replacers are my fav atm!)</p>
          <p>8. (The word class tagger isn't very good at verbs)</p>
          <p>9. (Feel free to email me if you have any questions or suggestions: <EMAIL>)</p>
          <p>10. (No data is collected on/through this app)</p>
          <p>11. (The full source can be found here: https://github.com/gregorykan/glass_leaves)</p>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <div class="added-actions">
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <%= select_tag :method, options_for_select(@procedures), prompt: 'Choose a manipulation', class: ['action-select'] %>
          <button type="button" class="add-action-btn">Add Manipulation</button>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <%= submit_tag("Manipulate Text", :class => ['submit-btn']) %>
        </div>
      </div>
    <% end %>
</div>

<script type="text/javascript">
$(function(){
  var seq = 1;
  $('.add-action-btn').click(function(){
    var current = seq;
    seq += 1;
    var selected_action_id = $('.action-select').val();
    var selected_text = $('.action-select option[value='+selected_action_id+']').text();
    if (selected_action_id == '10' || selected_action_id == '11')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Text to splice with" rows="7" cols="44"></textarea> \
      </div>';
    else if (selected_action_id == '12')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Target"></textarea> \
        <textarea name="operations['+current+'][args][1]" type="text" class="action-args" placeholder="Replacement"></textarea> \
      </div>';
    else if (selected_action_id == '13')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Replacement"></textarea> \
      </div>';
    else if (selected_action_id == '14')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" rows="7" cols="44" placeholder="Text to swap nouns with"></textarea> \
      </div>';
    else
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span> \
        <input type="hidden" name="operations['+current+'][args][0]" type="text"> \
      </div>';
    var item = $(block)
    $('.added-actions').append(item);
  })
})
</script>
<commit_msg>instr<commit_after><div id ="main-container" class="container">
    <%= form_tag(controller: "home", action: "manipulate", method: "post") do %>
      <div class="row">
        <div class="col-xs-5">
          <%= text_area_tag(:initial_text, nil, :class => ['initial-text-box'], :placeholder => "Text to manipulate", rows: 15, cols: 55) %>
        </div>
        <div class="col-xs-7">
          <p>1. Add some text to start with</p>
          <p>2. Choose a manipulation procedure and click 'Add Manipulation'</p>
          <p>3. (You can add as many procedures as you like)</p>
          <p>4. (Some manipulations require a secondary text: Splicers, Swappers, Replacers)</p>
          <p>5. When done, click 'Manipulate Text'</p>
          <p>6. (Not filling in the secondary text boxes will cause an error - just go back in your browser if this happens)</p>
          <p>7. (Swappers, Splicers and Replacers are my fav atm!)</p>
          <p>8. (The word class tagger isn't very good at verbs)</p>
          <p>9. (Feel free to email me if you have any questions or suggestions: <EMAIL>)</p>
          <p>10. (No data is collected on/through this app)</p>
          <p>11. (The full source can be found here: https://github.com/gregorykan/glass_leaves)</p>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <div class="added-actions">
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <%= select_tag :method, options_for_select(@procedures), prompt: 'Choose a manipulation', class: ['action-select'] %>
          <button type="button" class="add-action-btn">Add Manipulation</button>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-5">
          <%= submit_tag("Manipulate Text", :class => ['submit-btn']) %>
        </div>
      </div>
    <% end %>
</div>

<script type="text/javascript">
$(function(){
  var seq = 1;
  $('.add-action-btn').click(function(){
    var current = seq;
    seq += 1;
    var selected_action_id = $('.action-select').val();
    var selected_text = $('.action-select option[value='+selected_action_id+']').text();
    if (selected_action_id == '10' || selected_action_id == '11')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Text to splice with" rows="7" cols="44"></textarea> \
      </div>';
    else if (selected_action_id == '12')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Target"></textarea> \
        <textarea name="operations['+current+'][args][1]" type="text" class="action-args" placeholder="Replacement"></textarea> \
      </div>';
    else if (selected_action_id == '13')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" placeholder="Replacement"></textarea> \
      </div>';
    else if (selected_action_id == '14')
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span><br> \
        <textarea name="operations['+current+'][args][0]" type="text" class="action-args" rows="7" cols="44" placeholder="Text to swap nouns with"></textarea> \
      </div>';
    else
      var block = '<div class="action-item"> \
        <input type="hidden" value="'+selected_action_id+'" name="operations['+current+'][name]"> \
        <span class="action-label">'+selected_text+'</span> \
        <input type="hidden" name="operations['+current+'][args][0]" type="text"> \
      </div>';
    var item = $(block)
    $('.added-actions').append(item);
  })
})
</script>

{'fraction_non_alphanumeric': 0.1994984040127679, 'fraction_numerical': 0.010487916096671226, 'mean_word_length': 3.191591017677974, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 0, '>': 197, 'https://': 2, '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': '492922', 'n_tokens_mistral': 2813, 'n_tokens_neox': 2746, 'n_words': 644}