Commit 29b3b771 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Replace 'fromMaybe EN' with 'withDefaultLanguage'

parent a8b8b4fc
......@@ -25,7 +25,7 @@ import Data.Set (Set)
import Data.Text (Text, concat, pack, splitOn)
import Data.Vector (Vector)
import Gargantext.API.Admin.EnvTypes (Env, GargJob(..))
import Gargantext.Core (Lang(EN))
import Gargantext.Core (Lang, withDefaultLanguage)
import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Ngrams (setListNgrams)
import Gargantext.API.Ngrams.List.Types
......@@ -157,7 +157,7 @@ reIndexWith :: ( HasNodeStory env err m
reIndexWith cId lId nt lts = do
-- printDebug "(cId,lId,nt,lts)" (cId, lId, nt, lts)
corpus_node <- getNodeWith cId (Proxy @ HyperdataCorpus)
let corpusLang = fromMaybe EN $ view (node_hyperdata . to _hc_lang) corpus_node
let corpusLang = withDefaultLanguage $ view (node_hyperdata . to _hc_lang) corpus_node
-- Getting [NgramsTerm]
ts <- List.concat
......
......@@ -27,7 +27,7 @@ import Gargantext.API.Ngrams.Prelude (getTermList)
import Gargantext.API.Ngrams.Types (NgramsTerm(..))
import Gargantext.API.Prelude (GargNoServer)
import Gargantext.Core.Text.Terms.WithList (Patterns, buildPatterns, termsInText)
import Gargantext.Core (Lang(EN))
import Gargantext.Core (withDefaultLanguage, Lang)
import Gargantext.Core.Types (Context)
-- import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Core.Types.Main (ListType(MapTerm))
......@@ -114,7 +114,7 @@ corpusIdtoDocuments timeUnit corpusId = do
let patterns = case termList of
Nothing -> panic "[G.C.V.Phylo.API] no termList found"
Just termList' -> buildPatterns termList'
pure $ map (toPhyloDocs (fromMaybe EN corpusLang) patterns timeUnit) (map _context_hyperdata docs)
pure $ map (toPhyloDocs (withDefaultLanguage corpusLang) patterns timeUnit) (map _context_hyperdata docs)
termsInText' :: Lang -> Patterns -> Text -> [Text]
termsInText' lang p t = (map fst) $ termsInText lang p t
......
......@@ -39,8 +39,7 @@ import Gargantext.Database.Schema.Ngrams (NgramsType(..))
import Gargantext.Database.Schema.Node
import Gargantext.Database.Query.Table.NodeContext (selectDocs)
import Gargantext.Core.Types
import Gargantext.Core (HasDBid)
import Gargantext.Core (Lang(EN))
import Gargantext.Core (HasDBid, withDefaultLanguage)
-- import Gargantext.Core.Viz.Phylo.LevelMaker (toPhylo)
-- import Gargantext.Core.Viz.Phylo.Tools
......@@ -58,7 +57,7 @@ flowPhylo :: (FlowCmdM env err m, HasDBid NodeType)
flowPhylo cId = do
corpus_node <- getNodeWith cId (Proxy @ HyperdataCorpus)
let lang = fromMaybe EN $ view (node_hyperdata . to _hc_lang) corpus_node
let lang = withDefaultLanguage $ view (node_hyperdata . to _hc_lang) corpus_node
list <- defaultList cId
termList <- HashMap.toList <$> getTermsWith (Text.words . unNgramsTerm) [list] NgramsTerms (Set.singleton MapTerm)
......
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