<commit_before>$(document).on 'ready page:load', ->
  $('.js-select2-select').select2(
    theme: "bootstrap"
    tags: true
    allowClear: true,
    placeholder: 'Select a tag'
  )

  $('.js-show-edit-form').click ->
    $('.js-edit-form-container').show()
    $('.js-show-container').hide()

  $('.js-show-more').click ->
    $('.js-show-more-container').show()
    $(this).hide()

  $('.js-show-quick-forms').click ->
    $('.js-show-quick-forms-container').show()
    $(this).hide()

  $('.js-person-name').on 'keyup', ->
    name = $(this).val().replace(/^\s+|\s+$/g, '');
    if name.length > 1
      $.ajax(url: "/people.json?q[name_cont]=#{name}&q[id_not_eq]=#{$(this).data('current-id')}")
        .done (response)->
          if response.length > 0
            $('.js-similar-people-container').html("Found #{response.length} similar people")
            if response.length < 10
              $('.js-similar-people-container').append(": ")
              for person in response
                $('.js-similar-people-container').append("<a target='_blank' href='/people\/#{person["id"]}'>#{person["name"]}</a> &nbsp;")
          else
            $('.js-similar-people-container').html('Similar people not found')

      if name.indexOf(' ') > 0
        reverse_name = name.split(/\s+/).reverse().join(' ')
        $.ajax(url: "/people.json?q[name_cont]=#{reverse_name}&q[id_not_eq]=#{$(this).data('current-id')}")
          .done (response)->
            if response.length > 0
              if $('.js-similar-people-container').html().length > 0
                $('.js-similar-people-container').append('. ')
              $('.js-similar-people-container').append("Found #{response.length} with reversed name")
              if response.length < 10
                $('.js-similar-people-container').append(": ")
                for person in response
                  $('.js-similar-people-container').append("<a target='_blank' href='/people\/#{person["id"]}'>#{person["name"]}</a> &nbsp;")<commit_msg>account all typed words when search for similar people<commit_after>$(document).on 'ready page:load', ->
  $('.js-select2-select').select2(
    theme: "bootstrap"
    tags: true
    allowClear: true,
    placeholder: 'Select a tag'
  )

  $('.js-show-edit-form').click ->
    $('.js-edit-form-container').show()
    $('.js-show-container').hide()

  $('.js-show-more').click ->
    $('.js-show-more-container').show()
    $(this).hide()

  $('.js-show-quick-forms').click ->
    $('.js-show-quick-forms-container').show()
    $(this).hide()

  $('.js-person-name').on 'keyup', ->
    name = $(this).val().replace(/^\s+|\s+$/g, '');
    container = $('.js-similar-people-container')
    if name.length > 1
      query = "/people.json?q[id_not_eq]=#{$(this).data('current-id')}"
      for part in name.split(/\s+/)
        query = query + "&q[name_cont_all][]=#{part}"

      $.ajax(url: query)
        .done (response)->
          container.html('')
          if response.length > 0
            container.html("Found #{response.length} similar people")
            if response.length < 10
              container.append(": ")
              for person in response
                container.append("<a target='_blank' href='/people\/#{person["id"]}'>#{person["name"]}</a> &nbsp;")
{'fraction_non_alphanumeric': 0.22941355211182013, 'fraction_numerical': 0.005165603160133698, 'mean_word_length': 2.48728813559322, 'pattern_counts': {'":': 3, '<': 12, '<?xml version=': 0, '>': 29, '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': '803872', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1031, 'n_words': 163}