harper_pos_utils/chunker/mod.rs
1use crate::UPOS;
2
3mod brill_chunker;
4mod burn_chunker;
5mod cached_chunker;
6#[cfg(feature = "training")]
7mod np_extraction;
8mod upos_freq_dict;
9
10pub use brill_chunker::BrillChunker;
11pub use burn_chunker::{BurnChunker, BurnChunkerCpu};
12pub use cached_chunker::CachedChunker;
13pub use upos_freq_dict::UPOSFreqDict;
14
15/// An implementer of this trait is capable of identifying the noun phrases in a provided sentence.
16/// [See here](https://en.wikipedia.org/wiki/Shallow_parsing) for more details on what this is and how it can work.
17pub trait Chunker {
18 /// Iterate over the sentence, identifying the noun phrases contained within.
19 /// A token marked `true` is a component of a noun phrase.
20 /// A token marked `false` is not.
21 fn chunk_sentence(&self, sentence: &[String], tags: &[Option<UPOS>]) -> Vec<bool>;
22}