การสรุปข้อความ

การใช้งาน Hugging Face

Jacob H. Marquez

Lead Data Engineer

การสรุปความคืออะไร?

$$

ข้อความขนาดใหญ่

$$

part2.jpg

การใช้งาน Hugging Face

Extractive vs. Abstractive

$$

แบบดึงข้อความ (Extractive):

$$ ✅ คัดเลือกประโยคสำคัญจากข้อความ

$$ ✅ มีประสิทธิภาพ ใช้ทรัพยากรน้อย

$$ ❌ ขาดความยืดหยุ่น อาจไม่ต่อเนื่องกัน

$$

แบบสร้างข้อความใหม่ (Abstractive):

$$ ✅ สร้างข้อความใหม่ที่ถอดความแล้ว

$$ ✅ ชัดเจนและอ่านง่ายกว่า

$$ ❌ ต้องการทรัพยากรและการประมวลผลมากกว่า

การใช้งาน Hugging Face

กรณีใช้งานของ Extractive Summarization

$$

  • 📑 เอกสารกฎหมาย: เน้นข้อกำหนดสำคัญ

$$

$$

$$

  • 💰 การวิจัยทางการเงิน: ดึงข้อมูลเชิงลึก

เอกสารกฎหมาย

การวิจัยทางการเงิน

การใช้งาน Hugging Face

กรณีใช้งานของ Abstractive Summarization

บทความข่าว

Content Recommendations.jpg

$$

  • 📰 บทความข่าว: สร้างสรุปที่กระชับ

$$

$$ $$

  • 📍 การแนะนำเนื้อหา: สร้างคำอธิบายที่น่าสนใจ
การใช้งาน Hugging Face

Extractive Summarization ในทางปฏิบัติ

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

Abstractive Summarization ในทางปฏิบัติ

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...