IFinancialNLPModel<T>

Interfaces · AiDotNet.Finance.Interfaces

Interface for financial Natural Language Processing models.

Implements: IFullModel<T, Tensor<T>, Tensor<T>>

Known implementations: FinancialNLPModelBase<T>

For Beginners

Financial NLP models analyze text documents like:

  • News Articles: Analyze market sentiment from financial news
  • SEC Filings: Extract information from 10-K, 10-Q, 8-K filings
  • Earnings Calls: Process transcripts for sentiment and key information
  • Social Media: Monitor Twitter/Reddit for market-moving sentiment
  • Analyst Reports: Extract recommendations and price targets

These models convert unstructured text into structured signals that can inform trading decisions, risk assessment, and market analysis.

Common Use Cases:

  • Sentiment scoring of news to predict price movements
  • Named entity recognition for company names, stock tickers
  • Document classification (earnings, M&A, legal, regulatory)
  • Relationship extraction from financial documents

How It Works

This interface extends IFullModel with NLP-specific capabilities for processing financial text, including sentiment analysis, entity extraction, and text classification.

Properties

Property Summary
bool SupportsTraining { get; } Gets whether training is supported (only in native mode).
bool UseNativeMode { get; } Gets whether this model uses native mode (true) or ONNX mode (false).
int HiddenDimension { get; } Gets the hidden dimension of the model.
int MaxSequenceLength { get; } Gets the maximum sequence length (in tokens) that the model can process.
int NumSentimentClasses { get; } Gets the number of sentiment classes the model predicts.
int VocabularySize { get; } Gets the vocabulary size of the model’s tokenizer.

Methods

Method Summary
Dictionary<string, T> GetFinancialMetrics() Gets financial-specific NLP metrics from the model.
SentimentResult<T>[] AnalyzeSentiment(string[] texts) Analyzes sentiment from raw text strings.
Tensor<T> AnalyzeSentiment(Tensor<T> tokenIds) Analyzes sentiment from raw text strings.
Tensor<T> GetEmbeddings(Tensor<T> tokenIds) Gets embeddings (vector representations) for input tokens.
Tensor<T> GetSequenceEmbedding(Tensor<T> tokenIds) Gets the [CLS] token embedding representing the entire input sequence.
int[] Tokenize(string text, int? maxLength) Tokenizes raw text into token IDs.
string Detokenize(int[] tokenIds) Converts token IDs back to text.