Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Natural Language API with Java - setLanguage

I am using the Google Natural Language API to analyze entities from different texts. Is there a way to change the language of the input text to, for example english, as it is the case with the AlchemyAPI with

service.setLanguage (LanguageSelection.ENGLISH);

thanks

like image 891
sp0030 Avatar asked Nov 23 '16 13:11

sp0030


1 Answers

You specify the language via the relevant ISO or BCP-47 tag in the Document part of the request. So for example:

Document document = Document.newBuilder()
    .setLanguage("en")
    .set... // Call other setters
    .build();
like image 97
Jon Skeet Avatar answered Oct 17 '22 07:10

Jon Skeet