forgiveness.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
(defn extract-template
|
(defn extract-template
|
||||||
([text template]
|
([text template]
|
||||||
|
(println "template" template)
|
||||||
(if (:multi template)
|
(if (:multi template)
|
||||||
(mapcat
|
(mapcat
|
||||||
#(extract-template % text (dissoc template :multi))
|
#(extract-template % text (dissoc template :multi))
|
||||||
@@ -37,12 +38,15 @@
|
|||||||
(first (map second (re-seq v full-text))))
|
(first (map second (re-seq v full-text))))
|
||||||
str/trim )
|
str/trim )
|
||||||
[value-parser parser-params] (-> template :parser k)]
|
[value-parser parser-params] (-> template :parser k)]
|
||||||
(assoc result k (u/parse-value value-parser parser-params value))))
|
(assoc result k (try (u/parse-value value-parser parser-params value)
|
||||||
|
(catch Exception e
|
||||||
|
(println e))))))
|
||||||
{:vendor-code (:vendor template)
|
{:vendor-code (:vendor template)
|
||||||
:text text
|
:text text
|
||||||
:full-text full-text}))])))
|
:full-text full-text}))])))
|
||||||
|
|
||||||
(defn parse [text]
|
(defn parse [text]
|
||||||
|
(println "Parsing PDF " text)
|
||||||
(reset! last-text text)
|
(reset! last-text text)
|
||||||
(->> t/pdf-templates
|
(->> t/pdf-templates
|
||||||
(filter (partial template-applies? text))
|
(filter (partial template-applies? text))
|
||||||
|
|||||||
Reference in New Issue
Block a user