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 3 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.

@0xMochan
Copy link
Contributor

0xMochan commented Jan 17, 2025

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.

Hey, wanted to check up on this. Were you going to introduce anything extra here or is this ready for review? It does look like you need to rebase to main to ensure that this can be merged w/o conflicts. When resolved, you can mark me for review!

@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.

Hey, wanted to check up on this. Were you going to introduce anything extra here or is this ready for review? It does look like you need to rebase to main to ensure that this can be merged w/o conflicts. When resolved, you can mark me for review!

Hi! I've resolved conflicts using the GitHub tool. Let me know if rebase is mandatory; I'll squash commits locally and push them to the branch. The PR is ready to be reviewed. No additional changes aren't going to be added for now, maybe in the next PRs.

@0xMochan 0xMochan self-requested a review January 20, 2025 16:10
@0xMochan
Copy link
Contributor

0xMochan commented Feb 3, 2025

@danik-tro Could this PR be rebased / merged w/ main! thanks!

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