Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
caed118
BX-68618: multipart request example
asoos-babelstreet Mar 5, 2026
b3300f6
BX-68618: fix rubocop offenses
asoos-babelstreet Mar 5, 2026
219bf6a
BX-68618: update package information and README
asoos-babelstreet Mar 5, 2026
b993e30
BX-68618: update rubocop spec
asoos-babelstreet Mar 5, 2026
2e2be40
BX-68618: update ruby versions to test with, add CVE check instructio…
asoos-babelstreet Mar 5, 2026
c6c44c7
BX-68618: psych install/update fix
asoos-babelstreet Mar 5, 2026
be2eedb
BX-68618: use uid and gid for repermissioning
asoos-babelstreet Mar 5, 2026
ead28be
BX-68618: update sonar version
asoos-babelstreet Mar 5, 2026
accadc8
BX-68618: fixing coverage
asoos-babelstreet Mar 6, 2026
8486d1b
BX-68618: remove multipart test file at the end of the test
asoos-babelstreet Mar 6, 2026
7fbab2c
BX-68618: name and address similarity parameters option
asoos-babelstreet Mar 6, 2026
8721762
BX-68618: add events support
asoos-babelstreet Mar 6, 2026
4b5f7fa
BX-68618: add missing test cases
asoos-babelstreet Mar 6, 2026
6385017
BX-68618: Do not serialize genre for requests
asoos-babelstreet Mar 6, 2026
b50fb99
BX-68618: Add name translation maximum results
asoos-babelstreet Mar 6, 2026
c766ff6
BX-68618: Add gender to name parameter
asoos-babelstreet Mar 6, 2026
5a07788
BX-68618: case insensitive gender validation
asoos-babelstreet Mar 6, 2026
d7c32a6
BX-68618: rebranding changes
asoos-babelstreet Mar 6, 2026
332179f
BX-68618: positive custom header tests
asoos-babelstreet Mar 6, 2026
f3ec46d
BX-68618: alphabetically ordered endpoints
asoos-babelstreet Mar 6, 2026
411fb8d
BX-68618: add record similarity support
asoos-babelstreet Mar 6, 2026
ce14ebb
BX-68618: fix custom header tests
asoos-babelstreet Mar 6, 2026
748ba8a
BX-68618: fix record-similarity examples
asoos-babelstreet Mar 6, 2026
72da749
BX-68618: fixing code smells
asoos-babelstreet Mar 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-01-11 22:13:12 UTC using RuboCop version 1.59.0.
# on 2026-03-05 13:36:13 UTC using RuboCop version 1.85.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -9,28 +9,35 @@
# Offense count: 4
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 45
Max: 50

# Offense count: 10
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 786
#TODO check rubocop-rspec extension
Exclude:
- 'tests/tests_spec.rb'

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 232
Max: 250

# Offense count: 1
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 8
Max: 10

Metrics/PerceivedComplexity:
Max: 10


# Offense count: 11
# Offense count: 10
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 51
Max: 50

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Expand All @@ -43,6 +50,7 @@ Metrics/ParameterLists:
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'examples/morphology_compound-components.rb'
- 'examples/morphology_han-readings.rb'
- 'examples/morphology_parts-of-speech.rb'
Expand All @@ -60,18 +68,19 @@ Style/CommentedKeyword:
- 'lib/name_parameter.rb'
- 'lib/name_similarity_parameters.rb'
- 'lib/name_translation_parameters.rb'
- 'lib/record_similarity_parameters.rb'
- 'lib/rosette_api_error.rb'

# Offense count: 14
# This cop supports safe autocorrection (--autocorrect).
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedCompactTypes.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
EnforcedStyle: compact

# Offense count: 11
# Offense count: 18
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 772
15 changes: 8 additions & 7 deletions CI.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@


def versions = [3.0, 3.1, 3.2, 3.3]
def versions = [3.2, 3.3, 3.4, 4.0]

