Commit cb1136b4 authored by qlobbe's avatar qlobbe

export done

parent bba0632d
...@@ -105,8 +105,8 @@ defaultConfig = ...@@ -105,8 +105,8 @@ defaultConfig =
, outputPath = "" , outputPath = ""
, corpusParser = Csv 1000 , corpusParser = Csv 1000
, phyloName = pack "Default Phylo" , phyloName = pack "Default Phylo"
, phyloLevel = 2 , phyloLevel = 1
, phyloProximity = WeightedLogJaccard 10 0 0.2 , phyloProximity = WeightedLogJaccard 10 0 0.1
, timeUnit = Year 3 1 5 , timeUnit = Year 3 1 5
, contextualUnit = Fis 2 4 , contextualUnit = Fis 2 4
, exportLabel = [BranchLabel MostInclusive 2, GroupLabel MostEmergentInclusive 2] , exportLabel = [BranchLabel MostInclusive 2, GroupLabel MostEmergentInclusive 2]
...@@ -311,6 +311,8 @@ data PhyloFis = PhyloFis ...@@ -311,6 +311,8 @@ data PhyloFis = PhyloFis
type DotId = TextLazy.Text type DotId = TextLazy.Text
data EdgeType = GroupToGroup | BranchToGroup | BranchToBranch | PeriodToPeriod deriving (Show,Generic,Eq)
data Filter = ByBranchSize { _branch_size :: Double } deriving (Show,Generic,Eq) data Filter = ByBranchSize { _branch_size :: Double } deriving (Show,Generic,Eq)
data Order = Asc | Desc deriving (Show,Generic,Eq) data Order = Asc | Desc deriving (Show,Generic,Eq)
...@@ -333,7 +335,6 @@ data PhyloBranch = ...@@ -333,7 +335,6 @@ data PhyloBranch =
{ _branch_id :: PhyloBranchId { _branch_id :: PhyloBranchId
, _branch_label :: Text , _branch_label :: Text
, _branch_meta :: Map Text [Double] , _branch_meta :: Map Text [Double]
, _branch_cluster :: [Int]
} deriving (Generic, Show) } deriving (Generic, Show)
data PhyloExport = data PhyloExport =
......
...@@ -29,13 +29,22 @@ import Gargantext.Text.Terms.Mono (monoTexts) ...@@ -29,13 +29,22 @@ import Gargantext.Text.Terms.Mono (monoTexts)
import Gargantext.Viz.AdaptativePhylo import Gargantext.Viz.AdaptativePhylo
import Gargantext.Viz.Phylo.PhyloTools import Gargantext.Viz.Phylo.PhyloTools
import Gargantext.Viz.Phylo.PhyloMaker import Gargantext.Viz.Phylo.PhyloMaker
import Gargantext.Viz.Phylo.PhyloExport
import Gargantext.Viz.Phylo.TemporalMatching (temporalMatching) import Gargantext.Viz.Phylo.TemporalMatching (temporalMatching)
import Control.Lens import Control.Lens
import Data.GraphViz.Types.Generalised (DotGraph)
import qualified Data.Vector as Vector import qualified Data.Vector as Vector
phyloExport :: IO ()
phyloExport = dotToFile "/home/qlobbe/data/phylo/output/cesar_cleopatre_V2.dot" phyloDot
phyloDot :: DotGraph DotId
phyloDot = toPhyloExport phylo1
----------------------------------------------- -----------------------------------------------
-- | STEP 3 | -- Build the Level 1 of the Phylo -- | STEP 3 | -- Build the Level 1 of the Phylo
----------------------------------------------- -----------------------------------------------
...@@ -82,7 +91,7 @@ nbDocsByYear = docsToTimeScaleNb docs ...@@ -82,7 +91,7 @@ nbDocsByYear = docsToTimeScaleNb docs
config :: Config config :: Config
config = config =
defaultConfig { phyloName = "Cesar et Cleopatre" defaultConfig { phyloName = "Cesar et Cleopatre"
, exportFilter = [ByBranchSize 2] , exportFilter = [ByBranchSize 0]
, contextualUnit = Fis 0 0 } , contextualUnit = Fis 0 0 }
......
This diff is collapsed.
...@@ -46,7 +46,8 @@ toPhylo docs lst conf = phylo1 ...@@ -46,7 +46,8 @@ toPhylo docs lst conf = phylo1
where where
-------------------------------------- --------------------------------------
phylo1 :: Phylo phylo1 :: Phylo
phylo1 = toPhylo1 docs phyloBase phylo1 = temporalMatching
$ toPhylo1 docs phyloBase
-------------------------------------- --------------------------------------
phyloBase :: Phylo phyloBase :: Phylo
phyloBase = toPhyloBase docs lst conf phyloBase = toPhyloBase docs lst conf
......
...@@ -17,7 +17,7 @@ Portability : POSIX ...@@ -17,7 +17,7 @@ Portability : POSIX
module Gargantext.Viz.Phylo.PhyloTools where module Gargantext.Viz.Phylo.PhyloTools where
import Data.Vector (Vector, elemIndex) import Data.Vector (Vector, elemIndex)
import Data.List (sort, concat, null, union, (++), tails, sortOn, nub, init) import Data.List (sort, concat, null, union, (++), tails, sortOn, nub, init, tail)
import Data.Set (Set, size) import Data.Set (Set, size)
import Data.Map (Map, elems, fromList, unionWith, keys, member, (!), filterWithKey) import Data.Map (Map, elems, fromList, unionWith, keys, member, (!), filterWithKey)
import Data.String (String) import Data.String (String)
...@@ -284,6 +284,17 @@ getThresholdStep proxi = case proxi of ...@@ -284,6 +284,17 @@ getThresholdStep proxi = case proxi of
-- | Branch | -- -- | Branch | --
---------------- ----------------
intersectInit :: Eq a => [a] -> [a] -> [a] -> [a]
intersectInit acc lst lst' =
if (null lst) || (null lst')
then acc
else if (head' "intersectInit" lst) == (head' "intersectInit" lst')
then intersectInit (acc ++ [head' "intersectInit" lst]) (tail lst) (tail lst')
else acc
branchIdsToProximity :: PhyloBranchId -> PhyloBranchId -> Double -> Double -> Double
branchIdsToProximity id id' thrInit thrStep = thrInit + thrStep * (fromIntegral $ length $ intersectInit [] (snd id) (snd id'))
ngramsInBranches :: [[PhyloGroup]] -> [Int] ngramsInBranches :: [[PhyloGroup]] -> [Int]
ngramsInBranches branches = nub $ foldl (\acc g -> acc ++ (g ^. phylo_groupNgrams)) [] $ concat branches ngramsInBranches branches = nub $ foldl (\acc g -> acc ++ (g ^. phylo_groupNgrams)) [] $ concat branches
......
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