MG

muhgalihhh

Back to Works

PENGEMBANGANSISTEMOTOMATISASIWEBSCRAPINGDANRINGKASANBERITAMENGGUNAKANFLASK,NLTK,DANPENDEKATANMETODETF-IDF

Data Science & AnalysisMachine Learning, Data Science & Analysis (Asignment) · Universitas Jenderal Soedirman
HTMLCSSJavaScriptPython
PENGEMBANGAN SISTEM OTOMATISASI WEB SCRAPING DAN RINGKASAN BERITA MENGGUNAKAN FLASK, NLTK, DAN PENDEKATAN METODE TF-IDF screenshot 1

Overview

Keeping up with news across many portals takes time. This project is a Flask web app that scrapes articles from Indonesian news portals and condenses them into short extractive summaries using TF-IDF sentence scoring.

  • Context: Text Mining course research paper, Informatics, Universitas Jenderal Soedirman (December 2024)

  • Team: 2 people

  • Tools: Python, Flask, BeautifulSoup, Requests, NLTK, Sastrawi, HTML, CSS, JavaScript

Pipeline

  1. Scraping: BeautifulSoup and Requests pull the title, author, publish date and body from portals like Detik.com, Kompas.com, CNN Indonesia and Liputan6

  2. Preprocessing: NLTK tokenizes and removes stopwords, and Sastrawi stems Indonesian words

  3. Weighting: every word gets a TF-IDF weight

  4. Scoring: a sentence's score is the sum of its words' TF-IDF weights

  5. Summarizing: the top-scoring sentences are kept up to the chosen percentage, then put back in their original order so the summary reads naturally

The Web App

Users paste a news URL, pick the summary percentage, then scrape, summarize and evaluate with one click each. The result view shows the full article, the summary and its ROUGE scores together.

Worked Example

Detik.com's "Chelsea Jaga Ekspektasi meski Sedang Terbang Tinggi" was split into 10 sentences and scored. At 30%, the three highest-scoring sentences (36.15, 29.35 and 24.17) became the summary.

Evaluation

The system was tested on 10 articles from different portals (detik.com, cnnindonesia.com, liputan6.com and others) at a 30% summary length, using ROUGE against reference summaries.

Metric

Result

Average ROUGE F1

57%

Precision

0.96 to 1.00

Recall

Lower, since a 30% summary leaves out most of the text

High precision means almost every word in a summary is relevant. Recall is capped by the short length, so longer summaries are expected to score higher.

Limitations

  • Summary quality depends on how well the source article is structured

  • Stopword removal and stemming can strip context from complex sentences