Skip to content

Commit

Permalink
deprecate ìnit_model()`
Browse files Browse the repository at this point in the history
  • Loading branch information
fegue committed Sep 13, 2024
1 parent e07f445 commit 62ac206
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
12 changes: 12 additions & 0 deletions R/birdnetR-deprecated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' Deprecated Functions in the birdnetR Package
#'
#' These functions are deprecated and will be removed in future versions of the birdnetR package.
#' Please use the alternatives listed below.
#'
#' @name birdnetR-deprecated
#' @keywords internal
#' @section Deprecated functions:
#' \describe{
#' \item{\code{\link{init_model}}}{This function is deprecated. Use \code{\link{birdnet_model_tflite}} instead.}
#' }
NULL
29 changes: 11 additions & 18 deletions R/birdnet_interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -317,32 +317,25 @@ birdnet_model_protobuf <- function(version = "v2.4",
#' Initialize the BirdNET Model (Deprecated)
#'
#' This function initializes the BirdNET model (v2.4). It is kept for backward compatibility and is deprecated.
#' Use \code{birdnet_model_tflite()} instead for model initialization.
#' Use [birdnet_model_tflite()] instead for model initialization.
#'
#' @param tflite_num_threads integer. The number of threads to use for TensorFlow Lite operations. If NULL (default), the default threading behavior will be used.
#' Will be coerced to an integer if possible.
#' @param language Character string specifying the language code to use for the model's text processing. The language must be one of the available languages supported by the BirdNET model.
#' @note The `language` parameter must be one of the available languages returned by `available_languages()`.
#' @seealso [available_languages()]
#' @seealso [available_languages()] [birdnet_model_tflite()]
#' @return An instance of the BirdNET model.
#' @export
#' @note This function is kept for backward compatibility. Please use \code{birdnet_model_tflite()} instead.
init_model <-
function(tflite_num_threads = NULL,
language = "en_us") {
# Deprecation warning
warning(
"`init_model()` is deprecated. Please use `birdnet_model_tflite()` instead.",
call. = FALSE
)
#' @note This function is kept for backward compatibility. Please use [birdnet_model_tflite()] instead.
init_model <- function(tflite_num_threads = NULL, language = "en_us") {
.Deprecated("birdnet_model_tflite", package = "birdnetR")
birdnet_model_tflite(
version = "v2.4",
language = language,
tflite_num_threads = tflite_num_threads
)
}

# Call the updated model initialization function
birdnet_model_tflite(
version = "v2.4",
language = language,
tflite_num_threads = tflite_num_threads
)
}


#' Get Available Languages for BirdNET Model
Expand Down
17 changes: 17 additions & 0 deletions man/birdnetR-deprecated.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/init_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 62ac206

Please sign in to comment.