Commit 74ee77a3 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[GRAPH][COOC] Database mainly.

parent 71378e8e
...@@ -121,6 +121,7 @@ coocOn' fun ts = DMS.fromListWith (+) xs ...@@ -121,6 +121,7 @@ coocOn' fun ts = DMS.fromListWith (+) xs
, x >= y , x >= y
] ]
------------------------------------------------------------------------ ------------------------------------------------------------------------
coocOnContexts :: (a -> [Text]) -> [[a]] -> Map ([Text], [Text]) Int coocOnContexts :: (a -> [Text]) -> [[a]] -> Map ([Text], [Text]) Int
......
...@@ -59,8 +59,8 @@ $(deriveJSON (unPrefix "") ''Attributes) ...@@ -59,8 +59,8 @@ $(deriveJSON (unPrefix "") ''Attributes)
instance ToSchema Attributes instance ToSchema Attributes
data Node = Node { node_size :: Int data Node = Node { node_size :: Int
, node_type :: TypeNode , node_type :: TypeNode -- TODO NgramsType | Person
, node_id :: Text , node_id :: Text -- TODO NgramId
, node_label :: Text , node_label :: Text
, node_attributes :: Attributes , node_attributes :: Attributes
} }
...@@ -173,9 +173,9 @@ data2graph labels coocs distance partitions = Graph nodes edges Nothing ...@@ -173,9 +173,9 @@ data2graph labels coocs distance partitions = Graph nodes edges Nothing
community_id_by_node_id = M.fromList [ (n, c) | LouvainNode n c <- partitions ] community_id_by_node_id = M.fromList [ (n, c) | LouvainNode n c <- partitions ]
nodes = [ Node { node_size = maybe 0 identity (M.lookup (n,n) coocs) nodes = [ Node { node_size = maybe 0 identity (M.lookup (n,n) coocs)
, node_type = Terms -- or Unknown , node_type = Terms -- or Unknown
, node_id = cs (show n) , node_id = cs (show n)
, node_label = T.unwords l , node_label = T.unwords l
, node_attributes = , node_attributes =
Attributes { clust_default = maybe 0 identity Attributes { clust_default = maybe 0 identity
(M.lookup n community_id_by_node_id) } } (M.lookup n community_id_by_node_id) } }
| (l, n) <- labels ] | (l, n) <- labels ]
......
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