revamped logging!
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
(ns auto-ap.parse
|
||||
(:require [auto-ap.parse.excel :as excel]
|
||||
(:require [auto-ap.parse.csv :as csv]
|
||||
[auto-ap.parse.excel :as excel]
|
||||
[auto-ap.parse.templates :as t]
|
||||
[auto-ap.parse.util :as u]
|
||||
[auto-ap.parse.csv :as csv]
|
||||
[clj-fuzzy.metrics :as m]
|
||||
[clojure.java.shell :as sh]
|
||||
[clojure.string :as str]
|
||||
[clj-time.format :as f]
|
||||
[clj-time.core :as time]
|
||||
[clojure.set :as set]))
|
||||
|
||||
[clj-time.format :as f]
|
||||
[clojure.java.shell :as sh]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.logging :as log]
|
||||
[auto-ap.logging :refer [info-event]]))
|
||||
|
||||
(def last-text (atom nil))
|
||||
|
||||
@@ -19,7 +20,8 @@
|
||||
|
||||
(defn extract-template
|
||||
([text template]
|
||||
(println "template" template)
|
||||
(log/info "Template was determined to be" template)
|
||||
|
||||
(if (:multi template)
|
||||
(mapcat
|
||||
#(extract-template % text (dissoc template :multi))
|
||||
@@ -39,16 +41,15 @@
|
||||
str/trim )
|
||||
[value-parser parser-params] (-> template :parser k)]
|
||||
(assoc result k (try
|
||||
(println "applying parser" value-parser "to value" value)
|
||||
(u/parse-value value-parser parser-params value)
|
||||
(catch Exception e
|
||||
(println e))))))
|
||||
(log/warn e))))))
|
||||
{:vendor-code (:vendor template)
|
||||
:text text
|
||||
:full-text full-text}))])))
|
||||
|
||||
(defn parse [text]
|
||||
(println "Parsing PDF " text)
|
||||
(info-event "Parsing pdf text" {:raw text})
|
||||
(reset! last-text text)
|
||||
(->> t/pdf-templates
|
||||
(filter (partial template-applies? text))
|
||||
|
||||
Reference in New Issue
Block a user