Commit 424213e0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TextFlow] Type rename

parent 4463a799
...@@ -113,7 +113,7 @@ ex_cooc = cooc <$> ex_terms ...@@ -113,7 +113,7 @@ ex_cooc = cooc <$> ex_terms
-- 0.0, 1.0, 1.0, 0.5, -- 0.0, 1.0, 1.0, 0.5,
-- 0.0, 0.0, 1.0, 0.5, -- 0.0, 0.0, 1.0, 0.5,
-- 0.0, 0.0, 0.0, 1.0],(Vector (Z :. 4) [0.5833333333333334,0.5833333333333334,0.75,0.5833333333333334],Vector (Z :. 4) [-0.5833333333333334,-0.4166666666666667,0.41666666666666674,0.5833333333333334])) -- 0.0, 0.0, 0.0, 1.0],(Vector (Z :. 4) [0.5833333333333334,0.5833333333333334,0.75,0.5833333333333334],Vector (Z :. 4) [-0.5833333333333334,-0.4166666666666667,0.41666666666666674,0.5833333333333334]))
ex_cooc_mat :: IO (Map Label Index, Matrix Int, Matrix Double, (DAA.Vector InclusionExclusion, DAA.Vector SpecificityGenericity)) ex_cooc_mat :: IO (Map Label Index, Matrix Int, Matrix Double, (DAA.Vector GenericityInclusion, DAA.Vector SpecificityExclusion))
ex_cooc_mat = do ex_cooc_mat = do
m <- ex_cooc m <- ex_cooc
let (ti,_) = createIndices m let (ti,_) = createIndices m
......
...@@ -140,7 +140,10 @@ buildNgramsTermsList l n m s uCid mCid = do ...@@ -140,7 +140,10 @@ buildNgramsTermsList l n m s uCid mCid = do
-- Get Local Scores now for selected grouped ngrams -- Get Local Scores now for selected grouped ngrams
selectedTerms = Set.toList $ List.foldl' selectedTerms = Set.toList $ List.foldl'
(\set (GroupedText _ l _ g _ _) -> Set.union set $ Set.union g $ Set.singleton l) (\set (GroupedText _ l _ g _ _) -> Set.union set
$ Set.union g
$ Set.singleton l
)
Set.empty Set.empty
(groupedMonoHead <> groupedMultHead) (groupedMonoHead <> groupedMultHead)
......
...@@ -57,8 +57,8 @@ scored = map2scored . (pcaReduceTo (Dimension 2)) . scored2map ...@@ -57,8 +57,8 @@ scored = map2scored . (pcaReduceTo (Dimension 2)) . scored2map
-- TODO change type with (x,y) -- TODO change type with (x,y)
data Scored ts = Scored data Scored ts = Scored
{ _scored_terms :: !ts { _scored_terms :: !ts
, _scored_incExc :: !InclusionExclusion , _scored_incExc :: !GenericityInclusion
, _scored_speGen :: !SpecificityGenericity , _scored_speGen :: !SpecificityExclusion
} deriving (Show) } deriving (Show)
localMetrics' :: Ord t => Map (t,t) Int -> Map t (Vec.Vector Double) localMetrics' :: Ord t => Map (t,t) Int -> Map t (Vec.Vector Double)
...@@ -76,7 +76,7 @@ localMetrics' m = Map.fromList $ zipWith (\(_,t) (inc,spe) -> (t, Vec.fromList [ ...@@ -76,7 +76,7 @@ localMetrics' m = Map.fromList $ zipWith (\(_,t) (inc,spe) -> (t, Vec.fromList [
-- TODO in the textflow we end up needing these indices , it might be -- TODO in the textflow we end up needing these indices , it might be
-- better to compute them earlier and pass them around. -- better to compute them earlier and pass them around.
scored' :: Ord t => Map (t,t) Int -> [Scored t] scored' :: Ord t => Map (t,t) Int -> [Scored t]
scored' m = zipWith (\(_,t) (inc,spe) -> Scored t (inc) (spe)) (Map.toList fi) scores scored' m = zipWith (\(_,t) (inc,spe) -> Scored t inc spe) (Map.toList fi) scores
where where
(ti, fi) = createIndices m (ti, fi) = createIndices m
(is, ss) = incExcSpeGen $ cooc2mat ti m (is, ss) = incExcSpeGen $ cooc2mat ti m
......
...@@ -196,7 +196,7 @@ measureConditional m = run $ matProba (dim m) ...@@ -196,7 +196,7 @@ measureConditional m = run $ matProba (dim m)
-- in the corpus and _[n_{ij}\] the number of its occurrences we get: -- in the corpus and _[n_{ij}\] the number of its occurrences we get:
-- --
-- \[P_c=max(\frac{n_i}{n_{ij}},\frac{n_j}{n_{ij}} )\] -- \[P_c=max(\frac{n_i}{n_{ij}},\frac{n_j}{n_{ij}} )\]
conditional' :: Matrix Int -> (Matrix InclusionExclusion, Matrix SpecificityGenericity) conditional' :: Matrix Int -> (Matrix GenericityInclusion, Matrix SpecificityExclusion)
conditional' m = ( run $ ie $ map fromIntegral $ use m conditional' m = ( run $ ie $ map fromIntegral $ use m
, run $ sg $ map fromIntegral $ use m , run $ sg $ map fromIntegral $ use m
) )
...@@ -450,15 +450,15 @@ Jean-Philippe Cointet (CREA, TSV), David Chavalarias (CREA) (Submitted ...@@ -450,15 +450,15 @@ Jean-Philippe Cointet (CREA, TSV), David Chavalarias (CREA) (Submitted
on 15 Mar 2008), Networks and Heterogeneous Media 3, 2 (2008) 267 - 276, on 15 Mar 2008), Networks and Heterogeneous Media 3, 2 (2008) 267 - 276,
arXiv:0803.2315 [cs.OH] arXiv:0803.2315 [cs.OH]
-} -}
type InclusionExclusion = Double type GenericityInclusion = Double
type SpecificityGenericity = Double type SpecificityExclusion = Double
data SquareMatrix = SymetricMatrix | NonSymetricMatrix data SquareMatrix = SymetricMatrix | NonSymetricMatrix
type SymetricMatrix = Matrix type SymetricMatrix = Matrix
type NonSymetricMatrix = Matrix type NonSymetricMatrix = Matrix
incExcSpeGen :: Matrix Int -> (Vector InclusionExclusion, Vector SpecificityGenericity) incExcSpeGen :: Matrix Int -> (Vector GenericityInclusion, Vector SpecificityExclusion)
incExcSpeGen m = (run' inclusionExclusion m, run' specificityGenericity m) incExcSpeGen m = (run' inclusionExclusion m, run' specificityGenericity m)
where where
run' fun mat = run $ fun $ map fromIntegral $ use mat run' fun mat = run $ fun $ map fromIntegral $ use mat
......
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