API e modules

API sinonimes - Mòde d'emplec

L'API sinonimes que permet d'aver los sinonimes d'un mot en occitan.

L'URL d'entrada

L'URL de basa de l'aplicacion qu'ei http://api.locongres.org/synonyms. Que i cau ajustar los paramètres obligatòris. Si ne sabetz pas ajustar paramètres a un URL, anar que cau a aqueth tutoriau.

Los paramètres obligatòris

Que cau obligatòriament indicar los paramètres seguents :

  • La vòsta clau API : tà utilizar las API deu Congrès, que cau marcar ua clau API personau qui'vs podem balhar sus la pagina dedicada. Que la marcatz dab lo paramètre "key".
  • Lo mot : marcar lo mot dont voletz recercar los sinonimes dab lo paramètre "term".

Per exemple, si voletz cercar sinonimes de "polit" en totas las varietats de l'occitan, que's pòt utilizar l'URL http://api.locongres.org/synonyms?key=[la_vòsta_clau_API]&term=polit. Qu'avetz lo resultat seguent :

{
    "query": [
        {
            "id": "18601",
            "orth": "alindat",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "46788",
            "orth": "aunèste",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "62313",
            "orth": "bèl",
            "PoS": "AJ0110",
            "var": "oc-lengadoc",
        },
        {
            "id": "62769",
            "orth": "belòi",
            "PoS": "AJ0110",
            "var": "oc-lengadoc",
        },
        {
            "id": "64375",
            "orth": "beroget",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "64410",
            "orth": "berogin",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "64451",
            "orth": "beròi",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "64507",
            "orth": "berojon",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "65567",
            "orth": "bèth",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "66579",
            "orth": "bien aprés",
            "PoS": "AJ0110",
            "var": "oc-auvern",
        },
        {
            "id": "66585",
            "orth": "bien graciós",
            "PoS": "AJ0110",
            "var": "oc-auvern",
        },
        {
            "id": "66594",
            "orth": "bien oneste",
            "PoS": "AJ0110",
            "var": "oc-auvern",
        },
        {
            "id": "72698",
            "orth": "bon",
            "PoS": "AJ0110",
            "var": "oc-lengadoc",
        },
        {
            "id": "73805",
            "orth": "borgau",
            "PoS": "AJ0110",
            "var": "oc-vivaraup",
        },
        {
            "id": "78666",
            "orth": "brave",
            "PoS": "AJ0110",
            "var": "oc-lemosin",
        },
        {
            "id": "78667",
            "orth": "brave",
            "PoS": "AJ0110",
            "var": "oc-vivaraup",
        },
        {
            "id": "81103",
            "orth": "bròi",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "82623",
            "orth": "brunit",
            "PoS": "AJ0110",
            "var": "oc-lengadoc",
        },
        {
            "id": "124778",
            "orth": "corós",
            "PoS": "AJ0110",
            "var": "oc-vivaraup",
        },
        {
            "id": "126008",
            "orth": "cortés",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "128150",
            "orth": "crane",
            "PoS": "AJ0110",
            "var": "oc-lemosin",
        },
        {
            "id": "242928",
            "orth": "gente",
            "PoS": "AJ0110",
            "var": "oc-lemosin",
        },
        {
            "id": "274888",
            "orth": "jòli",
            "PoS": "AJ0110",
            "var": "oc-vivaraup",
        },
        {
            "id": "286261",
            "orth": "lis",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "286511",
            "orth": "lisse",
            "PoS": "AJ0110",
            "var": "oc-auvern",
        },
        {
            "id": "329984",
            "orth": "oneste",
            "PoS": "AJ0110",
            "var": "oc-vivaraup",
        },
        {
            "id": "363741",
            "orth": "plan",
            "PoS": "AJ0110",
            "var": "oc-auvern",
        },
        {
            "id": "364713",
            "orth": "plasent",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        },
        {
            "id": "368056",
            "orth": "polidet",
            "PoS": "AJ0110",
            "var": "oc-gascon",
        }
    ]
}

Lo paramètre facultatiu

Que podetz marcar en quau varietat de l'occitan e cercatz sinonimes dab lo paramètre "var". Peu moment, qu'accèpta las valors "auvern" (tà l'occitan auvernhat), "gascon" (tà l'occitan gascon), "lengadoc" (tà l'occitan lengadocian), "lemosin" (tà l'occitan lemosin), "provenc" (tà l'occitan provençau) e "vivaraup" (tà l'occitan vivaroaupenc).

