diff --git a/lib/src/translator/translate.probs b/lib/src/translator/translate.probs index 39cb7ff32..4c9972782 100644 --- a/lib/src/translator/translate.probs +++ b/lib/src/translator/translate.probs @@ -28465,9 +28465,9 @@ impurity_N 3.729715012475897e-6 imputation_N 3.729715012475897e-6 impute_V2 3.219730508556434e-5 imputrescible_A 1.0773191989054437e-5 -in_A 1.0773191989054437e-5 +in_A 1.0773191989054437e-12 in_Adv 5.2013800995197394e-5 -in_N 1.118914503742769e-5 +in_N 1.118914503742769e-12 in_Prep 0.20401137554258345 in_accordance_with_Prep 2.99356383774884e-5 in_addition_Adv 1.4390484942004612e-3 @@ -36593,7 +36593,7 @@ moult_N 3.729715012475897e-6 moult_V 2.2678822515534993e-5 moult_V2 1.609865254278217e-5 mound_N 2.237829007485538e-5 -mount_N 3.729715012475897e-6 +mount_N 3.729715012475897e-9 mount_V 6.350070304349798e-4 mount_V2 2.2538113559895037e-4 mount_VS 1.7328019407381737e-4 @@ -52981,7 +52981,7 @@ snuggle_V2 1.609865254278217e-5 snugness_N 3.729715012475897e-6 so_AdA 8.519269776876268e-2 so_Adv 1.7337933665065797e-5 -so_N 3.729715012475897e-6 +so_N 3.729715012475897e-9 so_PConj 3.0480370641307e-4 so_Subj 4.016064257028112e-3 so_and_so_N 3.729715012475897e-6 diff --git a/src/runtime/haskell-bind/examples/pgf-hsbind-trans.hs b/src/runtime/haskell-bind/examples/pgf-hsbind-trans.hs index d04a96e08..7487c04df 100644 --- a/src/runtime/haskell-bind/examples/pgf-hsbind-trans.hs +++ b/src/runtime/haskell-bind/examples/pgf-hsbind-trans.hs @@ -7,6 +7,7 @@ import PGF2 import PGF.Lexing (lexText') import Data.Char(isSpace,toLower) +import Data.List (nub) import System.Environment import qualified Data.Map as Map @@ -33,14 +34,19 @@ getConcr' pgf lang = maybe (fail $ "Concrete syntax not found: "++show lang) return $ Map.lookup lang (languages pgf) -linearizeAndShow gr mxv (t,p) = [show t]++take mxv (linearizeAll gr t)++[show p] +linearizeAndShow gr mxv (t,p) = [show t]++take mxv (nub (map unstar (linearizeAll gr t)))++[show p] + where + unstar s = case s of + '*':' ':cs -> cs + _ -> s translates pgf cfrom cto cat (mxt,mxv) s0 = - let s = lextext cfrom s0 + let s1 = lextext cfrom s0 + (s,p) = case reverse s1 of c:_ | elem c ".?!" -> (init s1,[c]) ; _ -> (s1,[]) -- separate final punctuation in case cparse pgf cfrom cat s of Left tok -> unlines [s,"Parse error: "++tok] - Right ts -> unlines $ take mxt $ map (unlines . linearizeAndShow cto mxv) ts + Right ts -> unlines $ (("> "++ s):) $ take mxt $ map ((++p) . unlines . linearizeAndShow cto mxv) ts -- append punctuation cparse pgf concr cat input = parseWithHeuristics concr cat input (-1) callbacks where callbacks = maybe [] cb $ lookup "App" literalCallbacks