Binary files /tmp/tmpF39A2o/ZPOBbXpvsD/abbyyr-0.5.1/build/vignette.rds and /tmp/tmpF39A2o/K8KApu7GFF/abbyyr-0.5.4/build/vignette.rds differ diff -Nru abbyyr-0.5.1/debian/changelog abbyyr-0.5.4/debian/changelog --- abbyyr-0.5.1/debian/changelog 2018-05-31 00:10:15.000000000 +0000 +++ abbyyr-0.5.4/debian/changelog 2018-05-31 00:10:16.000000000 +0000 @@ -1,14 +1,21 @@ -abbyyr (0.5.1-1cran1ppa0trusty0) trusty; urgency=medium +abbyyr (0.5.4-1cran1ppa0trusty1) trusty; urgency=medium * Compilation for Ubuntu 14.04.5 LTS - -- Michael Rutter Sun, 16 Apr 2017 20:01:23 +0000 + -- Michael Rutter Thu, 31 May 2018 00:07:58 +0000 + +abbyyr (0.5.4-1cran1) testing; urgency=low + + * cran2deb svn: 362M with DB version 1. + + -- cran2deb4ubuntu Wed, 30 May 2018 17:08:56 -0400 + abbyyr (0.5.1-1cran1) testing; urgency=low * cran2deb svn: 362M with DB version 1. - -- cran2deb4ubuntu Sat, 15 Apr 2017 14:38:58 -0400 + -- cran2deb4ubuntu Sat, 15 Apr 2017 14:39:12 -0400 abbyyr (0.5.0-1cran2) testing; urgency=low diff -Nru abbyyr-0.5.1/debian/copyright abbyyr-0.5.4/debian/copyright --- abbyyr-0.5.1/debian/copyright 2018-05-31 00:10:15.000000000 +0000 +++ abbyyr-0.5.4/debian/copyright 2018-05-31 00:10:16.000000000 +0000 @@ -2,7 +2,7 @@ automatically using cran2deb4ubuntu by cran2deb4ubuntu . -The original GNU R package is Copyright (C) 2017 Gaurav Sood [aut, cre] +The original GNU R package is Copyright (C) 2018 Gaurav Sood [aut, cre] and possibly others. The original GNU R package is maintained by Gaurav Sood diff -Nru abbyyr-0.5.1/DESCRIPTION abbyyr-0.5.4/DESCRIPTION --- abbyyr-0.5.1/DESCRIPTION 2017-04-12 22:30:27.000000000 +0000 +++ abbyyr-0.5.4/DESCRIPTION 2018-05-30 13:20:41.000000000 +0000 @@ -1,6 +1,6 @@ Package: abbyyR Title: Access to Abbyy Optical Character Recognition (OCR) API -Version: 0.5.1 +Version: 0.5.4 Authors@R: person("Gaurav", "Sood", email = "gsood07@gmail.com", role = c("aut", "cre")) Maintainer: Gaurav Sood Description: Get text from images of text using Abbyy Cloud Optical Character @@ -15,10 +15,10 @@ LazyData: true VignetteBuilder: knitr Imports: httr, XML, curl, readr, plyr, progress -Suggests: testthat, rmarkdown, knitr (>= 1.11) -RoxygenNote: 6.0.1 +Suggests: testthat, rmarkdown, knitr (>= 1.11), lintr +RoxygenNote: 6.0.1.9000 NeedsCompilation: no -Packaged: 2017-04-12 19:37:16 UTC; gsood +Packaged: 2018-05-30 12:47:37 UTC; soodoku Author: Gaurav Sood [aut, cre] Repository: CRAN -Date/Publication: 2017-04-12 22:30:27 UTC +Date/Publication: 2018-05-30 13:20:41 UTC diff -Nru abbyyr-0.5.1/inst/doc/example.html abbyyr-0.5.4/inst/doc/example.html --- abbyyr-0.5.1/inst/doc/example.html 2017-04-12 19:37:13.000000000 +0000 +++ abbyyr-0.5.4/inst/doc/example.html 2018-05-30 12:47:34.000000000 +0000 @@ -11,19 +11,204 @@ - + A Worked Out Example of Managing with abbyyR - + - - - - - - - + + + + + + + @@ -119,7 +306,7 @@

A Worked Out Example of Managing with abbyyR

Gaurav Sood

-

2017-04-12

+

2018-05-30

@@ -221,7 +408,7 @@ (function () { var script = document.createElement("script"); script.type = "text/javascript"; - script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; + script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); diff -Nru abbyyr-0.5.1/inst/doc/overview.html abbyyr-0.5.4/inst/doc/overview.html --- abbyyr-0.5.1/inst/doc/overview.html 2017-04-12 19:37:13.000000000 +0000 +++ abbyyr-0.5.4/inst/doc/overview.html 2018-05-30 12:47:35.000000000 +0000 @@ -11,19 +11,204 @@ - + Overview of abbyyR - + - - - - - - - + + + + + + + @@ -119,7 +306,7 @@

Overview of abbyyR

Gaurav Sood

-

2017-04-12

+

2018-05-30

@@ -148,68 +335,164 @@

Tasks

Tasks are a way to bundle images that need to be processed with same parameters. Say for instance, one task may have images that have been taken by a mobile phone and which you want OCRd to a text file. Another may have all scanned images that you want exported to XML. There are a variety of functions to help you manage the tasks.

    -
  • List Tasks

    -

    listTasks lists all the tasks in the application. You can specify a date range and whether or not you want to include deleted tasks. The function prints Total number of tasks, Task IDs, and No. of Finished Tasks. The function returns a data.frame with the following columns: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file). For additional details about how Abbyy FineReader implements listTasks, see the reference for the function.

    -
    listTasks(fromDate="yyyy-mm-ddThh:mm:ssZ",toDate="yyyy-mm-ddThh:mm:ssZ")
  • -
  • List Finished Tasks

    -

    List all the finished tasks in the application. “The tasks are ordered by the time of the end of processing. No more than 100 tasks can be returned at one method call.” (From Abbyy FineReader). The function returns a data.frame with the following columns: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file). For additional details about how Abbyy FineReader implements listFinishedTasks, see the reference for the function.

    -

    You can download the results of the OCR project from all the FinishedTasks using the getResults function.

    -
    listFinishedTasks()
  • -
  • Get Task Status

    -

    The function gets task status for a particular task ID. The function prints the status of the task by default. The function returns a data.frame with all the task details: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file if applicable).

    -

    For additional details about how Abbyy FineReader implements getTaskStatus, see the reference for the function.

    -
    getTaskStatus(taskId="task_id")
  • -
  • Delete a Task

    -

    This function deletes a particular task and associated data. From Abbyy “If you try to delete the task that has already been deleted, the successful response is returned.” The function by default prints the status of the task you are trying to delete. It will show up as ‘deleted’ if successful. The function returns a data.frame with all the details of the task you are trying to delete: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file if applicable)

    -

    For additional details about how Abbyy FineReader implements deleteTask, see the reference for the function.

    -
        deleteTask(taskId="task_id")
  • +
  • List Tasks
  • +
