forked from GitHub/gf-core
ma -status; sep lines for l -all
This commit is contained in:
@@ -3,7 +3,10 @@
|
|||||||
-- adapted from verb list in
|
-- adapted from verb list in
|
||||||
-- http://www.iee.et.tu-dresden.de/~wernerr/grammar/verben_dt.html
|
-- http://www.iee.et.tu-dresden.de/~wernerr/grammar/verben_dt.html
|
||||||
|
|
||||||
concrete IrregGer of IrregGerAbs = CatGer ** open ParadigmsGer in {
|
concrete IrregGer of IrregGerAbs = CatGer ** open
|
||||||
|
ParadigmsGer,
|
||||||
|
(M = MorphoGer)
|
||||||
|
in {
|
||||||
|
|
||||||
flags optimize=values ;
|
flags optimize=values ;
|
||||||
|
|
||||||
@@ -185,7 +188,13 @@ concrete IrregGer of IrregGerAbs = CatGer ** open ParadigmsGer in {
|
|||||||
lin wiegen_V = irregV "wiegen" "wiegt" "wog" "wöge" "gewogen" ;
|
lin wiegen_V = irregV "wiegen" "wiegt" "wog" "wöge" "gewogen" ;
|
||||||
lin winden_V = irregV "winden" "windt" "wand" "wände" "gewunden" ;
|
lin winden_V = irregV "winden" "windt" "wand" "wände" "gewunden" ;
|
||||||
lin wissen_V = irregV "wissen" "weiß" "wußte" "wüßte" "gewußt" ;
|
lin wissen_V = irregV "wissen" "weiß" "wußte" "wüßte" "gewußt" ;
|
||||||
lin wollen_V = irregV "wollen" "will" "wollte" "wollte" "gewollt" ;
|
lin wollen_V = M.mkV
|
||||||
|
"wollen" "will" "willst" "will" "wollt" "woll"
|
||||||
|
"wollte" "wolltest" "wollten" "wolltet"
|
||||||
|
"wollte" "gewollen" []
|
||||||
|
M.VHaben ** {lock_V = <>} ;
|
||||||
|
|
||||||
|
|
||||||
lin wringen_V = irregV "wringen" "wringt" "wrang" "wränge" "gewrungen" ;
|
lin wringen_V = irregV "wringen" "wringt" "wrang" "wränge" "gewrungen" ;
|
||||||
lin zeihen_V = irregV "zeihen" "zeiht" "zieh" "ziehe" "geziehen" ;
|
lin zeihen_V = irregV "zeihen" "zeiht" "zieh" "ziehe" "geziehen" ;
|
||||||
lin ziehen_V = irregV "ziehen" "zieht" "zog" "zöge" "gezogen" ;
|
lin ziehen_V = irregV "ziehen" "zieht" "zog" "zöge" "gezogen" ;
|
||||||
|
|||||||
@@ -241,11 +241,11 @@ optLinearizeTree opts0 gr t = case getOptVal opts transferFun of
|
|||||||
lin mk
|
lin mk
|
||||||
| oElem showRecord opts = liftM prt . linearizeNoMark g c
|
| oElem showRecord opts = liftM prt . linearizeNoMark g c
|
||||||
| oElem tableLin opts = liftM (unlines . map untok . prLinTable True) .
|
| oElem tableLin opts = liftM (unlines . map untok . prLinTable True) .
|
||||||
allLinTables g c
|
allLinTables True g c
|
||||||
| oElem showFields opts = liftM (unlines . map untok) .
|
| oElem showFields opts = liftM (unlines . map untok) .
|
||||||
allLinBranchFields g c
|
allLinBranchFields g c
|
||||||
| oElem showAll opts = liftM (unlines . map untok . prLinTable False) .
|
| oElem showAll opts = liftM (unlines . map untok . prLinTable False) .
|
||||||
allLinTables g c
|
allLinTables False g c
|
||||||
| otherwise = return . unlines . map untok . optIntOrOne . linTree2strings mk g c
|
| otherwise = return . unlines . map untok . optIntOrOne . linTree2strings mk g c
|
||||||
g = grammar gr
|
g = grammar gr
|
||||||
c = cncId gr
|
c = cncId gr
|
||||||
@@ -306,7 +306,8 @@ optParseArgErrMsg opts gr s = do
|
|||||||
|
|
||||||
-- | analyses word by word
|
-- | analyses word by word
|
||||||
morphoAnalyse :: Options -> GFGrammar -> String -> String
|
morphoAnalyse :: Options -> GFGrammar -> String -> String
|
||||||
morphoAnalyse opts gr
|
morphoAnalyse opts gr
|
||||||
|
| oElem (iOpt "status") opts = morphoTextStatus mo
|
||||||
| oElem beShort opts = morphoTextShort mo
|
| oElem beShort opts = morphoTextShort mo
|
||||||
| otherwise = morphoText mo
|
| otherwise = morphoText mo
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -375,6 +375,7 @@ txtHelpFile =
|
|||||||
"\n the results line by line." ++
|
"\n the results line by line." ++
|
||||||
"\n options:" ++
|
"\n options:" ++
|
||||||
"\n -short show analyses in bracketed words, instead of separate lines" ++
|
"\n -short show analyses in bracketed words, instead of separate lines" ++
|
||||||
|
"\n -status show just the work at success, prefixed with \"*\" at failure" ++
|
||||||
"\n flags:" ++
|
"\n flags:" ++
|
||||||
"\n -lang" ++
|
"\n -lang" ++
|
||||||
"\n examples:" ++
|
"\n examples:" ++
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ optionsOfCommand co = case co of
|
|||||||
CLookupTreebank -> both "assocs raw strings trees" "treebank"
|
CLookupTreebank -> both "assocs raw strings trees" "treebank"
|
||||||
CWrapTerm _ -> opts "c"
|
CWrapTerm _ -> opts "c"
|
||||||
CApplyTransfer _ -> flags "lang transfer"
|
CApplyTransfer _ -> flags "lang transfer"
|
||||||
CMorphoAnalyse -> both "short" "lang"
|
CMorphoAnalyse -> both "short status" "lang"
|
||||||
CTestTokenizer -> flags "lexer"
|
CTestTokenizer -> flags "lexer"
|
||||||
CComputeConcrete _ -> both "table" "res"
|
CComputeConcrete _ -> both "table" "res"
|
||||||
CShowOpers _ -> flags "res"
|
CShowOpers _ -> flags "res"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ morphoTrainList opts ig number = do
|
|||||||
mkOnes gen ts
|
mkOnes gen ts
|
||||||
where
|
where
|
||||||
mkOnes gen (t:ts) = do
|
mkOnes gen (t:ts) = do
|
||||||
psss <- ioeErr $ allLinTables gr cnc t
|
psss <- ioeErr $ allLinTables True gr cnc t
|
||||||
let pss = concat $ map snd $ concat psss
|
let pss = concat $ map snd $ concat psss
|
||||||
let (i,gen') = randomR (0, length pss - 1) gen
|
let (i,gen') = randomR (0, length pss - 1) gen
|
||||||
(ps,ss) <- ioeErr $ pss !? i
|
(ps,ss) <- ioeErr $ pss !? i
|
||||||
|
|||||||
@@ -213,14 +213,16 @@ allLinsAsRec gr c t = linearizeNoMark gr c t >>= expandLinTables gr >>= allLinVa
|
|||||||
|
|
||||||
-- | the value is a list of structures arranged as records of tables of strings
|
-- | the value is a list of structures arranged as records of tables of strings
|
||||||
-- only taking into account string fields
|
-- only taking into account string fields
|
||||||
allLinTables :: CanonGrammar ->Ident ->A.Tree ->Err [[(Label,[([Patt],[String])])]]
|
-- True: sep. by /, False: sep by \n
|
||||||
allLinTables gr c t = do
|
allLinTables ::
|
||||||
|
Bool -> CanonGrammar ->Ident ->A.Tree ->Err [[(Label,[([Patt],[String])])]]
|
||||||
|
allLinTables slash gr c t = do
|
||||||
r' <- allLinsAsRec gr c t
|
r' <- allLinsAsRec gr c t
|
||||||
mapM (mapM getS) r'
|
mapM (mapM getS) r'
|
||||||
where
|
where
|
||||||
getS (lab,pss) = liftM (curry id lab) $ mapM gets pss
|
getS (lab,pss) = liftM (curry id lab) $ mapM gets pss
|
||||||
gets (ps,t) = liftM (curry id ps . cc . map str2strings) $ strsFromTerm t
|
gets (ps,t) = liftM (curry id ps . cc . map str2strings) $ strsFromTerm t
|
||||||
cc = concat . intersperse ["/"]
|
cc = concat . intersperse [if slash then "/" else "\n"]
|
||||||
|
|
||||||
-- | the value is a list of strings gathered from all fields
|
-- | the value is a list of strings gathered from all fields
|
||||||
|
|
||||||
|
|||||||
@@ -113,9 +113,14 @@ allMorphoWords = map fst . collapse
|
|||||||
|
|
||||||
-- analyse running text and show results either in short form or on separate lines
|
-- analyse running text and show results either in short form or on separate lines
|
||||||
|
|
||||||
-- | analyse running text and show results in short form
|
-- | analyse running text and show just the word, with "*" if not found
|
||||||
|
morphoTextStatus :: Morpho -> String -> String
|
||||||
|
morphoTextStatus mo = unlines . map (prMark . appMorpho mo) . words where
|
||||||
|
prMark (w,fs) = if null fs then "*" +++ w else w
|
||||||
|
|
||||||
|
-- | analyse running text and show results in short form, one word per line
|
||||||
morphoTextShort :: Morpho -> String -> String
|
morphoTextShort :: Morpho -> String -> String
|
||||||
morphoTextShort mo = unwords . map (prMorphoAnalysisShort . appMorpho mo) . words
|
morphoTextShort mo = unlines . map (prMorphoAnalysisShort . appMorpho mo) . words
|
||||||
|
|
||||||
-- | analyse running text and show results on separate lines
|
-- | analyse running text and show results on separate lines
|
||||||
morphoText :: Morpho -> String -> String
|
morphoText :: Morpho -> String -> String
|
||||||
|
|||||||
@@ -241,9 +241,9 @@ linearize opts mgr lang = lin where
|
|||||||
lin
|
lin
|
||||||
| oElem showRecord opts = err id id . liftM prt . linearizeNoMark cgr zlang
|
| oElem showRecord opts = err id id . liftM prt . linearizeNoMark cgr zlang
|
||||||
| oElem tableLin opts =
|
| oElem tableLin opts =
|
||||||
err id id . liftM (unlines . map untok . prLinTable True) . allLinTables cgr zlang
|
err id id . liftM (unlines . map untok . prLinTable True) . allLinTables True cgr zlang
|
||||||
| oElem showAll opts =
|
| oElem showAll opts =
|
||||||
err id id . liftM (unlines . map untok . prLinTable False) . allLinTables cgr zlang
|
err id id . liftM (unlines . map untok . prLinTable False) . allLinTables False cgr zlang
|
||||||
|
|
||||||
| otherwise = untok . linTree2string noMark cgr zlang
|
| otherwise = untok . linTree2string noMark cgr zlang
|
||||||
|
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ ma, morphologically_analyse: ma String
|
|||||||
the results line by line.
|
the results line by line.
|
||||||
options:
|
options:
|
||||||
-short show analyses in bracketed words, instead of separate lines
|
-short show analyses in bracketed words, instead of separate lines
|
||||||
|
-status show just the work at success, prefixed with "*" at failure
|
||||||
flags:
|
flags:
|
||||||
-lang
|
-lang
|
||||||
examples:
|
examples:
|
||||||
|
|||||||
Reference in New Issue
Block a user