An Artificial Intelligence–Based Framework for Automated Framing Analysis of Online Media Texts
Description
This workflow began with the manual collection of 114 news articles (2022-2025), which were saved in PDF format. These articles were then converted into raw text (.txt) files using the ocr_pdftotxt.r script with RStudio, which leverages the tesseract package for Optical Character Recognition (OCR). Subsequently, the buat_corpus_baru_txt.r script was used to create a quanteda corpus object from the .txt files with RStudio, while also performing initial pre-processing (tokenisation, stopword removal, etc.). A word frequency table was then generated using buat_tabel_rds.r and further refined by normalising synonyms (ganti_sinonim_dgn_list.r) and removing irrelevant words (hapus_kata_dgn_list.r). From this clean table, 98 keywords were selected and manually classified into Entman's four framing dimensions (problem definition, causal interpretation, moral evaluation, and treatment recommendation), with the results saved in separate .csv files for each dimension. To reproduce the final network visualisations using RStudio, run the corresponding vis_fcm_*.r script (e.g., vis_fcm_problem_definition.r), which will filter the original corpus based on the keyword list for that dimension and generate a Feature Co-occurrence Matrix (FCM) using the quanteda package.
Files
Steps to reproduce
The dataset and associated analyses were generated using a sequential workflow in RStudio. The steps below outline the process from raw data collection to final visualisation. 1) Data Collection (Manual): The process began with the manual collection of 114 news articles (published 2022-2025) from 26 local online media outlets. Articles were identified via Google searches using keywords related to "IPLM," "indeks literasi," and "DPK Cilegon," then saved individually in PDF format. 2) Corpus Preparation (PDF to TXT Conversion): The 114 PDF articles were converted into machine-readable plain text (.txt) files. This was performed using the ocr_pdftotxt.r script, which leverages the tesseract and pdftools packages in R for Optical Character Recognition (OCR). This step creates the foundational text corpus. 3) Corpus Creation and Pre-processing: The raw .txt files were used to build a formal corpus object. The buat_corpus_baru_txt.r script was used to import the texts with the readtext package and create a quanteda corpus. This script also performs initial pre-processing, including tokenisation, conversion to lowercase, and removal of punctuation, numbers, symbols, and Indonesian stopwords. The processed corpus object was saved as an RDS file for subsequent steps. 4) Keyword Table Generation and Cleaning: A master table of keyword statistics was generated and refined through several scripts: a) First, buat_tabel_rds.r was used to load the processed corpus and create a comprehensive frequency table using quanteda.textstats, calculating word and document frequencies; b) Next, ganti_sinonim_dgn_list.r was executed to normalise the data by merging synonyms based on a predefined list (sinonim_kata.txt); c) Then, hapus_kata_dgn_list.r was run to filter out irrelevant or noisy words based on another predefined list (hapus_kata.txt); and d) Finally, the resulting clean table was exported to CSV format using the simpan_dan_ekspor_file.r script. 5) Manual Coding: From the clean keyword table, 98 keywords were selected based on high frequency and conceptual relevance. These 98 keywords were then manually coded into one or more of Entman's four framing dimensions, resulting in separate keyword lists (e.g., kata_problem2.csv, kata_causal2.csv, etc.) for each dimension. This manually coded data is central to the final dataset. 6) Reproducing the Network Visualisations (FCM): The network graphs for each framing dimension were generated using a set of specific scripts: vis_fcm_problem_definition.r, vis_fcm_causal_interpretation.r, vis_fcm_moral_evaluation.r, and vis_fcm_treatment_recommendation.r. Each script follows the same workflow: it reads the raw .txt corpus, tokenises it, filters the tokens to keep only the keywords from the corresponding dimension's list, builds a Feature Co-occurrence Matrix (FCM) with a window of 3, and then generates a network plot using textplot_network from the quanteda.textplots package.
Institutions
- Universitas PadjadjaranJawa Barat, Bandung