 
 (defn leaf?
   [src-num target-num]
-  (<= 0.5 (/ target-num src-num)))
+  (and
+   (-> src-num nil? not)
+   (<= 0.5 (/ target-num src-num))))
 
 (defn state-action
   "Args:

                                               (not (some #{href} template-links)))
                                             infos)]))
                                 xpaths-hrefs-text)
           
           xpaths-anchors-chars (map
                                 (fn [[xpath nodes]]
                                   [xpath (map

                                               (+ acc (:num-chars an-info)))
                                             0
                                             info)

                                     :hrefs (reduce
                                             (fn [acc an-info]
                                               (cons (:href an-info) acc))
                                             '()
                                             info)})
                                  xpaths-anchors-chars))]

       {:total-nav-info page-wide-nav-chars
        :xpath-nav-info (sort-by :score xpath-nav-info)})))

(defn filter-content
  "Helper routine you can use to filter
   content that the extractor mined.
   Threshold determined by training"
  [content]
  (filter
   (fn [x]
     (->> x :score (<= 0.1)))
   (map
    (fn [{xpath :xpath score :score hrefs :hrefs}]
      {:xpath xpath
       :score (/ score (:total-nav-info content))
       :hrefs hrefs})
    (:xpath-nav-info content))))
