Skip to content

gripskrieg/Dreams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Basic Analysis of Dream Data (MATLAB Live Script)

This repository contains a MATLAB live script for doing a quick exploratory text analysis of dream journal entries stored in a plain text file (dreams.txt).

The script:

  • Loads all dream text from dreams.txt
  • Cleans and normalises the text (tokenisation, stop-word removal, lemmatisation, etc.)
  • Builds visualisations:
    • Word cloud from raw text
    • Word cloud from a bag-of-words model
    • Top word frequency table and stacked plot
  • Computes VADER sentiment scores to estimate the overall emotional tone of the dreams

The script is designed to run on MATLAB R2020b or later.


Files

  • <your_live_script>.mlx MATLAB Live Script containing the code you provided (copy the .m code into a new live script and save it with any name you like, e.g. DreamAnalysis.mlx).

  • dreams.txt Plain text file containing dream entries (one or more entries, any length). This file must be in the same folder as the live script or on the MATLAB search path.


Requirements

MATLAB Version

  • MATLAB R2020b or later

Toolboxes

The script uses several functions from the Text Analytics Toolbox and core MATLAB:

  • extractFileText
  • tokenizedDocument
  • stopWords
  • removeWords
  • addPartOfSpeechDetails
  • normalizeWords
  • erasePunctuation
  • removeStopWords
  • removeShortWords
  • removeLongWords
  • bagOfWords
  • topkwords
  • wordcloud
  • stackedplot
  • vaderSentimentScores

Make sure the Text Analytics Toolbox is installed and licensed in your MATLAB environment.


Input Data: dreams.txt

  • Place dreams.txt in the same directory as your live script (recommended), or elsewhere on the MATLAB path.
  • Format:
    • Plain text file (UTF-8 recommended).
    • Each dream can be on:
      • Its own line, or
      • Multiple lines, or
      • All dreams in a single block of text.
  • The script assumes:
    • Dates, punctuation and small words are removed later in the preprocessing step.
    • Any numbers (e.g. dates like 2024-10-01) will be stripped out by a regular expression.

Example (simple) structure for dreams.txt:

I was walking through a forest made of glass. A strange light followed me.
I was back at school, but everyone spoke in riddles.
I dreamed of a city floating in the sky, full of libraries and trains.

About

Basic MATLAB text-mining and sentiment analysis of dream journal entries using dreams.txt. Generates word clouds, frequency plots, and VADER sentiment scores from preprocessed dream text (MATLAB R2020b+).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors