module Gargantext.Database.Action.Metrics.NgramsByNode
where
+
import Data.Map.Strict (Map, fromListWith, elems, toList)
import Data.Map.Strict.Patch (PatchMap, Replace, diff)
import Data.Set (Set)
import Database.PostgreSQL.Simple.SqlQQ (sql)
import Database.PostgreSQL.Simple.Types (Values(..), QualifiedIdentifier(..))
import Debug.Trace (trace)
-import qualified Data.List as List
-import qualified Data.Map.Strict as Map
-import qualified Data.Set as Set
-import qualified Data.Text as Text
-import qualified Database.PostgreSQL.Simple as DPS
-
-import Gargantext.Core (Lang(..))
import Gargantext.Database.Admin.Config (nodeTypeId)
import Gargantext.Database.Admin.Types.Node -- (ListId, CorpusId, NodeId)
import Gargantext.Database.Prelude (Cmd, runPGSQuery)
import Gargantext.Database.Schema.Ngrams (ngramsTypeId, NgramsType(..))
import Gargantext.Prelude
-import Gargantext.Core.Text.Terms.Mono.Stem (stem)
-
--- | TODO: group with 2 terms only can be
--- discussed. Main purpose of this is offering
--- a first grouping option to user and get some
--- enriched data to better learn and improve that algo
-ngramsGroup :: Lang
- -> Int
- -> Int
- -> Text
- -> Text
-ngramsGroup l _m _n = Text.intercalate " "
- . map (stem l)
- -- . take n
- . List.sort
- -- . (List.filter (\t -> Text.length t > m))
- . Text.splitOn " "
- . Text.replace "-" " "
+import qualified Data.Map.Strict as Map
+import qualified Data.Set as Set
+import qualified Database.PostgreSQL.Simple as DPS
|]
------------------------------------------------------------------------
-getNodesByNgramsOnlyUser :: NodeId
+getNodesByNgramsOnlyUser :: CorpusId
-> [ListId]
-> NgramsType
-> [Text]
|]
-getNgramsByDocOnlyUser :: NodeId
+getNgramsByDocOnlyUser :: DocId
-> [ListId]
-> NgramsType
-> [Text]