Debian Codegraph @

importers/ding2tei/src/Language/Ding/Enrich/Grammar/InflectedForms.hs

raw symbols SCIP
1 {-
2 - Language/Ding/Enrich/Grammar/FromInflectedForms.hs - Recognize that inflec-
3 - ted forms are only
4 - annotated to verbs.
5 -
6 - Copyright 2020 Einhard Leichtfuß
7 -
8 - This file is part of ding2tei-haskell.
9 -
10 - ding2tei-haskell is free software: you can redistribute it and/or modify
11 - it under the terms of the GNU Affero General Public License as published
12 - by the Free Software Foundation, either version 3 of the License, or
13 - (at your option) any later version.
14 -
15 - ding2tei-haskell is distributed in the hope that it will be useful,
16 - but WITHOUT ANY WARRANTY; without even the implied warranty of
17 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 - GNU Affero General Public License for more details.
19 -
20 - You should have received a copy of the GNU Affero General Public License
21 - along with ding2tei-haskell. If not, see <https://www.gnu.org/licenses/>.
22 -}
23
24 {-|
25 - From a set of grammar annotations on a unit, infer others to apply to the
26 - same unit.
27 -
28 - Note that this works on grammar elements which are common to the Ding and
29 - TEI, however this module is deliberately placed under `Language.Ding',
30 - because the enrichment depends on inference rules which are particular to
31 - the Ding. E.g. `{f}' implies that the corresponding unit is a noun, in the
32 - Ding. There may however, in general, very well be other parts of speach
33 - bearing a gender.
34 -}
35 module Language.Ding.Enrich.Grammar.InflectedForms
36 ( enrichFromInflectedForms
37 ) where
38
39 import Data.NatLang.Grammar
40 ( GrammarInfo(GramLexCategory)
41 , GramLexCategory(PartOfSpeech)
42 , PartOfSpeech(Verb)
43 )
44 import Language.Ding.Syntax (Unit(unitInflected, unitGrammar))
45
46
47 -- | Annotate any unit that is annotated with inflected forms as a verb.
48 -- Such new verb annotations are appended to the existing grammar
49 -- annotations.
50 enrichFromInflectedForms :: Unit -> Unit
51 enrichFromInflectedForms u =
52 case unitInflected u of
53 (Just _) -> u { unitGrammar = unitGrammar u ++ verbAnnot : [] }
54 Nothing -> u
55 where
56 verbAnnot = GramLexCategory $ PartOfSpeech $ Verb []
57
58
59 -- vi: ft=haskell ts=2 sw=2 et