{-# LANGUAGE OverloadedLists #-} module Language.EnglishSpec where import Data.ByteString.Builder qualified as ByteString.Builder import Data.GenValidity.Map () import Data.GenValidity.Sequence () import Data.GenValidity.Set () import Data.GenValidity.Text () import Data.List qualified as List import Data.Map.Strict qualified as Map import Data.Set qualified as Set import Data.Text qualified as Text import Data.Text.Encoding qualified as Text import Data.Text.Lazy.Encoding qualified as Text.Lazy import Data.Text.Short qualified as ShortText import Data.Validity.Map () import Data.Validity.Set () import Data.Validity.Text () import Language import Language.English import Language.English qualified as English import Language.Pronunciation qualified as Pron import Paths_worksheets qualified as Self import System.Directory qualified as IO import System.FilePath (joinPath, pathSeparator, (<.>), ()) import System.FilePath.Posix qualified as File import System.IO qualified as IO import Test.Syd import Text.Blaze.Html5.Attributes qualified as HA import Utils.Pronunciation qualified as Pron import Utils.Tests import Wiktionary qualified import Worksheets.Utils.HTML (Html, className, classes, cm, styles, (!)) import Worksheets.Utils.HTML qualified as HTML import Worksheets.Utils.IPA qualified as IPA import Worksheets.Utils.Paper qualified as Paper import Worksheets.Utils.Prelude import Worksheets.Utils.SQL qualified as SQL import Prelude (error, even, mod) spec :: HasCallStack => Spec spec = do -- Pron.lexerRender $ English.pronunciationDict describe "pronunciation" do describe "parser" do forM_ sentences \sentence -> Pron.pronunciationParserTest English.pronunciationRules sentence {- mangleSupraSegmentalFeatures :: [IPA.Syllable []] -> [[IPA.Segment]] mangleSupraSegmentalFeatures = \case [] -> [] IPA.Syllable syl : ts -> syl : mangleSupraSegmentalFeatures ts IPA.WithSuprasegmentalFeature IPA.Linking syl : ts -> case mangleSupraSegmentalFeatures ts of [] -> [dropSupraSegmentalFeatures syl] x : xs -> (dropSupraSegmentalFeatures syl <> x) : xs IPA.WithSuprasegmentalFeature _feat syl : xs -> mangleSupraSegmentalFeatures (syl : xs) -} -- cardsHtml "syllabes" $ English.syllablesTable & English.syllablesTableToHTML sentences :: Set [Pron.ExampleLiteral] sentences = [ [ ["father"] , ["house"] ] , English.pronunciationRules & Pron.examples ] & mconcat