Debian Codegraph @

importers/ding2tei/src/Data/NatLang/Grammar.hs

raw symbols SCIP
1 {-
2 - Data/NatLang/Grammar.hs - Grammar (linguistics) information
3 -
4 - Copyright 2020,2022 Einhard Leichtfuß
5 -
6 - This file is part of ding2tei-haskell.
7 -
8 - ding2tei-haskell is free software: you can redistribute it and/or modify
9 - it under the terms of the GNU Affero General Public License as published
10 - by the Free Software Foundation, either version 3 of the License, or
11 - (at your option) any later version.
12 -
13 - ding2tei-haskell is distributed in the hope that it will be useful,
14 - but WITHOUT ANY WARRANTY; without even the implied warranty of
15 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 - GNU Affero General Public License for more details.
17 -
18 - You should have received a copy of the GNU Affero General Public License
19 - along with ding2tei-haskell. If not, see <https://www.gnu.org/licenses/>.
20 -}
21
22
23 {-|
24 - Grammar information (linguistics), as present in the Ding dictionary,
25 - albeit also representable in TEI.
26 -}
27 module Data.NatLang.Grammar
28 ( GrammarInfo(..)
29 , GramLexCategory(..)
30 , PartOfSpeech(..)
31 , VerbType(..)
32 , PronounType(..)
33 , Gender(..)
34 , Number(..)
35 , Case(..)
36 , Collocate(..)
37 ) where
38
39
40 import Data.NatLang.Usage (Usage)
41
42
43 -- | A grammar single annotation, where "{f,n}" counts as two of them.
44 data GrammarInfo
45 = GramLexCategory GramLexCategory
46 | Collocate Collocate [Usage]
47 deriving (Show, Eq, Ord)
48
49
50 -- | Grammatical or lexical category (resp. values thereof).
51 -- See https://en.wikipedia.org/wiki/Grammatical_category for a distinction.
52 -- Might contain information not considered related to grammatical or lexical
53 -- categories. I am not a linguist.
54 data GramLexCategory
55 = PartOfSpeech PartOfSpeech
56 | Gender Gender
57 | Number Number
58 | Case Case -- ^ rare in the Ding
59 deriving (Show, Eq, Ord)
60
61
62 data PartOfSpeech
63 = Noun
64 | Verb [VerbType]
65 | Adjective
66 | Adverb
67 | Preposition
68 | Conjunction
69 | Article
70 | Pronoun [PronounType]
71 | Numeral
72 | Interjection
73 | Particle
74 deriving (Show, Eq, Ord)
75
76 data VerbType
77 = Transitive
78 | Intransitive
79 | Reflexive
80 deriving (Show, Eq, Ord)
81
82 -- | Some pronoun types.
83 -- There are many more, but the Ding does not annotate them.
84 data PronounType
85 = Personal
86 | Interrogative
87 | Relative
88 deriving (Show, Eq, Ord)
89
90
91 data Gender
92 = Feminine
93 | Masculine
94 | Neuter
95 deriving (Show, Eq, Ord)
96
97
98 -- | Grammatical number
99 -- The argument to both constructors specifies whether the annotated word
100 -- may only occur in the respective number, that is, whether it is a
101 -- singulare/plurale tantum.
102 data Number
103 = Singular Bool
104 | Plural Bool
105 deriving (Show, Eq, Ord)
106
107
108 -- | Grammatical case.
109 -- Only those listed that appear in annotations in the Ding.
110 data Case
111 = Nominative
112 | Genitive
113 | Accusative
114 | Dative
115 deriving (Show, Eq, Ord)
116
117
118 -- | Grammar collocate, such as "{+Dat.}" or "{+conj}".
119 data Collocate
120 = CollocCase
121 [String] -- ^ interrogative pronouns; often none
122 Case -- ^ case of collocating word
123 | CollocPOS PartOfSpeech -- ^ POS of collocating word; rare
124 | CollocNumber Number -- ^ number of collocating word; rare
125 deriving (Show, Eq, Ord)
126
127
128 -- vi: ts=2 sw=2 et