GENERATIVE-AI-ENGINEER-ASSOCIATE · Question #11
A Generative AI Engineer is building a RAG application that will rely on context retrieved from source documents that are currently in HTML format. They want to develop a solution using the least…
The correct answer is D. beautifulsoup. BeautifulSoup (beautifulsoup4) is a Python library specifically designed to parse HTML and XML documents. It provides a simple API to navigate the document tree and extract plain text with minimal code - typically just a few lines to load, parse, and call .get_text(). This…
Question
A Generative AI Engineer is building a RAG application that will rely on context retrieved from source documents that are currently in HTML format. They want to develop a solution using the least amount of lines of code. Which Python package should be used to extract the text from the source documents?
Options
- Apytesseract
- Bnumpy
- Cpypdf2
- Dbeautifulsoup
How the community answered
(60 responses)- A5% (3)
- B2% (1)
- C7% (4)
- D87% (52)
Explanation
BeautifulSoup (beautifulsoup4) is a Python library specifically designed to parse HTML and XML documents. It provides a simple API to navigate the document tree and extract plain text with minimal code - typically just a few lines to load, parse, and call .get_text(). This makes it the correct choice for extracting text from HTML source documents with the least amount of code. Option A (pytesseract) is an OCR wrapper for Tesseract, used to extract text from images and scanned PDFs - not HTML. Option B (numpy) is a numerical computing library with no HTML parsing capability. Option C (pypdf2) is a library for reading and manipulating PDF files, not HTML documents.
Topics
Community Discussion
No community discussion yet for this question.