+
`listTasks` lists all the tasks in the application. You can specify a date range and whether or not you want to include deleted tasks. The function prints Total number of tasks, Task IDs, and No. of Finished Tasks. The function returns a data.frame with the following columns: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file). For additional details about how Abbyy FineReader implements `listTasks`, see the [reference](http://ocrsdk.com/documentation/apireference/listTasks/) for the function.
+
+
+```r
+listTasks(fromDate="yyyy-mm-ddThh:mm:ssZ",toDate="yyyy-mm-ddThh:mm:ssZ")
+```
+
    +
  • List Finished Tasks
  • +
+
List all the finished tasks in the application. "The tasks are ordered by the time of the end of processing. No more than 100 tasks can be returned at one method call." (From Abbyy FineReader). The function returns a data.frame with the following columns: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file). For additional details about how Abbyy FineReader implements `listFinishedTasks`, see the [reference](http://ocrsdk.com/documentation/apireference/listFinishedTasks/) for the function.
+
+You can download the results of the OCR project from all the FinishedTasks using the `getResults` function.
+
+
+```r
+listFinishedTasks()
+```
+
    +
  • Get Task Status
  • +
+
The function gets task status for a particular task ID. The function prints the status of the task by default. The function returns a data.frame with all the task details: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file if applicable).
+
+For additional details about how Abbyy FineReader implements `getTaskStatus`, see the [reference](http://ocrsdk.com/documentation/apireference/getTaskStatus/) for the function.
+
+
+```r
+getTaskStatus(taskId="task_id")
+```
+
    +
  • Delete a Task
+
This function deletes a particular task and associated data. From Abbyy "If you try to delete the task that has already been deleted, the successful response is returned." The function by default prints the status of the task you are trying to delete. It will show up as 'deleted' if successful. The function returns a data.frame with all the details of the task you are trying to delete: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file if applicable)
+
+For additional details about how Abbyy FineReader implements `deleteTask`, see the [reference](http://ocrsdk.com/documentation/apireference/deleteTask/) for the function.
+
+
+```r
+    deleteTask(taskId="task_id")
+```

OCR

Till now we have covered tools to manage the workflow. Now we cover details about how to submit images, barcode fields, business cards etc. for OCR. Abbyy conveniently provides separate functions for submitting different types of documents. The argument that we can pass depending on the kind of the document we are processing. Abbyy provides a way to process a single image, and a bundle of images (bundled under one task) using the same set of parameters. The function below either submit documents to Abbyy or trigger processing of documents (separate steps). To download images that have been processed, use the getResults function.

    -
  • Submit an Image for Processing

    -

    Adds image to the existing task or creates a new task for the uploaded image. The new task isn’t processed till processDocument or processFields is called (via Abbyy FineReader). The function takes two optional arguments, taskId (assigns image to the task ID specified. If empty string is passed, a new task is created) and pdfPassword (If the pdf is password protected). The function returns a data.frame with all the details of the submitted image: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, estimatedProcessingTime

    -

    For additional details about how Abbyy FineReader implements submitImage, see the reference for the function.

    -
    submitImage(file_path="file_path", taskId="task_id", pdfPassword="")
  • -
  • Process Image

    -

    Adds image to the existing task or creates a new task for the uploaded image. The new task isn’t processed till processDocument or processFields is called (via Abbyy FineReader). The function takes two optional arguments, taskId (assigns image to the task ID specified. If an empty string is passed, a new task is created) and pdfPassword (If the pdf is password protected). The function returns a data.frame with all the details of the submitted image: id (task id), registrationTime, statusChangeTime, status (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits

    -

    For supported file formats, see Supported File Formats. For additional details about how Abbyy FineReader implements processImage, see the reference for the function.

    -
    processImage(file_path="file_path", language="English", profile="documentConversion")
  • -
  • Process a Remote Image

    -

    Same as processImage except the function takes image url as a required argument.

    -

    For supported file formats, see Supported File Formats. For additional details about how Abbyy FineReader implements processImage, see the reference for the function.

    -
    processRemoteImage(img_url="img_url", language="English", profile="documentConversion")
  • -
  • Process Document

    -

    This function processes several images for the same task and results in a multi-page document. For instance, upload pages of the book individually via submitImage to the same task. And then process it via ProcessDocument to get a multi-page pdf.

    -

    For additional details about how Abbyy FineReader implements processDocument, see the reference for the function.

    -
    processDocument(task_id="task_id")
  • -
  • Process Business Card

    -

    For additional details about how Abbyy FineReader implements processBusinessCard, see the reference for the function.

    -
    processBusinessCard(file_path="file_path")
  • -
  • Process Text Field

    -

    For additional details about how Abbyy FineReader implements processTextField, see the reference for the function.

    -
    processTextField(file_path="file_path")
  • -
  • Process Barcode Field

    -

    For additional details about how Abbyy FineReader implements processBarcodeField, see the reference for the function.

    -
    processBarcodeField(file_path="file_path")
  • -
  • Process Checkmark Field

    -

    For additional details about how Abbyy FineReader implements processCheckmarkField, see the reference for the function.

    -
    processCheckmarkField(file_path="file_path")
  • -
  • Process Fields

    -

    For additional details about how Abbyy FineReader implements processFields, see the reference for the function.

    -
    processFields(file_path="file_path")
  • -
  • Process MRZ

    -

    Extract data from Machine Readable Zone.

    -

    Output may contain the following fields: MrzType, Line1, Line2, Line3, DocumentType, DocumentSubtype, IssuingCountry, LastName, GivenName, DocumentNumber, DocumentNumberVerified, DocumentNumberCheck, Nationality, BirthDate, BirthDateVerified

    -

    For supported file formats, see Supported File Formats. For additional details about how Abbyy FineReader implements processMRZ, see the reference for the function.

    -
    processMRZ(file_path="file_path")
  • -
  • Process Photo ID

    -

    Extract data from a Photo ID.

    -

    For additional details about how Abbyy FineReader implements processMRZ, see the reference for the function.

    -
    processPhotoId(file_path="file_path")
  • +
  • Submit an Image for Processing
  • +
+
Adds image to the existing task or creates a new task for the uploaded image. The new task isn't processed till processDocument or processFields is called (via Abbyy FineReader). The function takes two optional arguments, taskId (assigns image to the task ID specified. If empty string is passed, a new task is created) and pdfPassword (If the pdf is password protected). The function returns a data.frame with all the details of the submitted image: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits,  estimatedProcessingTime
+
+For additional details about how Abbyy FineReader implements `submitImage`, see the [reference](http://ocrsdk.com/documentation/apireference/submitImage/) for the function.
+
+
+```r
+submitImage(file_path="file_path", taskId="task_id", pdfPassword="")
+```
+
    +
  • Process Image
  • +
+
Adds image to the existing task or creates a new task for the uploaded image. The new task isn't processed till processDocument or processFields is called (via Abbyy FineReader). The function takes two optional arguments, taskId (assigns image to the task ID specified. If an empty string is passed, a new task is created) and pdfPassword (If the pdf is password protected). The function returns a data.frame with all the details of the submitted image: id (task id), registrationTime, statusChangeTime, [status](http://ocrsdk.com/documentation/specifications/task-statuses/) (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits
+
+For supported file formats, see [Supported File Formats](http://ocrsdk.com/documentation/specifications/image-formats/). For additional details about how Abbyy FineReader implements `processImage`, see the [reference](http://ocrsdk.com/documentation/apireference/processImage/) for the function.
+
+
+```r
+processImage(file_path="file_path", language="English", profile="documentConversion")
+```
+
    +
  • Process a Remote Image
  • +
+
Same as processImage except the function takes image url as a required argument.
+
+For supported file formats, see [Supported File Formats](http://ocrsdk.com/documentation/specifications/image-formats/). For additional details about how Abbyy FineReader implements `processImage`, see the [reference](http://ocrsdk.com/documentation/apireference/processRemoteImage/) for the function.
+
+
+```r
+processRemoteImage(img_url="img_url", language="English", profile="documentConversion")
+```
+
    +
  • Process Document
  • +
+
This function processes several images for the same task and results in a multi-page document. For instance, upload pages of the book individually via submitImage to the same task. And then process it via ProcessDocument to get a multi-page pdf.
+
+For additional details about how Abbyy FineReader implements `processDocument`, see the [reference](http://ocrsdk.com/documentation/apireference/processDocument/) for the function.
+
+
+```r
+processDocument(task_id="task_id")
+```
+
    +
  • Process Business Card
  • +
+
For additional details about how Abbyy FineReader implements `processBusinessCard`, see the [reference](http://ocrsdk.com/documentation/apireference/processBusinessCard/) for the function.
+
+
+```r
+processBusinessCard(file_path="file_path")
+```
+
    +
  • Process Text Field
  • +
+
For additional details about how Abbyy FineReader implements `processTextField`, see the [reference](http://ocrsdk.com/documentation/apireference/processTextField/) for the function.
+
+
+```r
+processTextField(file_path="file_path")
+```
+
    +
  • Process Barcode Field
+
For additional details about how Abbyy FineReader implements `processBarcodeField`, see the [reference](http://ocrsdk.com/documentation/apireference/processBarcodeField/) for the function.
+
+
+```r
+processBarcodeField(file_path="file_path")
+```
+
    +
  • Process Checkmark Field
  • +
+
For additional details about how Abbyy FineReader implements `processCheckmarkField`, see the [reference](http://ocrsdk.com/documentation/apireference/processCheckmarkField/) for the function.
+
+
+```r
+processCheckmarkField(file_path="file_path")
+```
+
    +
  • Process Fields
  • +
+
For additional details about how Abbyy FineReader implements `processFields`, see the [reference](http://ocrsdk.com/documentation/apireference/processFields/) for the function.
+
+
+```r
+processFields(file_path="file_path")
+```
+
    +
  • Process MRZ
  • +
+
Extract data from Machine Readable Zone.
+
+Output may contain the following fields: MrzType, Line1, Line2, Line3, DocumentType, DocumentSubtype, IssuingCountry, LastName, GivenName, DocumentNumber, DocumentNumberVerified, DocumentNumberCheck, Nationality, BirthDate, BirthDateVerified
+
+For supported file formats, see [Supported File Formats](http://ocrsdk.com/documentation/specifications/image-formats/). For additional details about how Abbyy FineReader implements `processMRZ`, see the [reference](http://ocrsdk.com/documentation/apireference/processMRZ/) for the function.
+
+
+```r
+processMRZ(file_path="file_path")
+```
+
    +
  • Process Photo ID
  • +
+
Extract data from a Photo ID.
+
+For additional details about how Abbyy FineReader implements `processMRZ`, see the [reference](http://ocrsdk.com/documentation/apireference/processMRZ/) for the function.
+
+
+```r
+processPhotoId(file_path="file_path")
+```
@@ -236,7 +519,7 @@ (function () { var script = document.createElement("script"); script.type = "text/javascript"; - script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; + script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); diff -Nru abbyyr-0.5.1/inst/doc/wiscads.html abbyyr-0.5.4/inst/doc/wiscads.html --- abbyyr-0.5.1/inst/doc/wiscads.html 2017-04-12 19:37:13.000000000 +0000 +++ abbyyr-0.5.4/inst/doc/wiscads.html 2018-05-30 12:47:35.000000000 +0000 @@ -11,19 +11,204 @@ - + Getting Text from Wisconsin Ads Storyboards Using abbyyR - + - - - - - - - + + + + + + + @@ -119,7 +306,7 @@

Getting Text from Wisconsin Ads Storyboards Using abbyyR

Gaurav Sood

-

2017-04-12

+

2018-05-30

@@ -237,7 +424,7 @@ (function () { var script = document.createElement("script"); script.type = "text/javascript"; - script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; + script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); diff -Nru abbyyr-0.5.1/man/deleteTask.Rd abbyyr-0.5.4/man/deleteTask.Rd --- abbyyr-0.5.1/man/deleteTask.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/deleteTask.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -26,7 +26,7 @@ } \examples{ \dontrun{ -deleteTask(taskId="task_id") +deleteTask(taskId = "task_id") } } \references{ diff -Nru abbyyr-0.5.1/man/getResults.Rd abbyyr-0.5.4/man/getResults.Rd --- abbyyr-0.5.1/man/getResults.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/getResults.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -4,7 +4,7 @@ \alias{getResults} \title{Get Results} \usage{ -getResults(output="", save_to_file=TRUE) +getResults(output = "", save_to_file = TRUE) } \arguments{ \item{output}{Optional; folder to which you want to save the data from the processed images; Default is same folder as the script} @@ -26,7 +26,7 @@ } \examples{ \dontrun{ -getResults(save_to_file=FALSE) +getResults(save_to_file = FALSE) } } \references{ diff -Nru abbyyr-0.5.1/man/listTasks.Rd abbyyr-0.5.4/man/listTasks.Rd --- abbyyr-0.5.1/man/listTasks.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/listTasks.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -17,7 +17,7 @@ } \value{ A \code{data.frame} with the following columns: id (task id), registrationTime, statusChangeTime, status - (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), + (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), credits, resultUrl (URL for the processed file)). If no tasks are finished, the last column (resultUrl) isn't returned. } \description{ @@ -27,8 +27,8 @@ \examples{ \dontrun{ listTasks() -listTasks(fromDate="2015-11-10T00:00:00Z", toDate="2016-11-10T00:00:00Z") -listTasks(fromDate="2015-11-10T00:00:00Z") +listTasks(fromDate = "2015-11-10T00:00:00Z", toDate = "2016-11-10T00:00:00Z") +listTasks(fromDate = "2015-11-10T00:00:00Z") } } \references{ diff -Nru abbyyr-0.5.1/man/ocrFile.Rd abbyyr-0.5.4/man/ocrFile.Rd --- abbyyr-0.5.1/man/ocrFile.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/ocrFile.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -27,6 +27,6 @@ } \examples{ \dontrun{ -ocrFile(file_path="path_to_ocr_file", output_dir="path_to_output_dir") +ocrFile(file_path = "path_to_ocr_file", output_dir = "path_to_output_dir") } } diff -Nru abbyyr-0.5.1/man/processBarcodeField.Rd abbyyr-0.5.4/man/processBarcodeField.Rd --- abbyyr-0.5.1/man/processBarcodeField.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processBarcodeField.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -31,7 +31,7 @@ } \examples{ \dontrun{ -processBarcodeField(file_path="file_path") +processBarcodeField(file_path = "file_path") } } \references{ diff -Nru abbyyr-0.5.1/man/processCheckmarkField.Rd abbyyr-0.5.4/man/processCheckmarkField.Rd --- abbyyr-0.5.1/man/processCheckmarkField.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processCheckmarkField.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -31,7 +31,7 @@ } \examples{ \dontrun{ -processCheckmarkField(file_path="file_path") +processCheckmarkField(file_path = "file_path") } } \references{ diff -Nru abbyyr-0.5.1/man/processFields.Rd abbyyr-0.5.4/man/processFields.Rd --- abbyyr-0.5.1/man/processFields.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processFields.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -23,7 +23,7 @@ } \examples{ \dontrun{ -processFields(file_path="file_path", taskId="task_id",description="") +processFields(file_path = "file_path", taskId = "task_id", description = "") } } \references{ diff -Nru abbyyr-0.5.1/man/processImage.Rd abbyyr-0.5.4/man/processImage.Rd --- abbyyr-0.5.1/man/processImage.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processImage.Rd 2018-05-28 13:19:48.000000000 +0000 @@ -10,10 +10,10 @@ "typewriter", "matrix", "index", "ocrA", "ocrB", "e13b", "cmc7", "gothic"), imageSource = c("auto", "photo", "scanner"), correctOrientation = c("true", "false"), correctSkew = c("true", "false"), - readBarcodes = c("false", "true"), exportFormat = c("txt", - "txtUnstructured", "rtf", "docx", "xlsx", "pptx", "pdfSearchable", - "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", "alto"), - description = "", pdfPassword = "", ...) + region = "-1,-1,-1,-1", readBarcodes = c("false", "true"), + exportFormat = c("txt", "txtUnstructured", "rtf", "docx", "xlsx", "pptx", + "pdfSearchable", "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", + "alto"), description = "", pdfPassword = "", ...) } \arguments{ \item{file_path}{path to the document} @@ -35,6 +35,8 @@ \item{correctSkew}{String. Optional; default: \code{true}. Options: \code{true} or \code{false}} +\item{region}{String. Optional. Default: "-1,-1,-1,-1". Region of the image.} + \item{readBarcodes}{Optional; Options: \code{true} or \code{false}} @@ -55,7 +57,7 @@ } \examples{ \dontrun{ -processImage(file_path="file_path", language="English", exportFormat="txtUnstructured") +processImage(file_path = "file_path", language = "English", exportFormat = "txtUnstructured") } } \references{ diff -Nru abbyyr-0.5.1/man/processMRZ.Rd abbyyr-0.5.4/man/processMRZ.Rd --- abbyyr-0.5.1/man/processMRZ.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processMRZ.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -19,7 +19,7 @@ } \examples{ \dontrun{ -processMRZ(file_path="file_path") +processMRZ(file_path = "file_path") } } \references{ diff -Nru abbyyr-0.5.1/man/processPhotoId.Rd abbyyr-0.5.4/man/processPhotoId.Rd --- abbyyr-0.5.1/man/processPhotoId.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processPhotoId.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -35,7 +35,7 @@ } \examples{ \dontrun{ -processPhotoId(file_path="file_path", idType="auto", imageSource="auto") +processPhotoId(file_path = "file_path", idType = "auto", imageSource = "auto") } } \references{ diff -Nru abbyyr-0.5.1/man/processRemoteImage.Rd abbyyr-0.5.4/man/processRemoteImage.Rd --- abbyyr-0.5.1/man/processRemoteImage.Rd 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/man/processRemoteImage.Rd 2018-04-18 17:23:13.000000000 +0000 @@ -53,7 +53,7 @@ } \examples{ \dontrun{ -processRemoteImage(img_url="img_url") +processRemoteImage(img_url = "img_url") } } \references{ diff -Nru abbyyr-0.5.1/MD5 abbyyr-0.5.4/MD5 --- abbyyr-0.5.1/MD5 2017-04-12 22:30:27.000000000 +0000 +++ abbyyr-0.5.4/MD5 2018-05-30 13:20:41.000000000 +0000 @@ -1,39 +1,39 @@ -a2877428d305d29bee5d7735f499e788 *DESCRIPTION +d049a08269a376e52af494b828d41d56 *DESCRIPTION 91a8458fc2e6efe59b4ed31acfd2e59a *LICENSE ab10000ebb752a1da8fc7210d59d1ccc *NAMESPACE -018f0657ca20efcc0981e0876ef2fff3 *NEWS.md -7f5d7d18d05d16e54775666c2bc1b001 *R/abbyyR.R -7daa2a0fe2d085831ae1aea3f1c21db4 *R/deleteTask.R -19ed5415111e69146ece8a7229bf8258 *R/getAppInfo.R -aa0f35495baeb794956ecd294827faed *R/getResults.R -ba450bf577ccba23d0735a290d1576e3 *R/getTaskStatus.R -0d3e0369d249e4a5e469d08de90c9b87 *R/listFinishedTasks.R -638af582cce93b34afbcd60f8309aa96 *R/listTasks.R -4b3581bce613fb7cae80191c9a775c70 *R/ocrFile.R -25ea1bc3434e1a08f413ea28d5100a7a *R/processBarcodeField.R -35d29f2429bdc5cbab500380e69ddf4f *R/processBusinessCard.R -cfbf78167198f681c6c1deb018b9b630 *R/processCheckmarkField.R -175c2d73a7cea8a9478c47c8473e4bc8 *R/processDocument.R -fa85a795e9da0e6ab65d9ef90456c526 *R/processFields.R -fae257f0988f7579c622ea5912292e82 *R/processImage.R -f68491260786630cdfa342e9fc5ceeeb *R/processMRZ.R -e6166b80b286cd24bffbc9b22e37c4f9 *R/processPhotoId.R -61a704ce6410a5ebbc4a8bfd3b405371 *R/processRemoteImage.R -cdbce736cd30eb7b5a3956f3bb963bcb *R/processTextField.R -b9bc3c9cd62fca2d8179d2bceb59505c *R/setapp.R -2b6bf1ba2a3d5e2df2053124be1a9f51 *R/submitImage.R -c3e16eef3825b141f2abe739329d0830 *README.md -97a55c4ab2d47d8b6f5692673c1ab7cc *build/vignette.rds +da51b9e1599946094523def4b92a53c2 *NEWS.md +3cd3aa49329d1041bff8664fff9b0439 *R/abbyyR.R +342c0876d8dfc411320c85c19de93934 *R/deleteTask.R +907d8c81785f41eabd7deea846d7410c *R/getAppInfo.R +d3dea5b32126e18c9664488035c5edcd *R/getResults.R +821087aa861c0043254a41625cd60f90 *R/getTaskStatus.R +33f279d389f64688e950457507061d22 *R/listFinishedTasks.R +1792ae0588f4f62814494f5f61a74483 *R/listTasks.R +bfbfdb9e4b5fb3d5995a6334160cd13c *R/ocrFile.R +0101cf83e0dc1753845de6a203f95232 *R/processBarcodeField.R +d85a95cb6b6276183ee287f7d7b0bb04 *R/processBusinessCard.R +7841bd0d09f6512cad7cf6661ef66711 *R/processCheckmarkField.R +d60f34f5ae053a0c5575f3294c48ff75 *R/processDocument.R +5e19f4e72a567299bb963717a9858498 *R/processFields.R +3fae4ea93ebae83001968c4ddf72a3cd *R/processImage.R +c86b563bcb6c9639b6b9f66500b42245 *R/processMRZ.R +a00c30e4e82267de62d3739b3237e1dd *R/processPhotoId.R +0b6ddb75b5aaa98e21290c303e61d893 *R/processRemoteImage.R +f74538cd2ddf939552c9a9982c2d2e70 *R/processTextField.R +9651a2070364fb601757e9ce096c1e12 *R/setapp.R +6624488f2553b8277ed53e0930f9a1d2 *R/submitImage.R +ae578f5d4933f595f556271140a47cf4 *README.md +ee24e7d2ea4d2a85a26a7419fa61eebe *build/vignette.rds b69e1f6eccfe9801b8d5557c4fd557eb *inst/CITATION 73ff1af6db4248f52414065b5aad0a38 *inst/doc/example.R 99bbc905c1ded0eb3f7b79ae92b84035 *inst/doc/example.Rmd -1655d02fe88b0e96171bd2d90ec2e72e *inst/doc/example.html +fb91a7f16d58adcbc436d58d28dff7e8 *inst/doc/example.html 15b42096dd2ea3e8c74884e04d544bf6 *inst/doc/overview.R 6b566388164933442a8bff64bf1601bd *inst/doc/overview.Rmd -b87d1230179a759855a5fb493e671b3e *inst/doc/overview.html +dd13219db9817a8e45c6cf25d0cd8936 *inst/doc/overview.html fca95d75a02b429a05ca8852b139fd85 *inst/doc/wiscads.R 83420fd77acc56a1f3979807c3dd1b25 *inst/doc/wiscads.Rmd -7e01c877ffa923f808699a45114ee3c7 *inst/doc/wiscads.html +6c7e6c09f6162fb0bc24718eb2896784 *inst/doc/wiscads.html d5ef97bc60b0c5314021ca9d92add184 *inst/extdata/barcode1.jpg 16e2504da2e829988744d5d4b2aae243 *inst/extdata/doc10003.png f8050705c9a1e433d95984c3db757ace *inst/extdata/t1.png @@ -49,33 +49,34 @@ 4a58f7d516ce524f4f19680ceded5a3e *man/abbyy_GET.Rd 2183c1b6aad72f3df40e79a173e21683 *man/abbyy_POST.Rd 8c6e6c00f8df1377bced5735c407fad0 *man/abbyy_check.Rd -4025672183c403f0d36e0b8a0b218c22 *man/deleteTask.Rd +643b87372aee9398baa2e6935d5b4e8e *man/deleteTask.Rd 335083ed4a01bde843f7528905412952 *man/getAppInfo.Rd -706042dda449565b985f5bcf1192bb06 *man/getResults.Rd +1148b870ac41636fd14340d40b914ff0 *man/getResults.Rd c1f1fd1b47c38171862e1507ab774a2b *man/getTaskStatus.Rd ace72cebd5e141216f8338b6e0689362 *man/listFinishedTasks.Rd -fdd10db05771e16f1d2fda01ed1a615b *man/listTasks.Rd -26e87b3b4f19f920c05a88a777103fe2 *man/ocrFile.Rd -4571fe1934faf13b1833891df9718223 *man/processBarcodeField.Rd +20c30955d8786873f86c6adf21577ffa *man/listTasks.Rd +6db070adfe7542c19f5162ed08f33469 *man/ocrFile.Rd +6b58b3b7b29ef75c3a5d7a5e6625cb1d *man/processBarcodeField.Rd fb6900b0dbbfdf13b86ff0a829bd252e *man/processBusinessCard.Rd -0c8a5fd87213ac04f5f33243047ae67b *man/processCheckmarkField.Rd +bc2342b5fd4ef4f1e6c9ccb745cf3928 *man/processCheckmarkField.Rd 011785883bff007bcbf99586459ae88d *man/processDocument.Rd -f6c4c9f341ead00774dd44330b333169 *man/processFields.Rd -8863aab580cededb06b9a337341deeb4 *man/processImage.Rd -2419f19a34b38fffad490b1f3f289896 *man/processMRZ.Rd -53549d8f4974f4f301f52252fb696cbc *man/processPhotoId.Rd -7a029cb4455635c24d24f60f48eae477 *man/processRemoteImage.Rd +415033ae9cfeb793e947faf0e4cfcfe0 *man/processFields.Rd +658da46a7a169b6dd74e5ffb2adc9036 *man/processImage.Rd +b829a84adbb648b278d68381f543c567 *man/processMRZ.Rd +a863edb9a20404d64b833389ec5d9b96 *man/processPhotoId.Rd +bbd8f3aa2657d53bc9ed497b093d4501 *man/processRemoteImage.Rd df540594abc90721fee4d8ae36733806 *man/processTextField.Rd 7a8fcf0db7ec8977d8763585fba5aff1 *man/setapp.Rd adc22f5b0d9b2c4017993f72c1692d62 *man/submitImage.Rd -a7fa820c9f2a27e123dae9398bf6d669 *tests/testthat.R +04a6457566bc85375fe393b437b15e30 *tests/testthat.R c98ee0cab125936d30c1ff30c68521aa *tests/testthat/abbyy_key 88572b223309c426cf4d21fcf71172b4 *tests/testthat/abbyy_key.enc -679750bea488612b88619e5edd3bdc4b *tests/testthat/test-get-info.R -7e34759c486c6c9ed179b27fbca88256 *tests/testthat/test-get-results.R -3e781a66adb198e580d16d74253ed47b *tests/testthat/test-list-finished-tasks.R -677f084345a30eca5bf78cc48e4bc3e3 *tests/testthat/test-list-tasks.R -954a7e541147abef04ed49cc2481d983 *tests/testthat/test-submit-image.R +70dcc6ffd92b7b825822b65866ecc397 *tests/testthat/test-get-info.R +d83ffa93315b2721a83e4c85ee7517fd *tests/testthat/test-get-results.R +bf135ae6550fa7b64d27534be952d324 *tests/testthat/test-list-finished-tasks.R +0262cc7057490edff34fcda28b7e51ee *tests/testthat/test-list-tasks.R +d45b85b0afae5374816bbe804f8df2f6 *tests/testthat/test-pkg-style.R +769488aef9ad7d819405d9993a927fb2 *tests/testthat/test-submit-image.R 99bbc905c1ded0eb3f7b79ae92b84035 *vignettes/example.Rmd b4e8068ac6cfafb68cc69420abc80cae *vignettes/example.md 6b566388164933442a8bff64bf1601bd *vignettes/overview.Rmd diff -Nru abbyyr-0.5.1/NEWS.md abbyyr-0.5.4/NEWS.md --- abbyyr-0.5.1/NEWS.md 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/NEWS.md 2018-05-30 12:13:24.000000000 +0000 @@ -1,3 +1,15 @@ +# abbyyR 0.5.4 + +* fixed bug in processTextField, region was not being passed to the querylist. see #8. + +# abbyyR 0.5.3 + +* add region argument to processImage() + +# abbyyR 0.5.2 + +* extensive linting. passes expect_lint_free + # abbyyR 0.5.1 * moved to ldply for coercing list to data.frame diff -Nru abbyyr-0.5.1/R/abbyyR.R abbyyr-0.5.4/R/abbyyR.R --- abbyyr-0.5.1/R/abbyyR.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/abbyyR.R 2018-04-18 17:23:13.000000000 +0000 @@ -39,18 +39,22 @@ #' #' @return list -abbyy_GET <- -function(path, query, ...) { +abbyy_GET <- function(path, query, ...) { - app_id = Sys.getenv("AbbyyAppId"); app_pass = Sys.getenv("AbbyyAppPassword") - if(identical(app_id, "") | identical(app_pass, "")) stop("Please set application id and password using setapp(c('app_id', 'app_pass')).") - - auth <- authenticate(app_id, app_pass) - res <- GET("https://cloud.ocrsdk.com/", path=path, auth, query=query, ...) - abbyy_check(res) - res <- xmlToList(content(res, as="text")) + app_id <- Sys.getenv("AbbyyAppId") + app_pass <- Sys.getenv("AbbyyAppPassword") - res + if (identical(app_id, "") | identical(app_pass, "")) { + stop("Please set application id and password using + setapp(c('app_id', 'app_pass')).") + } + + auth <- authenticate(app_id, app_pass) + res <- GET("https://cloud.ocrsdk.com/", path = path, auth, query = query, ...) + abbyy_check(res) + res <- xmlToList(content(res, as = "text")) + + res } @@ -64,18 +68,26 @@ #' #' @return list -abbyy_POST <- -function(path, query, body="", ...) { +abbyy_POST <- function(path, query, body = "", ...) { + + app_id <- Sys.getenv("AbbyyAppId") + app_pass <- Sys.getenv("AbbyyAppPassword") - app_id = Sys.getenv("AbbyyAppId"); app_pass = Sys.getenv("AbbyyAppPassword") - if(identical(app_id, "") | identical(app_pass, "")) stop("Please set application id and password using setapp(c('app_id', 'app_pass')).") - - auth <- authenticate(app_id, app_pass) - res <- POST("https://cloud.ocrsdk.com/", path=path, auth, query=query, body=body, ...) - abbyy_check(res) - res <- xmlToList(content(res, as="text")) + if (identical(app_id, "") | identical(app_pass, "")) { + stop("Please set application id and password using + setapp(c('app_id', 'app_pass')).") + } + + auth <- authenticate(app_id, app_pass) + res <- POST("https://cloud.ocrsdk.com/", + path = path, + auth, + query = query, + body = body, ...) + abbyy_check(res) + res <- xmlToList(content(res, as = "text")) - res + res } #' @@ -84,9 +96,9 @@ #' @param req request #' @return in case of failure, a message -abbyy_check <- -function(req) { +abbyy_check <- function(req) { + if (req$status_code < 400) return(invisible()) stop("HTTP failure: ", req$status_code, "\n", call. = FALSE) -} +} diff -Nru abbyyr-0.5.1/R/deleteTask.R abbyyr-0.5.4/R/deleteTask.R --- abbyyr-0.5.1/R/deleteTask.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/deleteTask.R 2018-04-18 17:23:13.000000000 +0000 @@ -19,30 +19,30 @@ #' @references \url{http://ocrsdk.com/documentation/apireference/deleteTask/} #' #' @examples \dontrun{ -#' deleteTask(taskId="task_id") +#' deleteTask(taskId = "task_id") #' } deleteTask <- function(taskId = NULL, ...){ - - if (is.null(taskId)) stop("must provide taskId.", call. = FALSE) - # Get the status of the task - task_status <- getTaskStatus(taskId, ...) - - if (identical(task_status$status, 'Deleted')) { - # Print status of the task - cat("Status of the task: ", task_status$status, "\n") - - } else { - - querylist = list(taskId = taskId) - deleted_task_details <- abbyy_GET("deleteTask", query=querylist, ...) - resdf <- ldply(deleted_task_details, rbind) - - # Print status of the task - cat("Status of the task: ", resdf$status, "\n") - resdf - } + if (is.null(taskId)) stop("must provide taskId.", call. = FALSE) - task_status + # Get the status of the task + task_status <- getTaskStatus(taskId, ...) + + if (identical(task_status$status, "Deleted")) { + # Print status of the task + cat("Status of the task: ", task_status$status, "\n") + + } else { + + querylist <- list(taskId = taskId) + deleted_task_details <- abbyy_GET("deleteTask", query = querylist, ...) + resdf <- ldply(deleted_task_details, rbind) + + # Print status of the task + cat("Status of the task: ", resdf$status, "\n") + resdf + } + + task_status } diff -Nru abbyyr-0.5.1/R/getAppInfo.R abbyyr-0.5.4/R/getAppInfo.R --- abbyyr-0.5.1/R/getAppInfo.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/getAppInfo.R 2018-04-18 17:23:13.000000000 +0000 @@ -21,16 +21,15 @@ getAppInfo <- function(...) { - appinfo <- abbyy_GET("getApplicationInfo", query="", ...)[[1]] + appinfo <- abbyy_GET("getApplicationInfo", query = "", ...)[[1]] - appinfo <- as.data.frame(appinfo) + appinfo <- as.data.frame(appinfo) - cat("Name of Application: ", appinfo$name, "\n", sep = "") - cat("No. of Pages Remaining: ", appinfo$pages, "\n", sep = "") - cat("No. of Fields Remaining: ", appinfo$fields, "\n", sep = "") - cat("Application Credits Expire on: ", appinfo$expires, "\n", sep = "") - cat("Type: ", appinfo$type, "\n", sep = "") - - appinfo -} + cat("Name of Application: ", appinfo$name, "\n", sep = "") + cat("No. of Pages Remaining: ", appinfo$pages, "\n", sep = "") + cat("No. of Fields Remaining: ", appinfo$fields, "\n", sep = "") + cat("Application Credits Expire on: ", appinfo$expires, "\n", sep = "") + cat("Type: ", appinfo$type, "\n", sep = "") + appinfo +} diff -Nru abbyyr-0.5.1/R/getResults.R abbyyr-0.5.4/R/getResults.R --- abbyyr-0.5.1/R/getResults.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/getResults.R 2018-04-18 17:23:13.000000000 +0000 @@ -15,49 +15,50 @@ #' @export #' @references \url{http://ocrsdk.com/documentation/apireference/getTaskStatus/} #' -#' @usage getResults(output="", save_to_file=TRUE) +#' @usage getResults(output = "", save_to_file = TRUE) #' #' @examples \dontrun{ -#' getResults(save_to_file=FALSE) +#' getResults(save_to_file = FALSE) #' } -getResults <- function(output="./", save_to_file=TRUE) { +getResults <- function(output = "./", save_to_file = TRUE) { - finished_list <- listFinishedTasks() - - if (nrow(finished_list) == 0) { - - cat("No Finished Tasks") - - } else { - - # Set progress bar - pb <- progress_bar$new(total = nrow(finished_list)) - - if (!save_to_file) { - # Add additional col. to finished_list - finished_list$results <- NA - - for (i in seq_along(1:nrow(finished_list))) - { - url <- as.character(finished_list$resultUrl[i]) - temp <- curl_fetch_memory(url) - finished_list$results[i] <- rawToChar(temp$content) - pb$tick() - } - - return(invisible(finished_list)) - } - - finished_list$local_file_path <- NA - - for (i in seq_along(1:nrow(finished_list))) - { - curl_download(as.character(finished_list$resultUrl[i]), destfile=paste0(output, finished_list$id[i])) - finished_list$local_file_path[i] <- paste0(output, finished_list$id[i]) - pb$tick() - } - } - - finished_list + finished_list <- listFinishedTasks() + + if (nrow(finished_list) == 0) { + + cat("No Finished Tasks") + + } else { + + # Set progress bar + pb <- progress_bar$new(total = nrow(finished_list)) + + if (!save_to_file) { + # Add additional col. to finished_list + finished_list$results <- NA + + for (i in seq_along(1:nrow(finished_list))) { + + url <- as.character(finished_list$resultUrl[i]) + temp <- curl_fetch_memory(url) + finished_list$results[i] <- rawToChar(temp$content) + pb$tick() + } + + return(invisible(finished_list)) + } + + finished_list$local_file_path <- NA + + for (i in seq_along(1:nrow(finished_list))) { + + curl_download(as.character(finished_list$resultUrl[i]), + destfile = paste0(output, finished_list$id[i])) + finished_list$local_file_path[i] <- paste0(output, finished_list$id[i]) + pb$tick() + } + } + + finished_list } diff -Nru abbyyr-0.5.1/R/getTaskStatus.R abbyyr-0.5.4/R/getTaskStatus.R --- abbyyr-0.5.1/R/getTaskStatus.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/getTaskStatus.R 2018-04-18 17:23:13.000000000 +0000 @@ -19,16 +19,16 @@ #' } getTaskStatus <- function(taskId = NULL, ...) { - - if (is.null(taskId)) stop("Must specify taskId") - - querylist <- list(taskId = taskId) - taskdetails <- abbyy_GET("getTaskStatus", query=querylist, ...) - resdf <- ldply(taskdetails, rbind) + if (is.null(taskId)) stop("Must specify taskId") - # Print some important things - cat("Status of the task: ", resdf$status, "\n") + querylist <- list(taskId = taskId) + taskdetails <- abbyy_GET("getTaskStatus", query = querylist, ...) - resdf -} \ No newline at end of file + resdf <- ldply(taskdetails, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/listFinishedTasks.R abbyyr-0.5.4/R/listFinishedTasks.R --- abbyyr-0.5.1/R/listFinishedTasks.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/listFinishedTasks.R 2018-04-18 17:23:13.000000000 +0000 @@ -19,22 +19,24 @@ #' } listFinishedTasks <- function(...) { - - tasklist <- abbyy_GET("listFinishedTasks", query="", ...) - # Names of return df. - frame_names <- c("id", "registrationTime", "statusChangeTime", "status", "filesCount", "credits", "resultUrl") + tasklist <- abbyy_GET("listFinishedTasks", query = "", ...) - if (is.null(tasklist)){ - cat("No finished tasks in the application. \n") - no_dat <- read.table(text = "", col.names = frame_names) - return(invisible(no_dat)) - } - - resdf <- ldply(tasklist, rbind) - - # Print some important things - cat("No. of Finished Tasks: ", nrow(resdf), "\n") + # Names of return df. + frame_names <- c("id", "registrationTime", "statusChangeTime", + "status", "filesCount", "credits", "resultUrl") - resdf + if (is.null(tasklist)){ + cat("No finished tasks in the application. \n") + no_dat <- read.table(text = "", col.names = frame_names, + stringsAsFactors = FALSE) + return(invisible(no_dat)) + } + + resdf <- ldply(tasklist, rbind) + + # Print some important things + cat("No. of Finished Tasks: ", nrow(resdf), "\n") + + resdf } diff -Nru abbyyr-0.5.1/R/listTasks.R abbyyr-0.5.4/R/listTasks.R --- abbyyr-0.5.1/R/listTasks.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/listTasks.R 2018-04-18 17:23:13.000000000 +0000 @@ -9,7 +9,7 @@ #' @param \dots Additional arguments passed to \code{\link{abbyy_GET}}. #' #' @return A \code{data.frame} with the following columns: id (task id), registrationTime, statusChangeTime, status -#' (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), +#' (Submitted, Queued, InProgress, Completed, ProcessingFailed, Deleted, NotEnoughCredits), filesCount (No. of files), #' credits, resultUrl (URL for the processed file)). If no tasks are finished, the last column (resultUrl) isn't returned. #' #' @export @@ -19,37 +19,50 @@ #' #' @examples \dontrun{ #' listTasks() -#' listTasks(fromDate="2015-11-10T00:00:00Z", toDate="2016-11-10T00:00:00Z") -#' listTasks(fromDate="2015-11-10T00:00:00Z") +#' listTasks(fromDate = "2015-11-10T00:00:00Z", toDate = "2016-11-10T00:00:00Z") +#' listTasks(fromDate = "2015-11-10T00:00:00Z") #' } -listTasks <- function(fromDate = NULL, toDate = NULL, excludeDeleted = FALSE, ...) { - - # Convert Bool to string - exclude_deleted = 'false' - if (identical(excludeDeleted, TRUE)) { - exclude_deleted = 'true' - } - - # Check format - if (!identical(fromDate, NULL)) { - if (!grepl("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", fromDate)) stop("Incorrect Date Format. See examples.") - } - - if (!identical(toDate, NULL)) { - if (!grepl("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", toDate)) stop("Incorrect Date Format. See examples.") - } - - querylist <- list(fromDate = fromDate, toDate = toDate, excludeDeleted = exclude_deleted) - tasklist <- abbyy_GET("listTasks", query = querylist, ...) - - # Converting list to a data.frame - resdf <- ldply(tasklist, rbind) - - # Print some important things - cat("Total No. of Tasks: ", nrow(resdf), "\n") - cat("No. of Finished Tasks: ", ifelse(!("resultUrl" %in% names(resdf)), 0, sum(!is.na(resdf$resultUrl))), "\n") - - # Return the data.frame - resdf +listTasks <- function(fromDate = NULL, + toDate = NULL, + excludeDeleted = FALSE, ...) { + + # Convert Bool to string + exclude_deleted <- "false" + + if (identical(excludeDeleted, TRUE)) { + exclude_deleted <- "true" + } + + # Check format + if (!identical(fromDate, NULL)) { + if (!grepl("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", + fromDate)) { + stop("Incorrect Date Format. See examples.") + } + } + + if (!identical(toDate, NULL)) { + if (!grepl("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z", + toDate)) { + stop("Incorrect Date Format. See examples.") + } + } + + querylist <- list(fromDate = fromDate, + toDate = toDate, + excludeDeleted = exclude_deleted) + tasklist <- abbyy_GET("listTasks", query = querylist, ...) + + # Converting list to a data.frame + resdf <- ldply(tasklist, rbind) + + # Print some important things + cat("Total No. of Tasks: ", nrow(resdf), "\n") + cat("No. of Finished Tasks: ", ifelse(!("resultUrl" %in% names(resdf)), + 0, + sum(!is.na(resdf$resultUrl))), "\n") + + # Return the data.frame + resdf } diff -Nru abbyyr-0.5.1/R/ocrFile.R abbyyr-0.5.4/R/ocrFile.R --- abbyyr-0.5.1/R/ocrFile.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/ocrFile.R 2018-04-18 17:23:13.000000000 +0000 @@ -12,33 +12,40 @@ #' @export #' #' @examples \dontrun{ -#' ocrFile(file_path="path_to_ocr_file", output_dir="path_to_output_dir") +#' ocrFile(file_path = "path_to_ocr_file", output_dir = "path_to_output_dir") #' } -ocrFile <- function(file_path="", output_dir="./", - exportFormat=c("txt", "txtUnstructured", "rtf", "docx", "xlsx", "pptx", "pdfSearchable", "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", "alto"), - save_to_file=TRUE) { - - exportFormat <- match.arg(exportFormat) - - res <- processImage(file_path=file_path, exportFormat=exportFormat) - - # Wait till the processing is finished with a maximum time - while(!(any(as.character(res$id) == as.character(listFinishedTasks()$id)))) { - Sys.sleep(1) - } - - finishedlist <- listFinishedTasks() - - # Coerce to char. if not. - res$id <- as.character(res$id) - finishedlist$id <- as.character(finishedlist$id) - - if (identical(save_to_file, FALSE)) { - res <- curl_fetch_memory(finishedlist$resultUrl[res$id == finishedlist$id]) - return(rawToChar(res$content)) - } - - curl_download(finishedlist$resultUrl[res$id == finishedlist$id], destfile=paste0(output_dir, unlist(strsplit(basename(file_path), "[.]"))[1], ".", exportFormat)) - +ocrFile <- function(file_path = "", output_dir = "./", + exportFormat = c("txt", "txtUnstructured", "rtf", + "docx", "xlsx", "pptx", "pdfSearchable", + "pdfTextAndImages", "pdfa", "xml", + "xmlForCorrectedImage", "alto"), + save_to_file = TRUE) { + + exportFormat <- match.arg(exportFormat) + + res <- processImage(file_path = file_path, exportFormat = exportFormat) + + # Wait till the processing is finished with a maximum time + while (!(any(as.character(res$id) == as.character(listFinishedTasks()$id)))) { + Sys.sleep(1) + } + + finishedlist <- listFinishedTasks() + + # Coerce to char. if not. + res$id <- as.character(res$id) + finishedlist$id <- as.character(finishedlist$id) + finishedlist$resultUrl <- as.character(finishedlist$resultUrl) + + if (identical(save_to_file, FALSE)) { + res <- curl_fetch_memory(finishedlist$resultUrl[res$id == finishedlist$id]) + return(rawToChar(res$content)) + } + + curl_download(finishedlist$resultUrl[res$id == finishedlist$id], + destfile = paste0(output_dir, + unlist(strsplit(basename(file_path), "[.]"))[1], + ".", + exportFormat)) } diff -Nru abbyyr-0.5.1/R/processBarcodeField.R abbyyr-0.5.4/R/processBarcodeField.R --- abbyyr-0.5.1/R/processBarcodeField.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processBarcodeField.R 2018-04-18 17:23:13.000000000 +0000 @@ -17,22 +17,35 @@ #' @references \url{http://ocrsdk.com/documentation/apireference/processBarcodeField/} #' #' @examples \dontrun{ -#' processBarcodeField(file_path="file_path") +#' processBarcodeField(file_path = "file_path") #' } -processBarcodeField <- function(file_path="", barcodeType="autodetect", region="-1,-1,-1,-1", containsBinaryData="false", pdfPassword="", description="", ...) { - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - querylist = list(barcodeType=barcodeType, region=region, containsBinaryData=containsBinaryData, pdfPassword=pdfPassword, description=description) - - process_details <- abbyy_POST("processBarcodeField", query=querylist, body=upload_file(file_path), ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processBarcodeField <- function(file_path = "", + barcodeType = "autodetect", + region = "-1,-1,-1,-1", + containsBinaryData = "false", + pdfPassword = "", + description = "", ...) { - resdf -} \ No newline at end of file + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + querylist <- list(barcodeType = barcodeType, + region = region, + containsBinaryData = containsBinaryData, + pdfPassword = pdfPassword, + description = description) + + process_details <- abbyy_POST("processBarcodeField", + query = querylist, + body = upload_file(file_path), ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/processBusinessCard.R abbyyr-0.5.4/R/processBusinessCard.R --- abbyyr-0.5.1/R/processBusinessCard.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processBusinessCard.R 2018-04-18 17:23:13.000000000 +0000 @@ -24,23 +24,37 @@ #' processBusinessCard(file_path="file_path", language="English") #' } -processBusinessCard <- function(file_path="", language="English", imageSource="auto", correctOrientation="true", - correctSkew="true", exportFormat="vCard", description="", pdfPassword="", ...) -{ - - if(!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - querylist = list(language=language, imageSource=imageSource, correctOrientation=correctOrientation, - correctSkew=correctSkew,exportFormat=exportFormat, description=description, pdfPassword=pdfPassword) - - body=upload_file(file_path) - process_details <- abbyy_POST("processBusinessCard", query=querylist, body=body, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processBusinessCard <- function(file_path = "", + language = "English", + imageSource = "auto", + correctOrientation = "true", + correctSkew = "true", + exportFormat = "vCard", + description = "", + pdfPassword = "", ...) { - resdf + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + querylist <- list(language = language, + imageSource = imageSource, + correctOrientation = correctOrientation, + correctSkew = correctSkew, + exportFormat = exportFormat, + description = description, + pdfPassword = pdfPassword) + + body <- upload_file(file_path) + process_details <- abbyy_POST("processBusinessCard", + query = querylist, + body = body, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf } diff -Nru abbyyr-0.5.1/R/processCheckmarkField.R abbyyr-0.5.4/R/processCheckmarkField.R --- abbyyr-0.5.1/R/processCheckmarkField.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processCheckmarkField.R 2018-04-18 17:23:13.000000000 +0000 @@ -17,23 +17,36 @@ #' @references For supported image types, see \url{http://ocrsdk.com/documentation/specifications/image-formats/} #' #' @examples \dontrun{ -#' processCheckmarkField(file_path="file_path") +#' processCheckmarkField(file_path = "file_path") #' } -processCheckmarkField <- function(file_path="", checkmarkType="empty", region="-1,-1,-1,-1", correctionAllowed="false", pdfPassword="", description="", ...) { +processCheckmarkField <- function(file_path = "", + checkmarkType = "empty", + region = "-1,-1,-1,-1", + correctionAllowed = "false", + pdfPassword = "", description = "", ...) { - if(!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } - querylist = list(checkmarkType=checkmarkType, region=region,correctionAllowed=correctionAllowed,pdfPassword=pdfPassword,description=description) - - body=upload_file(file_path) - process_details <- abbyy_POST("processCheckmarkField", query=querylist, body=body, ...) - - resdf <- as.data.frame(do.call(rbind, process_details)) # collapse to a data.frame - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") - - resdf -} \ No newline at end of file + querylist <- list(checkmarkType = checkmarkType, + region = region, + correctionAllowed = correctionAllowed, + pdfPassword = pdfPassword, + description = description) + + body <- upload_file(file_path) + process_details <- abbyy_POST("processCheckmarkField", + query = querylist, + body = body, ...) + + # collapse to a data.frame + resdf <- as.data.frame(do.call(rbind, process_details)) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/processDocument.R abbyyr-0.5.4/R/processDocument.R --- abbyyr-0.5.1/R/processDocument.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processDocument.R 2018-04-18 17:23:13.000000000 +0000 @@ -33,35 +33,54 @@ #' processDocument(taskId = "task_id") #' } -processDocument <- function(taskId = NULL, language="English", - profile = c("documentConversion", "documentArchiving", "textExtraction", "fieldLevelRecognition", "barcodeRecognition"), - textType = c("normal", "typewriter", "matrix", "index", "ocrA", "ocrB", "e13b", "cmc7", "gothic"), - imageSource = c("auto", "photo", "scanner"), - correctOrientation = c("true", "false"), - correctSkew = c("true", "false"), - readBarcodes = c("false", "true"), - exportFormat = c("txt", "txtUnstructured", "rtf", "docx", "xlsx", "pptx", "pdfSearchable", "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", "alto"), - description = NULL, pdfPassword = NULL, ...) { - - - profile <- match.arg(profile, choices = profile) - textType <- match.arg(textType, choices = textType) - correctSkew <- match.arg(correctSkew, choices = correctSkew) - imageSource <- match.arg(imageSource, choices = imageSource) - correctOrientation <- match.arg(correctOrientation, choices = correctOrientation) - readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) - exportFormat <- match.arg(exportFormat, choices = exportFormat) - - - querylist <- list(taskId = taskId, language=language, profile=profile,textType=textType, imageSource=imageSource, correctOrientation=correctOrientation, - correctSkew=correctSkew,readBarcodes=readBarcodes,exportFormat=exportFormat, description=description, pdfPassword=pdfPassword) - - process_details <- abbyy_GET("processDocument", query=querylist, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") +processDocument <- function(taskId = NULL, language="English", + profile = c("documentConversion", + "documentArchiving", + "textExtraction", + "fieldLevelRecognition", + "barcodeRecognition"), + textType = c("normal", "typewriter", + "matrix", "index", "ocrA", "ocrB", + "e13b", "cmc7", "gothic"), + imageSource = c("auto", "photo", "scanner"), + correctOrientation = c("true", "false"), + correctSkew = c("true", "false"), + readBarcodes = c("false", "true"), + exportFormat = c("txt", "txtUnstructured", "rtf", + "docx", "xlsx", "pptx", + "pdfSearchable", + "pdfTextAndImages", "pdfa", "xml", + "xmlForCorrectedImage", "alto"), + description = NULL, pdfPassword = NULL, ...) { + + + profile <- match.arg(profile, choices = profile) + textType <- match.arg(textType, choices = textType) + correctSkew <- match.arg(correctSkew, choices = correctSkew) + imageSource <- match.arg(imageSource, choices = imageSource) + correctOrientation <- match.arg(correctOrientation, + choices = correctOrientation) + readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) + exportFormat <- match.arg(exportFormat, choices = exportFormat) + + querylist <- list(taskId = taskId, + language = language, + profile = profile, + textType = textType, + imageSource = imageSource, + correctOrientation = correctOrientation, + correctSkew = correctSkew, + readBarcodes = readBarcodes, + exportFormat = exportFormat, + description = description, + pdfPassword = pdfPassword) + + process_details <- abbyy_GET("processDocument", query = querylist, ...) - resdf -} \ No newline at end of file + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/processFields.R abbyyr-0.5.4/R/processFields.R --- abbyyr-0.5.1/R/processFields.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processFields.R 2018-04-18 17:23:13.000000000 +0000 @@ -12,22 +12,26 @@ #' @references \url{http://ocrsdk.com/documentation/apireference/processFields/} #' #' @examples \dontrun{ -#' processFields(file_path="file_path", taskId="task_id",description="") +#' processFields(file_path = "file_path", taskId = "task_id", description = "") #' } -processFields <- function(file_path="", taskId=NULL, description="", ...){ - - if(!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - querylist = list(taskId = taskId, description=description) - - process_details <- abbyy_POST("processFields", query=querylist, body=upload_file(file_path), ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processFields <- function(file_path = "", taskId = NULL, description = "", ...){ - resdf -} \ No newline at end of file + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + querylist <- list(taskId = taskId, description = description) + + process_details <- abbyy_POST("processFields", + query = querylist, + body = upload_file(file_path), ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/processImage.R abbyyr-0.5.4/R/processImage.R --- abbyyr-0.5.1/R/processImage.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processImage.R 2018-05-28 13:10:22.000000000 +0000 @@ -2,6 +2,7 @@ #' #' This function processes an image #' @param file_path path to the document +#' @param region String. Optional. Default: "-1,-1,-1,-1". Region of the image. #' @param language optional, default: English #' @param profile String. Optional; default: \code{documentConversion} #' Options: \code{documentConversion, documentArchiving, textExtraction, fieldLevelRecognition, barcodeRecognition} @@ -29,41 +30,65 @@ #' @references \url{http://ocrsdk.com/documentation/apireference/processImage/} #' #' @examples \dontrun{ -#' processImage(file_path="file_path", language="English", exportFormat="txtUnstructured") +#' processImage(file_path = "file_path", language = "English", exportFormat = "txtUnstructured") #' } +processImage <- function(file_path = "", language = "English", + profile = c("documentConversion", + "documentArchiving", + "textExtraction", + "fieldLevelRecognition", + "barcodeRecognition"), + textType = c("normal", "typewriter", "matrix", + "index", "ocrA", "ocrB", "e13b", + "cmc7", "gothic"), + imageSource = c("auto", "photo", "scanner"), + correctOrientation = c("true", "false"), + correctSkew = c("true", "false"), + region = "-1,-1,-1,-1", + readBarcodes = c("false", "true"), + exportFormat = c("txt", "txtUnstructured", + "rtf", "docx", "xlsx", "pptx", + "pdfSearchable", "pdfTextAndImages", + "pdfa", "xml", + "xmlForCorrectedImage", "alto"), + description = "", pdfPassword = "", ...) { + + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + profile <- match.arg(profile, choices = profile) + textType <- match.arg(textType, choices = textType) + correctSkew <- match.arg(correctSkew, choices = correctSkew) + imageSource <- match.arg(imageSource, choices = imageSource) + correctOrientation <- match.arg(correctOrientation, + choices = correctOrientation) + readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) + exportFormat <- match.arg(exportFormat, choices = exportFormat) + + querylist <- list(language = language, + region = region, + profile = profile, + textType = textType, + imageSource = imageSource, + correctOrientation = correctOrientation, + correctSkew = correctSkew, + readBarcodes = readBarcodes, + exportFormat = exportFormat, + description = description, + pdfPassword = pdfPassword) + + body <- upload_file(file_path) + process_details <- abbyy_POST("processImage", + query = querylist, + body = body, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") -processImage <- function(file_path="", language="English", - profile = c("documentConversion", "documentArchiving", "textExtraction", "fieldLevelRecognition", "barcodeRecognition"), - textType = c("normal", "typewriter", "matrix", "index", "ocrA", "ocrB", "e13b", "cmc7", "gothic"), - imageSource = c("auto", "photo", "scanner"), - correctOrientation = c("true", "false"), - correctSkew = c("true", "false"), - readBarcodes = c("false", "true"), - exportFormat = c("txt", "txtUnstructured", "rtf", "docx", "xlsx", "pptx", "pdfSearchable", "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", "alto"), - description="", pdfPassword="", ...) { - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - profile <- match.arg(profile, choices = profile) - textType <- match.arg(textType, choices = textType) - correctSkew <- match.arg(correctSkew, choices = correctSkew) - imageSource <- match.arg(imageSource, choices = imageSource) - correctOrientation <- match.arg(correctOrientation, choices = correctOrientation) - readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) - exportFormat <- match.arg(exportFormat, choices = exportFormat) - - querylist <- list(language=language, profile=profile,textType=textType, imageSource=imageSource, correctOrientation=correctOrientation, - correctSkew=correctSkew,readBarcodes=readBarcodes,exportFormat=exportFormat, description=description, pdfPassword=pdfPassword) - - body <- upload_file(file_path) - process_details <- abbyy_POST("processImage", query=querylist, body=body, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") - - resdf + resdf } diff -Nru abbyyr-0.5.1/R/processMRZ.R abbyyr-0.5.4/R/processMRZ.R --- abbyyr-0.5.1/R/processMRZ.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processMRZ.R 2018-04-18 17:23:13.000000000 +0000 @@ -8,22 +8,24 @@ #' @export #' @references \url{http://ocrsdk.com/documentation/apireference/processMRZ/} #' @examples \dontrun{ -#' processMRZ(file_path="file_path") +#' processMRZ(file_path = "file_path") #' } -processMRZ <- function(file_path="", ...) { - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - body=upload_file(file_path) - - process_details <- abbyy_POST("processMRZ", body=body, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processMRZ <- function(file_path = "", ...) { - resdf -} \ No newline at end of file + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + body <- upload_file(file_path) + + process_details <- abbyy_POST("processMRZ", body = body, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/processPhotoId.R abbyyr-0.5.4/R/processPhotoId.R --- abbyyr-0.5.1/R/processPhotoId.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processPhotoId.R 2018-04-18 17:23:13.000000000 +0000 @@ -17,23 +17,35 @@ #' @export #' @references \url{http://ocrsdk.com/documentation/apireference/processPhotoId/} #' @examples \dontrun{ -#' processPhotoId(file_path="file_path", idType="auto", imageSource="auto") +#' processPhotoId(file_path = "file_path", idType = "auto", imageSource = "auto") #' } -processPhotoId <- function(file_path="", idType="auto", imageSource="auto", correctOrientation="true", correctSkew="true", description="", pdfPassword="", ...) { - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") +processPhotoId <- function(file_path = "", idType = "auto", + imageSource = "auto", correctOrientation = "true", + correctSkew = "true", description = "", + pdfPassword = "", ...) { + + if ( !file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + querylist <- list(idType = idType, + imageSource = imageSource, + correctOrientation = correctOrientation, + correctSkew = correctSkew, + description = description, + pdfPassword = pdfPassword) + + body <- upload_file(file_path) + process_details <- abbyy_POST("processPhotoId", + query = NULL, + body = body, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") - querylist <- list(idType=idType, imageSource=imageSource, correctOrientation=correctOrientation, correctSkew=correctSkew, description=description, pdfPassword=pdfPassword) - - body <- upload_file(file_path) - process_details <- abbyy_POST("processPhotoId", query=NULL, body=body, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") - - resdf -} \ No newline at end of file + resdf +} diff -Nru abbyyr-0.5.1/R/processRemoteImage.R abbyyr-0.5.4/R/processRemoteImage.R --- abbyyr-0.5.1/R/processRemoteImage.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processRemoteImage.R 2018-04-18 17:23:13.000000000 +0000 @@ -23,39 +23,60 @@ #' @export #' @references \url{http://ocrsdk.com/documentation/apireference/processRemoteImage/} #' @examples \dontrun{ -#' processRemoteImage(img_url="img_url") +#' processRemoteImage(img_url = "img_url") #' } -processRemoteImage <- function(img_url=NULL, language="English", - profile = c("documentConversion", "documentArchiving", "textExtraction", "fieldLevelRecognition", "barcodeRecognition"), - textType = c("normal", "typewriter", "matrix", "index", "ocrA", "ocrB", "e13b", "cmc7", "gothic"), - imageSource = c("auto", "photo", "scanner"), - correctOrientation = c("true", "false"), - correctSkew = c("true", "false"), - readBarcodes = c("false", "true"), - exportFormat = c("txt", "txtUnstructured", "rtf", "docx", "xlsx", "pptx", "pdfSearchable", "pdfTextAndImages", "pdfa", "xml", "xmlForCorrectedImage", "alto"), - description=NULL, pdfPassword=NULL, ...) { - - if (is.null(img_url)) stop("Must specify img_url") - - profile <- match.arg(profile, choices = profile) - textType <- match.arg(textType, choices = textType) - correctSkew <- match.arg(correctSkew, choices = correctSkew) - imageSource <- match.arg(imageSource, choices = imageSource) - correctOrientation <- match.arg(correctOrientation, choices = correctOrientation) - readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) - exportFormat <- match.arg(exportFormat, choices = exportFormat) - - querylist = list(source=img_url, language=language, profile=profile,textType=textType, imageSource=imageSource, correctOrientation=correctOrientation, - correctSkew=correctSkew,readBarcodes=readBarcodes,exportFormat=exportFormat, description=description, pdfPassword=pdfPassword) - - process_details <- abbyy_GET("processRemoteImage", query=querylist, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processRemoteImage <- function(img_url = NULL, language = "English", + profile = c("documentConversion", + "documentArchiving", + "textExtraction", + "fieldLevelRecognition", + "barcodeRecognition"), + textType = c("normal", "typewriter", "matrix", + "index", "ocrA", "ocrB", "e13b", + "cmc7", "gothic"), + imageSource = c("auto", "photo", "scanner"), + correctOrientation = c("true", "false"), + correctSkew = c("true", "false"), + readBarcodes = c("false", "true"), + exportFormat = c("txt", "txtUnstructured", + "rtf", "docx", "xlsx", "pptx", + "pdfSearchable", + "pdfTextAndImages", "pdfa", + "xml", "xmlForCorrectedImage", + "alto"), + description = NULL, pdfPassword = NULL, ...) { - resdf + if (is.null(img_url)) stop("Must specify img_url") + + profile <- match.arg(profile, choices = profile) + textType <- match.arg(textType, choices = textType) + correctSkew <- match.arg(correctSkew, choices = correctSkew) + imageSource <- match.arg(imageSource, choices = imageSource) + correctOrientation <- match.arg(correctOrientation, + choices = correctOrientation) + readBarcodes <- match.arg(readBarcodes, choices = readBarcodes) + exportFormat <- match.arg(exportFormat, choices = exportFormat) + + querylist <- list(source = img_url, + language = language, + profile = profile, + textType = textType, + imageSource = imageSource, + correctOrientation = correctOrientation, + correctSkew = correctSkew, + readBarcodes = readBarcodes, + exportFormat = exportFormat, + description = description, + pdfPassword = pdfPassword) + + process_details <- abbyy_GET("processRemoteImage", query = querylist, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf } diff -Nru abbyyr-0.5.1/R/processTextField.R abbyyr-0.5.4/R/processTextField.R --- abbyyr-0.5.1/R/processTextField.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/processTextField.R 2018-05-30 12:11:44.000000000 +0000 @@ -26,24 +26,46 @@ #' processTextField(file_path="file_path") #' } -processTextField <- function(file_path="", region="-1,-1,-1,-1", language="English", letterSet="", regExp="", textType="normal", oneTextLine="false", - oneWordPerTextLine="false", markingType="simpleText", placeholdersCount="1", writingStyle="default", description="", - pdfPassword="", ...) { - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - querylist <- list(language = language, letterSet = letterSet, regExp = regExp, textType = textType, oneTextLine = oneTextLine, - oneWordPerTextLine = oneWordPerTextLine, markingType = markingType, placeholdersCount = placeholdersCount, - writingStyle = writingStyle, description = description, pdfPassword = pdfPassword) - - body <- upload_file(file_path) - process_details <- abbyy_POST("processTextField", query=querylist, body=body, ...) - - resdf <- ldply(process_details, rbind) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +processTextField <- function(file_path = "", + region = "-1,-1,-1,-1", + language = "English", + letterSet = "", + regExp = "", textType = "normal", + oneTextLine = "false", + oneWordPerTextLine = "false", + markingType = "simpleText", + placeholdersCount = "1", + writingStyle = "default", + description = "", + pdfPassword = "", ...) { - resdf -} \ No newline at end of file + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + querylist <- list(language = language, + region = region, + letterSet = letterSet, + regExp = regExp, + textType = textType, + oneTextLine = oneTextLine, + oneWordPerTextLine = oneWordPerTextLine, + markingType = markingType, + placeholdersCount = placeholdersCount, + writingStyle = writingStyle, + description = description, + pdfPassword = pdfPassword) + + body <- upload_file(file_path) + process_details <- abbyy_POST("processTextField", + query = querylist, + body = body, ...) + + resdf <- ldply(process_details, rbind) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/R/setapp.R abbyyr-0.5.4/R/setapp.R --- abbyyr-0.5.1/R/setapp.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/setapp.R 2018-04-18 17:23:13.000000000 +0000 @@ -16,30 +16,30 @@ #' setapp(c("app_id", "app_password")) #' } -setapp <- -function(appdetails = NULL, force=FALSE) { +setapp <- function(appdetails = NULL, force=FALSE) { + + env_id <- Sys.getenv("AbbyyAppId") + env_pass <- Sys.getenv("AbbyyAppPassword") - env_id <- Sys.getenv('AbbyyAppId') - env_pass <- Sys.getenv('AbbyyAppPassword') - # If you cannot find AbbyyAppId or AbbyyAppPassword in the environment - if ((identical(env_id, "") | identical(env_pass, "")) | !force) { + if ( (identical(env_id, "") | identical(env_pass, "")) | !force) { - # First look for arguments passed in the function - if (!is.null(appdetails)) { - Sys.setenv(AbbyyAppId = appdetails[1]) - Sys.setenv(AbbyyAppPassword = appdetails[2]) - } + # First look for arguments passed in the function + if (!is.null(appdetails)) { + Sys.setenv(AbbyyAppId = appdetails[1]) + Sys.setenv(AbbyyAppPassword = appdetails[2]) + } - # Else ask user for the details - else { - message("Couldn't find env var AbbyyAppId or AbbyyAppPassword. See ?setapp for more details.") - message("Please enter your AbbyyAppId and press enter:") - pat <- readline(": ") - Sys.setenv(AbbyyAppId = pat) - message("Now please enter your AbbyyAppPassword and press enter:") - pat <- readline(": ") - Sys.setenv(AbbyyAppPassword = pat) - } + # Else ask user for the details + else { + message("Couldn't find env var AbbyyAppId or AbbyyAppPassword. + See ?setapp for more details.") + message("Please enter your AbbyyAppId and press enter:") + pat <- readline(": ") + Sys.setenv(AbbyyAppId = pat) + message("Now please enter your AbbyyAppPassword and press enter:") + pat <- readline(": ") + Sys.setenv(AbbyyAppPassword = pat) + } } } diff -Nru abbyyr-0.5.1/R/submitImage.R abbyyr-0.5.4/R/submitImage.R --- abbyyr-0.5.1/R/submitImage.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/R/submitImage.R 2018-04-18 17:23:13.000000000 +0000 @@ -13,25 +13,28 @@ #' submitImage(file_path="/images/image1.png", taskId="task_id", pdfPassword="pdf_password") #' } -submitImage <- function(file_path="", taskId="", pdfPassword="", ...) -{ - - if (!file.exists(file_path)) stop("File Doesn't Exist. Please check the path.") - - # The API doesn't handle taskId="" and that is just as well as new task is created - if (taskId=="") { - querylist = list(pdfPassword=pdfPassword) - } else { - querylist = list(taskId = taskId, pdfPassword=pdfPassword) - } - - submit_details <- abbyy_POST("submitImage", query=querylist, body=upload_file(file_path), ...) - - resdf <- as.data.frame(do.call(rbind, submit_details)) - - # Print some important things - cat("Status of the task: ", resdf$status, "\n") - cat("Task ID: ", resdf$id, "\n") +submitImage <- function(file_path = "", taskId = "", pdfPassword = "", ...) { - resdf -} \ No newline at end of file + if (!file.exists(file_path)) { + stop("File Doesn't Exist. Please check the path.") + } + + # The API doesn't handle taskId="" and that is fine as new task is created + if (taskId == "") { + querylist <- list(pdfPassword = pdfPassword) + } else { + querylist <- list(taskId = taskId, pdfPassword = pdfPassword) + } + + submit_details <- abbyy_POST("submitImage", + query = querylist, + body = upload_file(file_path), ...) + + resdf <- as.data.frame(do.call(rbind, submit_details)) + + # Print some important things + cat("Status of the task: ", resdf$status, "\n") + cat("Task ID: ", resdf$id, "\n") + + resdf +} diff -Nru abbyyr-0.5.1/README.md abbyyr-0.5.4/README.md --- abbyyr-0.5.1/README.md 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/README.md 2018-05-30 12:44:39.000000000 +0000 @@ -5,6 +5,8 @@ [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/abbyyR)](https://cran.r-project.org/package=abbyyR) ![](http://cranlogs.r-pkg.org/badges/grand-total/abbyyR) [![codecov](https://codecov.io/gh/soodoku/abbyyR/branch/master/graph/badge.svg)](https://codecov.io/gh/soodoku/abbyyR) +[![Research software impact](http://depsy.org/api/package/cran/abbyyR/badge.svg)](http://depsy.org/package/r/abbyyR) +[![Github Stars](https://img.shields.io/github/stars/soodoku/abbyyR.svg?style=social&label=Github)](https://github.com/soodoku/abbyyR) Easily OCR images, barcodes, forms, documents with machine readable zones, e.g. passports, right from R. Get the results in a wide variety of formats, from text files to detailed XMLs with information about bounding boxes, etc. diff -Nru abbyyr-0.5.1/tests/testthat/test-get-info.R abbyyr-0.5.4/tests/testthat/test-get-info.R --- abbyyr-0.5.1/tests/testthat/test-get-info.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-get-info.R 2018-04-18 17:23:13.000000000 +0000 @@ -1,14 +1,14 @@ context("Get App Info.") test_that("getAppInfo happens successfully", { - + skip_on_cran() token_file <- file("abbyy_key", "r") token <- suppressWarnings(readLines(token_file)) close(token_file) setapp(unlist(strsplit(token, ","))) - + get_info <- getAppInfo() expect_that(get_info, is_a("data.frame")) -}) \ No newline at end of file +}) diff -Nru abbyyr-0.5.1/tests/testthat/test-get-results.R abbyyr-0.5.4/tests/testthat/test-get-results.R --- abbyyr-0.5.1/tests/testthat/test-get-results.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-get-results.R 2018-04-18 17:23:13.000000000 +0000 @@ -9,6 +9,6 @@ close(token_file) setapp(unlist(strsplit(token, ","))) - results <- getResults(save_to_file=FALSE) + results <- getResults(save_to_file = FALSE) expect_that(results, is_a("data.frame")) -}) \ No newline at end of file +}) diff -Nru abbyyr-0.5.1/tests/testthat/test-list-finished-tasks.R abbyyr-0.5.4/tests/testthat/test-list-finished-tasks.R --- abbyyr-0.5.1/tests/testthat/test-list-finished-tasks.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-list-finished-tasks.R 2018-04-18 17:23:13.000000000 +0000 @@ -2,7 +2,7 @@ test_that("listFinishedTasks happens successfully", { skip_on_cran() - + token_file <- file("abbyy_key", "r") token <- suppressWarnings(readLines(token_file)) close(token_file) @@ -10,4 +10,4 @@ list_fin_tasks <- listFinishedTasks() expect_that(list_fin_tasks, is_a("data.frame")) -}) \ No newline at end of file +}) diff -Nru abbyyr-0.5.1/tests/testthat/test-list-tasks.R abbyyr-0.5.4/tests/testthat/test-list-tasks.R --- abbyyr-0.5.1/tests/testthat/test-list-tasks.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-list-tasks.R 2018-04-18 17:23:13.000000000 +0000 @@ -2,7 +2,7 @@ test_that("listTasks happens successfully", { skip_on_cran() - + token_file <- file("abbyy_key", "r") token <- suppressWarnings(readLines(token_file)) close(token_file) @@ -10,15 +10,15 @@ list_tasks <- listTasks() expect_that(listTasks(), is_a("data.frame")) - + if (nrow(list_tasks) > 0 ) { - # Task Status - task_status <- getTaskStatus(list_tasks[1,2]) - expect_that(task_status, is_a("data.frame")) - - # Delete Task - ready_to_delete <- list_tasks[list_tasks$status=="Completed",] - del_task <- deleteTask(ready_to_delete[1,2]) - expect_that(del_task, is_a("data.frame")) + # Task Status + task_status <- getTaskStatus(list_tasks[1, 2]) + expect_that(task_status, is_a("data.frame")) + + # Delete Task + ready_to_delete <- list_tasks[list_tasks$status == "Completed", ] + del_task <- deleteTask(ready_to_delete[1, 2]) + expect_that(del_task, is_a("data.frame")) } -}) \ No newline at end of file +}) diff -Nru abbyyr-0.5.1/tests/testthat/test-pkg-style.R abbyyr-0.5.4/tests/testthat/test-pkg-style.R --- abbyyr-0.5.1/tests/testthat/test-pkg-style.R 1970-01-01 00:00:00.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-pkg-style.R 2018-04-18 17:23:13.000000000 +0000 @@ -0,0 +1,7 @@ +# https://github.com/jimhester/lintr +if (requireNamespace("lintr", quietly = TRUE)) { + context("lints") + test_that("Package Style", { + lintr::expect_lint_free(cache = TRUE) + }) +} diff -Nru abbyyr-0.5.1/tests/testthat/test-submit-image.R abbyyr-0.5.4/tests/testthat/test-submit-image.R --- abbyyr-0.5.1/tests/testthat/test-submit-image.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat/test-submit-image.R 2018-04-18 17:23:13.000000000 +0000 @@ -4,15 +4,15 @@ test_that("submitImage, processImage happens successfully", { skip_on_cran() - + token_file <- file("abbyy_key", "r") token <- suppressWarnings(readLines(token_file)) close(token_file) setapp(unlist(strsplit(token, ","))) - sub_img <- submitImage(file_path=samp_image) - proc_img <- processImage(file_path=samp_image) + sub_img <- submitImage(file_path = samp_image) + proc_img <- processImage(file_path = samp_image) expect_that(sub_img, is_a("data.frame")) expect_that(proc_img, is_a("data.frame")) -}) \ No newline at end of file +}) diff -Nru abbyyr-0.5.1/tests/testthat.R abbyyr-0.5.4/tests/testthat.R --- abbyyr-0.5.1/tests/testthat.R 2017-04-12 19:37:07.000000000 +0000 +++ abbyyr-0.5.4/tests/testthat.R 2018-04-18 17:23:13.000000000 +0000 @@ -1,4 +1,4 @@ library(testthat) library(abbyyR) -test_check("abbyyR") \ No newline at end of file +test_check("abbyyR")