Documentation for the RESTful API (SyntagRank)
In what follows, we describe the typical usage of our RESTful API and its parameters.
The SyntagRank API allows the user to perform two distinct queries:
- Disambiguate Text
- Disambiguate Token
Disambiguate Text
With Disambiguate Text, SyntagRank will process a raw text provided as input, given a target language among
the five currently supported: EN (English), DE (German), FR (French), ES (Spanish), and IT (Italian).
Request
Method
GET - POST
URL
http://api.syntagnet.org/disambiguate?lang=language&text=text
Parameters
Name |
Type |
Description |
text |
String |
The text to be disambiguated (with a maximum length of 1,500 characters).
For example, text=this is a text.
|
lang |
String |
The language of the input text, among the five currently supported:
EN (English), DE (German), FR (French), ES (Spanish), and IT (Italian).
|
Response
{
"Code": 200,
"Content":
{
"language": "EN",
"tokens": [
{
"senseID": "wn:02604760v",
"position": {
"charOffsetBegin": 5,
"charOffsetEnd": 7
}
},
{
"senseID": "wn:06387980n",
"position": {
"charOffsetBegin": 10,
"charOffsetEnd": 14
}
}
]
}
}
Description
Name |
Description |
language |
The language of the disambiguated tokens.
|
tokens |
Contains a list of disambiguated tokens.
|
senseID |
Identifies the WordNet 3.0 offset for the concept assigned to the token.
|
position |
Contains information concerning the token positioning.
|
charOffsetBegin |
Highlights the position where a given term instance starts. Expressed as char offset from the text start.
|
charOffsetEnd |
Highlights the position where a given term instance ends. Expressed as char offset from the text start.
|
Disambiguate Tokens
With Disambiguate Tokens, SyntagRank will accept a pre-processed text as input to be disambiguated.
As for Disambiguate Text, language specification is required.
Each token must show information concerning index (id), word form (word), lemma form (lemma),
POS tag (pos), and a boolean indicating whether the token is a content word to be
disambiguated (isTargetWord).
Request
Method
POST
URL
http://api.syntagnet.org/disambiguate_tokens
Parameters
Name |
Type |
Description |
lang |
String |
The language of the input text, among the five currently supported:
EN (English), DE (German), FR (French), ES (Spanish), and IT (Italian).
|
words |
List<Token> |
Contains a list, each representing a single token of the input text.
|
Token
Name |
Type |
Description |
id |
String |
Identifies the position of the token in the input text.
|
word |
String |
Identifies the token, as it appears in the input text.
|
lemma |
String |
The lemmatized form of the token.
|
pos |
String |
The Part of Speech of the token.
|
isTargetWord |
boolean |
If true, identifies a token (for a content word) to be disambiguated.
|
Request Example
{
"lang": "EN",
"words": [
{
"id": "0",
"word": "this",
"lemma": "this",
"pos": "X",
"isTargetWord": false
},
{
"id": "1",
"word": "is",
"lemma": "be",
"pos": "VERB",
"isTargetWord": true
},
{
"id": "2",
"word": "a",
"lemma": "a",
"pos": "X",
"isTargetWord": false
},
{
"id": "3",
"word": "first",
"lemma": "first",
"pos": "ADJ",
"isTargetWord": true
},
{
"id": "4",
"word": "test",
"lemma": "test",
"pos": "NOUN",
"isTargetWord": true
}
]
}
Response
{
"Code": 200,
"Content":
{
"result": [
{
"id": "3",
"synset": "wn:06387980n"
},
{
"id": "1",
"synset": "wn:02604760v"
}
]
}
}
Description
Name |
Description |
result |
Contains a list of disambiguated tokens.
|
id |
Identifies the position of the disambiguated token according to the input text.
|
synset |
Identifies the WordNet 3.0 offset for the concept assigned to the token.
|