Assigned
Status Update
Comments
mi...@google.com <mi...@google.com> #2
I have informed our engineering team of this feature request. There is currently no ETA for its implementation.
A current workaround would be to check the returned "boundingPoly" [1] "vertices" for the returned "textAnnotations". If the calculated rectangle's heights > widths, than your image is sideways.
[1]https://cloud.google.com/vision/reference/rest/v1/images/annotate#boundingpoly
A current workaround would be to check the returned "boundingPoly" [1] "vertices" for the returned "textAnnotations". If the calculated rectangle's heights > widths, than your image is sideways.
[1]
Description
The attached document contains the wrong tag: `<title />` which prevents annotation to happen.
I am using annotateText with Document.Type.HTML
The JSON response (AnnotateTextResponse printed to json) I get doesn't contain neither any valuable information nor error status code.
What you expected to happen:
either error status code if malformed HTML was detected,
or different from 200 HTTP Response Status code,
or a meaningful exception from thrown by `google-cloud-language` library.
Steps to reproduce:
1. place the attached document to GS bucket
2. create Document as:
try (LanguageServiceClient language = LanguageServiceClient.create()) {
Document.Builder docBuilder = Document.newBuilder();
docBuilder.setGcsContentUri(gcsUrl); // <-- gs url of your file
docBuilder.setType(Document.Type.HTML);
Document doc = docBuilder.build();
AnnotateTextRequest request = AnnotateTextRequest.newBuilder()
.setDocument(doc)
.setFeatures(AnnotateTextRequest.Features.newBuilder()
.setClassifyText(true)
.setExtractEntities(true)
.setExtractEntitySentiment(true)
.setExtractDocumentSentiment(true)
.setExtractSyntax(true)
.build())
.build();
AnnotateTextResponse annotateTextResponse = language.annotateText(request);
String json = JsonFormat.printer().print(annotateTextResponse)
} catch (Exception e) {
// process as you need
}
3. check json - nothing helps to detect that something went wrong
4. Remove from the attached document line with `<title />` tag and repeat step 2.
5. check json again - it contains annotation results.
pom dependency:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-language</artifactId>
<version>1.99.0</version>
</dependency>
Other information (workarounds you have tried, documentation consulted, etc):