about summary refs log tree commit diff
path: root/corp/russian/data-import/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-21T15·00+0300
committertazjin <tazjin@tvl.su>2023-01-21T17·49+0000
commit8eeb5d3bccf831681b2cad5c3b322e6a08f596df (patch)
tree4e02105c8ab39a4466b29e98c16aa9e2c69ac9b4 /corp/russian/data-import/src/main.rs
parent429c0d00c4cd07ea90c85bf1ec2f2c742d970420 (diff)
feat(corp/data-import): add import of OR 'words_forms' table r/5730
This is the full morphological set table for all the words from the
lemmata table, which they don't call it that.

Change-Id: I6f5be673c5f59f11e36bd8c8c935844a7d4fd170
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7894
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'corp/russian/data-import/src/main.rs')
-rw-r--r--corp/russian/data-import/src/main.rs21
1 files changed, 16 insertions, 5 deletions
diff --git a/corp/russian/data-import/src/main.rs b/corp/russian/data-import/src/main.rs
index 11387539ab84..18bc0238e7e0 100644
--- a/corp/russian/data-import/src/main.rs
+++ b/corp/russian/data-import/src/main.rs
@@ -210,12 +210,23 @@ fn open_russian(conn: &Connection, args: &Args) {
 
     db_setup::initial_or_schema(conn);
 
-    let tx = conn
-        .unchecked_transaction()
-        .ensure("failed to start transaction");
+    {
+        let tx = conn
+            .unchecked_transaction()
+            .ensure("failed to start transaction");
+
+        db_setup::insert_or_words(&tx, parser.words());
+        tx.commit().ensure("OpenRussian words commit failed");
+    }
+
+    {
+        let tx = conn
+            .unchecked_transaction()
+            .ensure("failed to start transaction");
 
-    db_setup::insert_or_words(&tx, parser.words());
-    tx.commit().ensure("OpenRussian words commit failed");
+        db_setup::insert_or_word_forms(&tx, parser.words_forms());
+        tx.commit().ensure("OpenRussian word forms commit failed");
+    }
 
     info!("finished OpenRussian import");
 }