Textual Analysis & NLP

Accounting Lab Module 4.2

Case Study

Apex Global Logistics (AGL)

In this lab, you will act as a forensic analyst. You must process unstructured MD&A data from 2024 and 2025 to detect shifts in corporate tone regarding AI implementation and supply chain risks using the Bag of Words technique.

Fiscal 2024 vs 2025 Loughran-McDonald

Part 1: The Theory

01 / 07

Financial reports are composed of 80% unstructured text. Natural Language Processing (NLP) allows auditors to quantify qualitative risk disclosures that traditional financial ratios might miss.

1. Tokenization

Computers cannot "read" paragraphs like humans do. Tokenization is the process of breaking a text stream into meaningful elements called tokens. In accounting, this transforms unstructured MD&A text into structured rows of data that can be analyzed.

Raw: "Sales fell."  →  Tokens: ["Sales", "fell", "."]

2. Stop Word Removal

Common words (e.g., "the", "and", "is", "at") appear frequently but carry no financial sentiment. These are called Stop Words. We filter them out to increase the "signal-to-noise" ratio, allowing us to focus on words that impact value (e.g., "loss", "gain", "risk").

3. Bag of Words (BoW)

The Bag of Words model simplifies text by disregarding grammar and word order, treating the document as a "bag" of tokens. We simply count the frequency of positive vs. negative words against a domain-specific dictionary (like Loughran-McDonald).

Why it matters: Even without context, a high frequency of words like "litigation" or "impairment" in a 10-K strongly correlates with future financial distress.

Part 1.5: Applied Logic

02 / 07

How Sentiment is Calculated

1. The Text

"The innovative strategy improved profits, though litigation risks remain."

2. Dictionary Match

innovativePositive Word
improvedPositive Word
litigationNegative Word
strategy/risksNeutral (Ignore)

3. The Formula

(Pos_Count - Neg_Count) / Total_Hits
(2 - 1) / (2 + 1) = 0.33

Result: Moderately Optimistic

Try It Yourself

Dictionary: efficient (Positive) loss (Negative) others (Ignore)

Click analyze to process this sample sentence using the dictionary above.

The efficient team avoided loss.
Result: (1 - 1) / (1 + 1) = 0.00 (Neutral)

Academic Context

Financial Sentiment: Authors Tim Loughran and Bill McDonald (Notre Dame) revolutionized the field by creating a domain-specific dictionary for accounting. They noted that words like 'liability' are negative in standard English but neutral in financial statements.

Social Media: Early research used Yahoo forums, while recent studies focus on Twitter and StockTwits. Twitter provides instantaneous information, such as predicting stock market reactions to FOMC meetings based on tweet sentiment. Researchers have found that while social media represents a small percentage of traders, its sentiment (especially negative) significantly impacts market liquidity.

Political Bias: Textual analysis is used to measure partisan differences in the speech of U.S. Congress members and financial regulators. For example, SEC Commissioners have shown an increasing trend in partisan language since the mid-1970s.

Fraud Detection: Specific vocabulary choices and topics in MD&A sections of 10-K filings can help predict accounting fraud. Managers committing fraud often disassociate their names from deceptive plans and may unintentionally transfer linguistic cues from fraudulent memos into their reports.

Part 2: The Corpus

03 / 07

Instructions

Copy the text blocks below into Excel or Power BI as your raw corpus. Detailed data processing steps are located in Part 4.

FY 2025 (Current Year)

Management Discussion and Analysis 2025. Fiscal 2025 marked a pivotal turnaround for Apex Global. We successfully executed our strategic integration of autonomous AI systems, leading to substantial efficiency gains across our logistics network. While inflation remains a concern, our ability to streamline operations helped stabilize margins. We see a tremendous opportunity in the electric vehicle transport sector, which has become a lucrative revenue stream. Innovation in our software stack has enabled us to better manage inventory, reducing waste. Despite geopolitical tension, we remain optimistic about our trajectory. The enhancement of our digital infrastructure is a major achievement that will empower our workforce and benefit shareholders.

FY 2024 (Prior Year)

Management Discussion and Analysis 2024. The operating environment in 2024 was characterized by persistent volatility and severe headwinds. We suffered a decline in volume due to the global economic slowdown. Rising fuel costs continued to burden our bottom line, resulting in a net loss for the third quarter. Supply chain disruption caused unwanted delays, forcing us to abandon several low-margin routes. We face ongoing litigation regarding labor disputes which creates uncertainty for future cash flows. The deterioration of demand in European markets acted as a significant constraint on growth. We fear that without correction, these adverse conditions may aggravate our liquidity position.

Part 3: The Dictionary

Loughran-McDonald Financial Sentiment (Subset)

04 / 07

The full dictionary is accessible through the Loughran-McDonald Master Dictionary website.

Word Sentiment

Part 4: The Process

05 / 07
1

Setup & Clean (Power Query)

Create an Excel table. Column A (ID): Manually type "Apex 2025" (or 2024). Column B (Text): Paste the copied MD&A data.

Before splitting:

  • Right-click [MD&A Text] → Replace Values.
  • Find punctuation (. , " ') and replace with (empty) to clean the text.
2

Tokenize (Split to Rows)

Right-click [MD&A Text] → Split Column → By Delimiter (Space).
Important: Expand 'Advanced Options' and select Split into Rows. Finally, transform the column to Lowercase and Trim.

3

Merge Queries

Perform a Merge between Token Table (Left) and Dictionary (Right). Use Left Outer Join. Expand [Sentiment]. Filter out null rows.

4

Calculate Tone (Group & Pivot)

  1. Group By: Advanced → Group by [Year] and [Sentiment]. Aggregation: Count Rows.
  2. Pivot Column: Select [Sentiment] → Pivot Column. Values: [Count].
  3. Clean Nulls: Select [Positive] and [Negative] columns → Replace Values (null → 0).
  4. Add Custom Column: Formula:
    ([Positive] - [Negative]) / ([Positive] + [Negative])

Part 5: Solution

FY 2025 (Current)

+0.88 Strongly Positive

Score Logic: (15 Positive - 1 Negative) / 16 Total = 0.875

Dominant Tokens: Efficiency, Opportunity, Innovation, Enhancement, Lucrative.
Interpretation: Management is signaling successful restructuring and AI integration.

FY 2024 (Prior)

-1.00 Strongly Negative

Score Logic: (0 Positive - 15 Negative) / 15 Total = -1.00

Dominant Tokens: Volatility, Decline, Burden, Loss, Litigation, Uncertainty.
Interpretation: Clear indicators of financial distress and macro-economic pressure.

Note on Dictionary Limitations

While the sentiment score accurately captures the shift in tone, standard dictionaries like Loughran-McDonald do not yet include terms like "AI" or "Autonomous". An advanced analysis would require a custom dictionary to capture the positive sentiment associated with these specific technological investments.

Solution Locked

Toggle switch to reveal

Copied to Clipboard