Commit 2ecc0288 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[COSMETICS]

parent 965531a2
...@@ -49,9 +49,6 @@ type Corpus a = [Sentence a] -- a list of sentences ...@@ -49,9 +49,6 @@ type Corpus a = [Sentence a] -- a list of sentences
-- | Contexts definition to build/unbuild contexts. -- | Contexts definition to build/unbuild contexts.
data SplitContext = Chars Int | Sentences Int | Paragraphs Int data SplitContext = Chars Int | Sentences Int | Paragraphs Int
tag :: Text -> [Tag Text]
tag = parseTags
-- | splitBy contexts of Chars or Sentences or Paragraphs -- | splitBy contexts of Chars or Sentences or Paragraphs
-- To see some examples at a higher level (sentences and paragraph), see -- To see some examples at a higher level (sentences and paragraph), see
-- 'Gargantext.Text.Examples.ex_terms' -- 'Gargantext.Text.Examples.ex_terms'
...@@ -67,10 +64,9 @@ tag = parseTags ...@@ -67,10 +64,9 @@ tag = parseTags
splitBy :: SplitContext -> Text -> [Text] splitBy :: SplitContext -> Text -> [Text]
splitBy (Chars n) = map pack . chunkAlong (n+1) 1 . unpack splitBy (Chars n) = map pack . chunkAlong (n+1) 1 . unpack
splitBy (Sentences n) = map unsentences . chunkAlong (n+1) 1 . sentences splitBy (Sentences n) = map unsentences . chunkAlong (n+1) 1 . sentences
splitBy (Paragraphs _) = map unTag . filter isTagText . tag splitBy (Paragraphs _) = map unTag . filter isTagText . parseTags
where where
unTag :: IsString p => Tag p -> p unTag :: IsString p => Tag p -> p
unTag (TagText x) = x unTag (TagText x) = x
unTag _ = "" unTag _ = ""
...@@ -59,7 +59,7 @@ data StopSize = StopSize {unStopSize :: Int} ...@@ -59,7 +59,7 @@ data StopSize = StopSize {unStopSize :: Int}
-- | TODO improve grouping functions of Authors, Sources, Institutes.. -- | TODO improve grouping functions of Authors, Sources, Institutes..
buildNgramsLists :: Lang -> Int -> Int -> StopSize -> UserCorpusId -> MasterCorpusId buildNgramsLists :: Lang -> Int -> Int -> StopSize -> UserCorpusId -> MasterCorpusId
-> Cmd err (Map NgramsType [NgramsElement]) -> Cmd err (Map NgramsType [NgramsElement])
buildNgramsLists l n m s uCid mCid = do buildNgramsLists l n m s uCid _mCid = do
--ngTerms <- buildNgramsTermsList l n m s uCid mCid --ngTerms <- buildNgramsTermsList l n m s uCid mCid
ngTerms <- buildNgramsTermsList' uCid (ngramsGroup l n m) (isStopTerm s . fst) 500 50 ngTerms <- buildNgramsTermsList' uCid (ngramsGroup l n m) (isStopTerm s . fst) 500 50
othersTerms <- mapM (buildNgramsOthersList uCid identity) [Authors, Sources, Institutes] othersTerms <- mapM (buildNgramsOthersList uCid identity) [Authors, Sources, Institutes]
......
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