Skip to content

Server

ConversationConfig

Bases: BaseModel

Config for conversational entity linking. For more information: https://rel.readthedocs.io/en/latest/tutorials/conversations/.

response()

Return response for request.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
121
122
123
124
125
126
def response(self):
    """Return response for request."""
    text = self.dict()["text"]
    conv_handler = conv_handlers[self.tagger]
    response = conv_handler.annotate(text)
    return response

ConversationTurn

Bases: BaseModel

Specify turns in a conversation. Each turn has a speaker and an utterance.

NEAnnotation

Bases: BaseModel

Annotation for named entity linking.

NamedEntityConceptConfig

Bases: BaseModel

Config for named entity linking. Not yet implemented.

response()

Return response for request.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
63
64
65
66
67
68
69
def response(self):
    """Return response for request."""
    response = JSONResponse(
        content={"msg": "Mode `ne_concept` has not been implemeted."},
        status_code=501,
    )
    return response

NamedEntityConfig

Bases: BaseModel

Config for named entity linking. For more information, see https://rel.readthedocs.io/en/latest/tutorials/e2e_entity_linking/

response()

Return response for request.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
53
54
55
56
57
def response(self):
    """Return response for request."""
    handler = handlers[self.tagger]
    response = handler.generate_response(text=self.text, spans=self.spans)
    return response

SystemResponse

Bases: ConversationTurn

Return input when the speaker equals 'SYSTEM'.

UserResponse

Bases: ConversationTurn

Return annotations when the speaker equals 'USER'.

conceptual_named_entity_linking(config)

Submit your text here for conceptual entity disambiguation or linking.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
242
243
244
245
246
247
@app.post("/ne_concept", response_model=List[NEAnnotation])
def conceptual_named_entity_linking(config: NamedEntityConceptConfig):
    """Submit your text here for conceptual entity disambiguation or linking."""
    if DEBUG:
        return []
    return config.response()

conversational_entity_linking(config)

Submit your text here for conversational entity linking.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
234
235
236
237
238
239
@app.post("/conv", response_model=List[TurnResponse])
def conversational_entity_linking(config: ConversationConfig):
    """Submit your text here for conversational entity linking."""
    if DEBUG:
        return []
    return config.response()

named_entity_linking(config)

Submit your text here for entity disambiguation or linking.

The REL annotation mode can be selected by changing the path. use / or /ne/ for annotating regular text with named entities (default), /ne_concept/ for regular text with both concepts and named entities, and /conv/ for conversations with both concepts and named entities.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@app.post("/", response_model=List[NEAnnotation])
@app.post("/ne", response_model=List[NEAnnotation])
def named_entity_linking(config: NamedEntityConfig):
    """Submit your text here for entity disambiguation or linking.

    The REL annotation mode can be selected by changing the path.
    use `/` or `/ne/` for annotating regular text with named
    entities (default), `/ne_concept/` for regular text with both concepts and
    named entities, and `/conv/` for conversations with both concepts and
    named entities.
    """
    if DEBUG:
        return []
    return config.response()

server_status()

Returns server status.

Source code in /home/docs/checkouts/readthedocs.org/user_builds/rel/envs/latest/lib/python3.7/site-packages/REL/server.py
207
208
209
210
211
212
213
214
215
@app.get("/", response_model=StatusResponse)
def server_status():
    """Returns server status."""
    return {
        "schemaVersion": 1,
        "label": "status",
        "message": "up",
        "color": "green",
    }