Skip to content

Commit

Permalink
Preinstall french data for running example
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Aug 10, 2018
1 parent 1b04ab5 commit 77c646b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ addons:
- libtesseract-dev
- libleptonica-dev
- tesseract-ocr-eng
- tesseract-ocr-fra
- libpoppler-cpp-dev
- libmagick++-dev

Expand Down
5 changes: 3 additions & 2 deletions R/tessdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
#' @param progress print progress while downloading
#' @references [tesseract wiki: training data](https://github.com/tesseract-ocr/tesseract/wiki/Data-Files)
#' @examples \donttest{
#' tesseract_download("fra")
#' if(is.na(match("fra", tesseract_info()$available)))
#' tesseract_download("fra")
#' french <- tesseract("fra")
#' text <- ocr("https://jeroen.github.io/images/french_text.png", engine = french)
#' cat(text)
#' }
tesseract_download <- function(lang, datapath = NULL, progress = TRUE){
tesseract_download <- function(lang, datapath = NULL, progress = interactive()){
if(!length(datapath)){
warn_on_linux()
datapath <- tesseract_info()$datapath
Expand Down
5 changes: 3 additions & 2 deletions man/tessdata.Rd

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

4 changes: 3 additions & 1 deletion src/tesseract.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "tesseract_types.h"
#include <tesseract/genericvector.h>

/* NB: libtesseract now insists that the engine is loaded in 'C' locale.
/* NB: libtesseract now insists that the engine is initiated in 'C' locale.
* We do this as exemplified in the example code in the libc manual:
* https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html
* Hopefully this is temporary and it will be fixed upstream.
* Full discussion: https://github.com/tesseract-ocr/tesseract/issues/1670
*/
Expand Down

0 comments on commit 77c646b

Please sign in to comment.