Skip to content
This repository was archived by the owner on Aug 3, 2022. It is now read-only.
This repository was archived by the owner on Aug 3, 2022. It is now read-only.

The Natural Language demo pulls the wrong code  #4

@dinagraves

Description

@dinagraves

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions