Commit fbc34579 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] pretty print fix.

parents 11a8797b 0c9ed01c
......@@ -115,6 +115,7 @@ library:
- path
- path-io
- postgresql-simple
- pretty-simple
- probability
- product-profunctors
- profunctors
......
......@@ -33,7 +33,7 @@ import qualified Data.Set as Set
import Data.Set (Set)
import qualified Data.Vector as V
import Data.List (filter, concat)
import Data.List (filter, concat, null)
import Data.Maybe (catMaybes)
import HLCM
......@@ -93,7 +93,9 @@ fisWithSize n f is = case n of
--- Filter on Fis and not on [Item]
fisWith :: Maybe ([Item] -> Bool) -> Frequency -> [[Item]] -> [Fis]
fisWith s f is = catMaybes $ map items2fis $ filter' $ runLCMmatrix is f
fisWith s f is = case filter (not . null) is of
[] -> []
js -> catMaybes $ map items2fis $ filter' $ runLCMmatrix js f
-- drop unMaybe
where
filter' = case s of
......
......@@ -10,13 +10,16 @@ module Gargantext.Viz.Phylo.Example where
import qualified Data.List as DL
import Data.String (String)
import Data.Text (Text, pack, unwords, toLower)
import Data.Text (Text, pack, unwords, toLower, words)
import Data.Tuple.Extra (both)
import Data.Map (Map)
import qualified Data.Map as DM
import Gargantext.Text.Terms.Mono (monoTexts)
import Data.Set (Set)
import Gargantext.Text.Metrics.FrequentItemSet (fisWithSizePolyMap, Size(..))
import Gargantext.Text.Terms.Mono (monoTexts)
import Gargantext.Prelude
------------------------------------------------------------------------
......@@ -24,11 +27,21 @@ type Histoire = [Event]
data Event = Event {date:: Double, text :: Text}
deriving (Show)
type MapList = [Text]
type PeriodeSize = Int
-- data Periodes b a = Map (b,b) a
------------------------------------------------------------------------
-- | TODO FIS on monotexts
phyloFIS :: Map (Double, Double) [Event] -> Map (Double, Double) (Map (Set Text) Int)
phyloFIS = DM.map (\n -> fisWithSizePolyMap (Point 1) 1 (map (words . text) n))
phyloExample :: Map (Double, Double) [Event]
phyloExample = toPeriodes date 1 $ cleanHistoire mapList phyloCorpus
------------------------------------------------------------------------
toPeriodes :: (Enum b, Fractional b, Ord b) => (t -> b) -> b -> [t] -> Map (b, b) [t]
toPeriodes _ _ [] = panic $ pack "Empty history can not have any periode"
toPeriodes f s hs = periodes f st hs
......
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