Commit 4dc5f9e2 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[john-snow-nlp] some tests for get pos/lemma

parent 3590f89f
......@@ -172,7 +172,7 @@ reIndexWith cId lId nt lts = do
, doc ^. context_hyperdata . hd_abstract
]
)
(List.cycle [Map.fromList $ [(nt, Map.singleton (doc ^. context_id) 1 )]])
(List.cycle [Map.fromList $ [(nt, Map.singleton (doc ^. context_id) 1)]])
) docs
-- printDebug "ngramsByDoc" ngramsByDoc
......
......@@ -38,9 +38,7 @@ type Patterns = [Pattern]
replaceTerms :: Patterns -> [Text] -> [[Text]]
replaceTerms pats terms = go 0
where
terms_len = length terms
go ix | ix >= terms_len = []
go ix | ix >= (length terms) = []
| otherwise =
case IntMap.lookup ix m of
Nothing -> go (ix + 1)
......
......@@ -179,6 +179,24 @@ waitForJsTask jsTask = wait' 0
_ <- threadDelay $ 1000000*1
wait' $ counter + 1
getPosTag :: Lang -> Text -> IO JSAsyncTaskResponse
getPosTag l t = do
jsPosTask <- jsRequest t (JSPOS l)
-- wait for both tasks
jsPos <- waitForJsTask jsPosTask
pure jsPos
getLems :: Lang -> Text -> IO JSAsyncTaskResponse
getLems l t = do
jsLemma <- jsRequest t (JSLemma l)
-- wait for both tasks
jsLemma <- waitForJsTask jsLemma
pure jsLemma
getPosTagAndLems :: Lang -> Text -> IO PosSentences
getPosTagAndLems l t = do
jsPosTask <- jsRequest t (JSPOS l)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment