{"id":26480243,"url":"https://github.com/hellostealth/stealth-aws-comprehend","last_synced_at":"2025-03-20T02:13:16.600Z","repository":{"id":59156444,"uuid":"131246292","full_name":"hellostealth/stealth-aws-comprehend","owner":"hellostealth","description":"Built-in NLP for Stealth bots via AWS Comprehend","archived":false,"fork":false,"pushed_at":"2020-05-08T05:25:03.000Z","size":38,"stargazers_count":14,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-09T10:15:55.561Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellostealth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-27T04:40:50.000Z","updated_at":"2021-07-12T02:08:33.000Z","dependencies_parsed_at":"2022-09-13T20:10:51.858Z","dependency_job_id":null,"html_url":"https://github.com/hellostealth/stealth-aws-comprehend","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellostealth%2Fstealth-aws-comprehend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellostealth%2Fstealth-aws-comprehend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellostealth%2Fstealth-aws-comprehend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellostealth%2Fstealth-aws-comprehend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellostealth","download_url":"https://codeload.github.com/hellostealth/stealth-aws-comprehend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244536457,"owners_count":20468350,"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","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":[],"created_at":"2025-03-20T02:13:16.059Z","updated_at":"2025-03-20T02:13:16.595Z","avatar_url":"https://github.com/hellostealth.png","language":"Ruby","readme":"# Stealth Amazon Comprehend\n\nThis gem provides NLP via the [AWS Comprehend](https://aws.amazon.com/comprehend/) service. It integrates with the [Stealth](https://github.com/hellostealth/stealth) Controller to provide NLP against `current_message`.\n\n[![Gem Version](https://badge.fury.io/rb/stealth-aws-comprehend.svg)](https://badge.fury.io/rb/stealth-aws-comprehend)\n\n## Setup\n\nTo use AWS Comprehend, set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables to your AWS account credentials. You may also want to optionally set your preferred AWS region by setting the environment variable `AWS_REGION`. That's the only setup required!\n\n## Using NLP\n\nThis gem adds the following methods to `current_message`:\n\n1. `language` identifies text written in over 100 languages and returns the dominant language in `current_message` with a confidence score\n2. `entities` returns the named entities (\"People,\" \"Places,\" \"Locations,\" etc.) present in `current_message`\n3. `key_phrases` returns the key phrases or talking points and a confidence score to support for the `current_message`\n4. `sentiment` returns the overall sentiment (Positive, Negative, Neutral, or Mixed) for the `current_message`\n5. `sentiment_score` returns the scoring for each sentiment (Positive, Negative, Neutral, or Mixed) for the `current_message`\n\nIf `current_message.message` is not available, each of these will return `nil`.\n\nThe following examples are run on `current_message.message` when it is equal to `\"I bought a brand new Craftsman Drill at Home Depot.\"`.\n\n### language\n\n`current_message.language` will return an Array of dominate languages:\n\n```ruby\nlanguages = [#\u003cstruct Aws::Comprehend::Types::DominantLanguage language_code=\"en\", score=0.9921924471855164\u003e]\nlanguages.first.language_code # \"en\"\nlanguages.first.score # 0.9921924471855164\n```\n\n### entities\n\n`current_message.entites` will return an Array of entities:\n\n```ruby\nentities = [#\u003cstruct Aws::Comprehend::Types::Entity score=0.5775995850563049, type=\"ORGANIZATION\", text=\"Craftsman\", begin_offset=21, end_offset=30\u003e, #\u003cstruct Aws::Comprehend::Types::Entity score=0.9224900007247925, type=\"ORGANIZATION\", text=\"Home Depot\", begin_offset=40, end_offset=50\u003e]\nentities.first.text # \"Craftsman\"\nentities.first.score # 5775995850563049\nentities.first.type # ORGANIZATION\n```\n\n### key_phrases\n\n`current_message.key_phrases` will return an Array of key phrases:\n\n```ruby\nkey_phrases = [#\u003cstruct Aws::Comprehend::Types::KeyPhrase score=0.965133786201477, text=\"a brand new Craftsman Drill\", begin_offset=9, end_offset=36\u003e, #\u003cstruct Aws::Comprehend::Types::KeyPhrase score=0.9943040609359741, text=\"Home Depot\", begin_offset=40, end_offset=50\u003e]\nkey_phrases.first.text # \"a brand new Craftsman Drill\"\nkey_phrases.first.score # 0.965133786201477\n```\n\n### sentiment\n\n`current_message.sentiment` will return the dominate sentiment of the message:\n\n```ruby\ncurrent_message.sentiment # \"NEUTRAL\"\n```\n\n### sentiment_score\n\n`current_message.sentiment_score` will return the scoring for each sentiment of the message:\n\n```ruby\nsentiment_scores = #\u003cstruct Aws::Comprehend::Types::SentimentScore positive=0.0249068271368742, negative=0.012575631029903889, neutral=0.9605817794799805, mixed=0.0019358232384547591\u003e\nsentiment_scores.positive # 0.0249068271368742\nsentiment_scores.negative # 0.012575631029903889\nsentiment_scores.neutral # 0.9605817794799805\nsentiment_scores.mixed # 0.0019358232384547591\n```\n\n## AWS Usage\n\nLoading this gem into your bot doesn't automatically issue API requests to your AWS account. API requests are lazily made each time you call one of the above methods. One exception is `sentiment` and `sentiment_score` which share an API call and so that only a single API call is made between the two.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellostealth%2Fstealth-aws-comprehend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellostealth%2Fstealth-aws-comprehend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellostealth%2Fstealth-aws-comprehend/lists"}