<commit_before>username_strategy =
  match: /(^|\s)@(\w*)$/;
  search: (name, callback)->
    search_call = $.getJSON("/user_lookup",{name: name})
    search_call.done (result)->
      callback( result.map (r)-> r.name)
    search_call.fail -> callback([],true)
  replace: (entry)->
    " @#{entry} "
  template: (entry)->
    "@#{entry}"


stratagies = [username_strategy]


$ ->
  $(".auto-complete").textcomplete(stratagies,{})
<commit_msg>adding the idea title lookup to the autocomplete <commit_after>username_strategy =
  match: /(^|\s)@(\w*)$/;
  search: (name, callback)->
    search_call = $.getJSON("/user_lookup",{query: name})
    search_call.done (result)->
      callback( result.map (r)-> r.name)
    search_call.fail -> callback([],true)
  replace: (entry)->
    "@#{entry} "
  template: (entry)->
    "@#{entry}"

idea_title_strategy =
  match: /(^|\s)#(\w*)$/;
  search: (name, callback)->
    search_call = $.getJSON("/idea_title_lookup",{query: name})
    search_call.done (result)->
      callback result
    search_call.fail -> callback([],true)
  replace: (entry)->
    "##{entry.title.substring(0,10).replace(" ","_")}[#{entry.doi}] "
  template: (entry)->
    "#{entry.title}"

stratagies = [username_strategy, idea_title_strategy ]


$ ->
  $(".auto-complete").textcomplete(stratagies,{})

{'fraction_non_alphanumeric': 0.21825095057034222, 'fraction_numerical': 0.0022813688212927757, 'mean_word_length': 3.7681159420289854, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '4324061', 'n_tokens_mistral': 469, 'n_tokens_neox': 471, 'n_words': 83}