From bb3b9a16321002b5132721c2c68fc1ec53734323 Mon Sep 17 00:00:00 2001 From: Alice BRENON <alice.brenon@ens-lyon.fr> Date: Tue, 21 Jun 2022 06:17:44 +0200 Subject: [PATCH] Rename 'dico' to something more meaningful --- lib/Text/Takkyuu/French.hs | 4 ++-- lib/Text/Takkyuu/NLP.hs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Text/Takkyuu/French.hs b/lib/Text/Takkyuu/French.hs index 1fdfe6a..3ce4426 100644 --- a/lib/Text/Takkyuu/French.hs +++ b/lib/Text/Takkyuu/French.hs @@ -12,7 +12,7 @@ module Text.Takkyuu.French ( import Data.Char (isSpace, toLower) import qualified Data.Map as Map (fromList) import qualified Data.Set as Set (fromList) -import Text.Takkyuu (Game, Label(..), Labeled(..), dico, fuzz, labelizer, rules) +import Text.Takkyuu (Game, Label(..), Labeled(..), fuzz, lookupTable, labelizer, rules) data POS = Determiner @@ -43,7 +43,7 @@ typo :: Functor m => Game Char Char m typo = fuzz $ Set.fromList ["bh"] french:: Functor m => Game Char String m -french = dico toLower isSpace $ Set.fromList ["le", "la", "chat", "lait", "marché"] +french = lookupTable toLower isSpace $ Set.fromList ["le", "la", "chat", "lait", "marché"] tag :: Functor m => Game String LabeledWord m tag = labelizer (fmap toLower) $ Map.fromList [ diff --git a/lib/Text/Takkyuu/NLP.hs b/lib/Text/Takkyuu/NLP.hs index af572fe..f9bbf58 100644 --- a/lib/Text/Takkyuu/NLP.hs +++ b/lib/Text/Takkyuu/NLP.hs @@ -1,8 +1,8 @@ module Text.Takkyuu.NLP ( Label(..) , Labeled(..) - , dico , fuzz + , lookupTable , labelizer , rules ) where @@ -25,8 +25,8 @@ fuzz classes = accept expand back ) tmp0 l ) Map.empty classes -dico :: (Functor m, Eq k, Ord k) => (a -> k) -> (k -> Bool) -> Set [k] -> Game a [a] m -dico projector _ vocabulary = start +lookupTable :: (Functor m, Eq k, Ord k) => (a -> k) -> (k -> Bool) -> Set [k] -> Game a [a] m +lookupTable projector _ vocabulary = start where start = Opponent $ continueFrom ([], [vocabulary]) continueFrom currentState@(stack, candidatesStack) (Here a) = @@ -68,4 +68,4 @@ labelizer projector labels = accept outputLabels back oneOf $ maybe [Labeled a Unknown] (Labeled a . Label <$>) possibleLabels rules :: (Functor m, Ord k) => (a -> k) -> Set [k] -> Game a [a] m -rules projector = dico projector undefined +rules projector = lookupTable projector undefined -- GitLab