The Basic API allows you to search, from a french or an occitan word, an entry of the Basic, Lo Congrès dictionary.
The application basic URL is http://api.locongres.org/basic.php. You have to add mandatory parameters and you can add a facultative parameter. If you don't know how to add parameters in an URL, you can read this tutorial.
You have to add the following parameters :
For instance, you can search the occitan translations of the word "parler" with the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=parler. You get the following result :
{
"query": [
{
"id": 0,
"forms": [
{
"orth": "parler",
"PoS": [
"V000050000000"
]
}
],
"trads": [
{
"var": "oc",
"orth": "parlar",
"PoS": [
"V000050000000"
]
}
]
}
]
}
You can search what is the french translation of the word "aimable" with the URL http://api.locongres.org/basic.php?key=[your_APIkey]&term=aimable&lang=oc. You get the following result :
{
"query": [
{
"id": 0,
"forms": [
{
"orth": "affable",
"PoS": [
"AJ0110",
"AJ0210"
]
}
],
"trads": [
{
"var": "oc",
"orth": "aimable",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "aimabla",
"PoS": [
"AJ0210"
]
}
]
},
{
"var": "oc",
"orth": "agradiu",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "agradiva",
"PoS": [
"AJ0210"
]
}
]
}
]
},
{
"id": 0,
"forms": [
{
"orth": "aimable",
"PoS": [
"AJ0110",
"AJ0210"
]
}
],
"trads": [
{
"var": "oc",
"orth": "aimable",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "aimabla",
"PoS": [
"AJ0210"
]
}
]
},
{
"var": "oc",
"orth": "amist\u00f3s",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "amistosa",
"PoS": [
"AJ0210"
]
}
]
}
]
},
{
"id": 0,
"forms": [
{
"orth": "gentil",
"PoS": [
"AJ0110"
],
"flexions": [
{
"orth": "gentille",
"PoS": [
"AJ0210"
]
}
]
}
],
"trads": [
{
"var": "oc",
"orth": "brave",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "brava",
"PoS": [
"AJ0210"
]
}
]
},
{
"var": "oc",
"orth": "aimable",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "aimabla",
"PoS": [
"AJ0210"
]
}
]
}
]
},
{
"id": 0,
"forms": [
{
"orth": "sympathique",
"PoS": [
"AJ0110",
"AJ0210"
]
}
],
"trads": [
{
"var": "oc",
"orth": "simpatic",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "simpatica",
"PoS": [
"AJ0210"
]
}
]
},
{
"var": "oc",
"orth": "aimable",
"PoS": [
"AJ0110"
],
"flexions": [
{
"var": "oc",
"orth": "aimabla",
"PoS": [
"AJ0210"
]
}
]
}
]
}
]
}
If you want to display only the occitan words of one variety, or if you want to search an occitan word in a particular variety, you can use the "var" parameter which allows, for now, the values : "gascon" (Gascony occitan forms), "lengadoc" (Languedoc occitan forms) o "oc" (forms existing in the two varieties as well).
For instance, if you want to display the Gascony occitan translations of the french word "partir", you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=partir&var=gascon. You get the following result :
{
"query": [
{
"id": 0,
"forms": [
{
"orth": "partir",
"PoS": [
"V000050000000"
]
}
],
"trads": [
{
"var": "oc",
"orth": "partir",
"PoS": [
"V000050000000"
]
},
{
"var": "oc",
"orth": "anar-se'n",
"PoS": [
"V000050000000"
]
}
]
}
]
}
If you want to search the french translation of the Languedoc occitan word "cencha", you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=oc&term=cencha&var=lengadoc. You get the following result :
{
"query": [
{
"id": 0,
"forms": [
{
"orth": "ceinture",
"PoS": [
"N1210"
]
}
],
"trads": [
{
"var": "oc",
"orth": "cinta",
"PoS": [
"N1210"
]
},
{
"var": "oc-lengadoc",
"orth": "cencha",
"PoS": [
"N1210"
]
}
]
},
{
"id": 0,
"forms": [
{
"orth": "taille",
"PoS": [
"N1210"
]
}
],
"trads": [
{
"var": "oc",
"orth": "talha",
"PoS": [
"N1210"
]
},
{
"var": "oc",
"orth": "cinta",
"PoS": [
"N1210"
]
},
{
"var": "oc-lengadoc",
"orth": "cencha",
"PoS": [
"N1210"
]
},
{
"var": "oc",
"orth": "talha",
"PoS": [
"N1210"
]
},
{
"var": "oc",
"orth": "mesura",
"PoS": [
"N1210"
]
},
{
"var": "oc-lengadoc",
"orth": "pag\u00e8la",
"PoS": [
"N1210"
]
}
]
}
]
}
The default output format is JSON. But you can get an XML output in adding "format=xml" to the l'URL.
For instance, if you want to display the translations of the french word "toujours" in XML format, you can use the URL http://api.locongres.org/basic.php?key=[your_APIkey]&lang=fr&term=toujours&format=xml. You get the following result :
<query>
<entry id="12787">
<form>
<orth>toujours</orth>
<PoS>AV0000</PoS>
</form>
<trad>
<var>oc-gascon</var>
<orth>tostemps</orth>
<PoS>AV0000</PoS>
</trad>
<trad>
<var>oc-lengadoc</var>
<orth>totjorn</orth>
<PoS>AV0000</PoS>
</trad>
</entry>
</query>
If there are errors in the input URL or if the query returns no form, the API returns an error with a code and an error text in english. You can see below the error codes with their text :
The output you get is a list of entries with an unique ID. For each one, you get :
Grammatical categories are given with Eagles norm. You will find an explanation about the way Lo Congrès uses Eagles norm in the fifth chapter of this document.
{
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"description": "The unique identifier for an error",
"type": "integer"
},
"text": {
"description": "A description of the error",
"type": "string"
}
},
"required": ["code", "text"]
},
"query": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"forms": {
"type": "array",
"items": {
"type": "object",
"properties": {
"orth": {
"type": "string",
},
"PoS": {
"type": "array",
"items": {
"type":"string"
},
"minItems": 1
},
"flexions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"orth": {
"type": "string",
},
"PoS": {
"type": "array",
"items": {
"type":"string"
},
"minItems": 1
}
},
"required": ["orth", "PoS"]
}
}
},
"required": ["orth", "PoS"]
},
"minItems": 1
},
"trads": {
"type": "array",
"items": {
"type": "object",
"properties": {
"orth": {
"type": "string",
},
"PoS": {
"type": "array",
"items": {
"type":"string"
},
"minItems": 1
},
"flexions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"orth": {
"type": "string",
},
"PoS": {
"type": "array",
"items": {
"type":"string"
},
"minItems": 1
}
},
"required": ["orth", "PoS"]
}
}
},
"required": ["orth", "PoS"]
},
"minItems": 1
},
},
"required": ["id", "forms", "trads"]
},
"minItems": 1
}
}
}
<! ELEMENT query (entry) >
<! ELEMENT error (#PCDATA) >
<! ATTLIST error code ID #REQUIRED >
<! ELEMENT entry (form+, trad*) >
<! ATTLIST entry id ID #REQUIRED >
<! ELEMENT form (orth, PoS+) >
<! ELEMENT orth (#PCDATA) >
<! ELEMENT PoS (#PCDATA) >
<! ELEMENT trad (orth, PoS+, var) >
<! ELEMENT var (#PCDATA) >
© Lo Congrès Permanent de la Lenga Occitana, 2017, all rights reserved - Contact Lo Congrès