텍스트 요약

Hugging Face 활용하기

Jacob H. Marquez

Lead Data Engineer

요약이란?

$$

긴 텍스트

$$

part2.jpg

Hugging Face 활용하기

추출적 vs. 추상적

$$

추출적:

$$ ✅ 텍스트에서 핵심 문장 선택

$$ ✅ 효율적, 리소스 적게 필요

$$ ❌ 유연성 부족; 결속력 떨어질 수 있음

$$

추상적:

$$ ✅ 새 문장으로 재서술하여 생성

$$ ✅ 더 명확하고 가독성 높음

$$ ❌ 더 많은 리소스와 처리 필요

Hugging Face 활용하기

추출적 요약의 활용 사례

$$

  • 📑 법률 문서: 핵심 조항 하이라이트

$$

$$

$$

  • 💰 재무 리서치: 인사이트 추출

법률 문서

재무 리서치

Hugging Face 활용하기

추상적 요약의 활용 사례

뉴스 기사

콘텐츠 추천.jpg

$$

  • 📰 뉴스 기사: 간결한 요약 생성

$$

$$ $$

  • 📍 콘텐츠 추천: 매력적인 설명 생성
Hugging Face 활용하기

추출적 요약 실습

from transformers import pipeline

# Load the extractive summarization pipeline
summarizer = pipeline("summarization", model="nyamuda/extractive-summarization")
text = "This is my really large text about Data Science..."
summary_text = summarizer(text)
print(summary_text[0]['summary_text'])
"data science is a field that combines mathematics, statistics...."
Hugging Face 활용하기

추상적 요약 실습

from transformers import pipeline

# Load the abstractive summarization pipeline
summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")

text = "This is my really large text about Data Science..." summary_text = summarizer(text) print(summary_text[0]['summary_text'])
"The global data science platform market is projected
 is projected to reach $140.9 billion by 2025..."
Hugging Face 활용하기

요약 파라미터

  • min_new_tokens & max_new_tokens: 요약 길이 제어
summarizer = pipeline(task="summarization", min_new_tokens=10, max_new_tokens=150)
Hugging Face 활용하기

연습해 봅시다!

Hugging Face 활용하기

Preparing Video For Download...