Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix: use `FullDictionary` on the web until workers are an option
Elijah Potter1d70ba540180
diff --git a/harper-wasm/src/lib.rs b/harper-wasm/src/lib.rsindex 7a404504c..53eeffc74 100644--- a/harper-wasm/src/lib.rs+++ b/harper-wasm/src/lib.rs@@ -5,15 +5,15 @@ use std::sync::Mutex;use harper_core::language_detection::is_doc_likely_english;use harper_core::linting::{LintGroup, LintGroupConfig, Linter};use harper_core::parsers::{IsolateEnglish, Markdown, PlainEnglish};-use harper_core::{remove_overlaps, Document, FstDictionary, Lrc};+use harper_core::{remove_overlaps, Document, FullDictionary, Lrc};use once_cell::sync::Lazy;use wasm_bindgen::prelude::wasm_bindgen;use wasm_bindgen::JsValue;-static LINTER: Lazy<Mutex<LintGroup<Lrc<FstDictionary>>>> = Lazy::new(|| {+static LINTER: Lazy<Mutex<LintGroup<Lrc<FullDictionary>>>> = Lazy::new(|| {Mutex::new(LintGroup::new(LintGroupConfig::default(),- FstDictionary::curated(),+ FullDictionary::curated(),))});@@ -32,13 +32,13 @@ pub fn setup() {#[wasm_bindgen]pub fn is_likely_english(text: String) -> bool {let document = Document::new_plain_english_curated(&text);- is_doc_likely_english(&document, &FstDictionary::curated())+ is_doc_likely_english(&document, &FullDictionary::curated())}/// Helper method to remove non-English text from a plain English document.#[wasm_bindgen]pub fn isolate_english(text: String) -> String {- let dict = FstDictionary::curated();+ let dict = FullDictionary::curated();let document = Document::new_curated(&text,@@ -67,7 +67,8 @@ pub fn lint(text: String) -> Vec<Lint> {let source: Vec<_> = text.chars().collect();let source = Lrc::new(source);- let document = Document::new_from_vec(source.clone(), &mut Markdown, &FstDictionary::curated());+ let document =+ Document::new_from_vec(source.clone(), &mut Markdown, &FullDictionary::curated());let mut lints = LINTER.lock().unwrap().lint(&document);