Skip to content

Commit

Permalink
Merge pull request #76 from gkumbhat/add_text_contents_response
Browse files Browse the repository at this point in the history
🧑‍💻 Add text to contents analysis detectors response API
  • Loading branch information
gkumbhat authored Jun 12, 2024
2 parents af57f66 + 702f73e commit 4973351
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/api/openapi_detector_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ paths:
- start: 15
end: 25
detection_type: pii
text: [email protected]
detection: EmailAddress
score: 0.99
- start: 105
end: 116
text: 123-456-7890
detection_type: pii
detection: SocialSecurity
score: 0.99
Expand Down Expand Up @@ -539,6 +541,10 @@ components:
type: integer
title: End
example: 26
text:
type: string
title: Text
example: [email protected]
detection:
type: string
title: Detection
Expand Down
4 changes: 3 additions & 1 deletion src/clients/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -112,7 +114,7 @@ impl From<ContentAnalysisResponse> 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,
Expand Down

0 comments on commit 4973351

Please sign in to comment.