aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-07-07 18:12:09 +0200
committerTom Smeding <tom@tomsmeding.com>2024-07-07 18:12:27 +0200
commit4bd0ea1136ca61a12e5079baca7f7129ca89d133 (patch)
tree8411c5108c901a14ff932fe62b887e03cce75149
parent63d048a4d891ac850a352fd3e9b345f778f5fdd7 (diff)
Some extra mappingsHEADmaster
These are conspicuously absent from the word list
-rw-r--r--database-extra.csv3
-rwxr-xr-xprocess-database.hs8
2 files changed, 9 insertions, 2 deletions
diff --git a/database-extra.csv b/database-extra.csv
new file mode 100644
index 0000000..b7ddd15
--- /dev/null
+++ b/database-extra.csv
@@ -0,0 +1,3 @@
+lexeme,orthography,reading,PoS,corrfreq
+車,車,クルマ,,13334
+自転車,自転車,ジテンシャ,,1180
diff --git a/process-database.hs b/process-database.hs
index bfbd4b7..a9eb97c 100755
--- a/process-database.hs
+++ b/process-database.hs
@@ -152,12 +152,16 @@ main :: IO ()
main = do
(csvfname, outfname) <- getArgs >>= \case
[csvfname, outfname] -> return (csvfname, outfname)
- _ -> die "Usage: process-database <database.csv> <output.bin>"
+ _ -> die "Usage: process-database <database.csv> <output.bin>\n\
+ \Additionally reads <database-extra.csv> and <table.txt>."
(hira2kata, kata2id, nIDs) <- readTable <$> readFile "table.txt"
let any2id = Map.map (kata2id Map.!) hira2kata <> kata2id
- rows <- concatMap (normalise any2id) . tail . readCSV <$> readFile csvfname
+ rows <- do
+ rows1 <- tail . readCSV <$> readFile csvfname
+ rows2 <- tail . readCSV <$> readFile "database-extra.csv"
+ return (concatMap (normalise any2id) (rows1 ++ rows2))
let trie = makeTrie 0 rows
-- print trie