In this recipe, we will use the Google NLP API to parse text. However, we can graphically display the tree. Using your browser, go to https://cloud.google.com/natural-language/. Near the bottom of the page, you will find a field labelled Try the API. Enter the string, He walked to the store. Next, press the ANALYZE button. Select the Syntax tab below the text field. You will see the parse tree as shown next:
Using the Google NLP API to parse text
Getting ready
To prepare, we need to do the following:
-
Setup the GCP service and API key according to the recipe Getting ready to use the Google Cloud Platform in the Appendix, Installation and Configuration.
-
Create a new Maven project
- Add the following dependencies to the POM...