add a rule to expand aspell dictionaries
authorLaurent Mazet <mazet@softndesign.org>
Wed, 3 Jun 2020 21:50:23 +0000 (23:50 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Tue, 9 Jun 2020 20:26:27 +0000 (22:26 +0200)
dict-dists-extractor/Makefile

index 5025b2ec54e9029e8bb4899139fc6b3633a2eadd..67f7385f61df5a5a181299e03582cddf40570060 100644 (file)
@@ -5,6 +5,8 @@ ROOT_DICT = ../public/dict
 LANGS = bg ca da de en eo es fr it nl no po sv uk
 # pl not working
 
+DICTS = $(addsuffix .dict,$(LANGS))
+
 MAKEFLAGS = -s
 
 all:
@@ -16,6 +18,17 @@ $(ROOT_DICT):
 count:
        wc -l $(ROOT_DICT)/*
 
+dicts: $(DICTS)
+
+$(DICTS):%:
+       lang=$(@:.dict=); \
+       apt search aspell-$$lang && \
+       ( dpkg -l aspell-$$lang | grep ^ii || \
+         sudo apt install aspell-$$lang ) && \
+       aspell -d $$lang dump master | aspell -l $$lang expand | \
+           tr -s '[:space:]' '\n' | \
+               LC_ALL=C sort -S28G -u > $$lang.dict
+
 $(ROOT_DICT)/bg.json: /usr/share/dict/bulgarian Makefile
        echo Building $@ from $<
        iconv -f Windows-1251 -t utf-8 $< | \