add plover dictionaries
This commit is contained in:
parent
c01d0dedd1
commit
acde406961
4 changed files with 155 additions and 0 deletions
17
flake.lock
17
flake.lock
|
@ -707,6 +707,7 @@
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
"plover": "plover",
|
"plover": "plover",
|
||||||
"regenpfeifer": "regenpfeifer",
|
"regenpfeifer": "regenpfeifer",
|
||||||
|
"steno-dictionaries": "steno-dictionaries",
|
||||||
"wortformliste": "wortformliste"
|
"wortformliste": "wortformliste"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -735,6 +736,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"steno-dictionaries": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1655010543,
|
||||||
|
"narHash": "sha256-CkxtDyzB5XZpYyEQDbzspN9VYkXNUJzM7CvfD+tLmcg=",
|
||||||
|
"owner": "didoesdigital",
|
||||||
|
"repo": "steno-dictionaries",
|
||||||
|
"rev": "0dbbd849cdb62ef1195bb511b9062cbe4a826f8f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "didoesdigital",
|
||||||
|
"repo": "steno-dictionaries",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1653893745,
|
"lastModified": 1653893745,
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
hydra.url = "github:mlabs-haskell/hydra/aciceri/ca-derivations";
|
hydra.url = "github:mlabs-haskell/hydra/aciceri/ca-derivations";
|
||||||
hydra-patched.url = "git+https://git.chir.rs/darkkirb/hydra?ref=hack";
|
hydra-patched.url = "git+https://git.chir.rs/darkkirb/hydra?ref=hack";
|
||||||
hydra-base.url = "git+https://git.chir.rs/darkkirb/hydra?ref=hack&rev=3fdc9e491dc7d33bc09ef4f33984f87c8f478aa2";
|
hydra-base.url = "git+https://git.chir.rs/darkkirb/hydra?ref=hack&rev=3fdc9e491dc7d33bc09ef4f33984f87c8f478aa2";
|
||||||
|
steno-dictionaries.url = "github:didoesdigital/steno-dictionaries";
|
||||||
|
steno-dictionaries.flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
@ -73,6 +75,7 @@
|
||||||
./fonts/kreative.nix
|
./fonts/kreative.nix
|
||||||
./fonts/nasin-nanpa.nix
|
./fonts/nasin-nanpa.nix
|
||||||
./plover
|
./plover
|
||||||
|
./plover/dicts.nix
|
||||||
./art
|
./art
|
||||||
./ci/drone-runner-docker
|
./ci/drone-runner-docker
|
||||||
./vim
|
./vim
|
||||||
|
|
109
plover/dicts.nix
Normal file
109
plover/dicts.nix
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
{ inputs, pkgs }:
|
||||||
|
let
|
||||||
|
plover = import ./. { inherit inputs pkgs; };
|
||||||
|
dict_list = [
|
||||||
|
"abbreviations"
|
||||||
|
"apps"
|
||||||
|
"bad-habits"
|
||||||
|
"briefs"
|
||||||
|
"code"
|
||||||
|
"computer-powerups"
|
||||||
|
"computer-use"
|
||||||
|
"condensed-strokes-fingerspelled"
|
||||||
|
"condensed-strokes"
|
||||||
|
"css-alignment"
|
||||||
|
"css-declarations"
|
||||||
|
"css-media-object"
|
||||||
|
"currency"
|
||||||
|
"d3"
|
||||||
|
"data-viz"
|
||||||
|
"di-briefs"
|
||||||
|
"di-nouns"
|
||||||
|
"di-proper-nouns"
|
||||||
|
"di-spectacle-v1"
|
||||||
|
"dict-en-AU-phonetic"
|
||||||
|
"dict-en-AU-vocab"
|
||||||
|
"dict-en-AU-with-extra-stroke"
|
||||||
|
"dict"
|
||||||
|
"emoji"
|
||||||
|
"fingerspelling-FPLT"
|
||||||
|
"fingerspelling-RBGS"
|
||||||
|
"fingerspelling-powerups"
|
||||||
|
"fingerspelling-right-hand"
|
||||||
|
"fingerspelling"
|
||||||
|
"git"
|
||||||
|
"haxe"
|
||||||
|
"html"
|
||||||
|
"human-resources"
|
||||||
|
"javascript"
|
||||||
|
"jquery"
|
||||||
|
"lorem"
|
||||||
|
"markdown"
|
||||||
|
"medical-suffixes"
|
||||||
|
"misstrokes"
|
||||||
|
"modifiers-single-stroke"
|
||||||
|
"modifiers"
|
||||||
|
"navigation"
|
||||||
|
"nouns"
|
||||||
|
"numbers-powerups"
|
||||||
|
"numbers"
|
||||||
|
"observable"
|
||||||
|
"plover-powerups"
|
||||||
|
"plover-use"
|
||||||
|
"proper-nouns"
|
||||||
|
"punctuation-di"
|
||||||
|
"punctuation-powerups"
|
||||||
|
"punctuation-unspaced"
|
||||||
|
"punctuation"
|
||||||
|
"python"
|
||||||
|
"react"
|
||||||
|
"retro-quotes"
|
||||||
|
"roman-numerals"
|
||||||
|
"ruby"
|
||||||
|
"shortcuts"
|
||||||
|
"sketch-app"
|
||||||
|
"sublime"
|
||||||
|
"svg"
|
||||||
|
"symbols-briefs"
|
||||||
|
"symbols-currency-culled"
|
||||||
|
"symbols-currency"
|
||||||
|
"symbols"
|
||||||
|
"tabbing"
|
||||||
|
"top-100-words"
|
||||||
|
"top-1000-words"
|
||||||
|
"top-10000-project-gutenberg-words"
|
||||||
|
"top-200-words-spoken-on-tv"
|
||||||
|
"top-level-domains"
|
||||||
|
"ux-design"
|
||||||
|
"vim"
|
||||||
|
"voiceover"
|
||||||
|
];
|
||||||
|
json-to-yaml-env = pkgs.python3.buildEnv.override {
|
||||||
|
extraLibs = with plover; [ruamel-yaml];
|
||||||
|
};
|
||||||
|
json-to-yaml = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
name = "json-to-yaml";
|
||||||
|
srcs = ./.;
|
||||||
|
python = json-to-yaml-env;
|
||||||
|
buildPhase = ''
|
||||||
|
substituteAllInPlace json-to-yaml.py
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp json-to-yaml.py $out/bin
|
||||||
|
chmod +x $out/bin/json-to-yaml.py
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in builtins.listToAttrs (builtins.map (name: {
|
||||||
|
name = "plover-dict-${name}";
|
||||||
|
value = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
name = "plover-dict-${name}-${inputs.steno-dictionaries.lastModifiedDate}.yaml";
|
||||||
|
pname = "plover-dict-${name}";
|
||||||
|
version = inputs.steno-dictionaries.lastModifiedDate;
|
||||||
|
srcs = inputs.steno-dictionaries;
|
||||||
|
buildPhase = ''
|
||||||
|
${json-to-yaml}/bin/json-to-yaml.py dictionaries/${name}.json $out
|
||||||
|
'';
|
||||||
|
installPhase = "true";
|
||||||
|
};
|
||||||
|
}) dict_list)
|
26
plover/json-to-yaml.py
Normal file
26
plover/json-to-yaml.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!%python%/bin/python
|
||||||
|
import json
|
||||||
|
import ruamel.yaml
|
||||||
|
import sys
|
||||||
|
|
||||||
|
JSON_FILENAME = sys.argv[1]
|
||||||
|
YAML_FILENAME = sys.argv[2]
|
||||||
|
|
||||||
|
# Load JSON dictionary
|
||||||
|
with open(JSON_FILENAME, 'r', encoding='utf-8') as in_file:
|
||||||
|
in_data = json.load(in_file)
|
||||||
|
|
||||||
|
# Group dictionary by value, sorted alphabetically
|
||||||
|
out_data = {}
|
||||||
|
|
||||||
|
for key, value in sorted(in_data.items(), key=lambda x: x[1].casefold()):
|
||||||
|
out_data.setdefault(value, []).append(key)
|
||||||
|
out_data[value] = sorted(out_data[value])
|
||||||
|
|
||||||
|
# Write dictionary to YAML
|
||||||
|
with open(YAML_FILENAME, 'w', encoding='utf-8') as out_file:
|
||||||
|
yaml = ruamel.yaml.YAML(typ='safe')
|
||||||
|
yaml.allow_unicode = True
|
||||||
|
yaml.default_flow_style = False
|
||||||
|
yaml.indent(sequence=4, offset=2)
|
||||||
|
yaml.dump(out_data, out_file)
|
Reference in a new issue