Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
doc(core): clarify difference between chunker NPs and pattern NPs (#2312)
Elijah Potterdedfa31b98f8
diff --git a/harper-core/src/dict_word_metadata.rs b/harper-core/src/dict_word_metadata.rsindex ee933f0f1..6f941fcf3 100644--- a/harper-core/src/dict_word_metadata.rs+++ b/harper-core/src/dict_word_metadata.rs@@ -43,7 +43,10 @@ pub struct DictWordMetadata {pub common: bool,#[serde(default = "default_none")]pub derived_from: Option<WordId>,- /// Generated by a chunker. Declares whether the word is a member of a nominal phrase.+ /// Generated by a chunker. Declares whether the word is a member of a nominal phrase. Using+ /// this should be preferred over the similarly named `Pattern`.+ ///+ /// For more details, see [the announcement blog post](https://elijahpotter.dev/articles/training_a_chunker_with_burn).pub np_member: Option<bool>,/// Generated by a POS tagger. Declares what it inferred the word's part of speech to be.pub pos_tag: Option<UPOS>,diff --git a/harper-core/src/patterns/nominal_phrase.rs b/harper-core/src/patterns/nominal_phrase.rsindex 91db625b0..3252b0dd5 100644--- a/harper-core/src/patterns/nominal_phrase.rs+++ b/harper-core/src/patterns/nominal_phrase.rs@@ -2,6 +2,9 @@ use crate::Token;use super::Pattern;+/// A pattern that uses primitive syntax-tree heuristics to locate nominal phrases.+/// Given that it does not take context into account, it is not recommended for new code.+/// Please prefer [`DictWordMetadata::np_member`](crate::DictWordMetadata::np_member).#[derive(Default)]pub struct NominalPhrase;diff --git a/justfile b/justfileindex 318fa639c..0b08b7b78 100644--- a/justfile+++ b/justfile@@ -627,7 +627,7 @@ newest-dict-changes *numCommits:});});-# Print the input string or file with nominal phrases highlighted.+# Print the input string or file with nominal phrases highlighted. These are generated using Harper's chunker.getnps text:cargo run --bin harper-cli -- nominal-phrases "{{text}}"