For the NLP part of this codelab, we're asked to download this snippet:
curl https://raw.githubusercontent.com/GoogleCloudPlatform/python-docs-samples/master/language/cloud-client/v1/snippets.py -o natural_language.py
However, the code doesn't take any command line input arguments - and the next step of the codelab assumes that it can take an argument:
python natural_language.py entities-text 'where did you leave my bike'
Which returns with
natural_language.py: error: unrecognized arguments: where did you leave my bike
I found this pull request that had a different version of the code that did take text inputs from the args:
https://github.com/GoogleCloudPlatform/python-docs-samples/pull/668/files
I edited my local version of the code by simply adding:
Line 85:
def entities_text(text):
Line 362:
entities_text_parser = subparsers.add_parser(
'entities-text', help=entities_text.__doc__)
entities_text_parser.add_argument('text')
Line 380:
elif args.command == 'entities-text':
entities_text(args.text)
Either the snippet should be updated or the codelab should include instructions to update the code.