% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/semantic_analysis.R
\name{calculate_document_similarity}
\alias{calculate_document_similarity}
\title{Calculate Document Similarity}
\usage{
calculate_document_similarity(
  texts,
  document_feature_type = "words",
  semantic_ngram_range = 2,
  similarity_method = "cosine",
  use_embeddings = FALSE,
  embedding_model = "all-MiniLM-L6-v2",
  calculate_metrics = TRUE,
  verbose = TRUE
)
}
\arguments{
\item{texts}{A character vector of texts to compare.}

\item{document_feature_type}{Feature extraction type: "words", "ngrams", or "embeddings".}

\item{semantic_ngram_range}{Integer, n-gram range for ngram features (default: 2).}

\item{similarity_method}{Similarity calculation method: "cosine", "jaccard", "euclidean", "manhattan".}

\item{use_embeddings}{Logical, use embedding-based similarity (default: FALSE).}

\item{embedding_model}{Sentence transformer model name (default: "all-MiniLM-L6-v2").}

\item{calculate_metrics}{Logical, compute similarity metrics (default: TRUE).}

\item{verbose}{Logical, if TRUE, prints progress messages.}
}
\value{
A list containing:
\describe{
\item{similarity_matrix}{N x N similarity matrix}
\item{feature_matrix}{Document feature matrix used for calculation}
\item{method_info}{Information about the method used}
\item{metrics}{Similarity metrics (if calculate_metrics = TRUE)}
\item{execution_time}{Time taken for analysis}
}
}
\description{
Calculates similarity between documents using traditional NLP methods or
modern embedding-based approaches. Metrics are automatically
computed unless disabled.
}
\examples{
\donttest{
  data(SpecialEduTech)
  texts <- SpecialEduTech$abstract[1:5]

  result <- calculate_document_similarity(
    texts = texts,
    document_feature_type = "words",
    similarity_method = "cosine"
  )

  print(result$similarity_matrix)
  print(result$metrics)
}
}
\concept{semantic}
\keyword{internal}
