nerdexam
Databricks

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…

Data Ingestion and Preprocessing for Retrieval Augmented Generation (RAG)

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)
  • A
    5% (3)
  • B
    2% (1)
  • C
    7% (4)
  • D
    87% (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

#HTML Parsing#Text Extraction#Python Libraries#RAG Data Preparation

Community Discussion

No community discussion yet for this question.

Full GENERATIVE-AI-ENGINEER-ASSOCIATE Practice