# Welcome

Welcome to the Remède Documentation Center ! Here you can understand what is Remède, how to use it, and how you can enhance it.

{% hint style="info" %}
This new documentation can contains broken links and errors. You can help us improving it on Github ! Thank you
{% endhint %}

The Remède Project is an open source project whose goal is to provide a free, privacy respectful dictionary experience for everyone, everywhere. We also distribute our own dictionaries, in an open format.

### Jump right in

<table data-view="cards"><thead><tr><th></th><th></th><th data-type="content-ref"></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>User Documentation</strong></td><td>Learn how to use Remède.</td><td><a href="/pages/A5BeRHiXr2LWNH3Nh9kz">/pages/A5BeRHiXr2LWNH3Nh9kz</a></td><td><a href="/pages/UoNivkFsgKAgKiTLlv8i">/pages/UoNivkFsgKAgKiTLlv8i</a></td><td><a href="/files/lQnaSHmRMt10KVTJAnVQ">/files/lQnaSHmRMt10KVTJAnVQ</a></td><td></td><td><a href="/pages/aeDkMIGIzMWDCo8Aazkv">/pages/aeDkMIGIzMWDCo8Aazkv</a></td></tr><tr><td><strong>Developers documentation</strong></td><td>Develop on Remède !</td><td><a href="/pages/7YydU9MGSZM15DiaM1oI">/pages/7YydU9MGSZM15DiaM1oI</a></td><td><a href="/pages/JGYsy57QEG33MIftkydY">/pages/JGYsy57QEG33MIftkydY</a></td><td><a href="/files/StQnTzqmWCI6lUNFVrjB">/files/StQnTzqmWCI6lUNFVrjB</a></td><td></td><td><a href="/pages/sPTeBQrVkBeeo8FJDJNH">/pages/sPTeBQrVkBeeo8FJDJNH</a></td></tr><tr><td><strong>Database</strong></td><td>We build our own dictionaries databases.</td><td><a href="/pages/DmUL34J2O9uVinrI75US">/pages/DmUL34J2O9uVinrI75US</a></td><td><a href="/pages/oZa4ApSTvKFziJTsAbmg">/pages/oZa4ApSTvKFziJTsAbmg</a></td><td><a href="/files/XJXhpU8yif3BkEpR123r">/files/XJXhpU8yif3BkEpR123r</a></td><td></td><td><a href="/pages/LH1QwKoXfvQyLCxfe3vd">/pages/LH1QwKoXfvQyLCxfe3vd</a></td></tr><tr><td><strong>The Remède Project</strong></td><td>Discover what is Remède.</td><td><a href="/pages/yKBogLjyTz6ecEQizaE8">/pages/yKBogLjyTz6ecEQizaE8</a></td><td><a href="/pages/E4sQkNh6P8OR5Zar7pI8">/pages/E4sQkNh6P8OR5Zar7pI8</a></td><td><a href="/files/OnnzlyTW4zr0M8Xw3v6Y">/files/OnnzlyTW4zr0M8Xw3v6Y</a></td><td></td><td><a href="/pages/Lz4bNcuSeAZIztbdGigG">/pages/Lz4bNcuSeAZIztbdGigG</a></td></tr></tbody></table>

```
Remède by The Remède Project <software@camarm.dev> © 2023-now CECILL-2.1.
Dictionary databases includes data from third-parties services governed by other free licenses. See https://docs.remede.camarm.fr/database/credits for further information.
```


# Download

How to install Remède on you machine.

### Mobile applications

Remède provides mobile applications. For the moment, only the Android application is available.

{% tabs %}
{% tab title="Android" %}
Select your download method below.

