From 5baae3d4256ae8607e736f97df5e131b546e8d52 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:28:04 +0000 Subject: [PATCH] feat: make `page_range` field public (#6654) fix: `OcrConfig.compute_style_info` is deprecated. Use `PremiumFeatures.compute_style_info` instead. PiperOrigin-RevId: 568225060 Source-Link: https://github.com/googleapis/googleapis/commit/3cd21b1720378111065a9be0d0884764d6d4a380 Source-Link: https://github.com/googleapis/googleapis-gen/commit/087cf523d1a0d9d53fe7833bc4d7bf369f82d333 Copy-Tag: eyJwIjoiRG9jdW1lbnRBaS8uT3dsQm90LnlhbWwiLCJoIjoiMDg3Y2Y1MjNkMWEwZDlkNTNmZTc4MzNiYzRkN2JmMzY5ZjgyZDMzMyJ9 Co-authored-by: Ajumal --- DocumentAi/metadata/V1/DocumentIo.php | Bin 1970 -> 2208 bytes .../metadata/V1/DocumentProcessorService.php | Bin 16005 -> 16211 bytes DocumentAi/src/V1/OcrConfig.php | 106 ++++++++++++- .../src/V1/OcrConfig/PremiumFeatures.php | 140 ++++++++++++++++++ DocumentAi/src/V1/ProcessOptions.php | 111 ++++++++++++++ .../ProcessOptions/IndividualPageSelector.php | 68 +++++++++ DocumentAi/src/V1/RawDocument.php | 8 +- 7 files changed, 421 insertions(+), 12 deletions(-) create mode 100644 DocumentAi/src/V1/OcrConfig/PremiumFeatures.php create mode 100644 DocumentAi/src/V1/ProcessOptions/IndividualPageSelector.php diff --git a/DocumentAi/metadata/V1/DocumentIo.php b/DocumentAi/metadata/V1/DocumentIo.php index e26dbd1ff412e22dcfb935a69eeceb8e8a19aecd..0da52cce58e734b3ad3a45c723f227d6f76e65eb 100644 GIT binary patch delta 269 zcmdnQzd&$<0u##?9xk1U-a4BDn5>zZJ~2=3Wqsl%npjd=lv*so4V2+FGM&uF zEFaIL00AOakN^Mx delta 36 scmZ1=xQTy*0u#$|E-syk-a4BDn5>zZTA3#IvObyomQ8VU1G@qv0L@qnF8}}l diff --git a/DocumentAi/metadata/V1/DocumentProcessorService.php b/DocumentAi/metadata/V1/DocumentProcessorService.php index 3c0b65beca9e804dd33033a7286dac18fe262f4d..3116356b7020ddebeea19c1112c98d78d257228f 100644 GIT binary patch delta 216 zcmZpzy|Fi;MjWN;32FiiJ|SBr@|-GRrbkN)vP9 z3lh^)g%#w6VhKhCW(`&+<_C_9 VPCQ&(V0RTI=B1}@e#bH06aY+=LYV*n delta 42 ycmcay*IK)QlZ|Oj!Deo@=}dy&TzmmV`N^rp#r_2)nfZCelU+HjH}Bz`ZVCWJpARhn diff --git a/DocumentAi/src/V1/OcrConfig.php b/DocumentAi/src/V1/OcrConfig.php index 380ddf120fe6..4b9bb667b81b 100644 --- a/DocumentAi/src/V1/OcrConfig.php +++ b/DocumentAi/src/V1/OcrConfig.php @@ -54,13 +54,28 @@ class OcrConfig extends \Google\Protobuf\Internal\Message */ private $enable_symbol = false; /** - * Turn on font id model and returns font style information. - * Use PremiumFeatures.compute_style_info instead. + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. * * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; * @deprecated */ protected $compute_style_info = false; + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + */ + private $disable_character_boxes_detection = false; + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + */ + private $premium_features = null; /** * Constructor. @@ -87,8 +102,15 @@ class OcrConfig extends \Google\Protobuf\Internal\Message * @type bool $enable_symbol * Includes symbol level OCR information if set to true. * @type bool $compute_style_info - * Turn on font id model and returns font style information. - * Use PremiumFeatures.compute_style_info instead. + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. + * @type bool $disable_character_boxes_detection + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * @type \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures $premium_features + * Configurations for premium OCR features. * } */ public function __construct($data = NULL) { @@ -253,8 +275,10 @@ public function setEnableSymbol($var) } /** - * Turn on font id model and returns font style information. - * Use PremiumFeatures.compute_style_info instead. + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. * * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; * @return bool @@ -267,8 +291,10 @@ public function getComputeStyleInfo() } /** - * Turn on font id model and returns font style information. - * Use PremiumFeatures.compute_style_info instead. + * Turn on font identification model and return font style information. + * Deprecated, use + * [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info] + * instead. * * Generated from protobuf field bool compute_style_info = 8 [deprecated = true]; * @param bool $var @@ -284,5 +310,69 @@ public function setComputeStyleInfo($var) return $this; } + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + * @return bool + */ + public function getDisableCharacterBoxesDetection() + { + return $this->disable_character_boxes_detection; + } + + /** + * Turn off character box detector in OCR engine. Character box detection is + * enabled by default in OCR 2.0+ processors. + * + * Generated from protobuf field bool disable_character_boxes_detection = 10; + * @param bool $var + * @return $this + */ + public function setDisableCharacterBoxesDetection($var) + { + GPBUtil::checkBool($var); + $this->disable_character_boxes_detection = $var; + + return $this; + } + + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + * @return \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures|null + */ + public function getPremiumFeatures() + { + return $this->premium_features; + } + + public function hasPremiumFeatures() + { + return isset($this->premium_features); + } + + public function clearPremiumFeatures() + { + unset($this->premium_features); + } + + /** + * Configurations for premium OCR features. + * + * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig.PremiumFeatures premium_features = 11; + * @param \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures $var + * @return $this + */ + public function setPremiumFeatures($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\OcrConfig\PremiumFeatures::class); + $this->premium_features = $var; + + return $this; + } + } diff --git a/DocumentAi/src/V1/OcrConfig/PremiumFeatures.php b/DocumentAi/src/V1/OcrConfig/PremiumFeatures.php new file mode 100644 index 000000000000..0501e1950206 --- /dev/null +++ b/DocumentAi/src/V1/OcrConfig/PremiumFeatures.php @@ -0,0 +1,140 @@ +google.cloud.documentai.v1.OcrConfig.PremiumFeatures + */ +class PremiumFeatures extends \Google\Protobuf\Internal\Message +{ + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + */ + private $enable_selection_mark_detection = false; + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + */ + private $compute_style_info = false; + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + */ + private $enable_math_ocr = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_selection_mark_detection + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * @type bool $compute_style_info + * Turn on font identification model and return font style information. + * @type bool $enable_math_ocr + * Turn on the model that can extract LaTeX math formulas. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentIo::initOnce(); + parent::__construct($data); + } + + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + * @return bool + */ + public function getEnableSelectionMarkDetection() + { + return $this->enable_selection_mark_detection; + } + + /** + * Turn on selection mark detector in OCR engine. Only available in OCR 2.0+ + * processors. + * + * Generated from protobuf field bool enable_selection_mark_detection = 3; + * @param bool $var + * @return $this + */ + public function setEnableSelectionMarkDetection($var) + { + GPBUtil::checkBool($var); + $this->enable_selection_mark_detection = $var; + + return $this; + } + + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + * @return bool + */ + public function getComputeStyleInfo() + { + return $this->compute_style_info; + } + + /** + * Turn on font identification model and return font style information. + * + * Generated from protobuf field bool compute_style_info = 4; + * @param bool $var + * @return $this + */ + public function setComputeStyleInfo($var) + { + GPBUtil::checkBool($var); + $this->compute_style_info = $var; + + return $this; + } + + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + * @return bool + */ + public function getEnableMathOcr() + { + return $this->enable_math_ocr; + } + + /** + * Turn on the model that can extract LaTeX math formulas. + * + * Generated from protobuf field bool enable_math_ocr = 5; + * @param bool $var + * @return $this + */ + public function setEnableMathOcr($var) + { + GPBUtil::checkBool($var); + $this->enable_math_ocr = $var; + + return $this; + } + +} + + diff --git a/DocumentAi/src/V1/ProcessOptions.php b/DocumentAi/src/V1/ProcessOptions.php index 7d0da0f9aafb..624ca6530ea5 100644 --- a/DocumentAi/src/V1/ProcessOptions.php +++ b/DocumentAi/src/V1/ProcessOptions.php @@ -22,6 +22,7 @@ class ProcessOptions extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.documentai.v1.OcrConfig ocr_config = 1; */ private $ocr_config = null; + protected $page_range; /** * Constructor. @@ -29,6 +30,13 @@ class ProcessOptions extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector $individual_page_selector + * Which pages to process (1-indexed). + * @type int $from_start + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * @type int $from_end + * Only process certain pages from the end, same as above. * @type \Google\Cloud\DocumentAI\V1\OcrConfig $ocr_config * Only applicable to `OCR_PROCESSOR`. Returns error if set on other * processor types. @@ -39,6 +47,101 @@ public function __construct($data = NULL) { parent::__construct($data); } + /** + * Which pages to process (1-indexed). + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector individual_page_selector = 5; + * @return \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector|null + */ + public function getIndividualPageSelector() + { + return $this->readOneof(5); + } + + public function hasIndividualPageSelector() + { + return $this->hasOneof(5); + } + + /** + * Which pages to process (1-indexed). + * + * Generated from protobuf field .google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector individual_page_selector = 5; + * @param \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector $var + * @return $this + */ + public function setIndividualPageSelector($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DocumentAI\V1\ProcessOptions\IndividualPageSelector::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * + * Generated from protobuf field int32 from_start = 6; + * @return int + */ + public function getFromStart() + { + return $this->readOneof(6); + } + + public function hasFromStart() + { + return $this->hasOneof(6); + } + + /** + * Only process certain pages from the start. Process all if the document + * has fewer pages. + * + * Generated from protobuf field int32 from_start = 6; + * @param int $var + * @return $this + */ + public function setFromStart($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Only process certain pages from the end, same as above. + * + * Generated from protobuf field int32 from_end = 7; + * @return int + */ + public function getFromEnd() + { + return $this->readOneof(7); + } + + public function hasFromEnd() + { + return $this->hasOneof(7); + } + + /** + * Only process certain pages from the end, same as above. + * + * Generated from protobuf field int32 from_end = 7; + * @param int $var + * @return $this + */ + public function setFromEnd($var) + { + GPBUtil::checkInt32($var); + $this->writeOneof(7, $var); + + return $this; + } + /** * Only applicable to `OCR_PROCESSOR`. Returns error if set on other * processor types. @@ -77,5 +180,13 @@ public function setOcrConfig($var) return $this; } + /** + * @return string + */ + public function getPageRange() + { + return $this->whichOneof("page_range"); + } + } diff --git a/DocumentAi/src/V1/ProcessOptions/IndividualPageSelector.php b/DocumentAi/src/V1/ProcessOptions/IndividualPageSelector.php new file mode 100644 index 000000000000..1e81f1fb76a3 --- /dev/null +++ b/DocumentAi/src/V1/ProcessOptions/IndividualPageSelector.php @@ -0,0 +1,68 @@ +google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector + */ +class IndividualPageSelector extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $pages; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $pages + * Optional. Indices of the pages (starting from 1). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Documentai\V1\DocumentProcessorService::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * Optional. Indices of the pages (starting from 1). + * + * Generated from protobuf field repeated int32 pages = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->pages = $arr; + + return $this; + } + +} + + diff --git a/DocumentAi/src/V1/RawDocument.php b/DocumentAi/src/V1/RawDocument.php index b00e24c1e281..93091ae18a0b 100644 --- a/DocumentAi/src/V1/RawDocument.php +++ b/DocumentAi/src/V1/RawDocument.php @@ -33,7 +33,7 @@ class RawDocument extends \Google\Protobuf\Internal\Message * the following: * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` * `~`, `=` and `:` are reserved. - * If not specified, a default ID will be generated. + * If not specified, a default ID is generated. * * Generated from protobuf field string display_name = 3; */ @@ -55,7 +55,7 @@ class RawDocument extends \Google\Protobuf\Internal\Message * the following: * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` * `~`, `=` and `:` are reserved. - * If not specified, a default ID will be generated. + * If not specified, a default ID is generated. * } */ public function __construct($data = NULL) { @@ -122,7 +122,7 @@ public function setMimeType($var) * the following: * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` * `~`, `=` and `:` are reserved. - * If not specified, a default ID will be generated. + * If not specified, a default ID is generated. * * Generated from protobuf field string display_name = 3; * @return string @@ -137,7 +137,7 @@ public function getDisplayName() * the following: * `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,` * `~`, `=` and `:` are reserved. - * If not specified, a default ID will be generated. + * If not specified, a default ID is generated. * * Generated from protobuf field string display_name = 3; * @param string $var