Debian Codegraph @

importers/ding2tei/src/preprocess/es-de/syntax.sed

raw
1 #!/usr/bin/env -S sed -Ef
2 #
3 # es-de/syntax.sed - modify the es-de dictionary to fit the Ding syntax
4 #
5 # Copyright 2020 Einhard Leichtfuß
6 #
7 # This file is part of ding2tei-haskell.
8 #
9 # ding2tei-haskell is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU Affero General Public License as published
11 # by the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # ding2tei-haskell is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU Affero General Public License for more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with ding2tei-haskell. If not, see <https://www.gnu.org/licenses/>.
21 #
22
23 # Notes:
24 # * This script is not a true solution.
25 # * This concerns the header, "/..." suffixes and the "|" -> ";"
26 # transformation.
27 # * Instead, the parser should be adapted to separately allow for the
28 # slightly different syntax of the es-de dictionary.
29 # * The main program has some hard coded values pertaining to the German
30 # English Ding dictionary, therefore even with this modifications, the
31 # resulting TEI will have pretty wrong metadata.
32
33
34 # Grammar.
35 s`\{prn\}`\{pron\}`g
36 s` \{Demonstrativpronomen\}``
37 s`:: ::`::`
38 s`\{s\}`\{sing\}`g
39 s`\{prep\}`\{prp\}`g
40 s`\{([fnm])$`\{\1\}`
41 s`\;$``
42 s`\{mf\}`\{m,f\}`g
43 s`\{adv\.\}`{adv}`g
44
45
46 # Remove a superfluous <(>.
47 s`\<(Besetzung) \((\{f\}) (\(Film\))`\1 \2 \3`
48
49 s`^(retroceder \{v\} :: zurückziehen)\|$`\1`
50
51 /^monstruoso \{adj\} :: \{adj\}$/ d
52
53
54 # Adapt header
55 \`^# Spanish :: German word list$` d
56 s`^(# Version :: 0\.0i) Mon Mar 5 18:36:47 2012$`\1 2012-05-03`
57 s`^(# Copyright \(c\) :: .*) (2003-2012)$`\1,\n# \2`
58 \`^# License ::` {
59 N; N
60 s/\n# License :: ([^\n]+)/; \1/g
61 }
62 \`^# [0-9]+ entries$` d
63
64
65
66 # Debatable.
67 s` /([[:alpha:]]*)$` (\1)`
68
69
70 # Cheating...
71 s`\|`\;`g
72
73
74 # Remaining problems:
75 # * <|> is always (and seemingly only) used to distinguish
76 # different genders. Sometimes, the respective other side has only one word
77 # for both genders, i.e. the number of groups on both sides to not match.
78 # . Ex.: "llorón {m}|llorona {f} :: Heulsuse {f} [coloq.]"
79 # . Ex.: "logopeda {m,f} :: Logopäde {m} | Logopädin {f}"
80 # * The header.
81
82 # vi: noet