Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brianlesko/epub_to_text
Extract text from an epub file for LLM training, similarity search embedding, textual data analysis, or text to speech. Created for learning purposes by a professional robotics engineer. Located in Cleveland and studying the world
https://github.com/brianlesko/epub_to_text
Last synced: about 20 hours ago
JSON representation
Extract text from an epub file for LLM training, similarity search embedding, textual data analysis, or text to speech. Created for learning purposes by a professional robotics engineer. Located in Cleveland and studying the world
- Host: GitHub
- URL: https://github.com/brianlesko/epub_to_text
- Owner: BrianLesko
- License: mit
- Created: 2023-11-25T17:13:29.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-17T23:15:58.000Z (10 months ago)
- Last Synced: 2024-01-18T06:06:48.309Z (10 months ago)
- Language: Python
- Size: 7.88 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Text Extraction from an Epub file
This code implements text parsing from an Electronic Publishing format. This implementation is written in [Pure Python](https://github.com/BrianLesko/epub_to_text/blob/main/app.py) - created for Learning Purposes.
## Dependencies
This code uses the following libraries:
- `streamlit`: for building the user interface.
- `os`: for interacting with the OS, used for file and directory operations.
- `io`: for handling the stream operations of files.
- `zipfile`: for reading and writing ZIP archive files.
- `bs4 (BeautifulSoup)`: for parsing HTML documents, used for extracting text.
## Usage
Run the following commands:
```
pip install --upgrade streamlit zipfile bs4
streamlit run https://raw.githubusercontent.com/BrianLesko/epub_to_text/main/app.py?token=GHSAT0AAAAAACEZSXSIC7IMS2W5EVZKLS7SZLCFV4Q
```This will start the local Streamlit server, and you can access the chatbot by opening a web browser and navigating to `http://localhost:8501`.
## How it Works
The app as follows:
1. The user enters some text in the input field.
2. OpenAI is used to embed the text into a vector of numbers.
3. Scikit-learn is used to compare the embedding to an embedding created from a description of soccer and a description of math.
4. The app displays the similarity on a Plotly chart.
5. The user can enter more text to see more similarities.
## Repository Structure
```
repository/
├── app.py # the code and UI integrated together live here
├── customize_gui # class for adding gui elements
├── requirements.txt # the python packages needed to run locally
├── .gitignore # includes the local virtual environment named my_env
├── .streamlit/
│ └── config.toml # theme info for the UI
└── docs/
└── preview.png # preview photo for Github
```
## Topics
```
Python | Streamlit | Git | Low Code UI
text scraping | HTML parser | textual data | books
Self taught coding | Mechanical engineer | Robotics engineer
```
╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮
┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃
┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃
┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃
┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃
╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯
follow all of these or i will kick you