diff options
| author | peb <unknown> | 2005-02-24 10:46:37 +0000 |
|---|---|---|
| committer | peb <unknown> | 2005-02-24 10:46:37 +0000 |
| commit | bf436aebaa5b84bbb50e305e8f7dc9ca4ae34299 (patch) | |
| tree | 346ac1e13a90d7b2c992c69f45b3e19c22f4bfe2 /src/GF/UseGrammar/Morphology.hs | |
| parent | 0137dd5511a83ea4672619ad3dc22fe7c51ab4bf (diff) | |
"Committed_by_peb"
Diffstat (limited to 'src/GF/UseGrammar/Morphology.hs')
| -rw-r--r-- | src/GF/UseGrammar/Morphology.hs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/GF/UseGrammar/Morphology.hs b/src/GF/UseGrammar/Morphology.hs index 135546680..62aeb7725 100644 --- a/src/GF/UseGrammar/Morphology.hs +++ b/src/GF/UseGrammar/Morphology.hs @@ -1,15 +1,20 @@ ---------------------------------------------------------------------- -- | --- Module : (Module) --- Maintainer : (Maintainer) +-- Module : Morphology +-- Maintainer : AR -- Stability : (stable) -- Portability : (portable) -- --- > CVS $Date: 2005/02/18 19:21:22 $ +-- > CVS $Date: 2005/02/24 11:46:39 $ -- > CVS $Author: peb $ --- > CVS $Revision: 1.6 $ +-- > CVS $Revision: 1.7 $ -- -- Morphological analyser constructed from a GF grammar. +-- +-- we first found the binary search tree sorted by word forms more efficient +-- than a trie, at least for grammars with 7000 word forms +-- (18\/11\/2003) but this may change since we have to use a trie +-- for decompositions and also want to use it in the parser ----------------------------------------------------------------------------- module Morphology where @@ -35,11 +40,12 @@ import Trie2 -- we first found the binary search tree sorted by word forms more efficient -- than a trie, at least for grammars with 7000 word forms --- (18/11/2003) but this may change since we have to use a trie +-- (18\/11\/2003) but this may change since we have to use a trie -- for decompositions and also want to use it in the parser type Morpho = Trie Char String +emptyMorpho :: Morpho emptyMorpho = emptyTrie appMorpho :: Morpho -> String -> (String,[String]) @@ -96,13 +102,18 @@ prMorphoAnalysisShort (w,fs) = prBracket (w' ++ prTList "/" fs) where tagPrt :: Print a => (a,a) -> String tagPrt (m,c) = "+" ++ prt c --- module name --- print all words recognized - +-- | print all words recognized allMorphoWords :: Morpho -> [String] 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 +morphoTextShort :: Morpho -> String -> String morphoTextShort mo = unwords . map (prMorphoAnalysisShort . appMorpho mo) . words + +-- | analyse running text and show results on separate lines +morphoText :: Morpho -> String -> String morphoText mo = unlines . map (('\n':) . prMorphoAnalysis . appMorpho mo) . words -- format used in the Italian Verb Engine |
