Fix fetchAnnotations documentation mismatches

Change-Id: I2dc7bc69ce64492780ee1f67fea03e00bbc034ba
diff --git a/R/KorAPQuery.R b/R/KorAPQuery.R
index db44f17..765e4bf 100644
--- a/R/KorAPQuery.R
+++ b/R/KorAPQuery.R
@@ -68,7 +68,13 @@
 setGeneric("fetchAll", function(kqo, ...) standardGeneric("fetchAll"))
 setGeneric("fetchNext", function(kqo, ...) standardGeneric("fetchNext"))
 setGeneric("fetchRest", function(kqo, ...) standardGeneric("fetchRest"))
-setGeneric("fetchAnnotations", function(kqo, ...) standardGeneric("fetchAnnotations"))
+setGeneric(
+  "fetchAnnotations",
+  function(kqo,
+           foundry = "tt",
+           overwrite = FALSE,
+           verbose = kqo@korapConnection@verbose) standardGeneric("fetchAnnotations")
+)
 setGeneric("frequencyQuery", function(kco, ...) standardGeneric("frequencyQuery"))
 
 maxResultsPerPage <- 50
@@ -1119,7 +1125,6 @@
 #'
 #' @family corpus search functions
 #' @concept Annotations
-#' @aliases fetchAnnotations
 #'
 #' @param kqo object obtained from [corpusQuery()] with collected matches. Note: the original corpus query should have `metadataOnly = FALSE` for annotation parsing to work.
 #' @param foundry string specifying the foundry to use for annotations (default: "tt" for Tree-Tagger)
@@ -1128,7 +1133,7 @@
 #'   and preserve already fetched ones (e.g., keep POS/lemma from a previous
 #'   foundry while adding morph from another).
 #' @param verbose print progress information if true
-#' @return The updated `kqo` object with annotation columns 
+#' @return The updated `kqo` object with annotation columns
 #' like `pos`, `lemma`, `morph` (and `atokens` and `annotation_snippet`)
 #' in the `@collectedMatches` slot. Each column is a data frame
 #' with `left`, `match`, and `right` columns containing list vectors of annotations
@@ -1155,12 +1160,16 @@
 #' # Data frame with left/match/right columns for morphological tags
 #' atokens <- q@collectedMatches$atokens
 #' # Data frame with left/match/right columns for annotation token text
-#' raw_snippet <- q@collectedMatches$annotation_snippet[[i]] # Original XML snippet for match i
+#' # Original XML snippet for match i
+#' raw_snippet <- q@collectedMatches$annotation_snippet[[i]]
 #'
 #' # Access specific components:
-#' match_pos <- q@collectedMatches$pos$match[[i]]     # POS tags for the matched tokens in match i
-#' left_lemmas <- q@collectedMatches$lemma$left[[i]]  # Lemmas for the left context in match i
-#' right_tokens <- q@collectedMatches$atokens$right[[i]] # Token text for the right context in match i
+#' # POS tags for the matched tokens in match i
+#' match_pos <- q@collectedMatches$pos$match[[i]]
+#' # Lemmas for the left context in match i
+#' left_lemmas <- q@collectedMatches$lemma$left[[i]]
+#'  # Token text for the right context in match i
+#' right_tokens <- q@collectedMatches$atokens$right[[i]]
 #'
 #' # Use a different foundry (e.g., MarMoT)
 #' q <- KorAPConnection() |>
@@ -1170,14 +1179,16 @@
 #'   fetchAnnotations(foundry = "marmot")
 #' q@collectedMatches$pos$left[1] # POS tags for the left context of the first match
 #' }
-#' @usage fetchAnnotations(kqo, foundry = "tt", overwrite = FALSE,
-#'   verbose = kqo@korapConnection@verbose)
 #' @export