Per exemple, si voletz cercar sinonimes de "parlar" en occitan vivaroaupenc, que's pòt utilizar l'URL http://api.locongres.org/synonyms?key=[la_vòsta_clau_API]&var=vivaraup&term=parlar. Qu'avetz lo resultat seguent :

{
    "query": [
        {
            "id": 261194,
            "orth": "charrar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 263297,
            "orth": "devisar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 269011,
            "orth": "calcular",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 270720,
            "orth": "causar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 270732,
            "orth": "provocar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 276412,
            "orth": "contestar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 276427,
            "orth": "discutir",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 276903,
            "orth": "conversar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 276913,
            "orth": "dialogar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 283986,
            "orth": "dialecte",
            "PoS": "N1110"
            "var": "oc-vivaraup"
        },
        {
            "id": 284562,
            "orth": "barjar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 284570,
            "orth": "discutar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 284579,
            "orth": "chicotear",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 284587,
            "orth": "chapitrolhar",
            "PoS": "V000050000000"
            "var": "oc-vivaraup"
        },
        {
            "id": 309207,
            "orth": "lengatge",
            "PoS": "N1110"
        }
    ]
}

Lo format de sortida

Per defaut, lo format de sortida qu'ei JSON. Mes que's pòt aver ua sortida au format XML en ajustant "format=xml" a l'URL.

Per exemple, tà afichar sinonimes en occitan provençau de "estatjant" au format XML, que's pòt utilizar l'URL http://api.locongres.org/synonyms.php?key=[la_vòsta_clau_API]&var=provenc&term=estatjant&format=xml. Qu'avetz lo resultat seguent :

<query>
    <syn id="245462">
        <orth>abitant</orth>
        <PoS>N1110</PoS>
        <var>oc-provenc</var>
    </syn>
</query>

Las errors

Si i a errors dens l'URL picada o que la requèsta ne torna pas nat sinonime, l'API que torna ua error dab un còdi e un tèxte d'error en anglés. Qu'avetz ací-devath, tà cada còdi d'error, la revirada deu son tèxte en occitan :

  • 1 : Que cau marcar ua clau API
  • 2 : Clau API invalida
  • 3 : Format incorrècte ("json" e "xml" permés)
  • 4 : Que cau marcar un mot
  • 5 : Que cau marcar ua varietat
  • 6 : Varietat incorrècta ("auvern", "gascon", "lengadoc", "lemo", "provenc" e "vivaraup" permés)
  • 7 : N'avem pas trobat nat sinonime dab las vòstas especificacions

Las informacions en sortida

En sortida, qu'avetz ua lista de mots dab un identificant unic. Per cadun qu'ei balhat :

  • La soa ortografia
  • La soa categoria gramaticau
  • La soa varietat : "oc-auvern" (occitan auvernhat), "oc-gascon" (occitan gascon), "oc-lemosin" (occitan lemosin), "oc-lengadoc" (occitan lengadocian), "oc-provenc" (occitan provençau), "oc-vivaraup" (occitan vivaroaupenc)

Las categorias gramaticaus que son indicadas dab la nòrma Eagles. Qu'avetz un explic de quin Lo Congrès utiliza la nòrma Eagles au capítol 5 d'aqueth document.

JSON schema

{
    "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"
                    },
                    "orth": {
                        "type": "string"
                    },
                    "PoS": {
                        "type": "string"
                    },
                    "var": {
                        "type": "string"
                    },
                },
                "required": ["id", "orth", "PoS", "var"]
            },
            "minItems": 1
        }
    }
}

DTD XML

<! ELEMENT query (syn) >

<! ELEMENT error (#PCDATA) >
<! ATTLIST error code ID #REQUIRED >

<! ELEMENT orth (#PCDATA) >

<! ELEMENT PoS (#PCDATA) >

<! ELEMENT syn (orth, PoS, var) >
<! ATTLIST syn id ID #REQUIRED >

<! ELEMENT var (#PCDATA) >

© Lo Congrès Permanent de la Lenga Occitana, 2017, tots los drets reservats - Contactar Lo Congrès