Commit cafa3ccd authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[graph] some more ngrams children work in graph

parent 8fab2571
This diff is collapsed.
...@@ -188,11 +188,11 @@ computeGraph cId d nt repo = do ...@@ -188,11 +188,11 @@ computeGraph cId d nt repo = do
-- printDebug "myCooc" myCooc -- printDebug "myCooc" myCooc
-- saveAsFileDebug "debug/my-cooc" myCooc -- saveAsFileDebug "debug/my-cooc" myCooc
listNgrams <- getListNgrams [lId] NgramsTerms listNgrams <- getListNgrams [lId] nt
graph <- liftBase $ cooc2graphWith Spinglass d 0 myCooc graph <- liftBase $ cooc2graphWith Spinglass d 0 myCooc
-- saveAsFileDebug "debug/graph" graph -- saveAsFileDebug "debug/graph" graph
pure $ set graph_ngrams (Just listNgrams) graph pure $ mergeGraphNgrams graph (Just listNgrams)
defaultGraphMetadata :: HasNodeError err defaultGraphMetadata :: HasNodeError err
......
...@@ -207,22 +207,22 @@ data2graph :: ToComId a ...@@ -207,22 +207,22 @@ data2graph :: ToComId a
-> Graph -> Graph
data2graph labels coocs bridge conf partitions = Graph { _graph_nodes = nodes data2graph labels coocs bridge conf partitions = Graph { _graph_nodes = nodes
, _graph_edges = edges , _graph_edges = edges
, _graph_metadata = Nothing , _graph_metadata = Nothing }
, _graph_ngrams = Nothing }
where where
community_id_by_node_id = Map.fromList $ map nodeId2comId partitions community_id_by_node_id = Map.fromList $ map nodeId2comId partitions
nodes = map (setCoord ForceAtlas labels bridge) nodes = map (setCoord ForceAtlas labels bridge)
[ (n, Node { node_size = maybe 0 identity (Map.lookup (n,n) coocs) [ (n, Node { node_size = maybe 0 identity (Map.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 = l , node_label = l
, node_x_coord = 0 , node_x_coord = 0
, node_y_coord = 0 , node_y_coord = 0
, node_attributes = , node_attributes =
Attributes { clust_default = maybe 0 identity Attributes { clust_default = maybe 0 identity
(Map.lookup n community_id_by_node_id) } } (Map.lookup n community_id_by_node_id) }
, node_children = [] }
) )
| (l, n) <- labels | (l, n) <- labels
, Set.member n $ Set.fromList , Set.member n $ Set.fromList
......
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