Commit 974a917d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Reindexing

parent 53f801e7
......@@ -158,7 +158,7 @@ reIndexWith cId lId nt lts = do
-- Checking Text documents where orphans match
-- TODO Tests here
let
ngramsByDoc = map (HashMap.fromList)
ngramsByDoc = map (HashMap.fromListWith (<>))
$ map (map (\(k,v) -> (SimpleNgrams (text2ngrams k), v)))
$ map (\doc -> List.zip
(termsInText (buildPatterns $ map (\k -> (Text.splitOn " " $ unNgramsTerm k, [])) orphans)
......
......@@ -70,9 +70,8 @@ buildPatterns = sortWith (Down . _pat_length) . concatMap buildPattern
--------------------------------------------------------------------------
-- Utils
type BlockText = Text
type MatchedText = Text
termsInText :: Patterns -> BlockText -> [MatchedText]
termsInText :: Patterns -> Text -> [MatchedText]
termsInText pats txt = List.nub
$ List.concat
$ map (map unwords)
......
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