% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/semantic_analysis.R
\name{sentiment_embedding_analysis}
\alias{sentiment_embedding_analysis}
\title{Embedding-based Sentiment Analysis}
\usage{
sentiment_embedding_analysis(
  texts,
  embeddings = NULL,
  model_name = "distilbert-base-uncased-finetuned-sst-2-english",
  doc_names = NULL,
  use_gpu = FALSE
)
}
\arguments{
\item{texts}{Character vector of texts to analyze}

\item{embeddings}{Optional pre-computed embedding matrix (from generate_embeddings)}

\item{model_name}{Sentiment model name (default: "distilbert-base-uncased-finetuned-sst-2-english")}

\item{doc_names}{Optional document names/IDs}

\item{use_gpu}{Whether to use GPU if available (default: FALSE)}
}
\value{
A list containing:
\describe{
\item{document_sentiment}{Data frame with document-level sentiment scores and classifications}
\item{emotion_scores}{NULL (emotion detection not currently supported for embeddings)}
\item{summary_stats}{Summary statistics including document counts and average scores}
\item{model_used}{Name of the transformer model used}
\item{feature_type}{"embeddings"}
}
}
\description{
Performs sentiment analysis using transformer-based embeddings and neural models.
This approach uses pre-trained language models for contextual sentiment detection
without requiring sentiment lexicons. Particularly effective for handling:
\itemize{
\item Complex contextual sentiment
\item Implicit sentiment and sarcasm
\item Domain-specific sentiment
\item Negation and intensifiers (automatically handled by the model)
}
}
\examples{
if (interactive()) {
  abstracts <- TextAnalysisR::SpecialEduTech$abstract[1:10]
  embedding_sentiment <- sentiment_embedding_analysis(abstracts)
  print(embedding_sentiment$document_sentiment)
  print(embedding_sentiment$summary_stats)
}
}
\concept{sentiment}
