728x90
반응형

1. 들어가며

RAG(Retrieval-Augmented Generation) 파이프라인을 구축할 때 가장 첫 단계는 외부 문서를 불러오는 것입니다.

LangChain에서는 이를 Document Loader라고 부르며, PDF, TXT, CSV, Markdown 등 다양한 형식을 일관된 Document 객체로 변환할 수 있습니다.

👉 이 글에서는 그중에서도 가장 많이 쓰이는 PDF Document Loader를 소개합니다.


2. Document 객체란?

Langchain에서 불러온 모든 데이터는 Document라는 표준 객체로 변환됩니다.

  • 구조:
    • page_content: 본문 텍스트 (str)
    • metadata: 부가 정보 (dict, 예: 파일명, 페이지 번호 등)
  • 예시:
from langchain.schema import Document

doc = Document(
page_content="이것은 PDF에서 추출한 텍스트입니다.",
metadata={"source": "sample.pdf", "page": 1}
)

 

👉 이렇게 표준화된 형식 덕분에 이후 단계(Text Splitter → Embeddings → Vector Store)에서 일관된 처리가 가능합니다.


3. 한국어 PDF 실험 결과 (AutoRAG 팀)

PDF 추출 품질은 단순히 어떤 라이브러리를 쓰느냐에 따라 크게 달라집니다.

AutoRAG 팀에서는 한국어 PDF 문서를 대상으로 다양한 로더를 비교 실험했는데, 아래는 그 결과입니다.

 

분야 PDFMiner PDFPlumber PyPDFium2 PyMuPDF PyPDF2
Medical 1 2 3 4 5
Law 3 1 1 3 5
Finance 1 2 2 4 5
Public 1 1 1 4 5
합계 5 5 7 15 20

 

📌 출처: AutoRAG Medium 블로그

해석

  • PDFMiner, PDFPlumber → 전반적으로 가장 안정적
  • PyPDFium2 → 법률·공공 분야에서 강세
  • PyMuPDF → 빠르지만 한국어 추출 품질은 다소 떨어짐
  • PyPDF2 → 전 영역에서 성능 낮음

👉 한국어 PDF 문서를 다룰 때는 PDFMiner / PDFPlumber를 우선 고려하는 것이 좋습니다.


4. 다양한 PDF Loader

LangChain은 내부적으로 여러 가지 PDF 로더를 지원합니다. 각각 사용하는 라이브러리가 다르고, 추출 품질이나 속도, 지원 기능에서 차이가 있습니다. 주요 로더들을 비교해보면 다음과 같습니다.

 

주요 로더들의 metadata를 보기 위한 코드를 먼저 만들어보았습니다.

def show_metadata(docs):
    if docs:
        print("[metadata]")
        print(list(docs[0].metadata.keys()))
        print("\\n[examples]")
        max_key_length = max(len(k) for k in docs[0].metadata.keys())
        for k, v in docs[0].metadata.items():
            print(f"{k:<{max_key_length}}: {v}")

4.1 PyPDF

  • 특징:
    • 가장 기본적인 PDF 로더
    • 페이지 단위로 Document를 생성
    • 속도는 무난하지만, 한국어 추출 품질은 떨어질 수 있음
  • 활용 포인트
    • 단순한 영어 PDF 문서 처리에는 충분
    • 한국어/복잡한 문서에는 다른 로더 추천
from langchain_community.document_loaders import PyPDFLoader

loader = PyPDFLoader(FILE_PATH)

docs = loader.load()

print(docs[1].page_content)

 

출력 결과:

