word: remove obsolete languageless include selection
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 13 Dec 2023 00:33:28 +0000 (01:33 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 28 Dec 2023 07:19:58 +0000 (08:19 +0100)
Makefile
tools/mkwordlist
tools/word.pg.sql

index 7d1e2e35e122db0a6baf51402cfbf275365eeefc..f48ffa7301aff2bf96ec135be52e64b525aae8c3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ UPDATE: $(download)
        $(call cmdsave,git log -1 --date=short --pretty="%ad    %s")
 
 cache: $(patsubst %.inc.pl,data/%.json,$(wildcard charset-*.inc.pl) writing-latn.inc.pl)
-word: word/put.min.js data/wordlist.inc.pl data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json
+word: word/put.min.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json
 
 word/put.js: $(download)
        tools/wget-ifmodified https://github.com/kriszyp/put-selector/raw/master/put.js $@
@@ -83,8 +83,6 @@ data/wordlist.version.txt: force
        @[ -e $@ ] || date -Is >$@
        tools/lastword $@ || true
 
-data/wordlist.inc.pl: tools/mkwordlist data/wordlist.version.txt
-       $(call cmdsave,$<)
 data/wordlist.%.inc.pl: tools/mkwordlist data/wordlist.version.txt
        $(call cmdsave,$< $*)
 data/word%.json: data/word%.inc.pl
index 81c363009acef20554311a922f009a8913e2e62e..7611b9f80706813c71ac124a88dafa2a34288c4d 100755 (executable)
@@ -11,7 +11,8 @@ say 'use utf8;';
 
 use Data::Dump 'pp';
 my %rows;
-if (my $lang = shift @ARGV) {
+my $lang = shift @ARGV or die "Missing language\n";
+{
        my %filter = (lang => $lang);
        my $cols = "ref, array_to_string(form || alt, '/'), prio, id, sub";
        %rows = $db->select(_word => $cols, \%filter)->map_arrays;
@@ -22,10 +23,4 @@ if (my $lang = shift @ARGV) {
        ];
        say pp \%rows
                =~ s/\\x\{([0-9A-F]+)\}/chr hex $1/ger;
-       exit;
-}
-else {
-       %rows = $db->select(_cat_words => "coalesce(id::text, ''), forms")->map;
-       $_ = [ map { [split /:/, $_, 3] } @{$_} ] for values %rows;
-       say pp \%rows;
 }
index 7f97ada4c58ebd947ed27083d5c49863128f20d4..9f972dc01041c2a867f9c5b3a6a47d9769edc237 100644 (file)
@@ -54,14 +54,6 @@ CREATE TABLE kind (
 
 COMMENT ON COLUMN kind.truth      IS 'link validity ranging from 0 (never) to 100 (always)';
 
-CREATE OR REPLACE FUNCTION exportform(word) RETURNS text AS $$
-       SELECT concat(
-               coalesce($1.ref, $1.id), ':',
-               $1.prio, CASE WHEN $1.cover THEN 'c' ELSE '' END, ':',
-               array_to_string($1.form || $1.alt, '/')
-       );
-$$ LANGUAGE SQL IMMUTABLE;
-
 CREATE OR REPLACE VIEW _word_ref AS
        SELECT
                r.form, r.alt, r.lang,
@@ -102,10 +94,3 @@ CREATE OR REPLACE VIEW _word AS
                w.*
        FROM _word_ref w
        ;
-
-CREATE OR REPLACE VIEW _cat_words AS
-       SELECT exportform(word.*) form, sub.*, word.lang, word.ref
-       FROM word RIGHT JOIN (
-               SELECT cat id, array_agg(exportform(word.*) ORDER BY grade, form) forms
-                       FROM word WHERE ref IS NULL GROUP BY cat
-       ) sub USING (id);