1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Core entity types and structures for information extraction
/// Entity types for named entity recognition
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EntityType {
/// Person names and personal identifiers
Person,
/// Organization names, companies, institutions
Organization,
/// Geographic locations, places, addresses
Location,
/// Date expressions and temporal references
Date,
/// Time expressions and temporal references
Time,
/// Monetary amounts and currency references
Money,
/// Percentage values and ratios
Percentage,
/// Email addresses
Email,
/// URL and web addresses
Url,
/// Phone numbers and contact information
Phone,
/// Custom entity type defined by user
Custom(String),
/// Other unspecified entity type
Other,
}
/// Extracted entity with type and position information
#[derive(Debug, Clone)]
pub struct Entity {
/// The extracted text content
pub text: String,
/// The type of entity detected
pub entity_type: EntityType,
/// Start position in the original text
pub start: usize,
/// End position in the original text
pub end: usize,
/// Confidence score for the extraction (0.0 to 1.0)
pub confidence: f64,
}
/// Cluster of similar entities
#[derive(Debug, Clone)]
pub struct EntityCluster {
/// Representative entity for the cluster
pub representative: Entity,
/// All entities in the cluster
pub members: Vec<Entity>,
/// Type of entities in the cluster
pub entity_type: EntityType,
/// Confidence score for the clustering
pub confidence: f64,
}