Skip to content
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

feat: Add EpubFileLoader for EPUB file processing #192

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

danik-tro
Copy link

Add EpubFileLoader for EPUB file processing.

Solves #160

Changes

  • Implemented a new loader type, EpubFileLoader, in rig-core/src/loaders/epub.rs under the epub feature.
  • Added an optional dependency on epub-rs for handling EPUB files.
  • Extracts chapters from the EPUB file. Currently, the text is retrieved in XML format, as EPUB files are archives of XML files.
  • Potential enhancement: Add methods to EpubFileLoader for stripping XML tags to produce plain text.

@0xMochan
Copy link
Contributor

Great work on this, will be reviewing this soon! I love how you added a by_chapter method which matches by_page. Let me know how creating a custom Loader was, I think there are ways to make it cleaner with loader traits but the way the types are setup might seem a bit confusing at first!

@danik-tro
Copy link
Author

Great work on this, will be reviewing this soon! I love how you added a by_chapter method which matches by_page. Let me know how creating a custom Loader was,

Thank you for the feedback! I spent some time understanding how the loader works, and that took the most effort. Compared to researching the existing ones, implementing the new loader took significantly less time. I really like the concept of the type state pattern.

I think there are ways to make it cleaner with loader traits but the way the types are setup might seem a bit confusing at first!

Yes, it does look confusing, but it’s effective at the same time. I’m experimenting with a few improvement options, and if something works out, I’ll share an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants