私はwit.aiのDuckling(https://duckling.wit.ai/)と一緒に作業していますが、私はJavaアプリケーション内からDucklingを呼び出して呼び出しています。私はClojureの経験はありません...Javaアプリケーション内からDuckling Clojure関数にパラメータを渡す
私はDucklingの解析メソッドを実行することができますが、日付と時刻をコンテキストに渡して時間と日付の解決に使用する方法を理解することはできません。それはファイルの先頭にコンテキスト日付を持って、テストコーパスで
(defn parse
"Public API. Parses text using given module. If dims are provided as a list of
keywords referencing token dimensions, only these dimensions are extracted.
Context is a map with a :reference-time key. If not provided, the system
current date and time is used."
([module text]
(parse module text []))
([module text dims]
(parse module text dims (default-context :now)))
([module text dims context]
(->> (analyze text context module (map (fn [dim] {:dim dim :label dim}) dims) nil)
:winners
(map #(assoc % :value (engine/export-value % {})))
(map #(select-keys % [:dim :body :value :start :end :latent])))))
:ここ
機能です。これは、コーパスのテスト中に解析関数に渡されます。{:reference-time (time/t -2 2013 2 12 4 30 0)
:min (time/t -2 1900)
:max (time/t -2 2100)}
ここ
は私のJavaコードです:
public void extract(String input) {
IFn require = Clojure.var("clojure.core", "require");
require.invoke(Clojure.read("duckling.core"));
Clojure.var("duckling.core", "load!").invoke();
LazySeq o = (LazySeq) Clojure.var("duckling.core", "parse").invoke("en$core", input, dims);
}
私の質問は、私はparse関数へのパラメータとしてでは特定の日付/時刻を挿入しますどのように、ありますか?
EDIT 1もう少し見ると、これはdatetimeオブジェクトのようです。 Ducklingはclj-time 0.8.0に依存していますが、clj-timeを呼び出してJavaで同じオブジェクトを作成する方法を理解することはできません。