From 8970184578da853095be849403d41608d3149cb6 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 12 Oct 2010 13:36:37 +0000 Subject: [PATCH] added option -depth to command gr --- src/compiler/GF/Command/Commands.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 10322715b..d27bea37e 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -306,14 +306,16 @@ allCommands env@(pgf, mos) = Map.fromList [ ("cat","generation category"), ("lang","uses only functions that have linearizations in all these languages"), ("number","number of trees generated"), + ("depth","the maximum generation depth"), ("probs", "file with biased probabilities (format 'f 0.4' one by line)") ], exec = \opts xs -> do pgf <- optProbs opts (optRestricted opts) gen <- newStdGen + let dp = valIntOpts "depth" 4 opts let ts = case mexp xs of - Just ex -> generateRandomFrom gen pgf ex - Nothing -> generateRandom gen pgf (optType opts) + Just ex -> generateRandomFromDepth gen pgf ex (Just dp) + Nothing -> generateRandomDepth gen pgf (optType opts) (Just dp) returnFromExprs $ take (optNum opts) ts }), ("gt", emptyCommandInfo {