{"id":16194661,"url":"https://github.com/hironsan/google-natural-language-sampler","last_synced_at":"2025-08-13T23:02:59.397Z","repository":{"id":78289585,"uuid":"72403043","full_name":"Hironsan/google-natural-language-sampler","owner":"Hironsan","description":"Code examples for Google Natural Language API.","archived":false,"fork":false,"pushed_at":"2019-07-28T20:43:15.000Z","size":13,"stargazers_count":14,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-13T23:02:27.969Z","etag":null,"topics":["entity-sentiment-analysis","gcp","named-entity-recognition","natural-language-processing","python","sentiment-analysis","syntax-analysis","text-classification"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hironsan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-31T05:07:36.000Z","updated_at":"2025-08-07T12:21:36.000Z","dependencies_parsed_at":"2023-06-26T00:38:16.081Z","dependency_job_id":null,"html_url":"https://github.com/Hironsan/google-natural-language-sampler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Hironsan/google-natural-language-sampler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hironsan%2Fgoogle-natural-language-sampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hironsan%2Fgoogle-natural-language-sampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hironsan%2Fgoogle-natural-language-sampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hironsan%2Fgoogle-natural-language-sampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hironsan","download_url":"https://codeload.github.com/Hironsan/google-natural-language-sampler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hironsan%2Fgoogle-natural-language-sampler/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270330595,"owners_count":24565816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["entity-sentiment-analysis","gcp","named-entity-recognition","natural-language-processing","python","sentiment-analysis","syntax-analysis","text-classification"],"created_at":"2024-10-10T08:24:14.036Z","updated_at":"2025-08-13T23:02:59.326Z","avatar_url":"https://github.com/Hironsan.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-natural-language-sampler\n\nCode examples for Google Natural Language API written in Python.\n\n## Description\n\nExample codes has following features:\n\n* Sentiment Analysis\n* Named Entity Recognition\n* Syntax Analysis\n* Entity Sentiment Analysis\n* Text Classification\n* Text Annotation\n\n## Requirement\n\n* Python 3.x\n* Credentials\n\n## Setup\n\nTo install necessary library, simply use pip:\n\n```bash\npip install google-cloud-language\n```\n\nor,\n\n```bash\npip install -r requirements.txt\n```\n\nNext, set up to authenticate with the Cloud Natural Language API using your project's service account credentials. Then, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your downloaded service account credentials:\n\n```bash\nexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials-key.json\n```\n\n## Quick Start: Running the Example\n\n### Sentiment Analysis\n\n```bash\n$ python examples/sentiment_analysis.py \"President Obama looks very happy.\"\n    Sentiment score: 0.4000000059604645\nSentiment magnitude: 0.4000000059604645\n```\n\nFor more information, see [Analyzing sentiment](https://cloud.google.com/natural-language/docs/analyzing-sentiment).\n\n### Named Entity Recognition\n\n```bash\n$ python examples/named_entities.py \"President Obama is speaking at the White House.\"\n====================\n         name: Obama\n         type: PERSON\n     salience: 0.9082207679748535\nwikipedia_url: -\n====================\n         name: White House\n         type: LOCATION\n     salience: 0.09177924692630768\nwikipedia_url: https://en.wikipedia.org/wiki/White_House\n```\n\nFor more information, see [Analyzing entities](https://cloud.google.com/natural-language/docs/analyzing-entities).\n\n### Syntax Analysis\n\n```bash\n$ python examples/syntax_analysis.py \"President Obama is speaking at the White House.\"\nNOUN: President\nNOUN: Obama\nVERB: is\nVERB: speaking\nADP: at\nDET: the\nNOUN: White\nNOUN: House\nPUNCT: .\n```\n\nFor more information, see [Analyzing syntax](https://cloud.google.com/natural-language/docs/analyzing-syntax).\n\n### Entity Sentiment Analysis\n\n```bash\n$ python examples/entity_sentiment.py \"President Obama is speaking at the White House.\"\n====================\n         name: Obama\n         type: PERSON\n     salience: 0.9082207679748535\nwikipedia_url: -\n    magnitude: 0.10000000149011612\n        score: 0.0\n====================\n         name: White House\n         type: LOCATION\n     salience: 0.09177924692630768\nwikipedia_url: https://en.wikipedia.org/wiki/White_House\n    magnitude: 0.0\n        score: 0.0\n```\n\nFor more information, see [Analyzing entity sentiment](https://cloud.google.com/natural-language/docs/analyzing-entity-sentiment).\n\n### Text Classification\n\n```bash\n$ python examples/classify_text.py \"On Saturday, Sevilla FC announced the signing of Spanish defender Aleix Vidal from defending LaLiga champions FC Barcelona. Via their official website, Barcelona said they were to receive €8.5 million transfer as well as two million in variables.\"\n====================\nname            : /Sports/Team Sports/Soccer\nconfidence      : 0.9900000095367432\n====================\nname            : /News\nconfidence      : 0.550000011920929\n\n```\n\nFor more information, see [Classifying text](https://cloud.google.com/natural-language/docs/classifying-text).\nIn [the content category page](https://cloud.google.com/natural-language/docs/categories), You can see all categories returned by classify_text method.\n\n### Text Annotation\n\n```bash\n$ python examples/annotate_text.py \"President Obama looks very happy.\"\n    Sentiment score: 0.4000000059604645\nSentiment magnitude: 0.4000000059604645\n====================\n         name: Obama\n         type: PERSON\n     salience: 1.0\nwikipedia_url: https://en.wikipedia.org/wiki/Barack_Obama\n```\n\nFor more information, see [AnnotateTextRequest](https://cloud.google.com/natural-language/docs/reference/rpc/google.cloud.language.v1#google.cloud.language.v1.AnnotateTextRequest).\n\n## Licence\n\n[MIT](https://github.com/Hironsan/google-vision-sampler/blob/master/LICENSE)\n\n## Author\n\n[Hironsan](https://github.com/Hironsan)\n\n## References\n\n* [Natural Language](https://googlecloudplatform.github.io/google-cloud-python/latest/language/usage.html)\n* [Natural Language API Client Libraries](https://cloud.google.com/natural-language/docs/reference/libraries)\n* [Method: documents.classifyText](https://cloud.google.com/natural-language/docs/reference/rest/v1/documents/classifyText)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhironsan%2Fgoogle-natural-language-sampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhironsan%2Fgoogle-natural-language-sampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhironsan%2Fgoogle-natural-language-sampler/lists"}