Skip to content

Commit cf6fc87

Browse files
committed
doc(core): clarify differance between chunker NPs and pattern NPs
1 parent 66f3e84 commit cf6fc87

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

harper-core/src/dict_word_metadata.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ pub struct DictWordMetadata {
4343
pub common: bool,
4444
#[serde(default = "default_none")]
4545
pub derived_from: Option<WordId>,
46-
/// Generated by a chunker. Declares whether the word is a member of a nominal phrase.
46+
/// Generated by a chunker. Declares whether the word is a member of a nominal phrase. Using
47+
/// this should be preferred over the similarly named `Pattern`.
48+
///
49+
/// For more details, see [the announcement blog post](https://elijahpotter.dev/articles/training_a_chunker_with_burn).
4750
pub np_member: Option<bool>,
4851
/// Generated by a POS tagger. Declares what it inferred the word's part of speech to be.
4952
pub pos_tag: Option<UPOS>,

harper-core/src/patterns/nominal_phrase.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ use crate::Token;
22

33
use super::Pattern;
44

5+
/// A pattern that uses primitive syntax-tree heuristics to locate nominal phrases.
6+
/// Given that it does not take context into account, it is not recommended for new code.
7+
/// Please prefer [`DictWordMetadata::np_member`](crate::DictWordMetadata::np_member).
58
#[derive(Default)]
69
pub struct NominalPhrase;
710

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ newest-dict-changes *numCommits:
627627
});
628628
});
629629

630-
# Print the input string or file with nominal phrases highlighted.
630+
# Print the input string or file with nominal phrases highlighted. These are generated using Harper's chunker.
631631
getnps text:
632632
cargo run --bin harper-cli -- nominal-phrases "{{text}}"
633633

0 commit comments

Comments
 (0)