diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-03-14 12:11:18 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-03-14 12:11:18 +0000 |
| commit | f7ce8940fa0d53718eb30bfc7d0ef9320bafc673 (patch) | |
| tree | a018f006c071e2782baa2e4e86fc28dc57901d49 /src/GF/UseGrammar | |
| parent | 98fcad148e61d5a284d0fe1b095f90eab368d28f (diff) | |
ma -status; sep lines for l -all
Diffstat (limited to 'src/GF/UseGrammar')
| -rw-r--r-- | src/GF/UseGrammar/Linear.hs | 8 | ||||
| -rw-r--r-- | src/GF/UseGrammar/Morphology.hs | 9 | ||||
| -rw-r--r-- | src/GF/UseGrammar/Treebank.hs | 4 |
3 files changed, 14 insertions, 7 deletions
diff --git a/src/GF/UseGrammar/Linear.hs b/src/GF/UseGrammar/Linear.hs index 85bae5b0d..ac6c3b703 100644 --- a/src/GF/UseGrammar/Linear.hs +++ b/src/GF/UseGrammar/Linear.hs @@ -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 -- only taking into account string fields -allLinTables :: CanonGrammar ->Ident ->A.Tree ->Err [[(Label,[([Patt],[String])])]] -allLinTables gr c t = do +-- True: sep. by /, False: sep by \n +allLinTables :: + Bool -> CanonGrammar ->Ident ->A.Tree ->Err [[(Label,[([Patt],[String])])]] +allLinTables slash gr c t = do r' <- allLinsAsRec gr c t mapM (mapM getS) r' where getS (lab,pss) = liftM (curry id lab) $ mapM gets pss 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 diff --git a/src/GF/UseGrammar/Morphology.hs b/src/GF/UseGrammar/Morphology.hs index 313aa6fbc..3aeb08dc7 100644 --- a/src/GF/UseGrammar/Morphology.hs +++ b/src/GF/UseGrammar/Morphology.hs @@ -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 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 mo = unwords . map (prMorphoAnalysisShort . appMorpho mo) . words +morphoTextShort mo = unlines . map (prMorphoAnalysisShort . appMorpho mo) . words -- | analyse running text and show results on separate lines morphoText :: Morpho -> String -> String diff --git a/src/GF/UseGrammar/Treebank.hs b/src/GF/UseGrammar/Treebank.hs index 952b71877..d353efc8a 100644 --- a/src/GF/UseGrammar/Treebank.hs +++ b/src/GF/UseGrammar/Treebank.hs @@ -241,9 +241,9 @@ linearize opts mgr lang = lin where lin | oElem showRecord opts = err id id . liftM prt . linearizeNoMark cgr zlang | 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 = - 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 |