def runSonnarForPythonVersion(sourceDir, ver){
mySonarOpts="-Dsonar.sources=/source -Dsonar.host.url=${env.SONAR_HOST_URL} -Dsonar.login=${env.SONAR_AUTH_TOKEN}"
mySonarOpts="-Dsonar.sources=/source -Dsonar.host.url=${env.SONAR_HOST_URL} -Dsonar.login=${env.SONAR_AUTH_TOKEN} -Dsonar.ruby.coverage.reportPaths=coverage/coverage.json"
if("${env.CHANGE_ID}" != "null"){
mySonarOpts = "$mySonarOpts -Dsonar.pullrequest.key=${env.CHANGE_ID} -Dsonar.pullrequest.branch=${env.BRANCH_NAME}"
} else {
Expand All @@ -15,12 +15,13 @@ def runSonnarForPythonVersion(sourceDir, ver){

// Only run Sonar once.
// Check for new versions at https://binaries.sonarsource.com/?prefix=Distribution/sonar-scanner-cli/
sonarScannerVersion = "6.2.1.4610-linux-x64"
if(ver == 3.3) {
sonarExec="cd /root/ && \
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023-linux.zip && \
unzip -q sonar-scanner-cli-4.8.1.3023-linux.zip && \
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sonarScannerVersion}.zip && \
unzip -q sonar-scanner-cli-${sonarScannerVersion}.zip && \
cd /source && \
/root/sonar-scanner-4.8.1.3023-linux/bin/sonar-scanner ${mySonarOpts}"
/root/sonar-scanner-${sonarScannerVersion}/bin/sonar-scanner ${mySonarOpts}"
} else {
sonarExec="echo Skipping Sonar for this version."
}
Expand All @@ -43,7 +44,7 @@ def runSonnarForPythonVersion(sourceDir, ver){
apt-get update -qq && \
echo && \
echo [INFO] Installing required OS packages. && \
apt-get -qq install -y gcc make wget unzip > /dev/null && \
apt-get -qq install -y gcc make wget unzip libyaml-dev > /dev/null && \
echo && \
echo [INFO] Installing gems needed for CI. && \
gem install --silent --quiet bundler rspec rubocop && \
Expand All @@ -70,7 +71,7 @@ def runSonnarForPythonVersion(sourceDir, ver){
${sonarExec} && \
echo && \
echo [INFO] Re-permission files for cleanup. && \
chown -R jenkins:jenkins /source\""
chown -R 9960:9960 /source\""
}

node ("docker-light") {
Expand Down
34 changes: 29 additions & 5 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Modify `.rubocop_todo.yml` as you fix issues.
Generate a new config file with `rubocop --auto-gen-config` as needed.

```
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim
apt-get update
apt-get install -y gcc make

Expand All @@ -14,12 +14,32 @@ rubocop

```

#### Check dependencies for CVEs

This uses `bundler-audit`, which checks your `Gemfile.lock` against the RubySec advisory DB.

```
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim
apt-get update
apt-get install -y gcc make git ca-certificates libyaml-dev

cd /source
bundle install

gem install bundler-audit
bundle audit update
bundle audit check --verbose

```



#### Run tests locally

```
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim
apt-get update
apt-get install -y gcc make
apt-get install -y gcc make libyaml-dev

gem install rspec
cd /source
Expand All @@ -31,7 +51,9 @@ rspec tests
#### Run a single example

```
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim
apt-get update
apt-get install -y gcc make libyaml-dev

cd /source
bundle install
Expand All @@ -47,7 +69,9 @@ ruby ping.rb ${API_KEY}
#### Run all examples

```
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim
apt-get update
apt-get install -y gcc make libyaml-dev

cd /source
bundle install
Expand Down
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

source 'https://rubygems.org'

gem 'rdoc', '6.6.2'
gem 'rubysl-securerandom', '2.0.0'
gem 'rdoc'

gem 'rspec', '3.12.0', group: [:test]
gem 'rspec', group: [:test]
gem 'simplecov', require: false, group: :test
gem 'simplecov_json_formatter', require: false, group: :test
gem 'webmock', '3.19.1', group: [:test]
gem 'webmock', group: [:test]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2024 Basis Technology Corporation.
Copyright (c) 2016-2026 Basis Technology Corporation.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
<a href="https://www.babelstreet.com/rosette"><img src="https://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>
<a href="https://www.babelstreet.com/rosette">
<img src="https://charts.babelstreet.com/icon.png" width="48" height="48" alt="Babel Street Logo"/>
</a>

---
# Analytics by Babel Street

[![Gem Version](https://badge.fury.io/rb/rosette_api.svg)](https://badge.fury.io/rb/rosette_api)

## Rosette API
The Rosette Text Analytics Platform uses natural language processing, statistical modeling, and machine learning to
analyze unstructured and semi-structured text across 364 language-encoding-script combinations, revealing valuable
information and actionable data. Rosette provides endpoints for extracting entities and relationships, translating and
comparing the similarity of names, categorizing and adding linguistic tags to text and more.
Our product is a full text processing pipeline from data preparation to extracting the most relevant information and
analysis utilizing precise, focused AI that has built-in human understanding. Text Analytics provides foundational
linguistic analysis for identifying languages and relating words. The result is enriched and normalized text for
high-speed search and processing without translation.

## Rosette API Access
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
Text Analytics extracts events and entities — people, organizations, and places — from unstructured text and adds the
structure of associating those entities into events that deliver only the necessary information for near real-time
decision making. Accompanying tools shorten the process of training AI models to recognize domain-specific events.

The product delivers a multitude of ways to sharpen and expand search results. Semantic similarity expands search
beyond keywords to words with the same meaning, even in other languages. Sentiment analysis and topic extraction help
filter results to what’s relevant.

## Analytics API Access
- Analytics Cloud [Sign Up](https://developer.babelstreet.com/signup)

## Quick Start

Expand All @@ -20,16 +29,15 @@ comparing the similarity of names, categorizing and adding linguistic tags to te
`gem install rosette_api`

#### Examples
View small example programs for each Rosette endpoint
View small example programs for each Analytics endpoint
in the [examples](https://github.com/rosette-api/ruby/tree/develop/examples) directory.

#### Documentation & Support
- [Binding API](https://rosette-api.github.io/ruby/)
- [Rosette Platform API](https://developer.rosette.com/features-and-functions)
- [Analytics Platform API](https://documentation.babelstreet.com/analytics)
- [Binding Release Notes](https://github.com/rosette-api/ruby/wiki/Release-Notes)
- [Rosette Platform Release Notes](https://support.rosette.com/hc/en-us/articles/360018354971-Release-Notes)
- [Binding/Rosette Platform Compatibility](https://developer.rosette.com/features-and-functions?ruby#)
- [Support](https://support.rosette.com)
- [Analytics Platform Release Notes](https://docs.babelstreet.com/r/Hosted-Services-Release-Notes)
- [Support](https://babelstreet.my.site.com/support/s/contactsupport)
- [Binding License: Apache 2.0](https://github.com/rosette-api/ruby/blob/develop/LICENSE)

## Binding Developer Information
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A note on prerequisites. Rosette API only suports TLS 1.2 so ensure your toolcha
```
git clone git@github.com:rosette-api/ruby.git
cd ruby
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim

gem install rosette_api

Expand All @@ -25,7 +25,7 @@ ruby ping.rb $API_KEY
```
git clone git@github.com:rosette-api/ruby.git
cd ruby
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.3-slim
docker run -it -v $(pwd):/source --entrypoint bash ruby:3.4-slim

cd /source
gem build rosette_api.gemspec
Expand Down
12 changes: 6 additions & 6 deletions examples/address_similarity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

api_key, url = ARGV

rosette_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end
analytics_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end

begin
address1 = AddressParameter.new(
Expand All @@ -20,7 +20,7 @@
)
address2 = '160 Pennsilvana Avenue, Washington, D.C., 20500'
params = AddressSimilarityParameters.new(address1, address2)
response = rosette_api.get_address_similarity(params)
response = analytics_api.get_address_similarity(params)
puts JSON.pretty_generate(response)
rescue RosetteAPIError => e
printf('Rosette API Error (%<status_code>s): %<message>s',
Expand Down
12 changes: 6 additions & 6 deletions examples/categories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

api_key, url = ARGV

rosette_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end
analytics_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end

categories_text_data = 'If you are a fan of the British television series Downton Abbey and you are planning to be in New York anytime before April 2nd, there is a perfect stop for you while in town.'
begin
params = DocumentParameters.new(content: categories_text_data)
response = rosette_api.get_categories(params)
response = analytics_api.get_categories(params)
puts JSON.pretty_generate(response)
rescue RosetteAPIError => e
printf('Rosette API Error (%<status_code>s): %<message>s',
Expand Down
12 changes: 6 additions & 6 deletions examples/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

api_key, url = ARGV

rosette_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end
analytics_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end

entities_text_data = 'The Securities and Exchange Commission today announced the leadership of the agency\'s trial unit. Bridget Fitzpatrick has been named Chief Litigation Counsel of the SEC and David Gottesman will continue to serve as the agency\'s Deputy Chief Litigation Counsel. Since December 2016, Ms. Fitzpatrick and Mr. Gottesman have served as Co-Acting Chief Litigation Counsel. In that role, they were jointly responsible for supervising the trial unit at the agency\'s Washington D.C. headquarters as well as coordinating with litigators in the SEC\'s 11 regional offices around the country.'
begin
params = DocumentParameters.new(content: entities_text_data)
response = rosette_api.get_entities(params)
response = analytics_api.get_entities(params)
puts JSON.pretty_generate(response)
rescue RosetteAPIError => e
printf('Rosette API Error (%<status_code>s): %<message>s',
Expand Down
22 changes: 22 additions & 0 deletions examples/events.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require 'rosette_api'

api_key, url = ARGV

analytics_api = if url
RosetteAPI.new(api_key, url)
else
RosetteAPI.new(api_key)
end

events_text_data = 'Bill Gates went to the store.'
begin
params = DocumentParameters.new(content: events_text_data)
response = analytics_api.get_events(params)
puts JSON.pretty_generate(response)
rescue RosetteAPIError => e
printf('Rosette API Error (%<status_code>s): %<message>s',
status_code: e.status_code,
message: e.message)
end
Loading