<commit_before>(ns kevin.routes.home
  (:require [compojure.core :refer :all]
            [hiccup.form :refer :all]
            [hiccup.util :refer [url]]
            [hiccup.element :refer [link-to]]
            [clojure.string :as str]
            [datomic.api :as d]
            [kevin.core]
            [kevin.views.layout :as layout]
            [kevin.search :as s]))

(defn form [person1 person2]
  (form-to [:get "search"]
           [:h2 "Search"]
           [:fieldset
            [:p "Choose two people"]
            [:p
             (label "person1" "From")
             (text-field "person1" person1)]
            [:p
             (label "person2" "To")
             (text-field "person2" person2)]]
           [:fieldset.actions
            (submit-button "Go")]))

(defn home []
  (layout/common
    (form nil "Bacon, Kevin (I)")))

(defn results [db search]
  (let [[result1 result2] search
        paths (s/find-annotated-paths db (:actor-id result1) (:actor-id result2) :limit 25)
        bacon-number (int (/ (-> paths first count) 2))]
    (layout/common
      (if (seq paths)
        [:div#results
         [:h2 "Results"]
         [:p "Bacon Number: " [:strong bacon-number]]
         (for [path paths]
           [:ul
            (for [node path] [:li {:class (:type node)} (:name node)])])]
        [:p "Not linkable in 5 hops or fewer"]))))

(defn disambiguate [search]
  (let [[result1 result2] search]
    (layout/common
      [:h2 "Did you mean one of the below?"]
      (or (seq (for [person1 (:names result1)
                     person2 (:names result2)]
                 [:p (link-to
                       (url "/search" {:person1 person1 :person2 person2})
                       (str person1 " -> " person2))]))
          [:p "No Results. Try another search"])
      (form (:name result1) (:name result2)))))

(defn search [context {:keys [person1 person2]}]<commit_msg>Change limit to 50<commit_after>(ns kevin.routes.home
  (:require [compojure.core :refer :all]
            [hiccup.form :refer :all]
            [hiccup.util :refer [url]]
            [hiccup.element :refer [link-to]]
            [clojure.string :as str]
            [datomic.api :as d]
            [kevin.core]
            [kevin.views.layout :as layout]
            [kevin.search :as s]))

(defn form [person1 person2]
  (form-to [:get "search"]
           [:h2 "Search"]
           [:fieldset
            [:p "Choose two people"]
            [:p
             (label "person1" "From")
             (text-field "person1" person1)]
            [:p
             (label "person2" "To")
             (text-field "person2" person2)]]
           [:fieldset.actions
            (submit-button "Go")]))

(defn home []
  (layout/common
    (form nil "Bacon, Kevin (I)")))

(defn results [db search]
  (let [[result1 result2] search
        paths (s/find-annotated-paths db (:actor-id result1) (:actor-id result2) :limit 50)
        bacon-number (int (/ (-> paths first count) 2))]
    (layout/common
      (if (seq paths)
        [:div#results
         [:h2 "Results"]
         [:p "Bacon Number: " [:strong bacon-number]]
         (for [path paths]
           [:ul
            (for [node path] [:li {:class (:type node)} (:name node)])])]
        [:p "Not linkable in 5 hops or fewer"]))))

(defn disambiguate [search]
  (let [[result1 result2] search]
    (layout/common
      [:h2 "Did you mean one of the below?"]
      (or (seq (for [person1 (:names result1)
                     person2 (:names result2)]
                 [:p (link-to
                       (url "/search" {:person1 person1 :person2 person2})
                       (str person1 " -> " person2))]))
          [:p "No Results. Try another search"])
      (form (:name result1) (:name result2)))))

(defn search [context {:keys [person1 person2]}]
{'fraction_non_alphanumeric': 0.15360419397116645, 'fraction_numerical': 0.01887287024901704, 'mean_word_length': 1.8308605341246291, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3918378', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1195, 'n_words': 354}