TextAPI

FREEMIUM
Por textapi | Atualizado 8 days ago | Text Analysis
Popularidade

8.9 / 10

Latência

47,829ms

Nível de serviço

98%

Health Check

N/A

Voltar para todos os tutoriais (1)

Embeddable Named Resolution Visualizations

If you want to display some extracted entities on your webpage you can do it in two ways. Either with our models or you can provide your own entity spans.

In this first example you can see that we only provide the text we want to display the entities for. In this case we will use TextAPI’s model to extract the entities we want to display.

Display Entities Extracted Automatically

There may be a case where you just want to highlight entities in an article quickly, and just supply text. Below is a sample request for doing this.

Request

import requests

url = "https://textapis.p.rapidapi.com/ner/display?text=An October post by Dylan to save you a Google search."

payload  = {}
headers = {
  'x-rapidapi-key': '{{YOUR KEY GOES HERE}}'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Response

response

Display Previously Extracted Entities

In our next example we already know the entities we want to display so in this case we will provide the spans ourselves, and not need a model to identify these.

Request

import requests

url = "https://textapis.p.rapidapi.com/ner/display?text=An October post by Dylan to save you a Google search.&spans=[{\"text\":\"October\",\"start\":3,\"end\":10,\"label\":\"DATE\"},{\"text\":\"Dylan\",\"start\":19,\"end\":24,\"label\":\"PERSON\"},{\"text\":\"Google\",\"start\":39,\"end\":45,\"label\":\"ORG\"}]"

payload  = {}
headers = {
  'x-rapidapi-key': '{{YOUR KEY GOES HERE}}'
}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))

Response

response

As you can see we have a lot of flexibility with the endpoint where you can bring your own model to display the results of or use a provided model. It really depends on your use case as there’s a lot of flexibility with this endpoint.