-setMethod("fetchAnnotations", "KorAPQuery", function(kqo, foundry = "tt", overwrite = FALSE, verbose = kqo@korapConnection@verbose) {
-  if (is.null(kqo@collectedMatches) || nrow(kqo@collectedMatches) == 0) {
-    warning("No collected matches found. Please run fetchNext() or fetchAll() first.")
-    return(kqo)
-  }
+setMethod("fetchAnnotations", "KorAPQuery", function(kqo,
+																											 foundry = "tt",
+																											 overwrite = FALSE,
+																											 verbose = kqo@korapConnection@verbose) {
+	if (is.null(kqo@collectedMatches) ||
+			nrow(kqo@collectedMatches) == 0) {
+		warning("No collected matches found. Please run fetchNext() or fetchAll() first.")
+		return(kqo)
+	}
 
   df <- kqo@collectedMatches
   kco <- kqo@korapConnection
@@ -1188,7 +1199,7 @@
 
   # Pre-compute the empty character vector list to avoid repeated computation
   empty_char_list <- I(replicate(nrows, character(0), simplify = FALSE))
-  
+
   # Helper function to create annotation data frame structure
   create_annotation_df <- function(empty_list) {
     data.frame(
diff --git a/man/fetchAnnotations-KorAPQuery-method.Rd b/man/fetchAnnotations-KorAPQuery-method.Rd
index ea00bcb..99f20e4 100644
--- a/man/fetchAnnotations-KorAPQuery-method.Rd
+++ b/man/fetchAnnotations-KorAPQuery-method.Rd
@@ -2,11 +2,14 @@
 % Please edit documentation in R/KorAPQuery.R
 \name{fetchAnnotations,KorAPQuery-method}
 \alias{fetchAnnotations,KorAPQuery-method}
-\alias{fetchAnnotations}
 \title{Fetch annotations for all collected matches}
 \usage{
-\S4method{fetchAnnotations}{KorAPQuery}(kqo, foundry = "tt", overwrite = FALSE,
-  verbose = kqo@korapConnection@verbose)
+\S4method{fetchAnnotations}{KorAPQuery}(
+  kqo,
+  foundry = "tt",
+  overwrite = FALSE,
+  verbose = kqo@korapConnection@verbose
+)
 }
 \arguments{
 \item{kqo}{object obtained from \code{\link[=corpusQuery]{corpusQuery()}} with collected matches. Note: the original corpus query should have \code{metadataOnly = FALSE} for annotation parsing to work.}
@@ -70,16 +73,16 @@
 # Data frame with left/match/right columns for morphological tags
 atokens <- q@collectedMatches$atokens
 # Data frame with left/match/right columns for annotation token text
-raw_snippet <- q@collectedMatches$annotation_snippet[[i]]
 # Original XML snippet for match i
+raw_snippet <- q@collectedMatches$annotation_snippet[[i]]
 
 # Access specific components:
-match_pos <- q@collectedMatches$pos$match[[i]]
 # POS tags for the matched tokens in match i
-left_lemmas <- q@collectedMatches$lemma$left[[i]]
+match_pos <- q@collectedMatches$pos$match[[i]]
 # Lemmas for the left context in match i
+left_lemmas <- q@collectedMatches$lemma$left[[i]]
+ # Token text for the right context in match i
 right_tokens <- q@collectedMatches$atokens$right[[i]]
-# Token text for the right context in match i
 
 # Use a different foundry (e.g., MarMoT)
 q <- KorAPConnection() |>
diff --git a/man/fetchAnnotations.Rd b/man/fetchAnnotations.Rd
new file mode 100644
index 0000000..e0d79d7
--- /dev/null
+++ b/man/fetchAnnotations.Rd
@@ -0,0 +1,20 @@
+% Please edit documentation in R/KorAPQuery.R if changing API
+\name{fetchAnnotations}
+\alias{fetchAnnotations}
+\title{Fetch annotations (generic)}
+\description{
+S4 generic for fetching token annotations for collected matches. See specific methods, e.g. \code{\link{fetchAnnotations,KorAPQuery-method}}.
+}
+\usage{
+fetchAnnotations(kqo, foundry = "tt", overwrite = FALSE,
+  verbose = kqo@korapConnection@verbose)
+}
+\arguments{
+\item{kqo}{An object on which an annotation fetching method is defined.}
+\item{foundry}{Annotation foundry identifier.}
+\item{overwrite}{Logical flag controlling whether to overwrite existing annotations.}
+\item{verbose}{Logical flag for progress output.}
+}
+\seealso{
+\code{\link{fetchAnnotations,KorAPQuery-method}}
+}