Commit 702336c1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[CLEAN]

parent c9cd5e03
...@@ -161,7 +161,7 @@ buildNgramsTermsList user uCid mCid mfslw groupParams (nt, _mapListSize)= do ...@@ -161,7 +161,7 @@ buildNgramsTermsList user uCid mCid mfslw groupParams (nt, _mapListSize)= do
-- Computing global speGen score -- Computing global speGen score
printDebug "[buildNgramsTermsList: Sample List] / start" nt printDebug "[buildNgramsTermsList: Sample List] / start" nt
allTerms :: HashMap NgramsTerm Double <- getTficf_withSample uCid mCid nt allTerms :: HashMap NgramsTerm Double <- getTficf_withSample uCid mCid nt
printDebug "[buildNgramsTermsList: Sample List / end]" nt printDebug "[buildNgramsTermsList: Sample List / end]" (nt, HashMap.size allTerms)
printDebug "[buildNgramsTermsList: Flow Social List / start]" nt printDebug "[buildNgramsTermsList: Flow Social List / start]" nt
-- PrivateFirst for first developments since Public NodeMode is not implemented yet -- PrivateFirst for first developments since Public NodeMode is not implemented yet
...@@ -218,7 +218,7 @@ buildNgramsTermsList user uCid mCid mfslw groupParams (nt, _mapListSize)= do ...@@ -218,7 +218,7 @@ buildNgramsTermsList user uCid mCid mfslw groupParams (nt, _mapListSize)= do
selectedTerms selectedTerms
printDebug "mapTextDocIds" mapTextDocIds -- printDebug "mapTextDocIds" mapTextDocIds
let let
groupedTreeScores_SetNodeId :: HashMap NgramsTerm (GroupedTreeScores (Set NodeId)) groupedTreeScores_SetNodeId :: HashMap NgramsTerm (GroupedTreeScores (Set NodeId))
......
...@@ -15,14 +15,15 @@ module Gargantext.Core.Text.List.Social ...@@ -15,14 +15,15 @@ module Gargantext.Core.Text.List.Social
import Control.Monad (mzero) import Control.Monad (mzero)
import Data.Aeson import Data.Aeson
import GHC.Generics
import Data.HashMap.Strict (HashMap) import Data.HashMap.Strict (HashMap)
import Data.Map (Map) import Data.Map (Map)
import Data.Monoid (mconcat) import Data.Monoid (mconcat)
import qualified Data.Scientific as Scientific
import Data.Swagger import Data.Swagger
import qualified Data.Text as T import GHC.Generics
import qualified Data.Vector as V import qualified Data.Scientific as Scientific
import qualified Data.Text as T
import qualified Data.Vector as V
import Gargantext.API.Ngrams.Tools import Gargantext.API.Ngrams.Tools
import Gargantext.API.Ngrams.Types import Gargantext.API.Ngrams.Types
import Gargantext.Core.NodeStory import Gargantext.Core.NodeStory
......
...@@ -89,12 +89,12 @@ import Gargantext.Database.Admin.Config (userMaster, corpusMasterName) ...@@ -89,12 +89,12 @@ import Gargantext.Database.Admin.Config (userMaster, corpusMasterName)
import Gargantext.Database.Admin.Types.Hyperdata import Gargantext.Database.Admin.Types.Hyperdata
import Gargantext.Database.Admin.Types.Node -- (HyperdataDocument(..), NodeType(..), NodeId, UserId, ListId, CorpusId, RootId, MasterCorpusId, MasterUserId) import Gargantext.Database.Admin.Types.Node -- (HyperdataDocument(..), NodeType(..), NodeId, UserId, ListId, CorpusId, RootId, MasterCorpusId, MasterUserId)
import Gargantext.Database.Prelude import Gargantext.Database.Prelude
import Gargantext.Database.Query.Table.ContextNodeNgrams2
import Gargantext.Database.Query.Table.Ngrams import Gargantext.Database.Query.Table.Ngrams
import Gargantext.Database.Query.Table.Node import Gargantext.Database.Query.Table.Node
import Gargantext.Database.Query.Table.Node.Document.Insert -- (insertDocuments, ReturnId(..), addUniqIdsDoc, addUniqIdsContact, ToDbData(..)) import Gargantext.Database.Query.Table.Node.Document.Insert -- (insertDocuments, ReturnId(..), addUniqIdsDoc, addUniqIdsContact, ToDbData(..))
import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..)) import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..))
import Gargantext.Database.Query.Table.NodeNgrams (listInsertDb , getCgramsId) import Gargantext.Database.Query.Table.NodeNgrams (listInsertDb , getCgramsId)
import Gargantext.Database.Query.Table.ContextNodeNgrams2
import Gargantext.Database.Query.Tree.Root (getOrMkRoot, getOrMk_RootWithCorpus) import Gargantext.Database.Query.Tree.Root (getOrMkRoot, getOrMk_RootWithCorpus)
import Gargantext.Database.Schema.Node (NodePoly(..), node_id) import Gargantext.Database.Schema.Node (NodePoly(..), node_id)
import Gargantext.Database.Types import Gargantext.Database.Types
......
...@@ -118,37 +118,40 @@ toNodeNgramsW l ngs = List.concat $ map (toNodeNgramsW'' l) ngs ...@@ -118,37 +118,40 @@ toNodeNgramsW l ngs = List.concat $ map (toNodeNgramsW'' l) ngs
-> (NgramsType, [NgramsElement]) -> (NgramsType, [NgramsElement])
-> [NodeNgramsW] -> [NodeNgramsW]
toNodeNgramsW'' l' (ngrams_type, elms) = toNodeNgramsW'' l' (ngrams_type, elms) =
[ NodeNgrams { _nng_id = Nothing [ NodeNgrams { _nng_id = Nothing
, _nng_node_id = l' , _nng_node_id = l'
, _nng_node_subtype = list_type , _nng_node_subtype = list_type
, _nng_ngrams_id = ngrams_terms' , _nng_ngrams_id = ngrams_terms'
, _nng_ngrams_type = ngrams_type , _nng_ngrams_type = ngrams_type
, _nng_ngrams_field = Nothing , _nng_ngrams_field = Nothing
, _nng_ngrams_tag = Nothing , _nng_ngrams_tag = Nothing
, _nng_ngrams_class = Nothing , _nng_ngrams_class = Nothing
, _nng_ngrams_weight = 0 } | , _nng_ngrams_weight = 0 } |
(NgramsElement { _ne_ngrams = NgramsTerm ngrams_terms' (NgramsElement { _ne_ngrams = NgramsTerm ngrams_terms'
, _ne_size = _size , _ne_size = _size
, _ne_list = list_type , _ne_list = list_type
, _ne_occurrences = _occ , _ne_occurrences = _occ
, _ne_root = _root , _ne_root = _root
, _ne_parent = _parent , _ne_parent = _parent
, _ne_children = _children }) <- elms , _ne_children = _children
}
) <- elms
] ]
toNodeNgramsW' :: ListId toNodeNgramsW' :: ListId
-> [(Text, [NgramsType])] -> [(Text, [NgramsType])]
-> [NodeNgramsW] -> [NodeNgramsW]
toNodeNgramsW' l'' ngs = [ NodeNgrams { _nng_id = Nothing toNodeNgramsW' l'' ngs = [ NodeNgrams { _nng_id = Nothing
, _nng_node_id = l'' , _nng_node_id = l''
, _nng_node_subtype = CandidateTerm , _nng_node_subtype = CandidateTerm
, _nng_ngrams_id = terms , _nng_ngrams_id = terms
, _nng_ngrams_type = ngrams_type , _nng_ngrams_type = ngrams_type
, _nng_ngrams_field = Nothing , _nng_ngrams_field = Nothing
, _nng_ngrams_tag = Nothing , _nng_ngrams_tag = Nothing
, _nng_ngrams_class = Nothing , _nng_ngrams_class = Nothing
, _nng_ngrams_weight = 0 } , _nng_ngrams_weight = 0
}
| (terms, ngrams_types) <- ngs | (terms, ngrams_types) <- ngs
, ngrams_type <- ngrams_types , ngrams_type <- ngrams_types
] ]
......
...@@ -74,7 +74,7 @@ getTficf_withSample cId mId nt = do ...@@ -74,7 +74,7 @@ getTficf_withSample cId mId nt = do
<$> getOccByNgramsOnlyFast_withSample mId countGlobal nt <$> getOccByNgramsOnlyFast_withSample mId countGlobal nt
(HM.keys mapTextDoubleLocal) (HM.keys mapTextDoubleLocal)
printDebug "getTficf_withSample" (mapTextDoubleLocal, mapTextDoubleGlobal, countLocal, countGlobal) --printDebug "getTficf_withSample" (mapTextDoubleLocal, mapTextDoubleGlobal, countLocal, countGlobal)
pure $ HM.mapWithKey (\t n -> pure $ HM.mapWithKey (\t n ->
tficf (TficfInfra (Count n ) tficf (TficfInfra (Count n )
(Total $ fromIntegral countLocal)) (Total $ fromIntegral countLocal))
......
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