Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat(core): add missing methods necessary for new genetic code

Elijah Pottera68018741ec5
diff --git a/harper-core/src/patterns/upos_set.rs b/harper-core/src/patterns/upos_set.rs
index c8186193b..937e46086 100644
--- a/harper-core/src/patterns/upos_set.rs
+++ b/harper-core/src/patterns/upos_set.rs
@@ -1,10 +1,12 @@
use harper_brill::UPOS;
+use serde::{Deserialize, Serialize};
use smallvec::{SmallVec, ToSmallVec};
use crate::Token;
use super::Pattern;
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct UPOSSet {
allowed_tags: SmallVec<[UPOS; 10]>,
}
diff --git a/harper-core/src/patterns/word_set.rs b/harper-core/src/patterns/word_set.rs
index 761cca835..ec3395c4d 100644
--- a/harper-core/src/patterns/word_set.rs
+++ b/harper-core/src/patterns/word_set.rs
@@ -21,6 +21,12 @@ impl WordSet {
}
}
+ pub fn add_chars(&mut self, chars: &[char]) {
+ if !self.words.iter().any(|i| i.as_ref() == chars) {
+ self.words.push(chars.into());
+ }
+ }
+
pub fn contains(&self, word: &str) -> bool {
self.words.contains(&word.chars().collect())
}