From b509d224822605d835dbd20979c4de5ac55abb6b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 7 Jul 2022 19:37:06 +0200 Subject: [PATCH] show match positions for ma -all|-longest|-best --- src/compiler/GF/Command/Commands.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 0377b167e..85a9af955 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -288,15 +288,15 @@ pgfCommands = Map.fromList [ case opts of _ | isOpt "all" opts -> return . fromString . unlines . - map prMorphoAnalysis . concatMap (morphoCohorts id concr) $ + map prCohortAnalysis . concatMap (morphoCohorts id concr) $ toStrings ts _ | isOpt "longest" opts -> return . fromString . unlines . - map prMorphoAnalysis . concatMap (morphoCohorts filterLongest concr) $ + map prCohortAnalysis . concatMap (morphoCohorts filterLongest concr) $ toStrings ts _ | isOpt "best" opts -> return . fromString . unlines . - map prMorphoAnalysis . concatMap (morphoCohorts filterBest concr) $ + map prCohortAnalysis . concatMap (morphoCohorts filterBest concr) $ toStrings ts _ | isOpt "known" opts -> return . fromString . unwords . @@ -857,8 +857,7 @@ pgfCommands = Map.fromList [ morphos pgf opts s = [(s,lookupMorpho concr s) | concr <- optLangs pgf opts] - morphoCohorts f concr s = - [(w,ans) | (_,w,ans,_) <- f (lookupCohorts concr s)] + morphoCohorts f concr s = f (lookupCohorts concr s) morphoKnown = morphoClassify True @@ -923,6 +922,9 @@ prAllWords concr = prMorphoAnalysis (w,lps) = unlines (w:[l ++ " : " ++ p ++ " " ++ show prob | (l,p,prob) <- lps]) +prCohortAnalysis (i,w,lps,j) = + unlines ((show i++"-"++show j++" "++w):[l ++ " : " ++ p ++ " " ++ show prob | (l,p,prob) <- lps]) + viewGraphviz :: String -> String -> String -> [String] -> SIO CommandOutput viewGraphviz view format name grphs = do let file i s = name ++ i ++ "." ++ s