Add KANJIDIC source

This commit is contained in:
Oystein Kristoffer Tveit 2022-08-18 21:39:36 +02:00
parent 9360695883
commit 83e216e401
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
6 changed files with 66 additions and 23 deletions

View File

@ -15,6 +15,6 @@ Future<void> main(List<String> arguments) async {
.openDatabase(Directory.current.uri.resolve('main.db').path);
await addDataFromJMdict(db);
await addDataFromRADKFILE(db);
// await addDataFromKANJIDIC(db);
await addDataFromKANJIDIC(db);
}

View File

@ -24,6 +24,18 @@
"url": "http://ftp.edrdg.org/pub/Nihongo/JMdict_e_examp.gz"
}
},
"KANJIDIC2Src": {
"flake": false,
"locked": {
"narHash": "sha256-BaVQaAEisPC60ohz8Gyr5r0Fe4Qrjupj6VKQqMvq9Eo=",
"type": "file",
"url": "http://nihongo.monash.edu/kanjidic2/kanjidic2.xml.gz"
},
"original": {
"type": "file",
"url": "http://nihongo.monash.edu/kanjidic2/kanjidic2.xml.gz"
}
},
"RADKFILESrc": {
"flake": false,
"locked": {
@ -110,6 +122,7 @@
"inputs": {
"JMdictSrc": "JMdictSrc",
"JMdictWithExamplesSrc": "JMdictWithExamplesSrc",
"KANJIDIC2Src": "KANJIDIC2Src",
"RADKFILESrc": "RADKFILESrc",
"flake-utils": "flake-utils",
"nix-dart": "nix-dart",

View File

@ -32,6 +32,11 @@
flake = false;
};
KANJIDIC2Src = {
url = "http://nihongo.monash.edu/kanjidic2/kanjidic2.xml.gz";
flake = false;
};
};
outputs = {
@ -41,7 +46,8 @@
nix-dart,
JMdictSrc,
JMdictWithExamplesSrc,
RADKFILESrc
RADKFILESrc,
KANJIDIC2Src
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
@ -95,9 +101,9 @@
buildPhase = ''
gzip -dkc ${JMdictSrc} > JMdict.xml
gzip -dkc ${JMdictWithExamplesSrc} > JMdict_with_examples.xml
xmlformat -i JMdict.xml
xmlformat -i JMdict_with_examples.xml
'';
# xmlformat -i JMdict.xml
# xmlformat -i JMdict_with_examples.xml
installPhase = ''
mkdir $out
@ -133,11 +139,34 @@
};
};
KANJIDIC2 = mkDerivation {
name = "KANJIDIC2";
src = KANJIDIC2Src;
dontUnpack = true;
nativeBuildInputs = with pkgs; [ xmlformat ];
buildPhase = ''
gzip -dkc ${KANJIDIC2Src} > kanjidic2.xml
'';
# xmlformat -i kanjidic2.xml
installPhase = ''
mkdir $out
cp kanjidic2.xml $out
'';
meta = edrdgMetadata // {
# description = "A Japanese-Multilingual Dictionary providing lexical data for japanese words";
# homepage = "https://www.edrdg.org/jmdict/j_jmdict.html";
};
};
database_generator = let
buildDartPackage = nix-dart.builders.${system}.buildDartPackage.override {
dart = nix-dart.packages.${system}.dart-dev;
};
in buildDartPackage {
in (buildDartPackage {
pname = "database_generator";
version = "1.0";
@ -166,6 +195,7 @@
mkdir -p data
ln -s ${self.packages.${system}.JMdict}/* data
ln -s ${self.packages.${system}.RADKFILE}/* data
ln -s ${self.packages.${system}.KANJIDIC2}/* data
sqlite3 ${dbName} < migrations/0001_initial.sql
sqlite3 ${dbName} < migrations/0002_insert_info_values.sql

View File

@ -13,8 +13,8 @@ packages:
name: ffi
url: https://pub.dartlang.org
source: hosted
version: 1.1.2
sha256: 0w0yd43y1fsfzihd4j6diymg90bgvyi2zqyb3vf0k6g8hk8x1yr6
version: 1.2.1
sha256: 0dcivi3fk4kig3adkgrfc6nfkmx5x471x947ndwzv4rds4vahfq5
js:
dependency: transitive
description:
@ -37,16 +37,16 @@ packages:
name: meta
url: https://pub.dartlang.org
source: hosted
version: 1.7.0
sha256: 1z8sx23l9jn2ickq3z63pqpb6k9y6gbnnvj9200c6v7m3cvd7jbv
version: 1.8.0
sha256: 01kqdd25nln5a219pr94s66p27m0kpqz0wpmwnm24kdy3ngif1v5
path:
dependency: transitive
description:
name: path
url: https://pub.dartlang.org
source: hosted
version: 1.8.1
sha256: 0wg5da3zykfbala8mvcl7r7blgi5qjb838qhw30brgj3ani2hdph
version: 1.8.2
sha256: 16ggdh29ciy7h8sdshhwmxn6dd12sfbykf2j82c56iwhhlljq181
petitparser:
dependency: transitive
description:
@ -69,8 +69,8 @@ packages:
name: sqflite_common_ffi
url: https://pub.dartlang.org
source: hosted
version: 2.1.1
sha256: 0v5xq9xpg63zidf8as17zh0pbhfzf9k00a2wn183jz9i5rmh6207
version: 2.1.1+1
sha256: 00h6mi8m76kh48hilvz3gw0i01fy37vcgxfjc0jbyhzrxbx4paal
sqlite3:
dependency: transitive
description:
@ -93,7 +93,7 @@ packages:
name: xml
url: https://pub.dartlang.org
source: hosted
version: 6.0.1
sha256: 158srisyld2zwhchcz264rf8qnby54xan4db14hf7lda7bx8ikbh
version: 6.1.0
sha256: 1pinq9zagchh2pk9d3ja3g8rljb3sl31qz2gw7djij7ih0dswxal
sdks:
dart: '>=2.16.1 <3.0.0'
dart: '>=2.17.0 <3.0.0'

View File

@ -14,7 +14,7 @@ packages:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
version: "1.2.1"
js:
dependency: transitive
description:
@ -35,14 +35,14 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
petitparser:
dependency: transitive
description:
@ -63,7 +63,7 @@ packages:
name: sqflite_common_ffi
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.1+1"
sqlite3:
dependency: transitive
description:
@ -84,6 +84,6 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.1"
version: "6.1.0"
sdks:
dart: ">=2.16.1 <3.0.0"
dart: ">=2.17.0 <3.0.0"

View File

@ -9,7 +9,7 @@ environment:
dependencies:
collection: ^1.16.0
sqflite_common_ffi: ^2.1.1
xml: ^6.0.1
xml: ^6.1.0
dev_dependencies:
lints: ^1.0.0