diff --git a/lib/Text/Takkyuu/French.hs b/lib/Text/Takkyuu/French.hs index 1fdfe6a605f3343f5c2fe962e5cbfda7640467f6..3ce4426b35ad078cad0a158f61b6eb9e68180e97 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 af572feb1a4814f1c82e4e266d8182417c61e9bb..f9bbf586801a515e2f43de3c7069b398ea1860b0 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