API e modules

API rimas - Mòde d'emplec

L'API rimas que permet d'aver los mots en occitan qui riman dab un mot qui balhatz.

L'URL d'entrada

L'URL de basa de l'aplicacion qu'ei http://api.locongres.org/rhymes.php. Que i cau ajustar los paramètres obligatòris e que s'i pòt ajustar un paramètre facultatiu. Si ne sabetz pas ajustar paramètres a un URL, que'vs renviam 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 indicar ua clau API personau qui'vs podem balhar sus la pagina dedicada. Que la cau marcar dab lo paramètre "key".
  • Lo mot : marcar lo mot dont voletz recercar las rimas dab lo paramètre "term".
  • La varietat : marcar en quau varietat de l'occitan e cercatz rimas dab lo paramètre "var". Peu moment, qu'accèpta las valors "gasc" (tà l'occitan gascon) "leng" (tà l'occitan lengadocian), "prov" (tà l'occitan provençau) e "viva" (tà l'occitan vivaroaupenc).

Per exemple, tà cercar mots qui riman dab "trobat" en occitan vivaroaupenc, que's pòt utilizar l'URL http://api.locongres.org/rhymes.php?key=[la_vòsta_clau_API]&term=trobat&var=viva. Qu'avetz lo resultat seguent :

{
    "query": [
        {
            "orth": "bac",
            "PoS": "N1110"
        },
        {
            "orth": "bas",
            "PoS": "N1110"
        },
        {
            "orth": "bas",
            "PoS": "AJ0110"
        },
        {
            "orth": "abat",
            "PoS": "N1110"
        },
        {
            "orth": "bab\u00e0",
            "PoS": "N1110"
        },
        {
            "orth": "sabat",
            "PoS": "N1110"
        },
        {
            "orth": "inachabat",
            "PoS": "AJ0110"
        },
        {
            "orth": "acabat",
            "PoS": "AJ0110"
        },
        {
            "orth": "inacabat",
            "PoS": "AJ0110"
        },
        {
            "orth": "escarabat",
            "PoS": "N1110"
        },
        {
            "orth": "grabat",
            "PoS": "N1110"
        },
        {
            "orth": "tabat",
            "PoS": "N1110"
        },
        {
            "orth": "debat",
            "PoS": "N1110"
        },
        {
            "orth": "rebat",
            "PoS": "N1110"
        },
        {
            "orth": "rebat",
            "PoS": "N1210"
        },
        {
            "orth": "crebat",
            "PoS": "AJ0110"
        },
        {
            "orth": "aqu\u00ed-bas",
            "PoS": "AV0000"
        },
        {
            "orth": "celibat",
            "PoS": "N1110"
        },
        {
            "orth": "ribas",
            "PoS": "N1110"
        },
        {
            "orth": "destibat",
            "PoS": "AJ0110"
        },
        {
            "orth": "combat",
            "PoS": "N1110"
        },
        {
            "orth": "catacombas",
            "PoS": "N1220"
        },
        {
            "orth": "tombat",
            "PoS": "N1110"
        },
        {
            "orth": "barbat",
            "PoS": "AJ0110"
        },
        {
            "orth": "corbat",
            "PoS": "AJ0110"
        },
        {
            "orth": "ubac",
            "PoS": "N1110"
        }
    ]
}

Lo paramètre facultatiu

Que's pòt indicar ua recèrca sonque dab rimas ricas o sonque dab rimas pauras dab lo paramètre "type" qui pren com valors "r" (rimas ricas) e "p" (rimas pauras).

Per exemple, tà cercar rimas ricas tau mot "nenet" en occitan provençau, que's pòt utilizar l'URL http://api.locongres.org/rhymes.php?key=[la_vòsta_clau_API]&term=nenet&var=prov&type=r. Qu'avetz lo resultat seguent

