1
0
forked from GitHub/gf-core

Merge pull request #50 from pkolachi/master

function for linearizing variants (bracketedStringAll)
This commit is contained in:
Prasanth Kolachina
2018-05-24 09:52:48 +02:00
committed by GitHub
3 changed files with 9 additions and 2 deletions

View File

@@ -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,

View File

@@ -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

View File

@@ -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.