diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2020-02-03 02:00:08 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2020-02-03 02:00:08 +0300 |
commit | a7fa2599f636d10be7f5849bfba6d39982cd9d93 (patch) | |
tree | face4fc6920437543d604a1800abb4fb56e11af4 | |
parent | 02c804fad43ff2b88023a58ed33c048cb646cfb8 (diff) | |
download | openrussian-cli-a7fa2599f636d10be7f5849bfba6d39982cd9d93.tar.gz |
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
-rw-r--r-- | openrussian-sql.zip | bin | 35607877 -> 36496959 bytes | |||
-rwxr-xr-x | openrussian.lua | 8 |
2 files changed, 5 insertions, 3 deletions
diff --git a/openrussian-sql.zip b/openrussian-sql.zip Binary files differindex 585e773..a1d9e4f 100644 --- a/openrussian-sql.zip +++ b/openrussian-sql.zip 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 |