
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
stealth-aws-comprehend
Advanced tools
This gem provides NLP via the AWS Comprehend service. It integrates with the Stealth Controller to provide NLP against current_message
.
To 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!
This gem adds the following methods to current_message
:
language
identifies text written in over 100 languages and returns the dominant language in current_message
with a confidence scoreentities
returns the named entities ("People," "Places," "Locations," etc.) present in current_message
key_phrases
returns the key phrases or talking points and a confidence score to support for the current_message
sentiment
returns the overall sentiment (Positive, Negative, Neutral, or Mixed) for the current_message
sentiment_score
returns the scoring for each sentiment (Positive, Negative, Neutral, or Mixed) for the current_message
If current_message.message
is not available, each of these will return nil
.
The following examples are run on current_message.message
when it is equal to "I bought a brand new Craftsman Drill at Home Depot."
.
current_message.language
will return an Array of dominate languages:
languages = [#<struct Aws::Comprehend::Types::DominantLanguage language_code="en", score=0.9921924471855164>]
languages.first.language_code # "en"
languages.first.score # 0.9921924471855164
current_message.entites
will return an Array of entities:
entities = [#<struct Aws::Comprehend::Types::Entity score=0.5775995850563049, type="ORGANIZATION", text="Craftsman", begin_offset=21, end_offset=30>, #<struct Aws::Comprehend::Types::Entity score=0.9224900007247925, type="ORGANIZATION", text="Home Depot", begin_offset=40, end_offset=50>]
entities.first.text # "Craftsman"
entities.first.score # 5775995850563049
entities.first.type # ORGANIZATION
current_message.key_phrases
will return an Array of key phrases:
key_phrases = [#<struct Aws::Comprehend::Types::KeyPhrase score=0.965133786201477, text="a brand new Craftsman Drill", begin_offset=9, end_offset=36>, #<struct Aws::Comprehend::Types::KeyPhrase score=0.9943040609359741, text="Home Depot", begin_offset=40, end_offset=50>]
key_phrases.first.text # "a brand new Craftsman Drill"
key_phrases.first.score # 0.965133786201477
current_message.sentiment
will return the dominate sentiment of the message:
current_message.sentiment # "NEUTRAL"
current_message.sentiment_score
will return the scoring for each sentiment of the message:
sentiment_scores = #<struct Aws::Comprehend::Types::SentimentScore positive=0.0249068271368742, negative=0.012575631029903889, neutral=0.9605817794799805, mixed=0.0019358232384547591>
sentiment_scores.positive # 0.0249068271368742
sentiment_scores.negative # 0.012575631029903889
sentiment_scores.neutral # 0.9605817794799805
sentiment_scores.mixed # 0.0019358232384547591
Loading 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.
FAQs
Unknown package
We found that stealth-aws-comprehend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.