From b3de41b3159f86e37d8abb0a1aea5308938f0533 Mon Sep 17 00:00:00 2001 From: Ruslan Khafizov Date: Mon, 14 Oct 2024 10:39:06 +0800 Subject: [PATCH] Add lang tags to AaJson --- lib/haskell/natural4/src/LS/XPile/AaJson.hs | 5 +++-- .../golden/AaJsonSpec/must_sing.json.expected | 12 ++++++------ .../testdata/golden/AaJsonSpec/rodents.json.expected | 12 ++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/haskell/natural4/src/LS/XPile/AaJson.hs b/lib/haskell/natural4/src/LS/XPile/AaJson.hs index 9a678d99d..cfacc0011 100644 --- a/lib/haskell/natural4/src/LS/XPile/AaJson.hs +++ b/lib/haskell/natural4/src/LS/XPile/AaJson.hs @@ -93,7 +93,8 @@ translate2AaJson nlgEnvs l4i = do let rules = origrules l4i qaHornsAllLangs :: [Either XPileLogW String] <- - for nlgEnvs \nlgEnv -> do + for nlgEnvs \nlgEnv@(NLGEnv {gfLang}) -> do + let nlgEnvStrLower = gfLang |> showLanguage |$> Char.toLower hornByLang :: Either XPileLogW [(String, BoolStructLT)] <- qaHornsByLang rules nlgEnv l4i @@ -101,7 +102,7 @@ translate2AaJson nlgEnvs l4i = do case hornByLang of Left err -> xpError err Right haveHorn -> xpReturn [__i| - #{encodePretty $ toAaJson <$> (DL.nub haveHorn)} + { "#{nlgEnvStrLower}" : #{encodePretty $ toAaJson <$> (DL.nub haveHorn)} } |] let qaHornsStrings = rights qaHornsAllLangs diff --git a/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/must_sing.json.expected b/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/must_sing.json.expected index 2f9e461c8..bf86fea65 100644 --- a/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/must_sing.json.expected +++ b/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/must_sing.json.expected @@ -1,5 +1,5 @@ [ - [ + { "nl4chi" : [ { "Person": { "All": { @@ -29,8 +29,8 @@ } } } -], -[ +] }, +{ "nl4eng" : [ { "Person": { "All": { @@ -60,8 +60,8 @@ } } } -], -[ +] }, +{ "nl4may" : [ { "Person": { "All": { @@ -91,5 +91,5 @@ } } } -] +] } ] \ No newline at end of file diff --git a/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/rodents.json.expected b/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/rodents.json.expected index bca36b851..a5711ab23 100644 --- a/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/rodents.json.expected +++ b/lib/haskell/natural4/test/testdata/golden/AaJsonSpec/rodents.json.expected @@ -1,5 +1,5 @@ [ - [ + { "nl4chi" : [ { "Covered If …": { "Not": { @@ -206,8 +206,8 @@ } } } -], -[ +] }, +{ "nl4eng" : [ { "Covered If …": { "Not": { @@ -414,8 +414,8 @@ } } } -], -[ +] }, +{ "nl4may" : [ { "Covered If …": { "Not": { @@ -622,5 +622,5 @@ } } } -] +] } ] \ No newline at end of file