This commit is contained in:
22
docs/snippets/r/advanced/language_detection_config.md
Normal file
22
docs/snippets/r/advanced/language_detection_config.md
Normal file
@@ -0,0 +1,22 @@
|
||||
```r title="R"
|
||||
library(kreuzberg)
|
||||
|
||||
config <- list(
|
||||
language_detection = list(
|
||||
enabled = TRUE,
|
||||
min_confidence = 0.8,
|
||||
detect_multiple = FALSE
|
||||
)
|
||||
)
|
||||
|
||||
json <- extract_file_sync("document.pdf", "application/pdf", config)
|
||||
result <- jsonlite::fromJSON(json, simplifyVector = FALSE)
|
||||
|
||||
if (length(result$detected_languages) > 0) {
|
||||
cat(sprintf("Detected language: %s\n", result$detected_languages[[1]]))
|
||||
} else {
|
||||
cat("No language detected\n")
|
||||
}
|
||||
|
||||
cat(sprintf("Content length: %d characters\n", nchar(result$content)))
|
||||
```
|
||||
Reference in New Issue
Block a user