The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Create a simple journal entry analyzer

Here’s a simple Journal Entry Analyzer implemented in Python. It analyzes a journal entry to extract:

  • Sentiment (positive/negative/neutral)

  • Word count

  • Most common words (excluding stopwords)

  • Date and time of entry (automatically added)

python
import datetime import re from collections import Counter from textblob import TextBlob import nltk from nltk.corpus import stopwords # Download stopwords if not already done nltk.download('stopwords') def analyze_journal_entry(entry: str): # Capture current date and time entry_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Basic cleaning cleaned_entry = re.sub(r'[^ws]', '', entry.lower()) # Tokenize and remove stopwords words = cleaned_entry.split() filtered_words = [word for word in words if word not in stopwords.words('english')] # Word count word_count = len(words) # Most common words word_freq = Counter(filtered_words).most_common(5) # Sentiment analysis using TextBlob blob = TextBlob(entry) polarity = blob.sentiment.polarity if polarity > 0.1: sentiment = "Positive" elif polarity < -0.1: sentiment = "Negative" else: sentiment = "Neutral" # Output results print("Journal Entry Analysis") print("======================") print(f"Date and Time: {entry_time}") print(f"Word Count: {word_count}") print(f"Sentiment: {sentiment} (Polarity Score: {polarity:.2f})") print("Most Common Words:") for word, freq in word_freq: print(f" - {word}: {freq} time(s)") # Example usage if __name__ == "__main__": journal_text = input("Enter your journal entry:n") analyze_journal_entry(journal_text)

Features:

  • Uses TextBlob for sentiment analysis

  • Uses NLTK for stopword filtering

  • Automatically timestamps entries

  • Designed to be simple and extendable

Let me know if you want a version with a GUI or web-based interface.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About