@@ -16,15 +16,23 @@ cause the tagger to cry."
16
16
17
17
(defn print-err [msg] (.println *err* msg))
18
18
19
- (defn -main [tag-path defns-path & args]
19
+ (def get-home (memoize (fn [] (System/getenv " HOME" ))))
20
+
21
+ (defn tilde-expand [str] (.replace str " ~" (get-home )))
22
+
23
+ (defn -main [tag-path-unfiltered defns-path-unfiltered & args]
20
24
; ; these are memoized, so we're not throwing away data. this also checks if
21
25
; ; the files actually exist immediately upon startup. these are still memoized
22
26
; ; and not set as globals for easier testing
23
27
; ; this will spew something out to stderr, really wish corenlp would stop that
24
- (pos/load-pos-tagger tag-path)
25
- (pos/tag-defns defns-path )
26
- (print-err (format " %s %s" " Tagger loaded from:" tag-path))
27
- (print-err (format " %s %s" " Tag definitions loaded from:" defns-path ))
28
- (print-err begin-string)
29
- (doseq [temp-file (line-seq (BufferedReader. *in*))]
30
- (println (json/write-str (analyze-file temp-file tag-path defns-path )))))
28
+ (let [tag-path (tilde-expand tag-path-unfiltered)
29
+ defns-path (tilde-expand defns-path-unfiltered )]
30
+ (pos/load-pos-tagger tag-path)
31
+ (pos/tag-defns defns-path )
32
+ (print-err (format " %s %s" " Tagger loaded from:" tag-path))
33
+ (print-err (format " %s %s" " Tag definitions loaded from:" defns-path ))
34
+ (print-err begin-string)
35
+ (doseq [temp-file (line-seq (BufferedReader. *in*))]
36
+ (println
37
+ (json/write-str
38
+ (analyze-file (tilde-expand temp-file) tag-path defns-path ))))))
0 commit comments