This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
/
example.Rmd
184 lines (125 loc) · 3.41 KB
/
example.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
title: "A Worked Out Example of Managing with abbyyR"
author: "Gaurav Sood"
date: "`r Sys.Date()`"
vignette: >
%\VignetteIndexEntry{A Worked Out Example of Managing with abbyyR}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
#### Load the package
To install the package from CRAN, type:
```{r, eval=FALSE, install_cran}
install.packages("abbyyR")
```
To get the latest development version from GitHub:
```{r, eval=FALSE, install}
# install.packages('devtools')
devtools::install_github('soodoku/abbyyR')
```
Next, load the package.
```{r, eval=FALSE, loadlib}
library(abbyyR)
```
#### Set credentials
Your first task on loading the package should be to set the credentials - application ID and password. If you haven't already, you can get this information
[http://ocrsdk.com/](http://ocrsdk.com/). Once you have the application ID and password, set it via the `setapp` function.
```{r, eval=FALSE, setapp}
setapp(c("factbook", "7YVBc8E6xMricoTwp0mF0aH"))
```
#### Get Information about Application
```{r, eval=FALSE, getinfo}
getAppInfo()
```
```
## Name of Application: factbook
## No. of Pages Remaining: 99
## No. of Fields Remaining: 495
## Application Credits Expire on: 2015-08-28T00:00:00
## Type: Normal
```
#### List Tasks
List all the tasks -- completed, in progress, queued etc. The function returns a data frame.
```{r, eval=FALSE, listasks}
tasklist <- listTasks()
```
```
## Total No. of Tasks: 30
## No. of Finished Tasks: 22
```
```{r, eval=FALSE, checktasksMdelete}
listTasks(excludeDeleted="true")
```
```
## Total No. of Tasks: 28
## No. of Finished Tasks: 22
```
```{r, eval=FALSE, listtasksdaterange}
listTasks(fromDate="2015-05-30T20:28:43Z", toDate="2015-05-31T20:28:43Z")
```
```
## No tasks in the application.
```
#### List Finished Tasks
```{r, eval=FALSE, listfinished}
listFinishedTasks()
```
```
## No. of Finished Tasks: 24
```
#### Get Task Status
```{r, eval=FALSE, gettaskstatus}
getTaskStatus(taskId="47f9b0d4-79a2-4aed-b656-2683a85ac203")
```
```
## Status of the task: Deleted
```
#### Delete Task
Deleting an already deleted task will result in an error.
```{r, eval=FALSE, deletetask}
#deleteTask(taskId="47f9b0d4-79a2-4aed-b656-2683a85ac203")
```
**Submit an Image for Processing**
Note: I am uploading a sample image that Abbyy provides for free to test its software. You can find this image in the data folder of the package.
```{r, eval=FALSE, submittask}
submitImage(file_path="t1.png", pdfPassword="")
```
```
## Status of the task: Submitted
## Task ID: 4c088272-003d-4fc7-b0f7-b805495c4466
```
**Process an Image**
```{r, eval=FALSE, processimage}
processImage(file_path="t1.png")
```
```
## Status of the task: Queued
## Task ID: 650d4cd3-964c-40c6-9118-97eecc099b34
```
**Process a Remote Image**
```{r, eval=FALSE, processRemote}
processRemoteImage(img_url="https://raw.githubusercontent.com/soodoku/abbyyR/master/inst/extdata/t1.png")
```
```
## Status of the task: Submitted
## Task ID: 7f5112b8-6541-435e-86c4-dc978a45749e
```
**Process Document**
```{r, eval=FALSE, processdoc}
res <- listTasks()
```
```
## Total No. of Tasks: 33
## No. of Finished Tasks: 23
```
```{r, eval=FALSE, processdoc2}
processDocument(taskId=res$id[res$status=="Submitted"][1])
```
```
## Status of the task: Queued
```
**Get Results**
Go through all the finished tasks and download all the data.
```{r, eval=FALSE, getresults}
# getResults()
```