Commit 46dd884f authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PROTOLUDE] cleaning filter.

parent 09038c19
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Gargantext.Ngrams.Lang.En (selectNgrams, groupNgrams, textTest) where module Gargantext.Ngrams.Lang.En (selectNgrams, groupNgrams, textTest) where
...@@ -7,7 +8,7 @@ import Data.Text (Text) ...@@ -7,7 +8,7 @@ import Data.Text (Text)
import Data.Monoid ((<>)) import Data.Monoid ((<>))
selectNgrams :: [(Text, Text, Text)] -> [(Text, Text, Text)] selectNgrams :: [(Text, Text, Text)] -> [(Text, Text, Text)]
selectNgrams xs = pf selectNgrams' xs selectNgrams xs = filter selectNgrams' xs
where where
selectNgrams' (_,"NN" ,_ ) = True selectNgrams' (_,"NN" ,_ ) = True
selectNgrams' (_,"NNS" ,_ ) = True selectNgrams' (_,"NNS" ,_ ) = True
...@@ -71,7 +72,7 @@ groupNgrams ((x,_,"LOCATION"):(y,yy,"LOCATION"):xs) = groupNgrams ((x <> " " <> ...@@ -71,7 +72,7 @@ groupNgrams ((x,_,"LOCATION"):(y,yy,"LOCATION"):xs) = groupNgrams ((x <> " " <>
groupNgrams (x:xs) = (x:(groupNgrams xs)) groupNgrams (x:xs) = (x:(groupNgrams xs))
textTest :: [String] textTest :: [Text]
textTest = [ "Alcoholic extract of Kaempferia galanga was tested for analgesic and antiinflammatory activities in animal models. " textTest = [ "Alcoholic extract of Kaempferia galanga was tested for analgesic and antiinflammatory activities in animal models. "
, "Three doses, 300 mg/kg, 600 mg/kg and 1200 mg/kg of the plant extract prepared as a suspension in 2 ml of 2% gum acacia were used. " , "Three doses, 300 mg/kg, 600 mg/kg and 1200 mg/kg of the plant extract prepared as a suspension in 2 ml of 2% gum acacia were used. "
, " Acute and sub acute inflammatory activities were studied in rats by carrageenan induced paw edema and cotton pellet induced granuloma models respectively. " , " Acute and sub acute inflammatory activities were studied in rats by carrageenan induced paw edema and cotton pellet induced granuloma models respectively. "
......
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Gargantext.Ngrams.Lang.Fr (selectNgrams, groupNgrams, textTest) module Gargantext.Ngrams.Lang.Fr (selectNgrams, groupNgrams, textTest)
where where
...@@ -8,7 +9,7 @@ import Data.Text (Text) ...@@ -8,7 +9,7 @@ import Data.Text (Text)
import Data.Monoid ((<>)) import Data.Monoid ((<>))
selectNgrams :: [(Text, Text, Text)] -> [(Text, Text, Text)] selectNgrams :: [(Text, Text, Text)] -> [(Text, Text, Text)]
selectNgrams xs = pf selectNgrams' xs selectNgrams xs = filter selectNgrams' xs
where where
selectNgrams' (_,"N" ,_ ) = True selectNgrams' (_,"N" ,_ ) = True
selectNgrams' (_,"NC" ,_ ) = True selectNgrams' (_,"NC" ,_ ) = True
...@@ -66,6 +67,6 @@ groupNgrams ((x,_,"ORGANIZATION"):(y,yy,"ORGANIZATION"):xs) = groupNgrams ((x <> ...@@ -66,6 +67,6 @@ groupNgrams ((x,_,"ORGANIZATION"):(y,yy,"ORGANIZATION"):xs) = groupNgrams ((x <>
groupNgrams (x:xs) = (x:(groupNgrams xs)) groupNgrams (x:xs) = (x:(groupNgrams xs))
textTest :: [String] textTest :: [Text]
textTest = [ "L'heure d'arrivée des coureurs dépend de la météo du jour."] textTest = [ "L'heure d'arrivée des coureurs dépend de la météo du jour."]
...@@ -35,8 +35,8 @@ import qualified Data.Map as Map ...@@ -35,8 +35,8 @@ import qualified Data.Map as Map
import qualified Data.Vector as V import qualified Data.Vector as V
import Safe (headMay) import Safe (headMay)
pf :: (a -> Bool) -> [a] -> [a] --pf :: (a -> Bool) -> [a] -> [a]
pf = filter --pf = filter
pr :: [a] -> [a] pr :: [a] -> [a]
pr = reverse pr = reverse
...@@ -44,8 +44,8 @@ pr = reverse ...@@ -44,8 +44,8 @@ pr = reverse
--pm :: (a -> b) -> [a] -> [b] --pm :: (a -> b) -> [a] -> [b]
--pm = map --pm = map
pm2 :: (t -> b) -> [[t]] -> [[b]] map2 :: (t -> b) -> [[t]] -> [[b]]
pm2 fun = map (map fun) map2 fun = map (map fun)
pz :: [a] -> [b] -> [(a, b)] pz :: [a] -> [b] -> [(a, b)]
pz = zip pz = zip
......
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