summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Pignolet <m@mpgn.dev>2025-05-05 19:08:18 +0400
committerMatthieu Pignolet <m@mpgn.dev>2025-05-05 19:08:18 +0400
commit8917bf898c4afea8219d9449f944acff1c8dd023 (patch)
tree4ba6a32cd05fae6126718891f0f63cb23e805692
parentc4d22da11b779d92faca44ac2a6b11cefc0e3d77 (diff)
feat: add constants loading for the constants extraxted from nltk
-rw-r--r--Cargo.toml4
-rw-r--r--src/constants.rs33
2 files changed, 37 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index a3a28f5..f95c71c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,3 +4,7 @@ version = "0.1.0"
edition = "2024"
[dependencies]
+array2d = "0.3.2"
+once_cell = "1.21.3"
+serde = { version = "1.0.219", features = ["derive"] }
+serde_json = "1.0.140"
diff --git a/src/constants.rs b/src/constants.rs
new file mode 100644
index 0000000..e18dc3d
--- /dev/null
+++ b/src/constants.rs
@@ -0,0 +1,33 @@
+
+
+use std::collections::{HashMap, HashSet};
+
+use once_cell::sync::Lazy;
+use serde::{Serialize, Deserialize};
+
+#[derive(Debug, Serialize, Deserialize)]
+pub(crate) struct Extracted {
+ #[serde(rename = "C_skip")]
+ pub cskip: f32,
+ #[serde(rename = "C_sub")]
+ pub csub: f32,
+ #[serde(rename = "C_exp")]
+ pub cexp: f32,
+ #[serde(rename = "C_vwl")]
+ pub cvwl: f32,
+ pub consonants: HashSet<String>,
+ #[serde(rename = "R_c")]
+ pub rc: HashSet<String>,
+ #[serde(rename = "R_v")]
+ pub rv: HashSet<String>,
+ pub similarity_matrix: HashMap<String, f32>,
+ pub salience: HashMap<String, f32>,
+ pub feature_matrix: HashMap<String, HashMap<String, String>>,
+}
+
+
+const EXTRACTED_JSON: &str = include_str!("extract.json");
+pub static EXTRACTED: Lazy<Extracted> = Lazy::new(|| {
+ serde_json::from_str(EXTRACTED_JSON).unwrap()
+});
+