【问题标题】:Cannot open connection, deploying Shiny app, tesseract trainingdata for other languages无法打开连接,部署 Shiny 应用程序,为其他语言测试训练数据
【发布时间】:2019-07-10 22:16:15
【问题描述】:

我一直在努力使用 tesseractpackage 部署我闪亮的应用程序。它似乎无法“访问”下载的语言。就我而言:英语和荷兰语。

设置语言时,生成的对象应“指向”路径。那是闪亮无法打开连接的部分。

任何帮助将不胜感激!

亲切的问候,R

下面我复制了错误信息和相关代码。

这是我在部署后收到的错误消息:

文件中的警告(con,“wb”): 无法打开文件'/usr/share/tesseract-ocr/tessdata/nld.traineddata':权限被拒绝 值错误[3L]:无法打开连接 调用:本地 ... tryCatch -> tryCatchList -> tryCatchOne -> 执行停止

这是我的代码

#loading software requirement
library(tesseract)

#download language (dutch)
tesseract_download('nld')
tesseract_download('eng')

#set language parameters for later use.
dutch <- tesseract('nld')
english <- tesseract('eng')

【问题讨论】:

    标签: deployment shiny path permissions tesseract


    【解决方案1】:

    我自己设法让它工作。关键是采取以下步骤:

    1. 创建一个名为“tessdata”的子目录(文件夹的)。该子目录是您可以下载语言并“设置”语言的目录。
    2. 在部署您的应用程序时,您还必须部署此 tessdata-subdirectory。因此,在部署提示中,您也可以“勾选”该文件夹的复选框。
    3. 然后确保 tesseract 引擎指向以下路径:

    如何将 tessdata 文件夹与应用一起上传的屏幕截图 enter image description here

    请看下面的代码

    #loading software requirementlibrary(tesseract)
    
    #Make sure the tesseract package is 'pointing' at the right 'parent directory'
    #which is in this case the path your shiny app is working from.
    #That's why you need the dot ("."). Which is in essence the workdir.
    
    Sys.setenv(TESSDAT_PREFIX = ".")
    
    #so combining the workdir and the pre-installed folder 'tessdata'
    path <- paste0(getwd(), '/tessdata')
    
    #use this path for downloading
    #download languages (dutch and english)
    tesseract_download('nld', datapath = path)
    tesseract_download('eng', datapath = path)
    
    
    #set language parameters for later use, using the same path
    dutch <- tesseract('nld', datapath = path)
    english <- tesseract('eng', datapath = path)
    

    【讨论】:

      猜你喜欢
      • 2019-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-20
      • 1970-01-01
      • 2010-10-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多