2023 년 12월호
Ⅰ. 인공지능 산업 동향 브리프
 1. 정책/법제 
   ▹ 미국, 안전하고 신뢰할 수 있는 AI 개발과 사용에 관한 행정명령 발표  ························· 1
   ▹ G7, 히로시마 AI 프로세스를 통해 AI 기업 대상 국제 행동강령에 합의··························· 2
   ▹ 영국 AI 안전성 정상회의에 참가한 28개국, AI 위험에 공동 대응 선언··························· 3
   ▹ 미국 법원, 예술가들이 생성 AI 기업에 제기한 저작권 소송 기각····································· 4
   ▹ 미국 연방거래위원회 , 저작권청에 소비자 보호와 경쟁 측면의 AI 의견서 제출················· 5
   ▹ EU AI 법 3자 협상, 기반모델 규제 관련 견해차로 난항··················································· 6
 
 2. 기업/산업 
   ▹ 미국 프런티어 모델 포럼, 1,000 만 달러 규모의 AI 안전 기금 조성································ 7
   ▹ 코히어 , 데이터 투명성 확보를 위한 데이터 출처 탐색기 공개  ······································· 8
   ▹ 알리바바 클라우드 , 최신 LLM ‘통이치엔원 2.0’ 공개 ······················································ 9
   ▹ 삼성전자 , 자체 개발 생성 AI ‘삼성 가우스 ’ 공개 ··························································· 10
   ▹ 구글, 앤스로픽에 20억 달러 투자로 생성 AI 협력 강화 ················································ 11
   ▹ IDC, 2027 년 AI 소프트웨어 매출 2,500 억 달러 돌파 전망··········································· 12
   ▹ 빌 게이츠 , AI 에이전트로 인한 컴퓨터 사용의 패러다임 변화 전망································ 13
   ▹ 유튜브 , 2024 년부터 AI 생성 콘텐츠 표시 의무화 ···························································· 14
 3. 기술/연구
   ▹ 영국 과학혁신기술부 , AI 안전 연구소 설립 발표······························································ 15
   ▹ 구글 딥마인드 , 범용 AI 모델의 기능과 동작에 대한 분류 체계 발표······························ 16
   ▹ 갈릴레오의 LLM 환각 지수 평가에서 GPT-4 가 가장 우수 ··········································· 17
   
 4. 인력/교육     
   ▹ 영국 옥스퍼드 인터넷 연구소 , AI 기술자의 임금이 평균 21% 높아······························· 18
   
   
 
Ⅱ. 주요 행사
   ▹CES 2024 ····························································································································· 19
   ▹AIMLA 2024 ························································································································· 19
   ▹AAAI Conference on Artificial Intelligence ·································································· 19
show_metadata(docs)

 

출력 결과:

[metadata]
['producer', 'creator', 'creationdate', 'author', 'moddate', 'pdfversion', 'source', 'total_pages', 'page', 'page_label']

[examples]
producer    : Hancom PDF 1.3.0.542
creator     : Hwp 2018 10.0.0.13462
creationdate: 2023-12-08T13:28:38+09:00
author      : dj
moddate     : 2023-12-08T13:28:38+09:00
pdfversion  : 1.4
source      : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
total_pages : 23
page        : 0
page_label  : 1

4.2 PyPDF(OCR 옵션)

일부 PDF에는 스캔된 문서나 그림 내에 텍스트 이미지가 포함되어 있습니다.

rapidocr-onnxruntime 패키지를 사용하여 이미지에서 텍스트를 추출할 수도 있습니다.

# PDF 로더 초기화, 이미지 추출 옵션 활성화
loader = PyPDFLoader("<https://arxiv.org/pdf/2503.23363>", extract_images=True)

# PDF 페이지 로드
docs = loader.load()

# 페이지 내용 접근
print(docs[0].page_content)

출력 결과:

Large Language Models Are Better Logical Fallacy Reasoners with
Counterargument, Explanation, and Goal-Aware Prompt Formulation
Jiwon Jeong1Hyeju Jang2*Hogun Park1*
1Sungkyunkwan University, Republic of Korea
2Indiana University Indianapolis, USA
jwjw9603@skku.edu hyejuj@iu.edu hogunpark@skku.edu
Abstract
The advancement of Large Language Models
(LLMs) has greatly improved our ability to pro-
cess complex language. However, accurately
detecting logical fallacies remains a significant
challenge. This study presents a novel and ef-
fective prompt formulation approach for logi-
cal fallacy detection, applicable in both super-
vised (fine-tuned) and unsupervised (zero-shot)
settings. Our method enriches input text in-
corporating implicit contextual information—
counterarguments ,explanations , and goals —
which we query for validity within the context
of the argument. We then rank these queries
based on confidence scores to inform classifica-
tion. We evaluate our approach across multiple
datasets from 5 domains, covering 29 distinct
fallacy types, using models from the GPT and
LLaMA series. The results show substantial im-
provements over state-of-the-art models, with
F1 score increases of up to 0.60 in zero-shot
settings and up to 0.45 in fine-tuned models.
Extensive analyses further illustrate why and
how our method excels.
1 Introduction
Logical fallacies are flawed arguments resulting
from faulty reasoning (Clark, 1971). For example,
consider the statement: “Annie must like Starbucks
because all girls like Starbucks.” This exemplifies
the logical fallacy known as faulty generalization ,
as it assumes that all girls universally share a prefer-
ence for Starbucks—an overly broad generalization.
Recognizing logical fallacies is essential for both
humans and AI. It enables us to avoid being misled
by faulty arguments, improves communication by
minimizing errors, prevents misleading or decep-
tive misinformation, and strengthens convincing
arguments (Woods, 2004; Tindale, 2007).
Despite this importance, logical fallacy detec-
tion remains in its early stage in natural language
*Corresponding authors.
LLM: Annie must like Starbucks because 
all girls like Starbucks.
LLM
LLM
LLM
Output
0.50
0.82
0.64
Confidence ScorePrompt 
RankingCG
EX
GO
Explanation
∶ This text generalizes that all girls like Starbucks and assumes Annie, 
being a girl, must like Starbucks without evidence.
     ∶How does this text perpetuate harmful gender stereotypes and 