* [Get it on Obtainium](https://url.camarm.fr/remedeobtainium) (<mark style="background-color:green;">Recommended</mark>)
* [Get it from Github Release](https://github.com/camarm-dev/remede/releases)
  {% endtab %}

{% tab title="iOS" %}
Sorry, we do not distribute iOS applications for the moment.

{% hint style="success" %}
If you are able to build and test Remède for mobile, please contact us at <software@camarm.dev>.
{% endhint %}
{% endtab %}
{% endtabs %}

### Desktop applications

Desktop applications are in a beta phase. Choose your source below, and download your platform's build.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Github Releases</strong></td><td><a href="https://github.com/camarm-dev/remede/releases">https://github.com/camarm-dev/remede/releases</a></td></tr><tr><td><strong>Remède website</strong></td><td><a href="https://remede.camarm.fr/desktop">https://remede.camarm.fr/desktop</a></td></tr></tbody></table>


# Update application

It is important to keep your application up to date to enjoy latest functionalities !

### Update android applications

See how to update the Android application with your download method

<details>

<summary>Obtainium</summary>

Just open the Obtainium application, find and click on Remède and then press the update button.

</details>

<details>

<summary>Github Release</summary>

Download the latest apk file from the [Github Release](https://github.com/camarm-dev/remede/releases/)

</details>

<details>

<summary>Other</summary>

Download the latest build and install the apk.

</details>

### Desktop applications

To update your desktop application, just download the latest build for your platform, using your preferred source (see [Download](/users/download#desktop-applications))

### Troubleshooting

{% hint style="success" %}
If the application installation fails, try to uninstall and reinstall Remède.
{% endhint %}

You can report the problem or ask us a question. See [Support](/users/support).


# Offline dictionaries

Learn how to download offline dictionaries in Remède.

## Download dictionaries

{% stepper %}
{% step %}

### Go to the settings page

Go to the settings page using the menu. Then click on "Offline dictionaries".

<div align="left"><figure><img src="/files/MuoRCHQO6rC1JSkgn4jX" alt="" width="206"><figcaption><p>Screenshot of the application menu.</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Select the dictionary to download

Select your dictionary version to download in the dropdown menu

<div align="left"><figure><img src="/files/XiqWcvfqwqf1Bq7l1GYo" alt="" width="206"><figcaption><p>Screenshot of the settings page</p></figcaption></figure> <figure><img src="/files/2pzLjJneZQ1YTDDw0WIQ" alt="" width="206"><figcaption><p>Screenshot of the dictionary selection</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Click on download

Press the download button and wait. Keep the application opened. When download is finished, you will see a popup message and the application will restart automatically.

<div align="left"><figure><img src="/files/DfljE2G6C6lXkPrLCxxa" alt="" width="206"><figcaption><p>Screenshot of the download button</p></figcaption></figure> <figure><img src="/files/K7HZfTQFMPeBWkFThs61" alt="" width="206"><figcaption><p>Dictionary downloading...</p></figcaption></figure> <figure><img src="/files/d47z4WMaMmFHa0w7wChZ" alt="" width="206"><figcaption><p>Download finished message.</p></figcaption></figure></div>
{% endstep %}

{% step %}

### You're done !

Enjoy browsing Remède offline !
{% endstep %}
{% endstepper %}

## Download multiple dictionaries

You can download multiple dictionaries. Just repeat the [#download-dictionaries](#download-dictionaries "mention") instructions with the dictionary you want to add. When you're done, you can set a favourite dictionary using the heart icon. The favourite dictionary will be used by default.

## Update dictionaries

{% stepper %}
{% step %}

### Go to the settings page

Go to the settings page using the menu.

<div align="left"><figure><img src="/files/fMvlqbsPdoJyJ2sTBb1n" alt="" width="206"><figcaption></figcaption></figure></div>

{% endstep %}

{% step %}

### Press the update button

If a dictionary can be update, you will see a "Update" button. Just press and wait for the end of the download. Keep the application opened. When download is finished, you will see a popup message and the application will restart automatically.

<div align="left"><figure><img src="/files/vF0TWdlUS2thMyBt7fGp" alt="" width="206"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Dictionary updated !

Enjoy your updated dictionary offline !
{% endstep %}
{% endstepper %}


# Dictionaries servers

You can explore DICT servers with Remède. Let's see how to enable and use this functionality.

{% hint style="warning" %}
Using Remède as a DICT client is **only available for Android devices**. See more : [#support](#support "mention").
{% endhint %}

### What is a dictionary server

The Dictionary Server Protocol (DICT) is a TCP based protocol which allows a client to access dictionary definitions from a set of dictionary databases. See [RFC2229](https://www.rfc-editor.org/rfc/rfc2229).

You can find a large amount of dictionary servers, that contains dictionaries about various topics.

### How to explore servers from Remède ?

You can browse dictionary servers from the "DICT Client" page in Remède. This page is more a testing purpose page than a way to browse dictionaries servers. It allows you to test servers connectivity and functionalities, with a logs page ect...

To use dictionaries servers as a search method in Remède, see [#how-to-set-a-dictionary-server-as-a-primary-dictionary](#how-to-set-a-dictionary-server-as-a-primary-dictionary "mention")

<details>

<summary>The server address field</summary>

On the DICT Client page, you can see two fields at the top of the page. The first one should indicate the DICT server address.\
![](/files/6gYc0e74YrJKqd3kIm1G)

The left part contains the hostname; a domain name or an IP address; and the second part is the server port. The default port for the DICT Protocol is 2628.

You can select a server from your saved servers or the default server directory by clicking the compass icon.

</details>

<details>

<summary>The search field, and search options</summary>

Below the server address field, you can see the search field. Use it to make a query to the dictionary server.

![](/files/5XvLhCjMDml264mlQj4x)

For more search options, click the filter icon at the right. You can now see the options page. You can select the dictionary to use (or choose to search in all dictionary), and the search method.

![](/files/kApNdoEzcAO4cZczSuP0)

* The DEFINE method will return the definitions of the words
* Whereas the MATCH method will return a list of word matching the requested pattern. The search pattern is what you enter into the search field.
  * The use of the MATCH method require a STRATEGY. The STRATEGY specify how do you want to match your pattern: REGular EXpression, starts with (preffix), ends with (suffixe) ect...

</details>

<details>

<summary>The logs page</summary>

For debugging purposes, you can open the logs page. It shows the raw transmission between Remède and the dictionary server.

![](/files/q0apzSunLwYRQHRlLYrn)

</details>

### How to set a dictionary server as a "primary" dictionary ?

Setting a dictionary server as "primary" will let you browse it directly from the home page and see a word's definitions.

{% stepper %}
{% step %}

### Go to the settings page

Using the menu, switch to the settings page. Then, click switch to the DICT servers page.

<div align="left"><figure><img src="/files/MuoRCHQO6rC1JSkgn4jX" alt="" width="206"><figcaption><p>App menu</p></figcaption></figure> <figure><img src="/files/CbGaW4ZATfA0VQZ8xbh9" alt="" width="188"><figcaption><p>Settings page</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Add a dictionary server

You can add your owns dictionary servers using the "Add a server button".

<div align="left"><figure><img src="/files/OVLaQ1I48iTX5Tp3ceqX" alt="" width="188"><figcaption><p>DICT servers settings</p></figcaption></figure> <figure><img src="/files/hbCyzY4OYqZce18PktnY" alt="" width="188"><figcaption><p>Add server modal</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Enable "search from DICT servers" and turn on desired servers

<div align="left"><figure><img src="/files/uKeh5V9OhWy92KS8JEGI" alt="" width="188"><figcaption><p>DICT server search enabled</p></figcaption></figure> <figure><img src="/files/W2JTyE6HuIyjQcsjdDKB" alt="" width="188"><figcaption><p>Wanted servers enabled</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Select "DICT servers" as search source and start browsing dictionaries servers !

<div align="left"><figure><img src="/files/2thM51W45p07YPW5wURj" alt="" width="188"><figcaption><p>Search source selection</p></figcaption></figure> <figure><img src="/files/kYbsw9uOJbbhrvanzGRw" alt="" width="188"><figcaption><p>Browsing DICT servers from Remède !</p></figcaption></figure> <figure><img src="/files/QbWmSacdQ9LiW9naR8wq" alt="" width="188"><figcaption><p>Simplified definition page</p></figcaption></figure></div>
{% endstep %}
{% endstepper %}

### Support

| Device                  | Support              | Method                                 |
| ----------------------- | -------------------- | -------------------------------------- |
| :green\_circle: Android | :white\_check\_mark: | Native TCP request client, with Java.  |
| :apple: iOS             | :x:                  | Future : With a proxy owned by Remède. |
| :desktop: Desktop       | :x:                  | Future : With a proxy owned by Remède. |

The support of this functionality is limited because the DICT protocol is based on the TCP protocol. Remède is powered by web technologies (Javascript, HTML, CSS), and Javascript does not allows us to use TCP Sockets. The only two methods are to write a TCP Socket client with native code (like we do for Android) or to send the request through a proxy server.

{% hint style="info" %}
The proxy server is owned and developed by Remède (see NO LINK YET)
{% endhint %}


# Support

Any question, remark ? Don't hesitate to contact us.

You can report a problem, a security issue or even ask question via these platforms :

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Github Issues</strong></td><td>Report a problem, ask a question.</td><td><a href="https://github.com/camarm-dev/remede/issues/new/choose">https://github.com/camarm-dev/remede/issues/new/choose</a></td></tr><tr><td><strong>Labse</strong> <strong>Support</strong></td><td>Report forum</td><td><a href="https://support.camarm.fr">https://support.camarm.fr</a></td></tr><tr><td><strong>By email</strong></td><td>Contact us at software@camarm.dev</td><td><a href="mailto:software@camarm.dev">mailto:software@camarm.dev</a></td></tr><tr><td><strong>Matrix Space</strong></td><td>Join our Matrix Space, the main communication channel !</td><td><a href="https://matrix.to/#/#remede:matrix.org">https://matrix.to/#/#remede:matrix.org</a></td></tr><tr><td><strong>Mailing List</strong></td><td>Subscribe to the mailing list; here you can discuss about Remède and find support</td><td><a href="https://www.freelists.org/list/remedeproject">https://www.freelists.org/list/remedeproject</a></td></tr></tbody></table>


# Getting started

Let's discover Remède documentation !

You can start by cloning your own copy of Remède locally:

```sh
git clone https://github.com/camarm-dev/remede
```

Now you can browse categories and documentation pages on left menu ! We recommend to first setup your development environment by following the documentation below.

{% content-ref url="/pages/pga2Fgl9Tft6C2BXtbdd" %}
[Setup](/developers/develop-on-remede/setup)
{% endcontent-ref %}


# Develop on Remède

Starts contributing to the best dictionary ever now !

This project is developed using [Typescript](https://www.typescriptlang.org/), [Python](https://python.org) and [VueJS](https://vuejs.org/). You need to know these to start contributing !


# Setup

Follow these steps to setup your development environment before developing on Remède.

## Setting up Ionic framework

Remède uses Ionic. You will install npm dependencies and requirements to start developing with Ionic.&#x20;

1. Make sure you have **node 18** installed.
2. Move to the `app/` folder
3. Install dependencies

```shell
npm install
```

4. Install Ionic

```shell
npm install -g @ionic/cli
```

## Setting up mobile development - Android

Ionic framework let us build Remède for native platforms with Capacitor. {: .fs-3 .fw-300 }

Developing for Android does not need special requirements. Just install npm dependencies.

See [Capacitor documentation](https://capacitorjs.com/docs/android) for more information.

{% hint style="success" %}
Make sure you have Android Studio installed.
{% endhint %}

## Setting up mobile development - iOS

Ionic Framework let us build Remède for iOS.

We do not build Remède for iOs yet. Follow the [official Ionic documentation](https://ionicframework.com/docs/developing/ios).

{% hint style="warning" %}
Remède has not been tested yet on iOS ! Build and use it at your own risks...
{% endhint %}

## Setting up API development

Remède has a public API written with FastAPI. {: .fs-3 .fw-300 }

1. Make sure you have **Python 3** installed.
2. Install dependencies

```shell
pip install -r requirements.txt
```

3. [Fetch database](#fetch-database) so the API can serve it

## Fetch database

Remède latest database is not served by git because it is too large... We host our database on our own servers.

To fetch the latest database, you can use `curl` or `wget` as you prefer...

{% hint style="warning" %}
Execute these commands at project root.
{% endhint %}

* With `curl`

```shell
curl -o data/remede.db https://api-remede.camarm.fr/download?variant=remede
```

* With `wget`

```shell
wget -O data/remede.db https://api-remede.camarm.fr/download?variant=remede
```

{% hint style="info" %}
Remède used to store its databases on **Github LFS servers** but our quota has been exceeded... The databases which are still stored in git lfs are **outdated**.
{% endhint %}

## Git submodules

Remède includes external projects to its codebase using git submodules... {: .fs-3 .fw-300 }

To fetch or update the git submodules, just pull the distant repository inside the submodule's directory:

For example :

```shell
cd api-definition && git pull origin main
```

{% hint style="info" %}
If you are pulling the submodules for the **first time**, you must execute
{% endhint %}

```shell
git submodule update --init --recursive
```

**Lists of submodules :**

* `/api-definition`: [api-definition](https://github.com/LabseSoftware/api-definition)


# Structure

Understand how Remède is structured.

{% hint style="success" %}
**Good practise**

To discover and understand the project structure, start a development server and try to modify some files and see what changes.
{% endhint %}

* `server.py`: Main API, made with Fastapi
* `data/`: [Dataset](/database/database/dataset) and Remède databases
* `app/`: Ionic project
  * `src/`: Vuejs project
    * `components` : Vue components for the interface
    * `data` : Static data like translations (see [Translation](/project/contributing/translation))
    * `functions` : Typescript file to interact with native API or manage the offline dictionary
    * `views` : The "views" (pages) of the application
  * `tauri-src/`: Tauri Project
  * `android/`: Android project, generated by [`@capacitor/android`](https://capacitorjs.com/docs/android)
* `api-definition`: API to fetch Wictionary definitions (it's a git submodule)
* `scripts/`: Scripts to parse, generate and make migrations on the database.
* `convert` : Tools and scripts used to convert Remède databases to other dictionaries formats
* `docs/`: The website and blog of Remède. The documentation is at [labsesoftware/docs.remede.camarm.fr](https://github.com/LabseSoftware/docs.remede.camarm.fr)
* `corrector/`: Docker to run languagetool API
* `tts/`: Docker compose to run nanotts with opentts
* `builds/latest`: Latest builds for platforms (can be outdated...)

Of course, there are more folders...&#x20;


# Development

Modify the source code in Vue to add functionalities !

The main code of Remède is in the `app` folder. The following documentation concerns this folder, so you should move to it before continuing.

This project is developed using **Ionic**. It **acts like a Vue website** (that's why we provide a web version of the application).

## Structure

* `public/`: Public resources, served under `/`
* `src/`: The Vue project
  * `assets/`: Assets
  * `components/`: Vue components
  * `views/`: Application pages
  * `functions/`: Native functionalities / dictionary or API calls...
  * `router/`: Router files
  * `theme/`: CSS styles
  * `App.vue`: main Vue file
  * `main.ts`: main typescript file
* `ionic.config.json`: Ionic configuration
* `capacitor.config.json`: Capacitor configuration
* `package.json`

Not all the files are listed, you can find more configurations files in these folders...

## Scripts

* Development start

```shell
npm run dev 
```

* Build project

```shell
npm run build 
```

* Lint project

```shell
npm run lint 
```

* Lint project and fix problems

```shell
npm run lint:fix 
```

## How to develop

You can navigate through the folders and files to understand more how it is working.

* Also check the [Ionic Vue](https://ionicframework.com/docs/vue/overview) and [Ionic Ui Components](https://ionicframework.com/docs/components) documentation
* Contact us at <software@camarm.dev> for more information


# API

The public API of Remède serve the Remède database and more functionalities !

## Configuration

* To use the service which permit to users to open issues (about missing words in the dictionary), create a `.github.json`, file which contains the following:

```json
{
  "token": "ghp_XXXXXXXX",
  "repo": "camarm-dev/remede",
  "labels": ["word"],
  "assignees": ["camarm-dev"]
}
```

* To serve the database you need to [download it](/developers/develop-on-remede/setup#fetch-database).

## Developing

Remède API is built using [FastAPI](https://fastapi.tiangolo.com/).

You can modify it inside the `server.py` file at project root.

An *open API* documentation generated by FastAPI can be found at [api-remede.camarm.fr](https://api-remede.camarm.fr/docs).

## Start API

```shell
python3 server.py
```

Running on [localhost:8000](http:/localhost:8000) !

Documentation available at [localhost:8000/docs](http:/localhost:8000/docs).


# Features

Discover the main Remède features and how you can enhance them.


# Offline

Understand Remède offline mode.

TODO


# Sheets

Remède can give you french lessons !

{% hint style="danger" %}
**Remède needs you**

Remède does not have enough french Sheets... You can add ones to help us !
{% endhint %}

Sheets are readable inside the application. They are a resume of french grammar, conjugate ect...

## Writing a sheet

Sheet containing french orthography and grammar lessons are written in the `data/fiches` folder.

They are written in `markdown` and use `front-matter` to work.

Sheet example:

```markdown
---
nom: Exemple de fiche
description: Ceci est la première fiche
credits: https://remede.camarm.fr/sheets-credits#example
slug: exemple
tags: 
  - grammaire
  - orthographe
---

# Exemple

Ceci est un exemple de fiche.
```

Available tags: `grammaire`, `orthographe`, `conjugaison`, `lexique`, `style`, `typographie`

To credit and permit right attribution of these sheets, please **fill correctly** the `credits` fields in the frontmatter.

* `credits.url`: Source URL (Remède GitHub link or source website url)
* `credits.attributions`: The person or project to attribute
* `credits.text`: The ressources that helped you, the file modification historic.

Please fill correctly this file, because it tracks authors and contributions, and is here to respect privacy policies and copyrights about Rèmede and the sources of its data !


# DICT Client

Remède supports the DICT protocol and can be used as a DICT client.

Remède is able to communicate with dictionaries servers. The DICT protocol was created in 1997; it has been described in the [RFC2229](https://www.rfc-editor.org/rfc/rfc2229). It is based on TCP/IP.

### How it works

The codebase contains a Dict Client view, which is able to explore dictionaries server.

{% hint style="info" %}
Because Javascript is not able to send TCP requests, we must use native code to send TCP request through sockets. Thanks to [Capacitor Plugins](https://capacitorjs.com/docs/android/custom-code), we can easily call native Java code from our Typescript codebase.
{% endhint %}

<details>

<summary>The Capacitor "TCPClient" plugin</summary>

The plugin native code is located at `app/android/app/src/main/java/dev/camarm/remede/TCPClient.java` and it is defined in the Vue codebase at `app/src/functions/plugins/tcpClient.ts`.

TODO: Not finished

</details>

<details>

<summary>The DICT Client view</summary>

TODO: Not finished

</details>

<details>

<summary>The "Searching using DICT servers" feature</summary>

TODO: Not finished

</details>


# Android development

Remède is running on Android. Let's learn how to build Remède for Android !

The Android project is inside `app/android` folder. The following commands need to be executed in the `app` folder.

## Opening Android project

You can open the Android project in Android Studio using :

```shell
ionic capacitor open android
```

## Building for Android

Run the following command and continue in Android Studio where you would build, test and debug the application.

```shell
ionic capacitor build android
```

This command builds the Vue project using `vite` and move the generated resources to the android project, so they can be served through a WebView in the native application.

***

See [Capacitor](https://capacitorjs.com/docs/android) for more information.


# API

Remède provides an API that let you browse the dictionaries databases !

The public API documentation is available at <https://api-remede.camarm.fr/docs>. You can also browse the OpenAPI specifications below.

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/validity/{slug}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/phoneme/{phoneme}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/word/{word}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/random" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/word-of-day" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/autocomplete/{query}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/search/{query}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/ask-new-word/{query}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/sheets" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/sheets/{slug}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/sheets/download/{slug}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/download" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}

{% openapi src="<https://api-remede.camarm.fr/openapi.json>" path="/release/{variant}" method="get" %}
<https://api-remede.camarm.fr/openapi.json>
{% endopenapi %}


# Database

Remède provides its own dictionary database format.

Remède brings its own database. It is built from various sources which makes it huge ! Learn more about it in this section.&#x20;


# Database schema

Discover how Remède's database is storing an entire dictionary.

Remède database is an **Sqlite 3** database.

## Tables

The database only has two tables :

| Name       | Description                                                                                    |
| ---------- | ---------------------------------------------------------------------------------------------- |
| dictionary | all Remède [documents](https://docs.remede.camarm.fr/docs/database/schema)                     |
| sources    | Remède sources links (to make the database lighter, we only store sources' ids, not full link) |

## Dictionary table

The `dictionary` table of Remède contains the following fields:

| Field          | Description                                                                               | Type      | Example                                       |
| -------------- | ----------------------------------------------------------------------------------------- | --------- | --------------------------------------------- |
| word           | The word                                                                                  | `string`  | `manger`                                      |
| indexed        | The word but case, accent and special chars insensitive                                   | `string`  | `manger` (`a vue d oeil` is a better example) |
| phoneme        | The word's phoneme                                                                        | `string`  | `m#Ze`                                        |
| nature         | The word's nature                                                                         | `string`  | `VER\|manger`                                 |
| syllables      | The word's syllables number                                                               | `integer` | `2`                                           |
| min\_syllables | The word's max syllables number^2                                                         | `integer` | `2`                                           |
| max\_syllables | The word's min syllables number^2                                                         | `integer` | `3`                                           |
| elidable       | Can the word be precede by an "élide"^1                                                   | `boolean` | `false` or `null` if no data                  |
| feminine       | Is the last phoneme "féminine"                                                            | `boolean` | `false` or `null` if no data                  |
| document       | The word's [document](https://docs.remede.camarm.fr/docs/database/schema), as JSON-string | `string`  | `{...}`                                       |

* See [Rimes](https://docs.remede.camarm.fr/docs/database/rimes) to know how this is used as a rhymes dictionary

## Sources table

The `sources` table of Remède contains the following fields:

| Field      | Description                                           | Type     | Example                                    |
| ---------- | ----------------------------------------------------- | -------- | ------------------------------------------ |
| identifier | The source id                                         | `string` | `fr_wik`                                   |
| label      | The source label, or the translation path             | `string` | `Wiktionnaire` or `definition.conjugation` |
| url        | The source's url. {word} will be replaced by the word | `string` | `https://fr.wiktionary.org/wiki/{word}`    |

***


# Document schema

A Remède word document contains everything about a word stored in Remède's database.

[Download Remède Document JSON Schema](https://github.com/camarm-dev/remede/tree/main/data/remede.schema.json)

Or use it into your JSON files:

```json
{
  "$schema": "https://remede.camarm.fr/schema.json"
}
```

JSON schema of an indexed word by Remède looks like:

```json
{
  "synonyms": [
    "acupuncture",
    ...
  ],
  "antonyms": [
    "embrocation",
    ...
  ],
  "etymologies": [
    "Du latin <i>remĕdium</i>."
  ],
  "definitions": [
    {
      "gender": "masculin",
      "nature": "Nom propre",
      "explanations": [
        "(Informatique) Dictionnaire français, open source et gratuit qui a pour objectif de remplacer Antidote."
      ],
      "examples": [
        {
          "content": "Tu connais pas <b>Remède</b> ? C'est le meilleur dictionnaire mobile !",
          "sources": "Un utilisateur de Remède, 2024"
        }
      ],
      "plurals": []
    },
    {
      "gender": "masculin",
      "nature": "Nom commun",
      "explanations": [
        "(Médecine) Substance qui sert à guérir un mal ou une maladie. ",
        "(Sens figuré) Ce qui sert à guérir les maladies de l’âme. ",
        "(Sens figuré) Ce qui sert à prévenir, surmonter ou faire cesser un malheur, un inconvénient ou une disgrâce. ",
        "(En particulier) Lavement. "
      ],
      "examples": [
        {
          "content": "<i>Le suc d'une certaine plante appelée par les Caraïbes </i>touloula<i>, et par les Français </i>herbes aux flèches<i>, est, dit-on, le seul <b>remède</b> contre les plaies faites par les flèches empoisonnées avec le suc de mancenilier.</i> ",
          "sources": "(R. P. Jean-Baptiste Labat, <i>Voyages aux iles françaises de l'Amérique</i>, nouvelle édition d'après celle de 1722, Paris&#160;: chez Lefebvre &amp; chez A.-J. Ducollet, 1831, page 75)"
        }
      ],
      "plurals": [
        {
          "label": "Masculin",
          "singular": "remède",
          "plural": "remèdes"
        }
      ]
    }
  ],
  "sources": [
    "fr_wik",
    "synonymo_fr",
    "antonymes_org"
  ],
  "phoneme": "/ʁəmɛd/",
  "pronunciation": {
    "audio": "https://upload.wikimedia.org/wikipedia/commons/2/27/Fr-rem%C3%A8de.ogg",
    "credits": "https://commons.wikimedia.org/w/index.php?curid=3043985"
  },
  "conjugations": {}
}
```

Here are the specifications of each field :

* `synonyms` (`[]string`): List of synonyms
* `antonyms` (`[]string`): List of antonyms
* `etymologies` (`[]string`): List of etymologies
* `definitions` (`[]{}`): List of objects containing a word definition
  * `gender` (`string`): The gender of defined word
  * `nature` (`string`): The grammar class of defined word
  * `explanations` (`[]string`): List of possible explanation of defined word
  * `examples` (`[]string`): List of examples sentences using this word (NOT IMPLEMENTED)
* `plurals` (`{}[]`): The word plurals
  * `label`: A label related to the type of the plural
  * `singular`: The word as singular
  * `plural`: The plural of the word
* `source` (`string[]`):A list of sources ids, to be displayed in interface. Their urls and link can be found at [app/src/functions/sources.ts](https://github.com/camarm-dev/remede/tree/main/app/src/functions/sources.ts). Sources are also described at Database Credits page.
* `phoneme` (`string`): International Phonetic Alphabet pronunciation of the word
* `pronunciation` (`{}`): Word pronunications audios
  * `audio` (`string`): Word audio URL
  * `credits` (`string`): Word credits URL
* `conjugations` (`{}`): Object containing word's conjugations
  * `[mode name]` (`{}`): Object containing conjugations' tenses for mode
    * `[tense name]` (`{}`): Object containing subjects of tense
      * `[subject]` (`string`): Verbal form (of `mode, tense, subject`)


# Dataset

The roots of Remède...

The `data` folder is destined to the linguistics resources used by Remède.

* Folder `fr/`
  * `words.txt`: List of \~1 000 000 words, semi separated
  * `ipa.json`: For a key 'word', returns his IPA
    * Generated from `data/IPA.txt`: a text file of format `[word]\t[ipa]` by `scripts/pre_generate_ressources.py`
* The sames resources, for each locale are situated in the folders `en` ect...

{% hint style="info" %}
The `data/remede.db` file is not included in git files, see Setup to download it.
{% endhint %}

* `data/remede.schema.json`: JSON schema of Remède document
* `data/custom_words.json`: File to add custom words... The words documents must follow the Remède Document Schema
  * `data/custom_words.schema.json`: its JSON schema
* `data/remede.db`: A sqlite database ([reference](/database/database/document-schema)) (french)&#x20;
* `data/remede.[locale].db`: A sqlite database ([reference](/database/database/database-schema)) (for locale, eg `remede.en.db`)&#x20;
* `data/drime.db`: The [Open Lexicon](http://lexique.org/shiny/openlexicon/) french database rewrote by the project [drime](https://a3nm.net/git/drime/files.html). Useful to get precise word metadata like syllables.


# Rimes

Discover how the rimes database work.

## How it work ?

Remède is able to serve a **rhymes dictionary** using its database.

It uses the field **phoneme** to know which words ends with the same sound. The query looks like (with phoneme `e`)

```sql
SELECT * FROM dictionary WHERE phoneme LIKE '%e'
```

TODO: more precision with elide ect


# Internationalization

Remède Next has introduced a translation system. These documentation pages will explain how we build database for other languages.


# English database

The Remède dictionary for english-speaking people !

{% hint style="info" %}
The english database is **very unstable** and still in **early development stage**.
{% endhint %}

## Generation

We will understand how to generate the Remède English database, situated at `data/remede.en.db`.

*The generation is working exactly as described in Database - Generation - Lifecycle*.

But some resources changes:

* `data/fr/IPA.txt` is `data/en/IPA.txt` and the generated resources from this file are
  * `data/fr/words.txt` is `data/en/words.txt`
  * `data/fr/ipa.json` is `data/en/ipa.json`

Also, it uses the english version of api-definition.

To start an english generation, just run

```shell
python3 scripts/generate.en.py
```


# Build Dictionary

Remède build its own dictionaries databases. Learn how it works here !


# The building lifecycle

A Remède database generation can take a while... Let's see what happend step by step in the generation.

## What is a Remède database generation

When you generate a new fresh Remède database, you build an **Sqlite database** which includes **all the dictionary's words**, and their metadata, stored in a JSON format, specified as the Remède document format.

## Generate the database step by step

Learn how to generate Remède database by yourself.

Generation used to require to execute a lot of python scripts. But now, only two steps are required to generate a database.

1. `pre_generate_ressources.py` generate multiple useful resources (`mots.txt` and `ipa.json`, from `IPA.txt`); see [Dataset](https://docs.remede.camarm.fr/docs/database/dataset)
2. `generate.py` generate the **Sqlite database** which contains all the [Remède documents](https://docs.remede.camarm.fr/docs/database/schema) for each letter of the alphabet (see [generate.py](#generate.py))

{% hint style="warning" %}
All the scripts are stored in `scripts` folder and must be executed from **project root**.
{% endhint %}

## generate.py

A script to iterate words and build their Remède document.

**How it works ?**

1. It iterates over 1 000 000 words (from `data/mots.txt`)
2. For each word, it retrieves its definition using [`api-definition`](/database/build-dictionary/about#api-definition) and more information with extern services...
3. It generates its [Remède document](https://docs.remede.camarm.fr/docs/database/schema)
4. It inserts into the Sqlite database: the word, its sanitized form, its phoneme, its `JSON` format (and more metadata required for powerful and advanced features)
   * Metadata like if the last phoneme is `feminine`, the number of `syllables` or if the word can have an `elide` are taken from [Open Lexicon](http://www.lexique.org/?page_id=91) database ([Drime](https://a3nm.net/git/drime/files.html) project) or calculated with less precision by us...

{% @mermaid/diagram content="flowchart TB
words\[(Word database)] --> Loop
Loop(Parser loop) --> def\[Definition API]
Loop --> syn\[aynonymo.fr]
Loop --> ant\[antonymes.org]
Loop .-> conj\[conjuguons.fr]
def --> doc\[\[Remède document]]
syn --> doc
conj .-> doc
ant --> doc
openlexicon\[(Open Lexicon Stats)] -- "Syllables, elides and feminines stats merged and added to" --> db
doc -- Is inserted into --> db\[(Remède Sqlite Database)]" %}

*A lifecycle schema of `parse.py`*


# Generate my own database

Learn how to generate your own Remède database !

Please read [Lifecycle](/database/build-dictionary/the-building-lifecycle) before.

See also [Quickly add a word](/database/build-dictionary/about#quickly-add-a-word).

## 1 - Generate required ressources

```shell
python3 scripts/pre_generate_ressources.py
```

## 2 - Start parsing words

You need to start [api-definition](/database/build-dictionary/about#api-definition) in local, so our generation script can get definitions of Wiktionary.

Start `generate.py`

```shell
python3 scripts/generate.py
```

This operation take few days !

{% hint style="warning" %}
Generating a new database will erase the current one ! Make sure to save it before ! For example, make a copy of it; `cp data/remede.db data/remede.07-06-2024.db`
{% endhint %}

## 3 - Enjoy your own database !

The database situated at `data/remede.db` has been generated successfully, and you can now serve it with the API ! Congratulations !

## Troubleshooting

A generation is very long ! Sometimes it crashes or freeze... The `generate.py` script handle crashes (or in cas of freeze, the KeyboardInterrupt that you can trigger by pressing <kbd>ctrl-c</kbd> in your terminal to end the process) and saves its progression:

* `data/remede.db`; the database, not fully generated
* `data/missing-wordlist.txt`; the list of words that should have been added

To **resume the generation**, execute

```shell
python3 scripts/generate.py --resume
```

*It will automatically resume the process with the saved files*


# About

This section contains documentation for related resources to Remède generation.

## Api Définition

This API, written by [Frederic Gainza](https://api-definition.fgainza.fr/), scrap the [French Wictionary](https://fr.wiktionary.org/wiki/Wiktionnaire:Page_d%E2%80%99accueil).

For Remède, **it has been readapted** by [Labse Software](https://github.com/LabseSoftware/api-definition)

### Start with docker

This API's code is contained under the `api-definition` folder which is a **git submodule**.

In `api-definition` folder:

```shell
docker build -t remede-definition-api . && docker run -p 8089:80 remede-definition-api
```

## Quickly add a word

The script `scripts/add_word.py` let you add a word to the Remède database without rebuilding it totally.

It :

* Add your word in `data/mots.txt`
* Add your word's document in `data/remede.db`

{% hint style="info" %}
You must have an [api-definition](#api-definition) instance running locally !
{% endhint %}

```shell
python3 scripts/add_word.py <word> <phoneme>
```

To add multiple words:

`wordlist.txt` (tabulation between word and IPA: `mot\t/ipa/`)

```
acupuncture /a.ky.pɔ̃k.tyʁ/
remède  /ʁəmɛd/
```

and execute

```shell
python3 scripts/add_word.py -f wordlist.txt
```

## Wordlist iterator

This script was created to iterate wordlists (text file with words separated by a newline) to add them to Remède...

The script `scripts/check_wordlist.py` iterate the given wordlist, find every word phoneme and add them to a `.words_to_add` file.

It adds all the **words that are not already in the database** to this file, them can be added with `scripts/add_word.py`. (referenced [just above](broken://pages/2AR3fjWMgzjhl8WwzCwg))

Usage:

```shell
python3 scripts/check_wordlist.py <path to wordlist>
```


# Remède for your project

You are looking for a free and open dictionary for a project ? Use Remède; it is free, open and simple to integrate to any project !

**There are multiple methods to integrate Remède to your project**

{% tabs %}
{% tab title="Sqlite " %}
We provide a Sqlite database for each dictionary. You can download them on [our website](https://remede.camarm.fr/download).

For further informations, see

{% content-ref url="/pages/m4yNJZ688lHWyF8V9rTf" %}
[Database schema](/database/database/database-schema)
{% endcontent-ref %}

{% content-ref url="/pages/cvrr5xPl5OzmHaTTMqUI" %}
[Document schema](/database/database/document-schema)
{% endcontent-ref %}
{% endtab %}

{% tab title="API" %}
You can easily integrate Remède everywhere using our API.

{% content-ref url="/pages/7YydU9MGSZM15DiaM1oI" %}
[API](/developers/api)
{% endcontent-ref %}
{% endtab %}

{% tab title="DICT" %}
Remède is compatible with the DICT Protocol (accordingly to the [RFC2229](https://www.rfc-editor.org/rfc/rfc2229)). We provide a DICT server available at dict.remede.camarm.fr

You can download the DICT compatible files (`.index` , `.dict` & `.txt` files) from the [release section](https://github.com/camarm-dev/remede) on Github.
{% endtab %}

{% tab title="XDXF" %}
The **XML Dictionary eXange Format** (XDXF) is a dictionary format created in 2006 whose goal is to unite all existing open dictionaries format.

You can download the Remède dictionaries in the XDXF format (`.xdxf` files) from the [release section](https://github.com/camarm-dev/remede) on Github.
{% endtab %}

{% tab title="CSV" %}
You can download the Remède dictionaries in the CSV format (`.csv` files) from the [release section](https://github.com/camarm-dev/remede) on Github.
{% endtab %}

{% tab title="JSON files (Depreciated)" %}
You can download the JSON files on our [Github Repository](https://github.com/camarm-dev/remede/tree/1.2.3/data).

{% hint style="warning" %}
JSON files are depreciated since <kbd>1.3.0</kbd> and removed by <kbd>1.4.0</kbd>. See [Remède Next](/project/remede-next) for more informations
{% endhint %}
{% endtab %}
{% endtabs %}

Even if it is depreciated, you can also read our blog post "[Utiliser les données Remède](https://remede.camarm.fr/2023/11/19/Utiliser-les-donnees-Remede.html)".

See also [Available formats](/database/available-formats).

```
Dictionaries distributed by The Remède Project <software@camarm.dev> © 2023-now CECILL-2.1.
Includes data from third-parties services governed by other free licenses. See https://docs.remede.camarm.fr/database/credits for further information.
```


# Available formats

Remède uses its own dictionary format but you can download our dictionaries in other formats.

Remède converts its dictionaries to other open formats. Tools and scripts used for conversion can be found in the `convert/` directory.


# DICT

The format created by the DICT Development Group.

The DICT format is used by the `dictd` software. A dictionary is divided in two files: a `.index` file and a `.dict` file. For further information, see&#x20;

### Download

You can download the `.index` and `.dict` format for each dictionary directly from the [Github Releases](https://github.com/camarm-dev/remede/releases/).

### How to convert

To convert Remède dictionaries databases to the DICT format, there is a `prepare.py` script.

First, execute the script

```
python3 dictd/prepare.py
```

Then, switch to the `convert/dictionaries` directory. Using `dictfmt` , generate the `.index` and `.dict` files.

```
dictfmt -e --utf8 --allchars -s "Remède Français" remede < remede.txt
dictfmt -e --utf8 --allchars -s "Remède English" remede.en < remede.en.txt
```

*Remède database are now available in the DICT format at `convert/dictionaries` .*


# XDXF

The XML Dictionary eXchange Format is an open dictionary format.

The [XDXF](https://en.wikipedia.org/wiki/XDXF) (XML Dictionary eXchange Format) dictionary format was created in 2006 and its goal is to unite all existing open dictionaries format.

### Download&#x20;

You can download the `.xdxf` format for each dictionary directly from the [Github Releases](https://github.com/camarm-dev/remede/releases/).

### How to convert

To convert Remède dictionaries databases to the XDXF format, there is the `convert/xdxf.py` script. It converts the Remède dictionaries databases to XDXF.


# CSV

Remède dictionaries as CSV format.

The CSV files can be widely used. They contain the word in the first column, and its definition in the second column. The definition contains HTML.

### Download&#x20;

You can download the `.csv` format for each dictionary directly from the [Github Releases](https://github.com/camarm-dev/remede/releases/).

### How to convert

To convert Remède dictionaries databases to the CSV format, we first convert it to the DICT format ([DICT](/database/available-formats/dict)) and then to CSV using [pyglossary](https://github.com/ilius/pyglossary).


# Credits

Listing of all tools and sources used to create database and serve all app functionalities.

Remède creates its own base of french words, synonyms, antonyms with extern services.

## French database credits

* Definitions, examples and etymologies by the [french Wiktionary](https://fr.wiktionary.org/wiki/Wiktionnaire:Page_d%E2%80%99accueil) ([CC BY-SA 3.0 Deed](https://fr.wiktionary.org/wiki/Wiktionnaire:Licence)), with the API wrapper made by [Frederic Gainza](https://api-definition.fgainza.fr/) ([GPL 3.0](https://github.com/FredGainza/api-definition/blob/main/LICENSE)), modified by [Labse Software](https://github.com/LabseSoftware/api-definition) for Remède.
* Synonyms from [synonymo.fr](http://www.synonymo.fr)
* Antonyms from [antonyme.org](http://www.antonyme.org)
* Conjugations from [conjuguons.fr](http://www.conjuguons.fr)
* Rhymes dictionary is made with data from [Open Lexicon](http://www.lexique.org/?page_id=91) ([CC BY-SA 4.0 Deed](https://github.com/chrplr/openlexicon/blob/master/LICENSE.txt)), parsed by the [Drime](https://a3nm.net/git/drime/files.html) ([GPLv3](https://a3nm.net/git/drime/file/COPYING.html)) project to be added to Remède database.
  * Used data: `syllables count`, `elidable` and `femnine`

**Wordlist and IPAs credits**

Wordlists and IPA are the root of our database: we iterate wordlists and fetch word's informations using the services listed above.

* Wordlist and IPA from [Open Dict Data](https://github.com/open-dict-data/ipa-dict)[MIT](https://github.com/open-dict-data/ipa-dict/blob/master/LICENSE) ([fr\_FR.txt](https://github.com/open-dict-data/ipa-dict/blob/master/data/fr_FR.txt) in their repo, [data/fr/IPA.txt](https://github.com/camarm-dev/remede/blob/main/data/fr/IPA.txt) in our repo)
* Another IPAs from french Wiktionary (above), words from [Words](https://github.com/lorenbrichter/Words) ([CC0 1.0 Universal](https://github.com/lorenbrichter/Words/blob/master/LICENSE)) by lorenbrichter (see concerned word in [wordlist-Words-CC0-1.0.txt](https://github.com/camarm-dev/remede/tree/main/data/wordlist-Words-CC0-1.0.txt)).
* Another IPAs from french Wiktionary (above), words from [wiktionaire-fr](https://github.com/drogbadvc/wiktionaire-fr) ([NO LICENCE SPECIFIED](https://github.com/drogbadvc/wiktionaire-fr)) by drogbadvc, data reorganised from [WiktionaryX](http://redac.univ-tlse2.fr/lexiques/wiktionaryx.html) ([CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)) project whose data comes from [Wiktionary Dumps](https://dumps.wikimedia.org/) (see concerned word in [wordlist-wiktionaire-fr.txt](https://github.com/camarm-dev/remede/tree/main/data/wordlist-wiktionaire-fr.txt)).

## English database credits

* Definitions, examples and etymologies by the [english Wiktionary](https://en.wiktionary.org) ([CC BY-SA 3.0 Deed](https://fr.wiktionary.org/wiki/Wiktionnaire:Licence)), with the API wrapper made by [Frederic Gainza](https://api-definition.fgainza.fr/) ([GPL 3.0](https://github.com/FredGainza/api-definition/blob/main/LICENSE)), modified by [Labse Software](https://github.com/LabseSoftware/api-definition) for Remède.
* Synonyms and antonyms from [thesaurus.com](https://www.thesaurus.com) (NO LICENSE SEPCIFIED)
* Conjugations from [???](broken://pages/VryC7oCuDEZpWipjWx2Z)

**Wordlist and IPAs credits**

* Wordlist and IPA from [Open Dict Data](https://github.com/open-dict-data/ipa-dict) ([MIT](https://github.com/open-dict-data/ipa-dict/blob/master/LICENSE)) ([en\_US.txt](https://github.com/open-dict-data/ipa-dict/blob/master/data/en_US.txt) in their repo, [data/en/IPA.txt](https://github.com/camarm-dev/remede/blob/main/data/en/IPA.txt) in our repo)

## Other services credits

* The TTS service from [nanotts](https://github.com/gmn/nanotts) ([Apache 2.0](https://github.com/gmn/nanotts/blob/master/LICENSE)), implemented in the API [opentts](https://github.com/synesthesiam/opentts) ([Apache 2.0](https://github.com/gmn/nanotts/blob/master/LICENSE)), hosted by us
* The corrector service by [languagetool.org](https://languagetool.org) ([LGPL 2.1](https://github.com/languagetool-org/languagetool/blob/master/COPYING.txt)), hosted by us

Remède collects these data and merge them to a unique document, served in a database. You can learn more about a specific word credits, in the more menu from the definition page of the application. Transparency about our data provenance is a priority for us at Remède. For more informations, contact us at <software@camarm.dev>.


# Story

Remède is a free and open dictionary for everyone. Let's discover its story !

### The beginning <a href="#the-beginning" id="the-beginning"></a>

Hi ! I'm Armand the maintainer and creator of Remède. I created Remède in October 2023 because I switched to an android phone, and the proprietary dictionary "Antidote" is only available on iOS phones.

Remède is a synonym of "Antidote" and its goal is to provides a **free**, **open** and **collaborative** dictionary available for **any platform**.

My main goal was to provide a dictionary which is easy and pleasant to use ! I also wanted Remède to have **his own database**.

### The application now

Remède is a cross-platform dictionary application. You can browse and use in offline mode the Remède dictionaries, but it also allows you to browse DICT servers, and to import your own dictionaries.

Remède also includes **a corrector**, **a rimes dictionary** and **French sheets** ! It is more than a dictionary.

### The Remède Project <a href="#the-concept" id="the-concept"></a>

Today, I want to create something bigger. With the Remède Project, I want to offer everyone, everywhere a simple and pleasant universal dictionary experience, with access to free dictionaries.

The Remède Project aims to develop free dictionaries resources and give access to the existing (or old) resources. The resources we distribute are always open and are for all use cases.

That's why we distribute our databases in many formats.

### My future goals <a href="#our-future-goal" id="our-future-goal"></a>

I want to save and preserve the world of free and open dictionaries resources on Internet.

The future goals is to make Remède even more universal, by translating it to more languages, and making it compatible with other dictionaries format.

### Community

The Remède community is very small at the moment. You can make part of the Remède community now :

* Join us on Matrix : [#remede:matrix.org](https://matrix.to/#/#remede:matrix.org) (New to Matrix? See [Matrix for instant messaging](https://moodle.org/mod/page/view.php?id=8829) by Moodle)
  * We recommend you to use the [Element](https://element.io/) client.
* Join our [mailing list](https://www.freelists.org/list/remedeproject)

### For you <a href="#for-you" id="for-you"></a>

Remède is built for you by his community. Any contribution is appreciated and you are free to donate any amount of money to support my work on [Ko-Fi](https://ko-fi.com/camarm).

I hope Remède is useful for you and will brings even more breathtaking functionalities.

Remède <<software@camarm.dev>>


# Contributing

Learn how to contribute to Remède !

## How to contribute

**To contribute, you can:**

* Open an issue ([here](https://github.com/camarm-dev/remede/issues/new/choose))
* Choose an issue or an enhancement idea, fork the repository, resolve it and open a pull request ! ([complete guide](#guide))
* Contact us to become part of our team (<software@camarm.dev>)
  * So you'll have access to this repository

## Guide

1. Open or choose an issue on our [issue page](https://github.com/camarm-dev/remede/issues)
2. Fork and clone the repository on your computer
3. Read [the documentation](https://docs.remede.camarm.fr), and contact us for more informations (at <software@camarm.dev>).
4. Make your changes, and separate your work in multiple commits
5. Open a pull request
6. Wait and make requested changes
7. You're now a contributor ! Thank you very much !

You can see some example fo enhancement ideas you can make above.

## Add words

Remède fetches words from the Wiktionary but sometimes, words are not in our list so, you can add custom words...

You can add custom or missing word in our wordlists with ease.

1. Check on the [french Wiktionary](https://fr.wiktionary.org) if your word exist (or the Wiktionary in the language you want to add the word).
   1. If it is not referenced on the Wiktionary, add it to `data/custom_words.json` as JSON (using Remède Document Schema). The `data/custom_words.json` file looks like `{ "you-word": { /* Remède document */}" }`
   2. Don't forget to cite your sources (link of your resources) in `sources` field.
2. Using the script `add_word.py`, quickly add you word to the database. It will also add it to the Dataset files.

```shell
python3 scripts/add_word.py my-word /its ipa notation/ 
```

Check also [Building database - About - Quickly add a word](https://docs.remede.camarm.fr/docs/database/build/about#quickly-add-a-word)

## Add sheets

Remède needs contributors who can add sheets (for french grammar) !

You can find a documentation about writing sheets [here](https://docs.remede.camarm.fr/docs/sheets)

## Translating

* Add a new translation for the interface
* Enhance a translation
* Or build a new database for a new language !

Full documentation at Translation

## More

You can browse the documentation on the left-side menu. Do not hesitate to contact me us at <software@camarm.dev> for more information.


# Translation

Remède is translated in multiple languages ! Let's learn how to translate Remède !

Remède has introduced a **translation system** since `1.3.0`. Remède uses [**i18n**](https://vue-i18n.intlify.dev/) for Vue as a translation system.

## Translating

The translations by languages are inside the `app/src/data/translations/[locale].json`.

For example, `en.json` (section "home")

```json
{
    "home": {
        "wordOfDay": "Word of day",
        "randomWord": "Random word",
        "myBookmarks": "My bookmarks",
        "forYou": "For you",
        "seeAll": "See all",
        "askToAddAWord": "Ask to add a word",
        "report": "Report",
        "searchWord": "Search a word...",
        "changelog": "Changelog"
    }
}
```

You can see that there are multiple translation in english.

## Add a language

1. Add his `app/src/data/translations/[locale].json` file
2. Define it in `app/src/i18n.ts`

```typescript
import yourNewLanguageTranslations from "@/data/translations/en.json"

const globalizationList = {
    fr: frenchTranslations,
    en: englishTranslations,
    yourLocale: yourNewLanguageTranslations
}

```

3. Define your language name in `app/src/functions/locales.ts`

```typescript
const locales = {
    en: "English",
    fr: "Français",
    yourLocale: "New language",
    dialects: {
        en: [
            "en-GB",
            "en-US",
            "en-CA",
            "en-AU",
            "en-NZ"
        ]
    }
} 
```

If your language has specific dialects for the correction service, add its dialects... See [Languagetool API documentation](https://languagetool.org/http-api/swagger-ui/#!/default/post_check), the field "language" in the check function.

And you're done !

## And about the database ?

Remède serve a **French database**, but we are working on internationalization of the database.

**How it works ?** We re-use as many code as possible across generation scripts and uses different scrapping services to build our databases.

To serve multiple databases, we define it inside `server.py`

```python

@app.get('/')
def root():
    return {
        "version": version,
        "message": "Check /docs for documentation",
        "dictionaries": DICTIONARIES
    }
    

if __name__ == '__main__':
    DICTIONARIES = {
        "remede": {
            # Definition of French dict
        },
        "remede.en": {  # Woaaaw ! Serving a new dictionary
            "name": "Remède (EN) Beta",
            "slug": "remede.en",
            "total": get_stats('data/remede.en.db'),
            "hash": md5(open('data/remede.en.db', 'rb').read()).hexdigest()[0:7],
            "valid": False,
            "schema": "",
            "size": f"{int(os.path.getsize('data/remede.en.db') * 10e-7)}Mb"
        }
    }
```

See [Internationalization](/database/database/internationalization) docs for more information about a specific language.


# Lifecycles and infrastructure

Understand the Remède's structure.

{% hint style="info" %}
These schemas are a bit old and hard to understand, but they can help you to understand how Remède is working.
{% endhint %}

## Application working schema

This schema shows how the mobile application (with the dictionary downloaded) is retrieving the data.

{% @mermaid/diagram content="graph LR
subgraph "Application Side"
subgraph "Database"
DB\[(Database)] --> Index
DB --> Main
DB --> Rimes
subgraph Index\["Search index (wordlist)"]

```
        end
        subgraph Main["Default table (dictionary)"]

        end
        subgraph Rimes["Rimes table (rimes)"]

        end
    end
    Main <-.-> A[WebView]
    Index <-.-> A[WebView]
    Rimes <-.-> A[WebView]
end
subgraph "Filesystem" 
    DFB[[DatabaseFile]] --> DB
end" %}
```

## Infrastructure schema

This schema shows which extern services are used through their API by the mobile application.

{% @mermaid/diagram content="graph LR
subgraph "`fa:fa-user User side`"
J\[(Database)] <-.-> A((User))
end
subgraph "`fa:fa-server Server side`"
subgraph fa:fa-circle-nodes Proxy
A((User)) --> B(\[Load Balancer])
end
subgraph fa:fa-memory Dedicated VM
B --> C\[API]
B --> D\[Ionic Web]
end
subgraph docker\["`fa:fa-docker Dedicated Docker Server`"]
B --> G\[TTS service]
B --> H\[Corrector service]
end
subgraph fa:fa-folder Filesystem
C --> E\[(Database)]
E --> F\[JSON]
end
end" %}

## Application requests schema

Schemas showing how and when Remède make requests.

### When database is not downloaded

{% @mermaid/diagram content="sequenceDiagram
title Interaction schema with only online Client (database not downloaded)
box Client
participant Frontend
end
box Server
participant API
participant Memory
participant Filesystem
end
API->>Filesystem: Collecting JSON files
Filesystem-->>API:
API-->>Memory:
API->>Filesystem: Generating sheets objects
Filesystem-->>API:
API-->>Memory:
Note over Frontend,API: Fetching a word
Frontend->>+API: Can I get word `remède` ?
API-->>Memory:
Memory-->>API:
API-->>-Frontend: {\[...]}

```
Note over Frontend,API: Fetching a sheet
Frontend->>+API: Can I get sheets ?
API->>Memory: Get sheet
Memory-->>API: 
API->>-Frontend: {[...]}" %}
```

### When database is downloaded

{% @mermaid/diagram content="sequenceDiagram
title Interaction schema with database downloaded on the client filesystem
box Client
participant Files as Filesystem
participant Frontend
participant Database
end
box Server
participant API
participant Memory
participant Filesystem
end
Frontend->>Files: Read database
Files-->>Database:
API->>Filesystem: Collecting JSON files
Filesystem-->>API:
API-->>Memory:
API->>Filesystem: Generating sheets objects
Filesystem-->>API:
API-->>Memory:
Note over Frontend,Database: Fetching a word
Frontend->>Database: Can I get word `remède` ?
Database-->>Frontend:

```
Note over Frontend,API: Fetching a sheet
Frontend->>+API: Can I get sheets ?
API->>Memory: Get sheet
Memory-->>API: 
API->>-Frontend: {[...]}
```

" %}

*Here, we can see that sheets can only be fetched with an internet connection. The same goes for the word of the day*


# Remède Next

Remède Next is more than the future of Remède.

The **Remède Next Program** is a program whose goal is to make Remède more scalable and maintainable. It brings a new document schema, more reliable, and a modular architecture.

### Breaking changes

* New database schema
* New Remède document schema
* No more JSON files


