Commit 7c083bed authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FLOW][DB][NGRAMS] grouping function and insertion design (for meeting).

parent b6abd151
...@@ -108,9 +108,11 @@ toInserted :: [ReturnId] -> Map HashId ReturnId ...@@ -108,9 +108,11 @@ toInserted :: [ReturnId] -> Map HashId ReturnId
toInserted rs = DM.fromList $ map (\r -> (reUniqId r, r) ) toInserted rs = DM.fromList $ map (\r -> (reUniqId r, r) )
$ filter (\r -> reInserted r == True) rs $ filter (\r -> reInserted r == True) rs
data DocumentWithId = DocumentWithId { documentId :: NodeId data DocumentWithId =
, documentData :: HyperdataDocument DocumentWithId
} { documentId :: NodeId
, documentData :: HyperdataDocument
}
mergeData :: Map HashId ReturnId -> Map HashId HyperdataDocument -> [DocumentWithId] mergeData :: Map HashId ReturnId -> Map HashId HyperdataDocument -> [DocumentWithId]
...@@ -118,10 +120,11 @@ mergeData rs hs = map (\(hash,r) -> DocumentWithId (reId r) (lookup' hash hs)) $ ...@@ -118,10 +120,11 @@ mergeData rs hs = map (\(hash,r) -> DocumentWithId (reId r) (lookup' hash hs)) $
where where
lookup' h xs = maybe (panic $ "Error with " <> h) identity (DM.lookup h xs) lookup' h xs = maybe (panic $ "Error with " <> h) identity (DM.lookup h xs)
data DocumentIdWithNgrams = DocumentIdWithNgrams { documentWithId :: DocumentWithId data DocumentIdWithNgrams =
, document_ngrams :: Map (NgramsT Ngrams)Int DocumentIdWithNgrams
} { documentWithId :: DocumentWithId
, document_ngrams :: Map (NgramsT Ngrams) Int
}
documentIdWithNgrams :: (HyperdataDocument -> Map (NgramsT Ngrams) Int) documentIdWithNgrams :: (HyperdataDocument -> Map (NgramsT Ngrams) Int)
-> [DocumentWithId] -> [DocumentIdWithNgrams] -> [DocumentWithId] -> [DocumentIdWithNgrams]
...@@ -149,19 +152,20 @@ insertToNodeNgrams m = insertNodeNgrams $ [ NodeNgram Nothing nId ((_ngramsId ...@@ -149,19 +152,20 @@ insertToNodeNgrams m = insertNodeNgrams $ [ NodeNgram Nothing nId ((_ngramsId
, (nId, n) <- DM.toList nId2int , (nId, n) <- DM.toList nId2int
] ]
------------------------------------------------------------------------
groupNgramsBy :: fun
listFlow :: UserId -> CorpusId -> Map (NgramsT NgramsIndexed) (Map NodeId Int) -> Cmd [ListId] listFlow :: UserId -> CorpusId -> Map (NgramsT NgramsIndexed) (Map NodeId Int) -> Cmd [ListId]
listFlow uId cId ng = do listFlow uId cId ng = do
lId <- mkList cId uId lId <- mkList cId uId
-- groupNgramsBy fun
-- insertGroups = NodeNgramsNgrams -- insertGroups = NodeNgramsNgrams
pure lId
-- compute Candidate / Map -- compute Candidate / Map
-- ALTER TABLE nodes_nodes_ngrams ADD COLUMN typelist int; -- ALTER TABLE nodes_nodes_ngrams ADD COLUMN typelist int;
-- insertLists = NodeNodeNgram -- insertLists = NodeNodeNgram
pure lId
......
...@@ -7,8 +7,12 @@ Maintainer : team@gargantext.org ...@@ -7,8 +7,12 @@ Maintainer : team@gargantext.org
Stability : experimental Stability : experimental
Portability : POSIX Portability : POSIX
Here is a longer description of this module, containing some NodeNgramNgram table is used to group Ngrams
commentary with @some markup@.
Next Step:
- group with: https://en.wikipedia.org/wiki/Nested_set_model
-} -}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
......
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