From 6faad1b3cfd2d0f37b7ea89a6282b44c95cd7620 Mon Sep 17 00:00:00 2001 From: Prasanth Kolachina Date: Thu, 24 May 2018 09:47:27 +0200 Subject: [PATCH 1/2] add bracketLinearizeAll for variants --- src/runtime/haskell/PGF.hs | 2 +- src/runtime/haskell/PGF/Linearize.hs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index 6c0002a8a..134a13c3b 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -58,7 +58,7 @@ module PGF( -- * Operations -- ** Linearization - linearize, linearizeAllLang, linearizeAll, bracketedLinearize, tabularLinearizes, + linearize, linearizeAllLang, linearizeAll, bracketedLinearize, bracketedLinearizeAll, tabularLinearizes, groupResults, -- lins of trees by language, removing duplicates showPrintName, diff --git a/src/runtime/haskell/PGF/Linearize.hs b/src/runtime/haskell/PGF/Linearize.hs index e3e8d92db..5fdb186c1 100644 --- a/src/runtime/haskell/PGF/Linearize.hs +++ b/src/runtime/haskell/PGF/Linearize.hs @@ -4,6 +4,7 @@ module PGF.Linearize , linearizeAll , linearizeAllLang , bracketedLinearize + , bracketedLinearizeAll , tabularLinearizes ) where @@ -47,6 +48,12 @@ bracketedLinearize pgf lang = head . map (snd . untokn Nothing . firstLin cnc) . head [] = [] head (bs:bss) = bs +-- | Linearizes given expression as a bracketed string in the language +bracketedLinearizeAll :: PGF -> Language -> Tree -> [[BracketedString]] +bracketedLinearizeAll pgf lang = map (snd . untokn Nothing . firstLin cnc) . linTree pgf cnc + where + cnc = lookMap (error "no lang") lang (concretes pgf) + firstLin cnc arg@(ct@(cat,n_fid),fid,fun,es,(xs,lin)) = case IntMap.lookup fid (linrefs cnc) of Just (funid:_) -> snd (mkLinTable cnc (const True) [] funid [arg]) ! 0 From ef4731e8ba5cada83b97b6d8068366f68bd8adff Mon Sep 17 00:00:00 2001 From: Prasanth Kolachina Date: Thu, 24 May 2018 09:47:55 +0200 Subject: [PATCH 2/2] spell error in py.egs.README --- src/runtime/python/examples/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/python/examples/README b/src/runtime/python/examples/README index b6791a368..813c2f9c9 100644 --- a/src/runtime/python/examples/README +++ b/src/runtime/python/examples/README @@ -9,7 +9,7 @@ TRANSLATION PIPELINE The module translation_pipeline.py is a Python replica of the translation pipeline used in Wide-coverage Translation demo. The pipeline allows for - 1. simulataneous batch translation from one language into multiple languages + 1. simultaneous batch translation from one language into multiple languages 2. K-best translations 3. translate both text files and sgm files.