Skip to content

Commit

Permalink
move and rename create_expression dart files
Browse files Browse the repository at this point in the history
  • Loading branch information
odrevet committed Aug 31, 2022
1 parent 3185c2e commit 5c4c89e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ bash src/run.bash kanji --clean --init --sql "en" --populate

# Generate sql for selected languages

The `src/expression/create_sql.dart` script can be called with arguments to process only some languages.
The `src/create_sql_expression.dart` and `src/create_sql_kanji.dart` scripts can be called with arguments to process only some languages.

The languages are in ISO 639-3 format for expression and ISO 639-2 for kanji, for example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:io';

import 'package:xml/xml.dart';

import '../common.dart';
import 'common.dart';

class Entity {
int id;
Expand Down
49 changes: 47 additions & 2 deletions src/kanji/create_sql.dart → src/create_sql_kanji.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,53 @@ import 'dart:io';

import 'package:xml/xml.dart';

import 'kanji.dart';
import '../common.dart';
import 'common.dart';

class Meaning {
String meaning;
String lang;

Meaning({required this.meaning, required this.lang});
}

class Kanji {
final String character;
final int stroke;
final List<String> radicals;
final List<String> on;
final List<String> kun;
final List<Meaning> meanings;
final String freq;
final String jlpt;

Kanji(
{required this.character,
required this.stroke,
this.radicals = const [],
this.on = const [],
this.kun = const [],
this.meanings = const [],
required this.freq,
required this.jlpt});

factory Kanji.fromMap(Map<String, dynamic> map) {
return Kanji(
character: map['id'],
stroke: map['stroke'],
radicals: map['radicals']?.split(','),
on: map['on_reading']?.split(','),
kun: map['kun_reading']?.split(','),
meanings: map['meanings']?.split(','),
freq: map['freq'],
jlpt: map['jlpt'],
);
}

@override
String toString() {
return character;
}
}

void main(List<String> args) async {
// langs to process are passed as arguments. No arguments means all languages
Expand Down
45 changes: 0 additions & 45 deletions src/kanji/kanji.dart

This file was deleted.

2 changes: 1 addition & 1 deletion src/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ while true; do
shift
fi

dart "src/${subject}/create_sql.dart" $languages
dart "src/create_sql_${subject}.dart" $languages

;;
--init)
Expand Down

0 comments on commit 5c4c89e

Please sign in to comment.