1 # -*- coding: utf-8 -*-
3 # This Makefile creates German hyphenation patterns in subdirectories
4 # $(TRAD) and $(REFO) for traditional and new orthography, respectively.
5 # Hyphenation patterns for traditional Swiss German are generated in
8 # The input data is in $(SRCDIR); the possible targets are `pattern-trad',
9 # `pattern-refo', and `pattern-swiss'. If no target (or target `all') is
10 # given, all patterns for all three targets are built.
12 # SRCDIR (and the other variables) can be easily modified as parameters
13 # while calling `make', e.g.
15 # make pattern-trad SRCDIR=~/git/wortliste
17 # If you add one of the (phony) targets `major', `fugen', or `suffix',
18 # patterns that only use major hyphenation points (`Haupttrennstellen')
19 # are created. Example:
21 # make major pattern-refo
23 # The output directories have `-major' (etc.) appended to their names.
25 # To control the used weights in the major hyphenation patterns, add
26 # variable `W=N', where `N' gives the quality: value 1 specifies the best
27 # hyphenation points only, value 2 both the best and second-best points,
28 # etc. The default is value 0, using all major hyphenation points.
32 # Dieses Makefile erzeugt deutsche Trennmuster in den
33 # Unterverzeichnissen $(TRAD) und $(REFO) für die traditionelle
34 # bzw. reformierte Rechtschreibung. Trennmuster für tradionelles
35 # deutschschweizerisches Deutsch werden Verzeichnis $(SWISS) erzeugt.
37 # Die Eingabedaten werden im Verzeichnis $(SRCDIR) erwartet; die möglichen
38 # Make-Ziele sind `pattern-trad', `pattern-refo' und `pattern-swiss'. Wenn
39 # kein Ziel angegeben ist (oder man das Ziel `all' verwendet), werden alle
40 # drei Trennmuster erzeugt.
42 # SRCDIR (und die anderen Variablen) kann man leicht beim Aufruf von
43 # `make' als Parameter modifizieren, z.B.
45 # make pattern-trad SRCDIR=~/git/wortliste
47 # Wird eines der zusätzlichen (künstlichen) Ziele `major', `fugen' oder
48 # `suffix' angegeben, werden Haupttrennstellmuster erzeugt.
52 # make major pattern-refo
54 # Die verwendeten Verzeichnisnamen sind die gleichen wie oben, allerdings
55 # mit einem angehängten `-major', `-fugen' bzw. `-suffix'.
57 # Diese Spezialmuster spiegeln die Auszeichnung in der Liste direkt wider.
58 # Sie haben nicht das Ziel, "gute" Trennungen in Texten zu erzeugen, sondern
59 # sind zum Testen der Konsistenz der Auszeichnung sowie zum "kategorisierten"
60 # Markieren der Trennstellen neuer Wörter gedacht.
62 # Bei `major' kann die Menge der verwendeten Haupttrennstellen mittels der
63 # Variable `W=N' (Wichtungs-Schwellwert)
64 # kontrolliert werden, wo `N' die Qualität angibt: Wert 1 selektiert
65 # nur die besten Haupttrennstellen, Wert 2 die besten und zweitbesten
66 # Haupttrennstellen usw. Der Standardwert für `W' ist 0; er gibt an, dass
67 # alle Haupttrennstellen verwendet werden sollen.
69 # Die Ziele `de-Latf' und `de-x-long-s' erzeugen (experimentelle) Wortlisten
70 # und (Quasi-) Trennmuster für die Wandlung von Wörtern in traditioneller oder
71 # reformierter Standardorthographie in der Variante mit Unterscheidung von
72 # langem und runden S (Binnen-S vs. Schluß-S) wie sie im Satz mit gebrochenen
73 # Schriften benötigt wird. Ein Beispiel für die Anwendung dieser Muster ist
74 # das Skript `skripte/python/patuse/long_s_conversion.py`
79 DATADIR
= $(SRCDIR
)/daten
80 SCRIPTDIR
= $(SRCDIR
)/skripte
81 LANGSDIR
= $(SCRIPTDIR
)/python
/lang_s
85 ifneq ($(findstring major
,$(MAKECMDGOALS
)),)
87 # A single `-' gets removed; all other combinations of `-', `<', `>',
88 # and `=' are converted to a hyphen.
89 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
92 -e
's/[=<>][=<>]*/-/g' \
96 ifeq ($(words $(MAKECMDGOALS
)),1)
99 # This is to suppress the `nothing to be done' warning.
103 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
105 # All combinations of `-', `<', `>', `<=', `=>' get removed,
106 # runs of `=' are converted to a hyphen.
107 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
111 -e
's/[<>][<>]*//g' \
115 ifeq ($(words $(MAKECMDGOALS
)),1)
118 # This is to suppress the `nothing to be done' warning.
122 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
124 # All combinations of `-', `<', `=' get removed,
125 # runs of `>' are converted to a hyphen.
126 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
128 -e
's/[<=][<=]*//g' \
132 ifeq ($(words $(MAKECMDGOALS
)),1)
135 # This is to suppress the `nothing to be done' warning.
145 TRAD
= dehypht-x
$(MAJOR
)
146 REFO
= dehyphn-x
$(MAJOR
)
147 SWISS
= dehyphts-x
$(MAJOR
)
151 LC_ENVVARS
= LC_COLLATE
=de_DE.UTF-8 \
157 DATE
= $(shell date
'+%Y-%m-%d')
164 SPRACHAUSZUG
= $(PYTHON
) skripte
/trennmuster
/sprachauszug.py
167 SORT
= $(LC_ENVVARS
) sort -d \
168 |
$(LC_ENVVARS
) uniq
-i
170 LEFTHYPHENMIN
= $(strip $(shell $(SED
) 's/^\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
171 RIGHTHYPHENMIN
= $(strip $(shell $(SED
) 's/^..\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
173 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
174 $(GIT) log --format=%H -1 HEAD --`
175 TRADFILES
= $(TRAD
)/$(TRAD
)-$(DATE
).pat
$(TRAD
)/$(TRAD
)-$(DATE
).
tex
176 REFOFILES
= $(REFO
)/$(REFO
)-$(DATE
).pat
$(REFO
)/$(REFO
)-$(DATE
).
tex
177 SWISSFILES
= $(SWISS
)/$(SWISS
)-$(DATE
).pat
$(SWISS
)/$(SWISS
)-$(DATE
).
tex
180 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
183 all: pattern-trad pattern-refo pattern-swiss
185 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
186 pattern-trad
: $(TRADFILES
)
187 pattern-refo
: $(REFOFILES
)
188 pattern-swiss
: $(SWISSFILES
)
190 # intermediate targets
194 .PHONY
: words-trad words-refo
195 words-trad
: $(TRAD
)/words.hyphenated.trad
196 words-refo
: $(REFO
)/words.hyphenated.refo
199 .PHONY
: pre-trad pre-refo pre-swiss
207 $(TRADFILES
) $(TRAD
)/words.hyphenated.trad
: pre-trad
208 $(REFOFILES
) $(REFO
)/words.hyphenated.refo
: pre-refo
209 $(SWISSFILES
) $(SWISS
)/words.hyphenated.swiss
: pre-swiss
212 # GNU make supports creation of multiple targets by a single
213 # invocation of a recipe only for pattern rules, thus we have
214 # to use a `sentinel file' (using `echo' for the time stamp).
217 $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
: $(TRAD
)/make-full-pattern-trad
219 $(TRAD
)/make-full-pattern-trad
: $(TRAD
)/words.hyphenated.trad
221 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
224 $(TRAD
)/$(TRAD
)-$(DATE
).pat
: $(TRAD
)/pattern
.8 $(TRAD
)/pattern.rules
225 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
226 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
227 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
228 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
229 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
230 $(CAT
) $(TRAD
)/pattern.rules
>> $@
; \
231 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
232 $(CAT
) $(TRAD
)/pattern
.8 >> $@
; \
233 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
236 $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
: $(REFO
)/make-full-pattern-refo
238 $(REFO
)/make-full-pattern-refo
: $(REFO
)/words.hyphenated.refo
240 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
243 $(REFO
)/$(REFO
)-$(DATE
).pat
: $(REFO
)/pattern
.8 $(REFO
)/pattern.rules
244 $(CAT
) $(DATADIR
)/$(REFO
).1 \
245 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
246 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
247 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
248 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
249 $(CAT
) $(REFO
)/pattern.rules
>> $@
; \
250 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
251 $(CAT
) $(REFO
)/pattern
.8 >> $@
; \
252 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
255 $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
: $(SWISS
)/make-full-pattern-swiss
257 $(SWISS
)/make-full-pattern-swiss
: $(SWISS
)/words.hyphenated.swiss
259 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
262 $(SWISS
)/$(SWISS
)-$(DATE
).pat
: $(SWISS
)/pattern
.8 $(SWISS
)/pattern.rules
263 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
264 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
265 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
266 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
267 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
268 $(CAT
) $(SWISS
)/pattern.rules
>> $@
; \
269 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
270 $(CAT
) $(SWISS
)/pattern
.8 >> $@
; \
271 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
274 $(TRAD
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
276 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-t
-1 -U
$(PERLMAJOR
) \
280 $(REFO
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
282 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-1 -U
$(PERLMAJOR
) \
286 $(SWISS
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
288 |
$(PERL
) $(SCRIPTDIR
)/extract-tex.pl
-s
-1 -U
$(PERLMAJOR
) \
293 $(TRAD
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
295 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
297 $(REFO
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
299 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
301 $(SWISS
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
303 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
305 # Listen und Patterns de-Latf (deutsch, Latin script, fraktur;
306 # Orthographie für Satz mit gebrochenen Schriften und rundem und langem S)
308 # Wortlisten mit Langem-S: gemischt, de-1901 (alt), de-1996 (reform)
310 $(LATF
)/words-de-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
312 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms \
313 -l
"de-1901,de-1996" -i wortliste
-o
$(LATF
)/words-de-Latf.txt
315 $(LATF
)/words-de-1901-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
317 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1901 \
318 -i wortliste
-o
$(LATF
)/words-de-1901-Latf.txt
320 $(LATF
)/words-de-1996-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
321 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1996 \
322 -i wortliste
-o
$(LATF
)/words-de-1996-Latf.txt
324 # de-Latf...: Variante mit Quasi-Trennstellen nach rund-s (aus-sagen)
326 .PHONY
: de-Latf de-1901-Latf de-1996-Latf
328 de-Latf
: $(LATF
)/de-Latf.pat
330 $(LATF
)/words-de-Latf.hyphenated
: $(LATF
)/words-de-Latf.txt
331 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
333 $(LATF
)/de-Latf.pat
: $(LATF
)/words-de-Latf.hyphenated
335 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
336 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
338 de-1901-Latf
: $(LATF
)/de-1901-Latf.pat
340 $(LATF
)/words-de-1901-Latf.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
341 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
343 $(LATF
)/de-1901-Latf.pat
: $(LATF
)/words-de-1901-Latf.hyphenated
345 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
346 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
348 de-1996-Latf
: $(LATF
)/de-1996-Latf.pat
350 $(LATF
)/words-de-1996-Latf.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
351 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
353 $(LATF
)/de-1996-Latf.pat
: $(LATF
)/words-de-1996-Latf.hyphenated
355 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
356 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
358 # long-s: Variante mit Quasi-Trennstellen nach Lang-S (auss-agen)
360 .PHONY
: de-x-long-s de-1901-x-long-s de-1996-x-long-s
362 de-x-long-s
: $(LONG_S
)/de-x-long-s.pat
364 $(LONG_S
)/words-de-x-long-s.hyphenated
: $(LATF
)/words-de-Latf.txt
366 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
368 $(LONG_S
)/de-x-long-s.pat
: $(LONG_S
)/words-de-x-long-s.hyphenated
369 $(CHDIR
) $(LONG_S
); \
370 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
371 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;
373 de-1901-x-long-s
: $(LONG_S
)/de-1901-x-long-s.pat
375 $(LONG_S
)/words-de-1901-x-long-s.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
377 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
379 $(LONG_S
)/de-1901-x-long-s.pat
: $(LONG_S
)/words-de-1901-x-long-s.hyphenated
380 $(CHDIR
) $(LONG_S
); \
381 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
382 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;
384 de-1996-x-long-s
: $(LONG_S
)/de-1996-x-long-s.pat
386 $(LONG_S
)/words-de-1996-x-long-s.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
388 $(PYTHON
) $(LANGSDIR
)/long_s_quasihyph.py
< $< > $@
390 $(LONG_S
)/de-1996-x-long-s.pat
: $(LONG_S
)/words-de-1996-x-long-s.hyphenated
391 $(CHDIR
) $(LONG_S
); \
392 $(SH
) $(SCRIPTDIR
)/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
393 $(CAT
) $(LONG_S
)/pattern
.8 >> $@
;
395 # Exzerpte mit `sprachauszug.py`
397 $(EXZERPTDIR
)/de-1996-x-morphemgrenzen
:
398 $(MKDIR
) $(EXZERPTDIR
)
399 $(SPRACHAUSZUG
) -l de-1996 \
400 -s
'morphemgrenzen,einfach' < $(WORDLIST
) > $@
402 $(EXZERPTDIR
)/de-1996-x-hyphenmin3
:
403 $(MKDIR
) $(EXZERPTDIR
)
404 $(SPRACHAUSZUG
) -l
'de-1996,de-1996-x-versal' \
405 -s
'standard,morphemisch,hyphenmin3,einfach' < $(WORDLIST
) > $@
407 $(EXZERPTDIR
)/de-1996-x-gesangstext
:
408 $(MKDIR
) $(EXZERPTDIR
)
409 $(SPRACHAUSZUG
) -l
'de-1996,de-1996-x-versal' \
410 -s
'syllabisch,gesangstext,einfach' < $(WORDLIST
) > $@