From a7fa2599f636d10be7f5849bfba6d39982cd9d93 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 3 Feb 2020 02:00:08 +0300 Subject: updated the database dump * the schema didn't change * included a fix for "pered" which failed to format with the new DB * "saliwnij" and "paraf" still cause errors with `make check` since they are stored errounously accented in words.bare --- openrussian-sql.zip | Bin 35607877 -> 36496959 bytes openrussian.lua | 8 +++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openrussian-sql.zip b/openrussian-sql.zip index 585e773..a1d9e4f 100644 Binary files a/openrussian-sql.zip and b/openrussian-sql.zip differ diff --git a/openrussian.lua b/openrussian.lua index 62215e4..3a4f7e9 100755 --- a/openrussian.lua +++ b/openrussian.lua @@ -136,12 +136,12 @@ local function format_declensions(...) local cur = assert(con:execute(string.format([[ SELECT * FROM declensions WHERE id = %d ]], decl_id))) - local row = assert(cur:fetch({}, "a")) + local row = cur:fetch({}, "a") cur:close() for _, case in ipairs{"nom", "gen", "dat", "acc", "inst", "prep"} do decl[case] = decl[case] or {} - local val = lutf8.gsub(row[case] or '-', "[;,] *%(", " (") + local val = lutf8.gsub(row and row[case] or '-', "[;,] *%(", " (") val = lutf8.gsub(val, "[;,] *", ", ") decl[case][i] = map_tbl(val) end @@ -185,7 +185,7 @@ function format.noun(word_id, accented) -- NOTE: Noun "partners" seem to be male/female counterparts. -- FIXME: It would also be nice to include an accented version, -- but since the DB lists the partner as a string instead of - -- word_id, finding the right entry could be unreliable + -- word_id, finding the right entry could be unreliable. out_stream:write('.SH PARTNER\n', row.partner, '\n') end @@ -199,6 +199,8 @@ function format.noun(word_id, accented) if row.indeclinable == 1 then format_declensions(accented, accented) else + -- FIXME: The ids turn out to be sometimes invalid and it would + -- be better to omit the entire DECLENSION section. format_declensions(row.pl_only == 0 and row.decl_sg_id or '-', row.sg_only == 0 and row.decl_pl_id or '-') end -- cgit v1.2.3