# to add: ar br cs cy el et eu fi? ga he hr hu hy is lv ro ru sk sl
#LANGS = af ar bg br ca cs cy da de el en eo es et eu fi fr ga he hr hu hy is it la lv ms nl no pl pt ro ru sk sl sv tr uk xk
+ASPDICT = https://ftp.gnu.org/gnu/aspell/dict/0index.html
+
LOWS = $(addsuffix .low,$(LANGS))
DICTS = $(addsuffix .dict,$(LANGS))
+DEPEND = Makefile
MAKEFLAGS = -s
-all:
+all: src.mk
make $(addprefix check-,$(LANGS))
$(ROOT_DICT):
low: $(LOWS)
-INSTALL_ASPELL_DICT = apt search aspell-$(1) && \
- ( dpkg -l aspell-$(1) | grep -q ^ii || sudo apt install aspell-$(1) )
-ASPELL_DUMP_MASTER = aspell -d $(1) dump master $(1) | \
- aspell -l $(1) expand | \
+src.mk:
+ wget $(ASPDICT) -q -O - | \
+ awk 'BEGIN { base="'`dirname $(ASPDICT)`'" } \
+ /<tr><td><a/ { $$0 = gensub(/.*"(.+)".*"(.+)\/(.+)".*/, "\\1 \\2 \\3", "g"); \
+ printf "%s.dir: %s\n\n", $$1, $$3; \
+ printf "%s:\n\twget -q %s/%s/%s\n\n", $$3, base, $$2, $$3 } \
+ /<\/table>/ { exit }' > $@
+
+include $(wildcard src.mk)
+
+INSTALL_ASPELL_DICT = tar xjf $(1) && \
+ cd $(2) && \
+ ./configure && \
+ make
+
+ASPELL_DUMP_MASTER = aspell --dict-dir=$(2) -d $(1) dump master $(1) | \
+ aspell --dict-dir=$(2) -l $(1) expand | \
tr -s '[:space:]' '\n' | \
LC_ALL=C sort -S28G -u > $(1).low
-%.low:
+%.dir:
+ echo Installing $(@:.dir=) dictionary
+ $(call INSTALL_ASPELL_DICT,$<,$(<:.tar.bz2=))
+ mv $(<:.tar.bz2=) $@
+
+%.low: %.dir
echo Building list of word $@
- $(call INSTALL_ASPELL_DICT,$(@:.low=))
- $(call ASPELL_DUMP_MASTER,$(@:.low=))
+ $(call ASPELL_DUMP_MASTER,$(<:.dir=),./$<)
no.low:
- echo Building list of word $@
- $(call INSTALL_ASPELL_DICT,no)
- $(call ASPELL_DUMP_MASTER,nb)
+ make nb.low
mv nb.low $@
pt.low:
- echo Building list of word $@
- $(call INSTALL_ASPELL_DICT,pt-pt)
- $(call ASPELL_DUMP_MASTER,pt_PT)
+ make pt_PT.low
mv pt_PT.low $@
-$(ROOT_DICT)/bg.dict: bg.low Makefile
+$(ROOT_DICT)/bg.dict: bg.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/ca.dict: ca.low Makefile
+$(ROOT_DICT)/ca.dict: ca.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/da.dict: da.low Makefile
+$(ROOT_DICT)/da.dict: da.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/de.dict: de.low Makefile
+$(ROOT_DICT)/de.dict: de.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/en.dict: en.low Makefile
+$(ROOT_DICT)/en.dict: en.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/eo.dict: eo.low Makefile
+$(ROOT_DICT)/eo.dict: eo.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/es.dict: es.low Makefile
+$(ROOT_DICT)/es.dict: es.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/fr.dict: fr.low Makefile
+$(ROOT_DICT)/fr.dict: fr.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/it.dict: it.low Makefile
+$(ROOT_DICT)/it.dict: it.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/nl.dict: nl.low Makefile
+$(ROOT_DICT)/nl.dict: nl.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/no.dict: no.low Makefile
+$(ROOT_DICT)/no.dict: no.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/pl.dict: pl.low Makefile
+$(ROOT_DICT)/pl.dict: pl.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/pt.dict: pt.low Makefile
+$(ROOT_DICT)/pt.dict: pt.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/sv.dict: sv.low Makefile
+$(ROOT_DICT)/sv.dict: sv.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \
sort | \
uniq > $@
-$(ROOT_DICT)/uk.dict: uk.low Makefile
+$(ROOT_DICT)/uk.dict: uk.low $(DEPEND)
echo Building $@ from $<
cat $< | \
grep -v '^.$$' | \