1 | <?php |
||
19 | class ImageToTextTask extends Entity implements TaskInterface |
||
20 | { |
||
21 | /** |
||
22 | * File body encoded in base64. Make sure to send it without line breaks. |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $body; |
||
26 | |||
27 | /** |
||
28 | * false - no requirements |
||
29 | * true - worker must enter an answer with at least one "space". |
||
30 | * @var bool |
||
31 | */ |
||
32 | protected $phrase = false; |
||
33 | |||
34 | /** |
||
35 | * false - no requirements |
||
36 | * true - worker will see a special mark telling that answer must be entered with case sensitivity. |
||
37 | * @var bool |
||
38 | */ |
||
39 | protected $case = false; |
||
40 | |||
41 | /** |
||
42 | * 0 - no requirements |
||
43 | * 1 - only number are allowed |
||
44 | * 2 - any letters are allowed except numbers |
||
45 | * @var int |
||
46 | */ |
||
47 | protected $numeric = 0; |
||
48 | |||
49 | /** |
||
50 | * false - no requirements |
||
51 | * true - worker will see a special mark telling that answer must be calculated |
||
52 | * @var bool; |
||
53 | */ |
||
54 | protected $math = false; |
||
55 | |||
56 | /** |
||
57 | * 0 - no requirements |
||
58 | * >1 - defines minimum length of the answer |
||
59 | * |
||
60 | * @var int |
||
61 | */ |
||
62 | protected $minLength = 0; |
||
63 | |||
64 | /** |
||
65 | * 0 - no requirements |
||
66 | * >1 - defines maximum length of the answer |
||
67 | * @var int |
||
68 | */ |
||
69 | protected $maxLength = 0; |
||
70 | |||
71 | /** |
||
72 | * From image task builder. |
||
73 | * |
||
74 | * @param string $path # Path po the image |
||
75 | * @param array $options # Recognition options |
||
76 | * @return static |
||
77 | * @throws InvalidArgumentException |
||
78 | */ |
||
79 | public static function fromImage($path, array $options = []) |
||
87 | /** |
||
88 | * From Base64 task builder. |
||
89 | * |
||
90 | * @param string $string # Base64 string |
||
91 | * @param array $options # Recognition options |
||
92 | * @return static |
||
93 | * @throws InvalidArgumentException |
||
94 | */ |
||
95 | public static function fromBase64($string, array $options = []) |
||
100 | |||
101 | /** |
||
102 | * ImageToTextTask constructor. |
||
103 | * |
||
104 | * @param array $options |
||
105 | * @throws InvalidArgumentException |
||
106 | */ |
||
107 | public function __construct(array $options = []) |
||
114 | |||
115 | /** |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getBody() |
||
122 | |||
123 | /** |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function isPhrase() |
||
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isCase() |
||
138 | |||
139 | /** |
||
140 | * @return int |
||
141 | */ |
||
142 | public function getNumeric() |
||
146 | |||
147 | /** |
||
148 | * @return bool |
||
149 | */ |
||
150 | public function isMath() |
||
154 | |||
155 | /** |
||
156 | * @return int |
||
157 | */ |
||
158 | public function getMinLength() |
||
162 | |||
163 | /** |
||
164 | * @return int |
||
165 | */ |
||
166 | public function getMaxLength() |
||
170 | |||
171 | /** |
||
172 | * @return string |
||
173 | */ |
||
174 | public function getType() |
||
178 | |||
179 | /** |
||
180 | * @return array |
||
181 | */ |
||
182 | public function toArray() |
||
195 | } |
||
196 |