<commit_before>(ns rdf-path-examples.diversification-test
  (:require [rdf-path-examples.diversification :as divers]
            [clojure.set :refer [union]]
            [clojure.test :refer :all]))

(deftest greedy-construction
  (let [distances {#{1 2} 0.5
                   #{1 3} 1
                   #{2 3} 0.5}
        distance-fn (fn [a b] (get distances (hash-set a b)))
        paths (apply union (keys distances))]
    (with-redefs [rand-nth (constantly 1)] ; Start with path 1
      (is (= (divers/greedy-construction paths distance-fn 2) #{1 3})))))
<commit_msg>Test greedy construction for 3 selected items<commit_after>(ns rdf-path-examples.diversification-test
  (:require [rdf-path-examples.diversification :as divers]
            [clojure.set :refer [union]]
            [clojure.test :refer :all]))

(deftest greedy-construction
  (let [distances {#{1 2} 0.5
                   #{1 3} 1
                   #{1 4} 1
                   #{2 3} 0.5
                   #{2 4} 0.5
                   #{3 4} 0}
        distance-fn (fn [a b] (get distances (hash-set a b)))
        paths (apply union (keys distances))]
    (with-redefs [rand-nth (constantly 1)] ; Start with path 1
      (is (= (divers/greedy-construction paths distance-fn 3) #{1 2 3})))))

{'fraction_non_alphanumeric': 0.14173228346456693, 'fraction_numerical': 0.03464566929133858, 'mean_word_length': 2.0924574209245743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4256509', 'n_tokens_mistral': 453, 'n_tokens_neox': 413, 'n_words': 124}