diff --git a/docs/api/openapi_detector_api.yaml b/docs/api/openapi_detector_api.yaml index 545a763b..a7da93e0 100644 --- a/docs/api/openapi_detector_api.yaml +++ b/docs/api/openapi_detector_api.yaml @@ -44,10 +44,12 @@ paths: - start: 15 end: 25 detection_type: pii + text: foo@bar.com detection: EmailAddress score: 0.99 - start: 105 end: 116 + text: 123-456-7890 detection_type: pii detection: SocialSecurity score: 0.99 @@ -539,6 +541,10 @@ components: type: integer title: End example: 26 + text: + type: string + title: Text + example: foo@bar.com detection: type: string title: Detection diff --git a/src/clients/detector.rs b/src/clients/detector.rs index f6b3a31f..1de10357 100644 --- a/src/clients/detector.rs +++ b/src/clients/detector.rs @@ -96,6 +96,8 @@ pub struct ContentAnalysisResponse { pub start: usize, /// End index of detection pub end: usize, + /// Text corresponding to detection + pub text: String, /// Relevant detection class pub detection: String, /// Detection type or aggregate detection label @@ -112,7 +114,7 @@ impl From for crate::models::TokenClassificationResult Self { start: value.start as u32, end: value.end as u32, - word: "".to_string(), // TODO: fill in when provided in the detector API in the next iteration + word: value.text, entity: value.detection, entity_group: value.detection_type, score: value.score,