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 # Das Ziel `de-Latf' erzeugt (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 PATTDIR
= $(SRCDIR
)/muster
81 SCRIPTDIR
= $(SRCDIR
)/skripte
82 LANGSDIR
= $(SCRIPTDIR
)/spezialmuster
/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'
95 ifeq ($(words $(MAKECMDGOALS
)),1)
98 # This is to suppress the `nothing to be done' warning.
102 else ifneq ($(findstring fugen
,$(MAKECMDGOALS
)),)
104 # All combinations of `-', `<', `>', `<=', `=>' get removed,
105 # runs of `=' are converted to a hyphen.
106 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
110 -e
's/[<>][<>]*//g' \
114 ifeq ($(words $(MAKECMDGOALS
)),1)
117 # This is to suppress the `nothing to be done' warning.
121 else ifneq ($(findstring suffix,$(MAKECMDGOALS
)),)
123 # All combinations of `-', `<', `=' get removed,
124 # runs of `>' are converted to a hyphen.
125 SEDMAJOR
= $(SED
) -e
'/[=<>-]/!n' \
127 -e
's/[<=][<=]*//g' \
131 ifeq ($(words $(MAKECMDGOALS
)),1)
134 # This is to suppress the `nothing to be done' warning.
144 TRAD
= dehypht-x
$(MAJOR
)
145 REFO
= dehyphn-x
$(MAJOR
)
146 SWISS
= dehyphts-x
$(MAJOR
)
148 LIGA
= $(PATTDIR
)/ligaturaufbruch
150 LC_ENVVARS
= LC_COLLATE
=de_DE.UTF-8 \
156 DATE
= $(shell date
'+%Y-%m-%d')
163 SPRACHAUSZUG
= $(PYTHON
) skripte
/wortliste
/sprachauszug.py
166 SORT
= $(LC_ENVVARS
) sort -d \
167 |
$(LC_ENVVARS
) uniq
-i
169 LEFTHYPHENMIN
= $(strip $(shell $(SED
) 's/^\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
170 RIGHTHYPHENMIN
= $(strip $(shell $(SED
) 's/^..\(..\).*/\1/;q' < $(DATADIR
)/german.tr
))
172 GIT_VERSION
:= `$(CHDIR) $(SRCDIR); \
173 $(GIT) log --format=%H -1 HEAD --`
175 TRADDIR
= muster
/$(TRAD
)
176 REFODIR
= muster
/$(REFO
)
177 SWISSDIR
= muster
/$(SWISS
)
178 TRADFILES
= $(TRADDIR
)/$(TRAD
)-$(DATE
).pat
$(TRADDIR
)/$(TRAD
)-$(DATE
).
tex
179 REFOFILES
= $(REFODIR
)/$(REFO
)-$(DATE
).pat
$(REFODIR
)/$(REFO
)-$(DATE
).
tex
180 SWISSFILES
= $(SWISSDIR
)/$(SWISS
)-$(DATE
).pat
$(SWISSDIR
)/$(SWISS
)-$(DATE
).
tex
183 override SRCDIR
:= $(shell cd
$(SRCDIR
); $(PWD
))
186 all: pattern-trad pattern-refo pattern-swiss
188 .PHONY
: pattern-trad pattern-refo pattern-swiss major fugen
suffix
189 pattern-trad
: $(TRADFILES
)
190 pattern-refo
: $(REFOFILES
)
191 pattern-swiss
: $(SWISSFILES
)
193 # intermediate targets
197 .PHONY
: words-trad words-refo
198 words-trad
: $(TRADDIR
)/words.hyphenated.trad
199 words-refo
: $(REFODIR
)/words.hyphenated.refo
202 .PHONY
: pre-trad pre-refo pre-swiss
210 $(TRADFILES
) $(TRADDIR
)/words.hyphenated.trad
: pre-trad
211 $(REFOFILES
) $(REFODIR
)/words.hyphenated.refo
: pre-refo
212 $(SWISSFILES
) $(SWISSDIR
)/words.hyphenated.swiss
: pre-swiss
215 # GNU make supports creation of multiple targets by a single
216 # invocation of a recipe only for pattern rules, thus we have
217 # to use a `sentinel file' (using `echo' for the time stamp).
220 $(TRADDIR
)/pattern
.8 $(TRADDIR
)/pattern.rules
: $(TRADDIR
)/make-full-pattern-trad
222 $(TRADDIR
)/make-full-pattern-trad
: $(TRADDIR
)/words.hyphenated.trad
223 $(CHDIR
) $(TRADDIR
); \
224 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
227 $(TRADDIR
)/$(TRAD
)-$(DATE
).pat
: $(TRADDIR
)/pattern
.8 $(TRADDIR
)/pattern.rules
228 $(CAT
) $(DATADIR
)/$(TRAD
).1 \
229 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
230 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
231 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
232 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
233 $(CAT
) $(TRADDIR
)/pattern.rules
>> $@
; \
234 $(CAT
) $(DATADIR
)/$(TRAD
).2 >> $@
; \
235 $(CAT
) $(TRADDIR
)/pattern
.8 >> $@
; \
236 $(CAT
) $(DATADIR
)/$(TRAD
).3 >> $@
239 $(REFODIR
)/pattern
.8 $(REFODIR
)/pattern.rules
: $(REFODIR
)/make-full-pattern-refo
241 $(REFODIR
)/make-full-pattern-refo
: $(REFODIR
)/words.hyphenated.refo
242 $(CHDIR
) $(REFODIR
); \
243 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
246 $(REFODIR
)/$(REFO
)-$(DATE
).pat
: $(REFODIR
)/pattern
.8 $(REFODIR
)/pattern.rules
247 $(CAT
) $(DATADIR
)/$(REFO
).1 \
248 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
249 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
250 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
251 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
252 $(CAT
) $(REFODIR
)/pattern.rules
>> $@
; \
253 $(CAT
) $(DATADIR
)/$(REFO
).2 >> $@
; \
254 $(CAT
) $(REFODIR
)/pattern
.8 >> $@
; \
255 $(CAT
) $(DATADIR
)/$(REFO
).3 >> $@
258 $(SWISSDIR
)/pattern
.8 $(SWISSDIR
)/pattern.rules
: $(SWISSDIR
)/make-full-pattern-swiss
260 $(SWISSDIR
)/make-full-pattern-swiss
: $(SWISSDIR
)/words.hyphenated.swiss
261 $(CHDIR
) $(SWISSDIR
); \
262 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/german.tr
265 $(SWISSDIR
)/$(SWISS
)-$(DATE
).pat
: $(SWISSDIR
)/pattern
.8 $(SWISSDIR
)/pattern.rules
266 $(CAT
) $(DATADIR
)/$(SWISS
).1 \
267 |
$(SED
) -e
"s/@DATE@/$(DATE)/" \
268 -e
"s/@GIT_VERSION@/$(GIT_VERSION)/" \
269 -e
"s/@LEFTHYPHENMIN@/$(LEFTHYPHENMIN)/" \
270 -e
"s/@RIGHTHYPHENMIN@/$(RIGHTHYPHENMIN)/" > $@
; \
271 $(CAT
) $(SWISSDIR
)/pattern.rules
>> $@
; \
272 $(CAT
) $(DATADIR
)/$(SWISS
).2 >> $@
; \
273 $(CAT
) $(SWISSDIR
)/pattern
.8 >> $@
; \
274 $(CAT
) $(DATADIR
)/$(SWISS
).3 >> $@
277 $(TRADDIR
)/words.hyphenated.trad
: $(SRCDIR
)/$(WORDLIST
)
279 |
$(PERL
) $(SCRIPTDIR
)/wortliste
/extract-tex.pl
-t
-1 -U
$(PERLMAJOR
) \
283 $(REFODIR
)/words.hyphenated.refo
: $(SRCDIR
)/$(WORDLIST
)
285 |
$(PERL
) $(SCRIPTDIR
)/wortliste
/extract-tex.pl
-1 -U
$(PERLMAJOR
) \
289 $(SWISSDIR
)/words.hyphenated.swiss
: $(SRCDIR
)/$(WORDLIST
)
291 |
$(PERL
) $(SCRIPTDIR
)/wortliste
/extract-tex.pl
-s
-1 -U
$(PERLMAJOR
) \
296 $(TRADDIR
)/$(TRAD
)-$(DATE
).
tex: $(DATADIR
)/$(TRAD
).
tex.in
298 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
300 $(REFODIR
)/$(REFO
)-$(DATE
).
tex: $(DATADIR
)/$(REFO
).
tex.in
302 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
304 $(SWISSDIR
)/$(SWISS
)-$(DATE
).
tex: $(DATADIR
)/$(SWISS
).
tex.in
306 |
$(SED
) -e
"s/@DATE@/$(DATE)/" > $@
308 # Listen und Patterns de-Latf (deutsch, Latin script, fraktur;
309 # Orthographie für Satz mit gebrochenen Schriften und rundem und langem S)
311 # Wortlisten mit Langem-S: gemischt, de-1901 (alt), de-1996 (reform)
313 $(LATF
)/words-de-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
315 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms \
316 -l
"de-1901,de-1996" < $(WORDLIST
) > $(LATF
)/words-de-Latf.txt
318 $(LATF
)/words-de-1901-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
320 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1901 \
321 < $(WORDLIST
) > $(LATF
)/words-de-1901-Latf.txt
323 $(LATF
)/words-de-1996-Latf.txt
: wortliste
$(LANGSDIR
)/s2long-s.py
324 $(PYTHON
) $(LANGSDIR
)/s2long-s.py
--drop-homonyms
-l de-1996 \
325 < $(WORDLIST
) > $(LATF
)/words-de-1996-Latf.txt
327 # de-Latf...: Quasi-Trennstellen nach rund-s (aus-sagen == ausſagen)
329 .PHONY
: de-Latf de-1901-Latf de-1996-Latf
331 de-Latf
: $(LATF
)/de-Latf.pat
333 $(LATF
)/words-de-Latf.hyphenated
: $(LATF
)/words-de-Latf.txt
334 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
336 $(LATF
)/de-Latf.pat
: $(LATF
)/words-de-Latf.hyphenated
338 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
339 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
341 de-1901-Latf
: $(LATF
)/de-1901-Latf.pat
343 $(LATF
)/words-de-1901-Latf.hyphenated
: $(LATF
)/words-de-1901-Latf.txt
344 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
346 $(LATF
)/de-1901-Latf.pat
: $(LATF
)/words-de-1901-Latf.hyphenated
348 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
349 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
351 de-1996-Latf
: $(LATF
)/de-1996-Latf.pat
353 $(LATF
)/words-de-1996-Latf.hyphenated
: $(LATF
)/words-de-1996-Latf.txt
354 $(PYTHON
) $(LANGSDIR
)/de_Latf_quasihyph.py
< $< > $@
356 $(LATF
)/de-1996-Latf.pat
: $(LATF
)/words-de-1996-Latf.hyphenated
358 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
359 $(CAT
) $(LATF
)/pattern
.8 >> $@
;
362 # Ligaturaufbruchmuster
364 .PHONY
: de_ligaturaufbruch de-1901_ligaturaufbruch de-1996_ligaturaufbruch
366 de_ligaturaufbruch
: $(LIGA
)/de_ligaturaufbruch-
$(DATE
).pat
368 $(LIGA
)/de_ligaturaufbruch.eingabe
: $(SRCDIR
)/$(WORDLIST
)
370 $(SPRACHAUSZUG
) -l
'de-1901,de-CH-1901,de-1996,de-CH-1996' -s
'morphemgrenzen,einfach' \
373 $(LIGA
)/de_ligaturaufbruch-
$(DATE
).pat
: $(LIGA
)/de_ligaturaufbruch.eingabe
375 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
376 $(CAT
) $(LIGA
)/pattern
.8 >> $@
;
378 de-1901_ligaturaufbruch
: $(LIGA
)/de-1901_ligaturaufbruch-
$(DATE
).pat
380 $(LIGA
)/de-1901_ligaturaufbruch.eingabe
: $(SRCDIR
)/$(WORDLIST
)
382 $(SPRACHAUSZUG
) -l
'de-1901,de-CH-1901' -s
'morphemgrenzen,einfach' \
385 $(LIGA
)/de-1901_ligaturaufbruch-
$(DATE
).pat
: $(LIGA
)/de-1901_ligaturaufbruch.eingabe
387 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
388 $(CAT
) $(LIGA
)/pattern
.8 >> $@
;
390 de-1996_ligaturaufbruch
: $(LIGA
)/de-1996_ligaturaufbruch-
$(DATE
).pat
392 $(LIGA
)/de-1996_ligaturaufbruch.eingabe
: $(SRCDIR
)/$(WORDLIST
)
394 $(SPRACHAUSZUG
) -l
'de-1996,de-CH-1996' -s
'morphemgrenzen,einfach' \
397 $(LIGA
)/de-1996_ligaturaufbruch-
$(DATE
).pat
: $(LIGA
)/de-1996_ligaturaufbruch.eingabe
399 $(SH
) $(SCRIPTDIR
)/trennmuster
/make-full-pattern.sh
$(<F
) $(DATADIR
)/de-Latf.tr
400 $(CAT
) $(LIGA
)/pattern
.8 >> $@
;
402 # Exzerpte mit `sprachauszug.py`
404 exzerpte
/de-1996_morphemgrenzen
:
406 $(SPRACHAUSZUG
) -l de-1996 \
407 -s
'morphemgrenzen,einfach' < $(WORDLIST
) > $@
409 exzerpte
/de-1901_morphemgrenzen
:
411 $(SPRACHAUSZUG
) -l de-1901 \
412 -s
'morphemgrenzen,einfach' < $(WORDLIST
) > $@
414 exzerpte
/de-1996_hyphenmin3
:
416 $(SPRACHAUSZUG
) -l
'de-1996,de-1996-x-versal' \
417 -s
'standard,morphemisch,hyphenmin3,einfach' < $(WORDLIST
) > $@
419 exzerpte
/de-1996_gesangstext
:
421 $(SPRACHAUSZUG
) -l
'de-1996,de-1996-x-versal' \
422 -s
'syllabisch,gesangstext,einfach' < $(WORDLIST
) > $@