aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-10 16:26:13 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-10 16:26:13 +0200
commita3a81530a0a30ba02b5253b762e2ccd77d3b01fc (patch)
treeafad1bae0c2f7cb9d4a11b6c1c56bc8bae2f14e5 /db
parente430d8cb4a30640298b7fae3c93bc6329e2a0382 (diff)
small restructuring + all deinflection tests working
Diffstat (limited to 'db')
-rw-r--r--db/db.ts6
-rw-r--r--db/dict/deinflections.sql53
-rw-r--r--db/find.sql2
3 files changed, 30 insertions, 31 deletions
diff --git a/db/db.ts b/db/db.ts
index 5605f40..7bb315c 100644
--- a/db/db.ts
+++ b/db/db.ts
@@ -1,7 +1,7 @@
import { Database, Statement } from "https://deno.land/x/sqlite3@0.9.1/mod.ts";
import * as path from 'https://deno.land/std@0.102.0/path/mod.ts';
-import { TokenTags } from "../language/tags.ts";
+import { TokenTags } from "../search/tags.ts";
import "../util/string.ts";
export interface DBDictInfo {
@@ -20,7 +20,7 @@ export interface FindResult {
depth: number;
original: string;
match: {
- kanji: boolean;
+ writing: boolean;
reading: boolean;
};
}
@@ -97,7 +97,7 @@ export default class DB {
depth: term.depth,
original: term.original,
match: {
- kanji: term.expression == term.deinflected,
+ writing: term.expression == term.deinflected,
reading: term.reading == term.deinflected,
},
};
diff --git a/db/dict/deinflections.sql b/db/dict/deinflections.sql
index a79fff0..e768d33 100644
--- a/db/dict/deinflections.sql
+++ b/db/dict/deinflections.sql
@@ -126,20 +126,20 @@ insert into deinflection_temp values
('infl:tense:cont', 'いる', '', 'a', 'a'),
-- potential form <https://guidetojapanese.org/learn/grammar/potential>
- ('infl:potential', 'られる', 'る', 'a', 'ru'),
- ('infl:potential', 'える', 'う', 'a', 'u'),
- ('infl:potential', 'ける', 'く', 'a', 'u'),
- ('infl:potential', 'げる', 'ぐ', 'a', 'u'),
- ('infl:potential', 'せる', 'す', 'a', 'u'),
- ('infl:potential', 'てる', 'つ', 'a', 'u'),
- ('infl:potential', 'ねる', 'ぬ', 'a', 'u'),
- ('infl:potential', 'べる', 'ぶ', 'a', 'u'),
- ('infl:potential', 'める', 'む', 'a', 'u'),
- ('infl:potential', 'れる', 'る', 'a', 'u'),
- ('infl:potential', 'できる', 'する', 'a', 's'),
- ('infl:potential', 'こられる', 'くる', 'a', 'k'),
- ('infl:potential', 'ありうる', 'ある', 'a', ''), -- exception
- ('infl:potential', 'ありえる', 'ある', 'a', ''), -- exception
+ ('infl:potential', 'られる', 'る', 'ru', 'ru'),
+ ('infl:potential', 'える', 'う', 'ru', 'u'),
+ ('infl:potential', 'ける', 'く', 'ru', 'u'),
+ ('infl:potential', 'げる', 'ぐ', 'ru', 'u'),
+ ('infl:potential', 'せる', 'す', 'ru', 'u'),
+ ('infl:potential', 'てる', 'つ', 'ru', 'u'),
+ ('infl:potential', 'ねる', 'ぬ', 'ru', 'u'),
+ ('infl:potential', 'べる', 'ぶ', 'ru', 'u'),
+ ('infl:potential', 'める', 'む', 'ru', 'u'),
+ ('infl:potential', 'れる', 'る', 'ru', 'u'),
+ ('infl:potential', 'できる', 'する', 'ru', 's'),
+ ('infl:potential', 'こられる', 'くる', 'ru', 'k'),
+ ('infl:potential', 'ありうる', 'ある', 'ru', ''), -- exception
+ ('infl:potential', 'ありえる', 'ある', 'ru', ''), -- exception
-- conditionals <https://guidetojapanese.org/learn/grammar/conditionals>
('infl:cond:ba', 'えば', 'う', 'nt', 'u'),
@@ -271,19 +271,18 @@ insert into deinflection_temp values
('infl:causative', '来さす', '来る', 'a', 'k'),
-- passive <https://guidetojapanese.org/learn/grammar/causepass>
- ('infl:passive', 'られる', 'る', 'a', 'ru'),
- ('infl:passive', 'われる', 'う', 'a', 'u'),
- ('infl:passive', 'かれる', 'く', 'a', 'u'),
- ('infl:passive', 'がれる', 'ぐ', 'a', 'u'),
- ('infl:passive', 'される', 'す', 'a', 'u'),
- ('infl:passive', 'たれる', 'つ', 'a', 'u'),
- ('infl:passive', 'なれる', 'ぬ', 'a', 'u'),
- ('infl:passive', 'ばれる', 'ぶ', 'a', 'u'),
- ('infl:passive', 'まれる', 'む', 'a', 'u'),
- ('infl:passive', 'られる', 'る', 'a', 'u'),
- ('infl:passive', 'される', 'する', 'a', 's'),
- ('infl:passive', 'こられる', 'くる', 'a', 'k'),
- ('infl:passive', '来られる', '来る', 'a', 'k'),
+ ('infl:passive', 'られる', 'る', 'ru', 'ru u'),
+ ('infl:passive', 'われる', 'う', 'ru', 'u'),
+ ('infl:passive', 'かれる', 'く', 'ru', 'u'),
+ ('infl:passive', 'がれる', 'ぐ', 'ru', 'u'),
+ ('infl:passive', 'される', 'す', 'ru', 'u'),
+ ('infl:passive', 'たれる', 'つ', 'ru', 'u'),
+ ('infl:passive', 'なれる', 'ぬ', 'ru', 'u'),
+ ('infl:passive', 'ばれる', 'ぶ', 'ru', 'u'),
+ ('infl:passive', 'まれる', 'む', 'ru', 'u'),
+ ('infl:passive', 'される', 'する', 'ru', 's'),
+ ('infl:passive', 'こられる', 'くる', 'ru', 'k'),
+ ('infl:passive', '来られる', '来る', 'ru', 'k'),
-- auxiliary rules
('class:verb:suru-included', 'する', '', 's', ''); -- deconjugate suru verbs into stem
diff --git a/db/find.sql b/db/find.sql
index dd6a011..e2d6ad8 100644
--- a/db/find.sql
+++ b/db/find.sql
@@ -47,7 +47,7 @@ with results(id, expression, reading, tags, depth, rules, original, deinflected)
(substr(term, length(term) - length(kana_in) + 1) = kana_in) and
-- can't deconjugate to length <1
(length(term) > 0)
- limit 50 -- failsafe to catch any infinite loops
+ limit 100 -- failsafe to catch any infinite loops
)
select term, tags, depth, substr(:term, 1, deinflect.length), rules
from deinflect