Documentation

Feel free to reach out if you have any questionns.

Front End

Once you create an account, you can test our models by visting the front-end interface for individual sentences. Here, you can submit a sentence and choose a model to test.

If you want to process your text in batch, you can upload an XLSX file instead. Every single row in the first column (i.e., column A) will be scored and a new file will be provided for download once the scoring is complete.

API

Phase NLP supports querying models via POST requests. We support three functions. Please refer to our model list to see which models we support. Note that we also build custom models via our AutoNLP utility. Please contact us to learn more.

Classify Text

Your API key is available in your account profile. This is your secret key and should be passed along with the e-mail you used to sign up for Phase. We use Basic API Authentication to verify your requests.

The API has three endpoints.

https://phasenlp.com/api/v0/classify/ takes a model ID and text argument and returns a score for the model.

Here is sample Python code:

import requests
from requests.auth import HTTPBasicAuth

user_name = "YOUR USER NAME"
api_key = "YOUR API KEY"
host = "https://phasenlp.com"
auth = HTTPBasicAuth(user_name, api_key)

request_data = {
    "model" : "esg",
    "text" : "ESG is a new trend in green and socially responsible investing."
}
r = requests.post(url = host + "/api/v0/classify/", data = request_data, auth = auth)

print(r.text)

The response is a JSON object with a status, exec_time showing how long the query took (in seconds), and score for the actual probability estimate of the model.

Classify Arrays

https://phasenlp.com/api/v0/classify_array/ takes an array of text and scores each array element, returning a scores array.

Here is sample Python code:

import requests
from requests.auth import HTTPBasicAuth

user_name = "YOUR USER NAME"
api_key = "YOUR API KEY"
host = "https://phasenlp.com"
auth = HTTPBasicAuth(user_name, api_key)

text_array = [
    "ESG is a new trend in green and socially responsible investing.",
    "Major hedge funds and PE firms are now investing with ESG in mind.",
    "It remains to be seen what impacts this will have on carbon emissions."
]

request_data = {
    "model" : "esg",
    "array" : text_array
}

r = requests.post(url = host + "/api/v0/classify_array/", data = request_data, auth = auth)

print(r.text)

The response is a JSON object with a status, exec_time showing how long the query took (in seconds), and scores dictionary which contains the original text and associated probability estimate for each piece of text.

Multiple Models

https://phasenlp.com/api/v0/classify_multi/ allows you to score one piece of text with multiple models. This API request takes a text argument, and a models argument that should have a list of pipe-delmited (i.e., |) model IDs.

Here is sample Python code:

import requests
from requests.auth import HTTPBasicAuth

user_name = "YOUR USER NAME"
api_key = "YOUR API KEY"
host = "https://phasenlp.com"
auth = HTTPBasicAuth(user_name, api_key)

request_data = {
    "models" : "esg|corporeviews|mgmt",
    "text" : "ESG is a new trend in green and socially responsible investing."
}

r = requests.post(url = host + "/api/v0/classify_multi/", data = request_data, auth = auth)
print(r.text)

Product Roadmap

We're striving to keep our product roadmap as open as possible, so you know what to expect. We're also keen to get your feedback on what we're building.

We'll be sharing our feature roadmap soon. In the meantime, if you have feature requests or questions, please contact us.

 

 

© 2021