Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
seth-mg committed Jan 11, 2024
2 parents 7a3f8b5 + 3ce3a6e commit c3053db
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 63 deletions.
13 changes: 7 additions & 6 deletions CI.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


def versions = [3.7, 3.8, 3.9, 3.10, 3.11]
def versions = [3.8, 3.9, 3.10, 3.11, 3.12]

def runSonnarForPythonVersion(sourceDir, ver){
mySonarOpts="-Dsonar.sources=/source -Dsonar.host.url=${env.SONAR_HOST_URL} -Dsonar.login=${env.SONAR_AUTH_TOKEN}"
Expand All @@ -14,12 +14,13 @@ def runSonnarForPythonVersion(sourceDir, ver){
}

// Only run Sonar once.
if(ver == 3.11) {
// Check for new versions at https://binaries.sonarsource.com/?prefix=Distribution/sonar-scanner-cli/
if(ver == 3.12) {
sonarExec="cd /root/ && \
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip && \
unzip -q sonar-scanner-cli-4.8.0.2856-linux.zip && \
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 && \
cd /source && \
/root/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner ${mySonarOpts}"
/root/sonar-scanner-4.8.1.3023-linux/bin/sonar-scanner ${mySonarOpts}"
} else {
sonarExec="echo Skipping Sonar for this version."
}
Expand Down Expand Up @@ -57,4 +58,4 @@ node ("docker-light") {
currentBuild.result = "FAILED"
throw e
}
}
}
13 changes: 7 additions & 6 deletions Jenkinsfile.examples
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ node {
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source ${TEST_CONTAINER}"
}
}
slack(true)
postToTeams(true)
} catch (e) {
currentBuild.result = "FAILED"
slack(false)
postToTeams(false)
throw e
}
}

def slack(boolean success) {
def postToTeams(boolean success) {
def webhookUrl = "${env.TEAMS_PNC_JENKINS_WEBHOOK_URL}"
def color = success ? "#00FF00" : "#FF0000"
def status = success ? "SUCCESSFUL" : "FAILED"
def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
slackSend(color: color, channel: "#rapid", message: message)
}
def message = "*" + status + ":* '${env.JOB_NAME}' - [${env.BUILD_NUMBER}] - ${env.BUILD_URL}"
office365ConnectorSend(webhookUrl: webhookUrl, color: color, message: message, status: status)
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="https://www.rosette.com"><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://s3.amazonaws.com/styleguide.basistech.com/logos/rosette-logo.png" width="181" height="47" /></a>

---

Expand All @@ -13,7 +13,6 @@ comparing the similarity of names, categorizing and adding linguistic tags to te

## Rosette API Access
- Rosette Cloud [Sign Up](https://developer.rosette.com/signup)
- Rosette Enterprise [Evaluation](https://www.rosette.com/product-eval/)

## Quick Start

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = '1.25.1'
version = '1.28.0'
# The full version, including alpha/beta/rc tags.
release = '1.25.1'
release = '1.28.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 2 additions & 4 deletions examples/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

def run(key, alt_url='https://api.rosette.com/rest/v1/'):
""" Run the example """
categories_url_data = "https://rosette.com/about"
url = categories_url_data
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."
# Create an API instance
api = API(user_key=key, service_url=alt_url)

Expand All @@ -29,8 +28,7 @@ def run(key, alt_url='https://api.rosette.com/rest/v1/'):

params = DocumentParameters()

# Use a URL to input data instead of a string
params["contentUri"] = url
params["content"] = categories_text_data
try:
return api.categories(params)
except RosetteException as exception:
Expand Down
37 changes: 37 additions & 0 deletions examples/events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
"""
Example code to call Rosette API to get entities from a piece of text.
"""

import argparse
import json
import os

from rosette.api import API, DocumentParameters, RosetteException


def run(key, alt_url='https://api.rosette.com/rest/v1/'):
""" Run the example """
# Create an API instance
api = API(user_key=key, service_url=alt_url)

events_text_data = "I am looking for flights to Super Bowl 2022 in Inglewood, LA."
params = DocumentParameters()
params["content"] = events_text_data

try:
return api.events(params)
except RosetteException as exception:
print(exception)

PARSER = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Calls the ' +
os.path.splitext(os.path.basename(__file__))[0] + ' endpoint')
PARSER.add_argument('-k', '--key', help='Rosette API Key', required=True)
PARSER.add_argument('-u', '--url', help="Alternative API URL",
default='https://api.rosette.com/rest/v1/')

if __name__ == '__main__':
ARGS = PARSER.parse_args()
RESULT = run(ARGS.key, ARGS.url)
print(RESULT)
41 changes: 41 additions & 0 deletions examples/events_negation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
"""
Example code to call Rosette API to get events, based on a set negation option, from a piece of text.
"""

import argparse
import json
import os

from rosette.api import API, DocumentParameters, RosetteException


def run(key, alt_url='https://api.rosette.com/rest/v1/'):
""" Run the example """
# Create an API instance
api = API(user_key=key, service_url=alt_url)

# Double negative, meaning that the event should be skipped with "IGNORE" or "ONLY_NEGATIVE"
# and recognized under "BOTH" or "ONLY_POSITIVE"
events_text_data = "Sam didn't not take a flight to Boston."
params = DocumentParameters()
params["content"] = events_text_data
api.set_option('negation', 'ONLY_POSITIVE')


try:
return api.events(params)
except RosetteException as exception:
print(exception)

PARSER = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Calls the ' +
os.path.splitext(os.path.basename(__file__))[0] + ' endpoint')
PARSER.add_argument('-k', '--key', help='Rosette API Key', required=True)
PARSER.add_argument('-u', '--url', help="Alternative API URL",
default='https://api.rosette.com/rest/v1/')

if __name__ == '__main__':
ARGS = PARSER.parse_args()
RESULT = run(ARGS.key, ARGS.url)
print(RESULT)
2 changes: 1 addition & 1 deletion rosette/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
limitations under the License.
"""

__version__ = '1.25.1'
__version__ = '1.28.0'
Loading

0 comments on commit c3053db

Please sign in to comment.