-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed an issue to make sure all the top level categories are selected from aws rekognition response #67
Conversation
…aws, this improves on the existing solution of only looking for the top-level category in Label.ParentName, this is achieved by lookin at both ParentName and Name
Codecov Report
@@ Coverage Diff @@
## main #67 +/- ##
=======================================
Coverage 55.35% 55.35%
=======================================
Files 4 4
Lines 336 336
Branches 94 94
=======================================
Hits 186 186
Misses 70 70
Partials 80 80 |
src/aws/messages.rs
Outdated
match self.ParentName.is_empty() { | ||
true => &self.Name, | ||
_ => &self.ParentName, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to an if
else
src/aws/messages.rs
Outdated
@@ -24,7 +33,7 @@ impl RekognitionResponse { | |||
let labels: HashSet<String> = self | |||
.ModerationLabels | |||
.iter() | |||
.map(|l| l.ParentName.clone()) | |||
.map(|l| l.top_category().to_owned()) | |||
.filter(|l| !l.is_empty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line necessary since a empty check is occurring in the top_category
fn?
added a function to the implementation of Label for correctly getting the top-level category returned by aws, this improves on the existing solution of only looking for the top-level category in Label.ParentName, by looking at both ParentName and Name