diff --git a/harper-core/src/dict_word_metadata.rs b/harper-core/src/dict_word_metadata.rs index ee933f0f..6f941fcf 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, - /// 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, /// Generated by a POS tagger. Declares what it inferred the word's part of speech to be. pub pos_tag: Option, diff --git a/harper-core/src/patterns/nominal_phrase.rs b/harper-core/src/patterns/nominal_phrase.rs index 91db625b..3252b0dd 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/justfile index 318fa639..0b08b7b7 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}}"