Skip to content

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

doc(core): add example to the README

Elijah Potter6b8ffd29f554
diff --git a/harper-core/README.md b/harper-core/README.md
index 3fb578e82..cddc89e54 100644
--- a/harper-core/README.md
+++ b/harper-core/README.md
@@ -6,6 +6,33 @@
Feel free to use `harper-core` in your projects.
If you run into issues, create a pull request.
+## Example
+
+Here's what a full end-to-end linting pipeline could look like using `harper-core`.
+
+```rust
+use harper_core::linting::{LintGroup, Linter};
+use harper_core::parsers::PlainEnglish;
+use harper_core::spell::FstDictionary;
+use harper_core::{Dialect, Document};
+
+fn main() {
+ let text = "This is an test.";
+ let parser = PlainEnglish;
+
+ let document = Document::new_curated(text, &parser);
+
+ let dict = FstDictionary::curated();
+ let mut linter = LintGroup::new_curated(dict, Dialect::American);
+
+ let lints = linter.lint(&document);
+
+ for lint in lints {
+ println!("{:?}", lint);
+ }
+}
+```
+
## Features
`concurrent`: Whether to use thread-safe primitives (`Arc` vs `Rc`). Disabled by default.