-----------------------------------------------------------------------------
-- Copyright 2019, Advise-Me project team. This file is distributed under 
-- the terms of the Apache License 2.0. For more information, see the files
-- "LICENSE.txt" and "NOTICE.txt", which are included in the distribution.
-----------------------------------------------------------------------------
-- |
-- Maintainer  :  bastiaan.heeren@ou.nl
-- Stability   :  provisional
-- Portability :  portable (depends on ghc)
--
-----------------------------------------------------------------------------

module Recognize.Data.StringLexerOptions
   ( StringLexerOptions, stringLexerOptions
   , variableWhitelist, replaceXByMultiplication
   ) where

import Data.Semigroup

-- | Parameters for "Recognize.Parsing.MathLexer"
data StringLexerOptions = Opts
 { variableWhitelist        :: [String] -- ^ Almost all natural language is removed. If some words need to be seen as variables then add them here
 , replaceXByMultiplication :: Bool
 }

stringLexerOptions :: StringLexerOptions
stringLexerOptions = Opts
   { variableWhitelist        = []
   , replaceXByMultiplication = False
   }

instance Semigroup StringLexerOptions where
   x <> y = Opts
      { variableWhitelist        = variableWhitelist x ++ variableWhitelist y
      , replaceXByMultiplication = replaceXByMultiplication x || replaceXByMultiplication y
      }

instance Monoid StringLexerOptions where
   mempty  = stringLexerOptions
   mappend = (<>)