본문으로 건너뛰기
🛠️ToolsShed

텍스트 요약기

중요한 문장을 추출하여 긴 텍스트를 요약합니다.

110

이 도구 소개

텍스트 요약 도구는 긴 문서, 기사 또는 보고서에서 가장 중요한 정보를 빠르게 추출하고 핵심 문장을 식별하여 보존합니다. 연구 논문을 검토하는 학생, 여러 문서를 관리하는 전문가, 또는 몇 시간을 들이지 않고 정보를 파악하려는 사람이라면 누구나 이 도구가 필수적입니다.

입력 필드에 텍스트를 붙여넣거나 입력한 후 요약 길이를 필요에 맞게 조정하면, 도구가 가장 중요한 문장들을 지능적으로 식별하여 간결한 형식으로 제시합니다. 브라우저에서 즉시 작동하며 계정이나 외부 서버로의 파일 업로드가 필요 없어, 일상적인 텍스트 축약을 위한 빠르고 안전한 솔루션입니다.

이 도구는 뉴스 기사, 학술 논문, 비즈니스 문서처럼 중요한 정보가 명확하게 표현된 공식적이고 잘 구조화된 콘텐츠에서 가장 잘 작동합니다. 창작물이나 전문 용어가 많은 매우 기술적인 내용의 경우 결과가 달라질 수 있으므로, 요약본이 원본의 중요한 세부 사항을 놓치지 않았는지 항상 비교해 보는 것이 좋습니다.

자주 묻는 질문

코드 구현

# Extractive text summarization (TF-based)
import re
from collections import Counter

STOP_WORDS = {
    "the", "a", "an", "and", "or", "but", "in", "on", "at", "to", "for",
    "of", "with", "by", "from", "is", "was", "are", "were", "be", "been",
    "has", "have", "had", "do", "does", "did", "will", "would", "could",
    "should", "that", "this", "it", "its", "he", "she", "they", "we", "you",
    "i", "not", "no", "as", "if", "so", "than", "then", "more", "most",
}

def tokenize_sentences(text: str) -> list[str]:
    sentences = re.split(r'(?<=[.!?])\s+', text.strip())
    return [s.strip() for s in sentences if len(s.strip()) > 10]

def word_frequency(sentences: list[str]) -> dict[str, int]:
    words = re.findall(r"[a-z']+", " ".join(sentences).lower())
    return Counter(w for w in words if w not in STOP_WORDS and len(w) > 2)

def score_sentences(sentences: list[str], freq: dict[str, int]) -> list[float]:
    scores = []
    n = len(sentences)
    for i, sentence in enumerate(sentences):
        words = re.findall(r"[a-z']+", sentence.lower())
        score = sum(freq.get(w, 0) for w in words)
        if words:
            score /= len(words)  # normalize by length
        # Position weight
        rel_pos = i / max(n - 1, 1)
        if rel_pos <= 0.2:
            score *= 1.4
        elif rel_pos >= 0.8:
            score *= 1.2
        scores.append(score)
    return scores

def summarize(text: str, num_sentences: int = 3) -> str:
    sentences = tokenize_sentences(text)
    if len(sentences) <= num_sentences:
        return text

    freq = word_frequency(sentences)
    scores = score_sentences(sentences, freq)

    # Get top-N sentence indices, sort by original position
    ranked = sorted(range(len(scores)), key=lambda i: -scores[i])[:num_sentences]
    selected = sorted(ranked)

    return " ".join(sentences[i] for i in selected)

# Example
text = """..."""  # Your long text here
print(summarize(text, num_sentences=3))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.