Code Documentation

Code Documentation

This section provides an overview of the key classes and functions implemented in the WordStream-Extension project. The documentation covers the primary files essential for the extension, including their roles and functionalities.

sentiment.html

Libraries & Frameworks

HTML Structure

JavaScript Functionality

Key Features

File Dependencies

smain.js

Variables

Functions

Classes & IDs

Interactive Elements

Event Listeners

sstyles.css

Wordcloud sentiment.html

The Wordcloud sentiment.html file provides the structure and layout for the Sentiment Cloud visualization within the WordStream-Extension project. It includes the necessary HTML elements, external libraries, and custom scripts to render and interact with the sentiment word cloud.

Wmain.js

The Wmain.js script manages the functionality and interactivity of the Sentiment Cloud visualization within the WordStream-Extension project. It handles data loading, filtering, and rendering of the word cloud based on sentiment analysis.

wstyles.css

The wstyles.css file provides the styling for the Sentiment Cloud visualization within the WordStream-Extension project. It ensures a cohesive and visually appealing user interface by defining styles for various elements and components.

Data Folder

The /data folder contains all datasets used for the WordStream-Extension, along with scripts for preprocessing the data.

The /data/preprocess directory includes Python scripts responsible for cleaning, processing, and preparing raw data for visualization. Each script contains the name of the dataset it preprocesses, the original datasets can be found in /data/raw.

We integrated three new datasets into WordStream: Rotten Tomatoes movie reviews, CNN news articles, and Reddit posts from the /datasets subreddit. The preprocessing pipeline for these datasets included:

Other datasets containing data such as social media posts and fact-check articles were added. However, due to reasons that we were not able to understand, these datasets proved to be difficult to visualize in the WordStream. In order not to waste the effort invested in these datasets, they are only visualizible in the SentimentCloud and SentimentStream tabs.