restrict individual expressions?
∶ The goal is to make a generalization about girls liking Starbucks 
based on the assumption that Annie is a girl.
     ∶What does this text reveal about the speaker’s attitude towards 
girls and their preferences? ∶ It is not fair to make assumptions about someone based on their 
gender.
     ∶How does the Counterargument refute the idea that all girls like 
Starbucks?Counterargument
Goal
Figure 1: Prompt formulation: xrepresents the input
text to classify. Ridenotes the contextual augmentation
generated from the input text using specific instructions
for Counterargument (CG), Explanation (EX), and Goal
(GO).Qidenotes the reformulated queries created from
each augmentation to analyze the input text.
processing. Recent large language models (LLMs)
have demonstrated challenges not only in general
reasoning (Naveed et al., 2023; Chen et al., 2024)
but also in detecting logical fallacies. For exam-
ple, Jin et al. (2022) showed that both zero-shot
and fine-tuning results of BERT-based models are
suboptimal. More recently, Hong et al. (2024) high-
lighted that most LLMs continue to struggle in this
area. To the best of our knowledge, there has been
no attempt to address this issue through prompting
engineering or other unsupervised methods.
To address this gap, we investigate whether in-
corporating implicit information from multiple per-
spectives on arguments into prompts can improve
LLM performance in logical fallacy detection. WearXiv:2503.23363v1  [cs.AI]  30 Mar 2025
show_metadata(docs)

 

출력 결과:

[metadata]
['producer', 'creator', 'creationdate', 'author', 'keywords', 'moddate', 'ptex.fullbanner', 'subject', 'title', 'trapped', 'source', 'total_pages', 'page', 'page_label']

[examples]
producer       : pdfTeX-1.40.25
creator        : LaTeX with hyperref
creationdate   : 2025-04-01T00:56:24+00:00
author         : 
keywords       : 
moddate        : 2025-04-01T00:56:24+00:00
ptex.fullbanner: This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) kpathsea version 6.3.5
subject        : 
title          : 
trapped        : /False
source         : <https://arxiv.org/pdf/2503.23363>
total_pages    : 20
page           : 0
page_label     : 1

4.3 PyMuPDF

  • 특징:
    • 속도가 매우 빠름
    • 레이아웃 정보를 잘 보존 (문단, 위치 기반 추출 가능) → 자세한 메타 데이터
    • 한국어 추출 품질은 PDFPlumber보다 다소 약함
  • 활용 포인트:
    • 속도가 중요한 대규모 PDF 처리
    • 레이아웃 분석이 필요한 경우 적합
from langchain_community.document_loaders import PyMuPDFLoader

# PyMuPDF 로더 인스턴스 생성
loader = PyMuPDFLoader(FILE_PATH)

# 문서 로드
docs = loader.load()

# 문서의 내용 출력
print(docs[1].page_content)

 

출력 결과:

2023년 12월호
Ⅰ. 인공지능 산업 동향 브리프
 1. 정책/법제 
   ▹ 미국, 안전하고 신뢰할 수 있는 AI 개발과 사용에 관한 행정명령 발표  ························· 1
   ▹ G7, 히로시마 AI 프로세스를 통해 AI 기업 대상 국제 행동강령에 합의··························· 2
   ▹ 영국 AI 안전성 정상회의에 참가한 28개국, AI 위험에 공동 대응 선언··························· 3
   ▹ 미국 법원, 예술가들이 생성 AI 기업에 제기한 저작권 소송 기각····································· 4
   ▹ 미국 연방거래위원회, 저작권청에 소비자 보호와 경쟁 측면의 AI 의견서 제출················· 5
   ▹ EU AI 법 3자 협상, 기반모델 규제 관련 견해차로 난항··················································· 6
 
 2. 기업/산업 
   ▹ 미국 프런티어 모델 포럼, 1,000만 달러 규모의 AI 안전 기금 조성································ 7
   ▹ 코히어, 데이터 투명성 확보를 위한 데이터 출처 탐색기 공개  ······································· 8
   ▹ 알리바바 클라우드, 최신 LLM ‘통이치엔원 2.0’ 공개 ······················································ 9
   ▹ 삼성전자, 자체 개발 생성 AI ‘삼성 가우스’ 공개 ··························································· 10
   ▹ 구글, 앤스로픽에 20억 달러 투자로 생성 AI 협력 강화 ················································ 11
   ▹ IDC, 2027년 AI 소프트웨어 매출 2,500억 달러 돌파 전망··········································· 12
   ▹ 빌 게이츠, AI 에이전트로 인한 컴퓨터 사용의 패러다임 변화 전망································ 13
   ▹ 유튜브, 2024년부터 AI 생성 콘텐츠 표시 의무화···························································· 14
 3. 기술/연구
   ▹ 영국 과학혁신기술부, AI 안전 연구소 설립 발표······························································ 15
   ▹ 구글 딥마인드, 범용 AI 모델의 기능과 동작에 대한 분류 체계 발표······························ 16
   ▹ 갈릴레오의 LLM 환각 지수 평가에서 GPT-4가 가장 우수 ··········································· 17
   
 4. 인력/교육     
   ▹ 영국 옥스퍼드 인터넷 연구소, AI 기술자의 임금이 평균 21% 높아······························· 18
   
   
 
Ⅱ. 주요 행사
   ▹CES 2024 ····························································································································· 19
   ▹AIMLA 2024 ························································································································· 19
   ▹AAAI Conference on Artificial Intelligence ·································································· 19
show_metadata(docs)

 

출력 결과:

[metadata]
['producer', 'creator', 'creationdate', 'source', 'file_path', 'total_pages', 'format', 'title', 'author', 'subject', 'keywords', 'moddate', 'trapped', 'modDate', 'creationDate', 'page']

[examples]
producer    : Hancom PDF 1.3.0.542
creator     : Hwp 2018 10.0.0.13462
creationdate: 2023-12-08T13:28:38+09:00
source      : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
file_path   : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
total_pages : 23
format      : PDF 1.4
title       : 
author      : dj
subject     : 
keywords    : 
moddate     : 2023-12-08T13:28:38+09:00
trapped     : 
modDate     : D:20231208132838+09'00'
creationDate: D:20231208132838+09'00'
page        : 0

4.4 Unstructured

  • 특징
    • PDF 문서를 구조적 요소 단위(제목, 표, 본문 등)로 분리 가능
    • 단순 텍스트 추출이 아니라 “문서 구조 보존”에 강점
    • 설치 및 환경 설정이 다소 까다로움
  • 활용 포인트
    • 보고서, 논문처럼 구조가 중요한 PDF
    • 표, 리스트, 제목 구분이 필요한 RAG 파이프라인
from langchain_community.document_loaders import UnstructuredPDFLoader

# UnstructuredPDFLoader 인스턴스 생성
loader = UnstructuredPDFLoader(FILE_PATH)

# 데이터 로드
docs = loader.load()

# 문서의 내용 출력
print(docs[0].page_content)
show_metadata(docs)

 

출력 결과:

[metadata]
['source']

[examples]
source: ./data/SPRI_AI_Brief_2023년12월호_F.pdf

 

내부적으로 비정형에서는 텍스트 청크마다 서로 다른 “요소” 를 만듭니다. 기본적으로 이들은 결합되어 있지만 mode = “elements” 를 지정하여 쉽게 분리할 수 있습니다.

# UnstructuredPDFLoader 인스턴스 생성(mode="elements")
loader = UnstructuredPDFLoader(FILE_PATH, mode="elements")

# 데이터 로드
docs = loader.load()

