Skip to content

Commit

Permalink
UPDATE
Browse files Browse the repository at this point in the history
  • Loading branch information
davidycliao committed Dec 30, 2024
1 parent a3b2431 commit e23a912
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion R/flair_nn.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ flair_nn <- function() {

#' @title Initializing a Class for Flair Classifier
#'
#' @description This function interfaces with Python via the {reticulate} package
#' @description This function interfaces with Python via the reticulate package
#' to create a Classifier object from the Flair library.
#'
#' @return A Flair Classifier class instance.
Expand Down
5 changes: 3 additions & 2 deletions R/predict_label.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
#' )
#' }
#'
#' @import flaiR
#' @importFrom reticulate import
#' @export
predict_label <- function(text, classifier, sentence = NULL) {
# Import Sentence class from flair
Sentence <- reticulate::import("flair")$data$Sentence

# Check if classifier is valid
if (is.null(classifier) || !isTRUE(class(classifier)[1] == "flair.models.text_classification_model.TextClassifier")) {
Expand Down Expand Up @@ -64,7 +66,6 @@ predict_label <- function(text, classifier, sentence = NULL) {
if (!inherits(sentence, "flair.data.Sentence")) {
stop("Invalid sentence object. Must be a Flair Sentence instance.")
}

if (!("tokens" %in% names(sentence)) || length(sentence$tokens) == 0) {
stop("Invalid sentence object: No tokens found.")
}
Expand Down
2 changes: 1 addition & 1 deletion man/flair_data.Rd

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

2 changes: 1 addition & 1 deletion man/flair_data.Sentence.Rd

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

2 changes: 1 addition & 1 deletion man/flair_nn.Classifier.Rd

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

0 comments on commit e23a912

Please sign in to comment.