daidai 0.2.0 → 0.2.1.dev.20260725.d207d36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/daidai/tables.rb +44 -8
- data/lib/daidai/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa525465625e67b90786e617291fd3717d3eda5c0a16aa181dd54482b943bc25
|
|
4
|
+
data.tar.gz: e3f10ebd8fef9bea3c0d4083252611bfa21d634d3aa10751b319a42f52a39105
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7790b0b5725fb295f31461ee98558c1f2a7a3b1c08a104bc7903913d7a681ead6159d34c32a4a71803ca699312df6ba4cad986024bc5dcb2e08298404190c7e
|
|
7
|
+
data.tar.gz: 15f9c6594ba990b47917577133e2610d6e4594d6f196934d93131202d10ddaa1a2b7871f3d23de1ee6eb8ac0afb16e4554cfb00caf31ec7483c5937e31580340
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.1] - 2026-07-25
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `Daidai.conjugate` now produces the correct godan-u negative conditional
|
|
14
|
+
(買う → 買わなかったら). The upstream JMdictDB `conjo.csv` stores this one cell
|
|
15
|
+
without the な (買わかったら); `Tables::CONJO_ERRATA` corrects it at load, so the
|
|
16
|
+
vendored tables stay byte-identical to upstream while every godan-u verb's
|
|
17
|
+
negative ~tara comes out right.
|
|
18
|
+
|
|
9
19
|
## [0.2.0] - 2026-06-27
|
|
10
20
|
|
|
11
21
|
### Added
|
data/lib/daidai/tables.rb
CHANGED
|
@@ -13,6 +13,21 @@ module Daidai
|
|
|
13
13
|
# One okurigana rule: how to turn a dictionary form into one conjugation.
|
|
14
14
|
Okurigana = Struct.new(:stem, :okuri, :euphr, :euphk, keyword_init: true)
|
|
15
15
|
|
|
16
|
+
# Corrections for known errors in the upstream JMdictDB tables, applied at
|
|
17
|
+
# load so the vendored CSVs stay byte-identical to upstream (keeping
|
|
18
|
+
# `rake daidai:check_resources` green) while daidai still emits the right
|
|
19
|
+
# form. Keyed by JMdict code + [conj_id, negative?, polite?, onum] so a
|
|
20
|
+
# pos-id renumber upstream can't silently misapply the fix; values override
|
|
21
|
+
# only the given Okurigana fields.
|
|
22
|
+
#
|
|
23
|
+
# • v5u negative conditional (買う → 買わなかったら): upstream conjo.csv stores
|
|
24
|
+
# "わかったら", dropping the な. Every other class is correct here (v5u-s
|
|
25
|
+
# even has わなかったら), so this one cell is a typo. Without it every
|
|
26
|
+
# godan-u verb's negative ~tara comes out as 買わかったら / 使わかったら / ….
|
|
27
|
+
CONJO_ERRATA = {
|
|
28
|
+
[ "v5u", 11, true, false, 1 ] => { okuri: "わなかったら" }
|
|
29
|
+
}.freeze
|
|
30
|
+
|
|
16
31
|
class << self
|
|
17
32
|
# conjugation id (Integer) => human name ("Past (~ta)", …)
|
|
18
33
|
def conj
|
|
@@ -21,14 +36,17 @@ module Daidai
|
|
|
21
36
|
|
|
22
37
|
# [pos_id, conj_id, negative?, polite?, onum] => Okurigana
|
|
23
38
|
def conjo
|
|
24
|
-
@conjo ||=
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
@conjo ||= begin
|
|
40
|
+
table = read("conjo.csv").each_with_object({}) do |r, acc|
|
|
41
|
+
key = [ r["pos"].to_i, r["conj"].to_i, r["neg"] == "t", r["fml"] == "t", r["onum"].to_i ]
|
|
42
|
+
acc[key] = Okurigana.new(
|
|
43
|
+
stem: r["stem"].to_i,
|
|
44
|
+
okuri: r["okuri"].to_s,
|
|
45
|
+
euphr: presence(r["euphr"]),
|
|
46
|
+
euphk: presence(r["euphk"])
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
apply_conjo_errata(table)
|
|
32
50
|
end
|
|
33
51
|
end
|
|
34
52
|
|
|
@@ -43,6 +61,24 @@ module Daidai
|
|
|
43
61
|
|
|
44
62
|
private
|
|
45
63
|
|
|
64
|
+
# Overlay CONJO_ERRATA onto the freshly-loaded table, resolving each JMdict
|
|
65
|
+
# code to its pos id. A correction that no longer matches a row (upstream
|
|
66
|
+
# fixed it, or restructured) is skipped silently — the errata is advisory.
|
|
67
|
+
def apply_conjo_errata(table)
|
|
68
|
+
CONJO_ERRATA.each do |(code, conj, neg, fml, onum), fix|
|
|
69
|
+
pos_id = pos_ids[code] or next
|
|
70
|
+
key = [ pos_id, conj, neg, fml, onum ]
|
|
71
|
+
row = table[key] or next
|
|
72
|
+
table[key] = Okurigana.new(
|
|
73
|
+
stem: fix.fetch(:stem, row.stem),
|
|
74
|
+
okuri: fix.fetch(:okuri, row.okuri),
|
|
75
|
+
euphr: fix.fetch(:euphr, row.euphr),
|
|
76
|
+
euphk: fix.fetch(:euphk, row.euphk)
|
|
77
|
+
)
|
|
78
|
+
end
|
|
79
|
+
table
|
|
80
|
+
end
|
|
81
|
+
|
|
46
82
|
def read(file, headers: true)
|
|
47
83
|
CSV.read(File.join(DIR, file), col_sep: "\t", headers: headers, quote_char: '"')
|
|
48
84
|
end
|
data/lib/daidai/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: daidai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1.dev.20260725.d207d36
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- davafons
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: csv
|