Classifying Financial Texts into Pre-defined Subdomains

Classifying Financial Texts into Pre-defined Subdomains
Source: Freepik vis freepik licence

Natural Language Processing (NLP) allows us to automatically analyse and categorise textual data. With the help of GenAI, even complex classification tasks can now be executed using just a well-designed prompt. In this post, we present a practical example where GenAI classifies financial-related sentences into domain-specific categories, showcasing how effective and accessible prompt-based NLP has become.

In the prompt, we specified nine distinct categories: Stock Market, Banking, Investment, Economy, Corporate Finance, Cryptocurrency, Real Estate, Insurance, and Personal Finance. To evaluate the classification capabilities of GenAI, we tested the prompt on a set of 25 example sentences covering a wide range of financial topics.

Prompt

Financial Text Classification Task

Please read the following sentences and classify each sentence into one of the specified financial categories. The categories include:

  • Stock Market – Sentences related to stock prices, trading activities, or stock exchanges.
  • Banking – Sentences about bank operations, loans, interest rates, or banking services.
  • Investment – Sentences that mention investments, investment strategies, or portfolio management.
  • Economy – Sentences discussing economic indicators, GDP, inflation, or economic policies.
  • Corporate Finance – Sentences related to corporate mergers, acquisitions, financial statements, or corporate funding.
  • Cryptocurrency – Sentences about Bitcoin, Ethereum, blockchain technology, or other digital currencies.
  • Real Estate – Sentences that focus on property markets, real estate investments, or housing prices.
  • Insurance – Sentences discussing insurance policies, claims, premiums, or risk management.
  • Personal Finance – Sentences regarding budgeting, saving, personal loans, or credit scores.

<begin>

"The S&P 500 index rose by 2% today, marking a significant recovery in the stock market."

"The central bank has decided to increase the interest rate by 0.25% to curb inflation."

"Investors are advised to diversify their portfolios to mitigate risk during market volatility."

"The real estate market has seen a surge in property prices over the past year."

"Blockchain technology is revolutionizing the way digital transactions are conducted."

"Bitcoin's value dropped by 10% in the last 24 hours amid market uncertainty."

"The new tax policy is expected to boost economic growth by attracting foreign investments."

"Many banks are now offering digital wallets as a part of their online banking services."

"Gold is considered a safe investment during times of economic instability."

"The company's quarterly earnings report showed a significant increase in profits."

"Real estate developers are focusing on building more affordable housing units."

"Cryptocurrency regulations are being tightened to prevent illegal transactions."

"The government announced a stimulus package to support small businesses affected by the pandemic."

"An increase in oil prices has led to higher transportation costs for many companies."

"Life insurance policies can provide financial security for your family in case of an emergency."

"The Dow Jones Industrial Average reached an all-time high last week."

"Venture capitalists are looking to invest in innovative tech startups."

"Rising inflation is causing concern among economists and policymakers."

"The merger between the two companies is expected to create a market leader in the industry."

"Cybersecurity has become a top priority for financial institutions to protect customer data."

"Interest rates on personal loans have decreased, making it cheaper to borrow money."

"The housing market boom has resulted in increased demand for real estate agents."

"Many investors are turning to ESG (Environmental, Social, and Governance) funds for sustainable investment options."

"Credit card companies are offering cashback rewards to attract more customers."

"The central bank's decision to inject liquidity into the economy has stabilized the financial markets."

<end>

Output

Sentence Classification by Financial Category

Here’s the classification of each sentence into the specified financial categories:

  1. "The S&P 500 index rose by 2% today, marking a significant recovery in the stock market." – Stock Market
  2. "The central bank has decided to increase the interest rate by 0.25% to curb inflation." – Banking
  3. "Investors are advised to diversify their portfolios to mitigate risk during market volatility." – Investment
  4. "The real estate market has seen a surge in property prices over the past year." – Real Estate
  5. "Blockchain technology is revolutionizing the way digital transactions are conducted." – Cryptocurrency
  6. "Bitcoin's value dropped by 10% in the last 24 hours amid market uncertainty." – Cryptocurrency
  7. "The new tax policy is expected to boost economic growth by attracting foreign investments." – Economy
  8. "Many banks are now offering digital wallets as a part of their online banking services." – Banking
  9. "Gold is considered a safe investment during times of economic instability." – Investment
  10. "The company's quarterly earnings report showed a significant increase in profits." – Corporate Finance
  11. "Real estate developers are focusing on building more affordable housing units." – Real Estate
  12. "Cryptocurrency regulations are being tightened to prevent illegal transactions." – Cryptocurrency
  13. "The government announced a stimulus package to support small businesses affected by the pandemic." – Economy
  14. "An increase in oil prices has led to higher transportation costs for many companies." – Corporate Finance
  15. "Life insurance policies can provide financial security for your family in case of an emergency." – Insurance
  16. "The Dow Jones Industrial Average reached an all-time high last week." – Stock Market
  17. "Venture capitalists are looking to invest in innovative tech startups." – Investment
  18. "Rising inflation is causing concern among economists and policymakers." – Economy
  19. "The merger between the two companies is expected to create a market leader in the industry." – Corporate Finance
  20. "Cybersecurity has become a top priority for financial institutions to protect customer data." – Banking
  21. "Interest rates on personal loans have decreased, making it cheaper to borrow money." – Personal Finance
  22. "The housing market boom has resulted in increased demand for real estate agents." – Real Estate
  23. "Many investors are turning to ESG (Environmental, Social, and Governance) funds for sustainable investment options." – Investment
  24. "Credit card companies are offering cashback rewards to attract more customers." – Personal Finance
  25. "The central bank's decision to inject liquidity into the economy has stabilized the financial markets." – Economy

We tested the Grok 3 model on this financial sentence classification task. The model performed well overall, providing accurate and context-sensitive categorisation across a range of topics. It handled distinctions between overlapping areas—such as investment, banking, and corporate finance—with notable precision. The results demonstrate Grok 3’s capability in sentence-level NLP classification.

The authors used Grok 3 [xAI (2025) Grok 3 (accessed on 23 March 2025), Large language model (LLM), available at: https://x.ai/grok] to generate the output.