<commit_before>(ns crawler.structure-driven
  "An implementation of the structure driven crawler.
   Requires an entry point and a target page.
   The structure driven crawler fetches a navigation
   pattern = XPath seq"
  (:require [crawler.rich-char-extractor :as rc-extractor]
            [crawler.similarity :as similarity]))

(defn stop?
  [{visited :visited}]
  (<= 100 visited))

(defn leaf?
  ([body example-leaf]
     (leaf? body example-leaf 0.8))
  
  ([body example-leaf thresh]
     (let [sim (similarity/tree-edit-distance-html
                body
                example-leaf)]
       (do
         (println :similarity sim)
         (<= thresh sim)))))

(def extractor rc-extractor/state-action)<commit_msg>similarity was printed to stdout. fixed<commit_after>(ns crawler.structure-driven
  "An implementation of the structure driven crawler.
   Requires an entry point and a target page.
   The structure driven crawler fetches a navigation
   pattern = XPath seq"
  (:require [crawler.rich-char-extractor :as rc-extractor]
            [crawler.similarity :as similarity]
            [crawler.utils :as utils]))

(defn stop?
  [{visited :visited}]
  (<= 100 visited))

(defn leaf?
  ([body example-leaf]
     (leaf? body example-leaf 0.8))
  
  ([body example-leaf thresh]
     (let [sim (similarity/tree-edit-distance-html
                body
                example-leaf)]
       (do
         (utils/sayln :similarity sim)
         (<= thresh sim)))))

(def extractor rc-extractor/state-action)
{'fraction_non_alphanumeric': 0.11096433289299867, 'fraction_numerical': 0.0066050198150594455, 'mean_word_length': 2.6771844660194173, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4130266', 'n_tokens_mistral': 489, 'n_tokens_neox': 461, 'n_words': 137}