-
Notifications
You must be signed in to change notification settings - Fork 17
Support ignoring images based on hash when inferring nonvisual reading #228
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
Conversation
necessitated passing of context to inference functions
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.
Pull Request Overview
This PR adds support for ignoring specific images based on their hash when inferring nonvisual reading, updates the accessibility metadata inference functions, and improves the image analysis functionality.
- Added a new config option (InferIgnoredImages) and utility functions (String, Equal, Find) for hash handling.
- Renamed and refactored accessibility metadata inference and image inspection functions.
- Updated tests to validate the new behavior with ignored images.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/streamer/streamer.go | Introduced InferIgnoredImages config and updated the inference flow. |
pkg/streamer/a11y_infer_test.go | Updated tests to use the new signature for accessing accessibility metadata. |
pkg/streamer/a11y_infer.go | Modified inference function to return errors and handle ignored images. |
pkg/manifest/properties_hash.go | Added convenience functions for HashValue and HashList. |
pkg/manifest/properties.go | Refactored property getters to use consistent patterns. |
pkg/analyzer/image_test.go | Added tests for InspectImage and MatchImage functionality. |
pkg/analyzer/image.go | Renamed and refactored the image inspection logic to support computed hashes. |
CHANGELOG.md | Updated changelog to document added and changed features. |
pkg/manifest/properties.go
Outdated
return nil | ||
} | ||
if enc, ok := v.(Encryption); ok { | ||
// Is already an Encryption struct |
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.
Link Properties
must only contain JSON data specifically to avoid this ambiguity and facilitate the serialization of the manifest to JSON. If there are Encryption
or HashList
objects in Properties
, they need to be serialized at the location where they are added to Properties
.
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.
@mickael-menu I changed it, look OK?
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.
Looking good, thank you for making the changes 👌
Toolkit portion of the work for readium/cli#15
From the changelog:
Added
Streamer
:InferIgnoredImages
, a list of hashes of images to ignore when when inferring nonvisual readinganalyzer.MatchImage
function that compares an image link's hashes with given hashes to check for a matchHashValue
has newString
andEqual
convenience functions.HashList
has a newFind
convenience function.Changed
analyzer.Image
toanalyzer.InspectImage