{
    "query": [
        {
            "orth": "net",
            "PoS": "AJ0110"
        },
        {
            "orth": "anet",
            "PoS": "N1110"
        },
        {
            "orth": "nanet",
            "PoS": "AJ0110"
        },
        {
            "orth": "nanet",
            "PoS": "N1110"
        },
        {
            "orth": "senec",
            "PoS": "AJ0110"
        },
        {
            "orth": "omenet",
            "PoS": "N1110"
        },
        {
            "orth": "momenet",
            "PoS": "N1110"
        },
        {
            "orth": "penet",
            "PoS": "N1110"
        },
        {
            "orth": "gabinet",
            "PoS": "N1110"
        },
        {
            "orth": "robinet",
            "PoS": "N1110"
        },
        {
            "orth": "minet",
            "PoS": "N1110"
        },
        {
            "orth": "caminet",
            "PoS": "N1110"
        },
        {
            "orth": "ninet",
            "PoS": "N1110"
        },
        {
            "orth": "bonet",
            "PoS": "N1110"
        },
        {
            "orth": "guionet",
            "PoS": "N1110"
        },
        {
            "orth": "lionet",
            "PoS": "N1110"
        },
        {
            "orth": "molonet",
            "PoS": "N1110"
        },
        {
            "orth": "monet",
            "PoS": "N1110"
        },
        {
            "orth": "quasernet",
            "PoS": "N1110"
        },
        {
            "orth": "cornet",
            "PoS": "N1110"
        },
        {
            "orth": "torneg",
            "PoS": "N1110"
        },
        {
            "orth": "maunet",
            "PoS": "AJ0110"
        }
    ]
}

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 mots en occitan lengadocian qui riman dab "amic" au format XML, que's pòt utilizar l'URL http://api.locongres.org/rhymes.php?key=[la_vòsta_clau_API]&term=amic&var=leng&format=xml. Qu'avetz lo resultat seguent

<query>
    <form id="1">
        <orth>balsamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="2">
        <orth>adamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="3">
        <orth>criptogamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="4">
        <orth>islamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="5">
        <orth>dinamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="6">
        <orth>aerodinamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="7">
        <orth>idrodinamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="8">
        <orth>electrodinamic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="9">
        <orth>ceramic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="10">
        <orth>panoramic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="11">
        <orth>protoplasmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="12">
        <orth>sismic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="13">
        <orth>osmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="14">
        <orth>cosmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="15">
        <orth>racemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="16">
        <orth>septicemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="17">
        <orth>academic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="18">
        <orth>epidemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="19">
        <orth>endemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="20">
        <orth>eufemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="21">
        <orth>polemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="22">
        <orth>anemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="23">
        <orth>enemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="24">
        <orth>enemic</orth>
        <PoS>N1110</PoS>
    </form>
    <form id="25">
        <orth>totemic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="26">
        <orth>quimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="27">
        <orth>bioquimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="28">
        <orth>cacoquimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="29">
        <orth>fisico-quimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="30">
        <orth>electroquimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="31">
        <orth>fotoquimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="32">
        <orth>mimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="33">
        <orth>sinonimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="34">
        <orth>toponimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="35">
        <orth>paronimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="36">
        <orth>metonimic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="37">
        <orth>timic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="38">
        <orth>oftalmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="39">
        <orth>ritmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="40">
        <orth>aritmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="41">
        <orth>logaritmic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="42">
        <orth>vomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="43">
        <orth>somic</orth>
        <PoS>N1110</PoS>
    </form>
    <form id="44">
        <orth>comic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="45">
        <orth>comic</orth>
        <PoS>N1110</PoS>
    </form>
    <form id="46">
        <orth>tragi-comic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="47">
        <orth>taxonomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="48">
        <orth>fisionomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="49">
        <orth>economic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="50">
        <orth>astronomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="51">
        <orth>gastronomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="52">
        <orth>gnomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="53">
        <orth>cromic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="54">
        <orth>atomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="55">
        <orth>monoatomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="56">
        <orth>diatomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="57">
        <orth>anatomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="58">
        <orth>tricotomic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="59">
        <orth>dermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="60">
        <orth>epidermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="61">
        <orth>ipodermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="62">
        <orth>termic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="63">
        <orth>atermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="64">
        <orth>antitermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="65">
        <orth>exotermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="66">
        <orth>endotermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="67">
        <orth>isotermic</orth>
        <PoS>AJ0110</PoS>
    </form>
    <form id="68">
        <orth>formic</orth>
        <PoS>AJ0110</PoS>
    </form>
</query>

Las errors

Si i a errors dens l'URL picada o que la requèsta ne torna pas nada forma, l'API que'vs 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 indicar 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 ("gasc", "leng", "prov" e "viva" permés)
  • 7 : Tipe incorrècte ("p" e "r" permés)
  • 8 : N'avem pas trobat nada rima 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

Las categorias gramaticaus que son marcadas dab la nòrma Eagles. Qu'avetz un explic de quin Lo Congrès e 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": {
                    "orth": {
                        "type": "string"
                    },
                    "PoS": {
                        "type": "string"
                    },
                },
                "required": ["orth", "PoS"]
            },
            "minItems": 1
        }
    }
}

DTD XML

<! ELEMENT query (form) >

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

<! ELEMENT form (orth | PoS) >
<! ATTLIST form id ID #REQUIRED >

<! ELEMENT orth (#PCDATA) >

<! ELEMENT PoS (#PCDATA) >

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