# 문서의 내용 출력
print(docs[0].page_content)

 

출력 결과:

2023년 12월호
show_metadata(docs)

 

출력 결과:

[metadata]
['source', 'coordinates', 'file_directory', 'filename', 'languages', 'last_modified', 'page_number', 'filetype', 'category', 'element_id']

[examples]
source        : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
coordinates   : {'points': ((256.579467, 282.444348), (256.579467, 303.42387300000007), (355.4236898438, 303.42387300000007), (355.4236898438, 282.444348)), 'system': 'PixelSpace', 'layout_width': 612, 'layout_height': 858}
file_directory: ./data
filename      : SPRI_AI_Brief_2023년12월호_F.pdf
languages     : ['eng']
last_modified : 2025-09-10T16:55:24
page_number   : 1
filetype      : application/pdf
category      : UncategorizedText
element_id    : d6be7c84c90e17d08bcfd9f6daa807ca

4.5 PyPDFium2

  • 특징
    • PDF 렌더링 엔진 기반 추출
    • 법률/공공 PDF 등 특정 도메인에서 강세 (AutoRAG 실험에서도 좋은 결과)
    • 이미지 처리 및 텍스트 추출 기능 제공
  • 활용 포인트
    • 법률/공공 문서 처리
    • PyPDF2보다 더 정밀한 텍스트 추출 필요할 때
from langchain_community.document_loaders import PyPDFium2Loader

# PyPDFium2 로더 인스턴스 생성
loader = PyPDFium2Loader(FILE_PATH)

# 데이터 로드
docs = loader.load()

# 문서의 내용 출력
print(docs[10].page_content[:300])

 

출력 결과:

SPRi AI Brief | 
2023-12월호
8
코히어, 데이터 투명성 확보를 위한 데이터 출처 탐색기 공개
n 코히어와 12개 기관이 광범위한 데이터셋에 대한 감사를 통해 원본 데이터 출처, 재라이선스 상태, 작성자 등 다양한 정보를 제공하는 ‘데이터 출처 탐색기’ 플랫폼을 출시
n 대화형 플랫폼을 통해 개발자는 데이터셋의 라이선스 상태를 쉽게 파악할 수 있으며 데이터셋의 
구성과 계보도 추적 가능
KEY Contents
£ 데이터 출처 탐색기, 광범위한 데이터셋 정보 제공을 통해 데이터 투명성 향상
n AI 기업 코히어(Co
/Users/jeongjiwon/Library/Caches/pypoetry/virtualenvs/langchain-kr-1ZhpxXXh-py3.11/lib/python3.11/site-packages/pypdfium2/_helpers/textpage.py:80: UserWarning: get_text_range() call with default params will be implicitly redirected to get_text_bounded()
  warnings.warn("get_text_range() call with default params will be implicitly redirected to get_text_bounded()")
show_metadata(docs)

 

출력 결과:

[metadata]
['title', 'author', 'subject', 'keywords', 'creator', 'producer', 'creationdate', 'moddate', 'source', 'total_pages', 'page']

[examples]
title        : 
author       : dj
subject      : 
keywords     : 
creator      : Hwp 2018 10.0.0.13462
producer     : Hancom PDF 1.3.0.542
creationdate : 2023-12-08T13:28:38+09:00
moddate      : 2023-12-08T13:28:38+09:00
source       : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
total_pages  : 23
page         : 0

4.6 PDFMiner

  • 특징
    • 오래된 라이브러리지만 여전히 한국어 PDF에서 강력
    • AutoRAG 실험에서도 상위권
    • 다만 속도는 느린 편
  • 활용 포인트
    • 한국어 PDF 품질이 중요한 경우
    • 속도보다는 정확도가 중요한 도메인
from langchain_community.document_loaders import PDFMinerLoader

# PDFMiner 로더 인스턴스 생성
loader = PDFMinerLoader(FILE_PATH)

# 데이터 로드
docs = loader.load()

# 문서의 내용 출력
print(docs[0].page_content[:300])

 

출력 결과:

2023년  12월호
2023년  12월호

Ⅰ.  인공지능  산업  동향  브리프

  1.  정책/법제 

      ▹  미국,  안전하고  신뢰할  수  있는  AI  개발과  사용에  관한  행정명령  발표    ························· 1

      ▹  G7,  히로시마  AI  프로세스를  통해  AI  기업  대상  국제  행동강령에  합의 ··························· 2

      ▹  영국  AI  안전성  정상회의에  참가한  28개국,  AI  위험에  공동

4.7 PyPDF 디렉토리

from langchain_community.document_loaders import PyPDFDirectoryLoader

# 디렉토리 경로
loader = PyPDFDirectoryLoader("data/")

# 문서 로드
docs = loader.load()

# 문서의 개수 출력
print(len(docs)) >> 23
# 문서의 내용 출력
print(docs[22].page_content[:300])

 

출력 결과:

홈페이지 : <https://spri.kr/>
보고서와 관련된 문의는 AI정책연구실 (jayoo@spri.kr, 031-739-7352) 으로 연락주시기 바랍니다 .

4.8 PDFPlumber

  • 특징
    • 표(table) 추출에 특히 강력
    • 한국어 문서 추출 성능도 우수
    • PDFMiner 기반이지만 레이아웃 해석을 보완
  • 활용 포인트
    • 표, 레이아웃이 많은 한국어 문서
    • 금융 보고서, 논문, 행정 문서

즉, PyMuPDF와 마찬가지로, 출력 문서는 PDF와 그 페이지에 대한 자세한 메타 데이터를 포함하며, 페이지 당 하나의 문서를 반환합니다.

from langchain_community.document_loaders import PDFPlumberLoader

# PDF 문서 로더 인스턴스 생성
loader = PDFPlumberLoader(FILE_PATH)

# 문서 로딩
docs = loader.load()

# 첫 번째 문서 데이터 접근
print(docs[10].page_content[:300])

 

출력 결과:

SPRi AI Brief |
2023-12월호
코히어, 데이터 투명성 확보를 위한 데이터 출처 탐색기 공개
KEY Contents
n 코히어와 12개 기관이 광범위한 데이터셋에 대한 감사를 통해 원본 데이터 출처, 재라이선스 상태,
작성자 등 다양한 정보를 제공하는 ‘데이터 출처 탐색기’ 플랫폼을 출시
n 대화형 플랫폼을 통해 개발자는 데이터셋의 라이선스 상태를 쉽게 파악할 수 있으며 데이터셋의
구성과 계보도 추적 가능
£데이터 출처 탐색기, 광범위한 데이터셋 정보 제공을 통해 데이터 투명성 향상
n AI 기업 코히어(Cohere)
show_metadata(docs)

 

출력 결과:

[metadata]
['source', 'file_path', 'page', 'total_pages', 'Author', 'Creator', 'Producer', 'CreationDate', 'ModDate', 'PDFVersion']

[examples]
source      : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
file_path   : ./data/SPRI_AI_Brief_2023년12월호_F.pdf
page        : 0
total_pages : 23
Author      : dj
Creator     : Hwp 2018 10.0.0.13462
Producer    : Hancom PDF 1.3.0.542
CreationDate: D:20231208132838+09'00'
ModDate     : D:20231208132838+09'00'
PDFVersion  : 1.4

마무리

이번 글에서는 LangChain에서 PDF Document Loader를 활용해 문서를 Document(page_content, metadata) 형태로 표준화하고, 한국어 문서 기준으로 어떤 로더가 언제 유리한지 실제 예시와 함께 살펴봤습니다. 핵심만 정리하면 아래와 같습니다.

핵심 요약

  • 표준화된 Document 포맷 덕분에 이후 단계(텍스트 분할 → 임베딩 → 벡터스토어)로 자연스럽게 이어집니다.
  • 로더 선택이 품질을 좌우합니다. 한국어 PDF 기준으로는 PDFMiner / PDFPlumber가 일관되게 안정적이며, PyPDFium2는 법률·공공 문서에서 강세를 보였다. (AutoRAG 실험 참고)
  • 속도 vs 품질 vs 구조 보존의 트레이드오프가 있다.
    • 속도 최우선 → PyMuPDF
    • 표·레이아웃 보존 → PDFPlumber / Unstructured
    • 스캔/OCR 필요 → PyPDF(+OCR)
    • 도메인 특화(법/공공) → PyPDFium2
  • 메타데이터(source, page, total_pages, 생성·수정 시각 등)를 적극 활용하면 검색 결과의 출처 추적성신뢰성이 크게 좋아진다.

오늘도 확실히 배웠습니다!!

 

읽어주셔서 감사합니다.

728x90
반응형

+ Recent posts