pub struct JointModel { /* private fields */ }Expand description
Joint model for entity analysis.
Combines NER, coreference, and entity linking in a single factor graph following Durrett & Klein (2014).
Implementations§
Source§impl JointModel
impl JointModel
Sourcepub fn new(config: JointConfig) -> Result<Self>
pub fn new(config: JointConfig) -> Result<Self>
Create a new joint model.
Sourcepub fn with_knowledge(self, store: Arc<WikipediaKnowledgeStore>) -> Self
pub fn with_knowledge(self, store: Arc<WikipediaKnowledgeStore>) -> Self
Add Wikipedia knowledge store for semantics lookups (Link+NER factors).
Sourcepub fn with_ner_provider(self, provider: Arc<dyn NerScoreProvider>) -> Self
pub fn with_ner_provider(self, provider: Arc<dyn NerScoreProvider>) -> Self
Attach a custom NER score provider.
Sourcepub fn with_coref_provider(self, provider: Arc<dyn CorefScoreProvider>) -> Self
pub fn with_coref_provider(self, provider: Arc<dyn CorefScoreProvider>) -> Self
Attach a custom coreference score provider.
Sourcepub fn with_link_provider(self, provider: Arc<dyn LinkScoreProvider>) -> Self
pub fn with_link_provider(self, provider: Arc<dyn LinkScoreProvider>) -> Self
Attach a custom link score provider.
Sourcepub fn analyze(&self, text: &str, entities: &[Entity]) -> Result<JointResult>
pub fn analyze(&self, text: &str, entities: &[Entity]) -> Result<JointResult>
Analyze text jointly for entities, coreference, and links.
Sourcepub fn config(&self) -> &JointConfig
pub fn config(&self) -> &JointConfig
Get configuration.
Sourcepub fn extract_entities_from_mentions(
&self,
text: &str,
mentions: &[JointMention],
) -> Result<Vec<Entity>>
pub fn extract_entities_from_mentions( &self, text: &str, mentions: &[JointMention], ) -> Result<Vec<Entity>>
Extract entities from raw text (requires external NER first).
This is a convenience method for pipelines that want to use JointModel as the final step after mention detection.
Trait Implementations§
Source§impl CoreferenceResolver for JointModel
Implement the CoreferenceResolver trait for JointModel.
impl CoreferenceResolver for JointModel
Implement the CoreferenceResolver trait for JointModel.
Source§impl Default for JointModel
impl Default for JointModel
Source§impl Model for JointModel
Implement the Model trait for JointModel to allow it to be used as an NER backend.
impl Model for JointModel
Implement the Model trait for JointModel to allow it to be used as an NER backend.
Note: JointModel requires pre-extracted entities as input, so extract_entities
uses an internal regex-based mention detector as a fallback.
Source§fn extract_entities(
&self,
text: &str,
_language: Option<&str>,
) -> Result<Vec<Entity>>
fn extract_entities( &self, text: &str, _language: Option<&str>, ) -> Result<Vec<Entity>>
Source§fn supported_types(&self) -> Vec<EntityType>
fn supported_types(&self) -> Vec<EntityType>
Source§fn is_available(&self) -> bool
fn is_available(&self) -> bool
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Source§fn capabilities(&self) -> ModelCapabilities
fn capabilities(&self) -> ModelCapabilities
Auto Trait Implementations§
impl Freeze for JointModel
impl !RefUnwindSafe for JointModel
impl Send for JointModel
impl Sync for JointModel
impl Unpin for JointModel
impl UnsafeUnpin for JointModel
impl !UnwindSafe for JointModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more