<commit_before>(function($){
  var el;
  var settings = {};

  var methods = {
    init: function(options) {
      el = this;

      settings = {
                   token: false,
                   query_param: 'query'
                 };

      if (options) {
        $.extend(settings, options);
      }

      if (!settings.token || settings.query_param == '') {
        return this;
      }

      $.getJSON(
        'http://tapirgo.com/api/1/search.json?token=' + settings.token + '&query=' + paramValue(settings.query_param) + '&callback=?', function(data){
          if(settings['complete']) { settings.complete() }
          $.each(data, function(key, val) {
            summary = val.summary;
            if (settings.summary_limit != null) {
              summary = summary.slice(0, settings.summary_limit);
              summary += '...'
            }
            el.append('<div class="result"><h3><a href="' + val.link + '">' + val.title + '</a></h3><p>' + summary + '</p></div>');
          });
        }
      );

      return this;
    }
  };

  // Extract the param value from the URL.
  function paramValue(query_param) {
    var results = new RegExp('[\\?&]' + query_param + '=([^&#]*)').exec(window.location.href);
    return results ? results[1] : false;
  }

  $.fn.tapir = function(method) {
    if (methods[method]) {<commit_msg>Search results now trim on a the first space before the limit.<commit_after>(function($){
  var el;
  var settings = {};

  var methods = {
    init: function(options) {
      el = this;

      settings = {
                   token: false,
                   query_param: 'query'
                 };

      if (options) {
        $.extend(settings, options);
      }

      if (!settings.token || settings.query_param == '') {
        return this;
      }

      $.getJSON(
        'http://tapirgo.com/api/1/search.json?token=' + settings.token + '&query=' + paramValue(settings.query_param) + '&callback=?', function(data){
          if(settings['complete']) { settings.complete() }
          $.each(data, function(key, val) {
            summary = val.summary;
            if (settings.summary_limit != null) {
              summary = summary.slice(0, settings.summary_limit);
              summary = summary.slice(0, summary.lastIndexOf(' '));
              summary += '...';
            }
            el.append('<div class="result"><h3><a href="' + val.link + '">' + val.title + '</a></h3><p>' + summary + '</p></div>');
          });
        }
      );

      return this;
    }
  };

  // Extract the param value from the URL.
  function paramValue(query_param) {
    var results = new RegExp('[\\?&]' + query_param + '=([^&#]*)').exec(window.location.href);
    return results ? results[1] : false;
  }

  $.fn.tapir = function(method) {
    if (methods[method]) {
{'fraction_non_alphanumeric': 0.17669971671388102, 'fraction_numerical': 0.003895184135977337, 'mean_word_length': 1.955020920502092, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2632250', 'n_tokens_mistral': 863, 'n_tokens_neox': 830, 'n_words': 172}