Skip to content

Commit

Permalink
Merge pull request #151 from camarm-dev/dev
Browse files Browse the repository at this point in the history
1.2.0.beta revision 2, with patches for #108, #148, #149, #150, #152, #153, #154, #155, #157, #158, #159, #160, #161, #163
  • Loading branch information
camarm-dev authored Jun 8, 2024
2 parents 6077bdc + 272d89d commit cd1a158
Show file tree
Hide file tree
Showing 153 changed files with 7,274 additions and 1,510 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
/builds/latest/remede.exe
/builds/latest/remede.nupkg
/builds/latest/remede.dmg
/docs/.jekyll-cache/
/docs/_site/
/data/remede.db
/data/remede-less.db
140 changes: 1 addition & 139 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,142 +1,4 @@
# Contributing
Welcome at Rèmede ! We are happy to welcome new contributors like you !

## Table of content
- [How to contribute](#how-to-contribute)
- [Big steps](#big-steps)
- [Guide](#guide)
- [Project structure](#understanding-project-structure)
- [Lifecycle Schemas](#lifecycle-schemas)
- [Add a custom word](#add-a-custom-word)
- [Documentation](#documentation)

## How to contribute
**To contribute, you can:**
- Open an issue ([here](https://github.com/camarm-dev/remede/issues))
- Choose an issue, fork the repository, resolve it and open a pull request ! ([complete guide](#guide))
- Contact us to become part of our team ([email protected])
- So you'll have access to this repository

### Big steps
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://remede.camarm.fr/EN), and contact us for more informations (at [email protected]).
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 !

## Guide

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 !

### Understanding project structure

First, the folders;
- `server.py`: Main API, made with Fastapi
- `data`: Ressources to make Remède database and Remède databases
- `app`: Ionic project
- `src`: Vuejs project
- `electron`: Electron project, generated by [`@capacitor-community/electron`](https://github.com/capacitor-community/electron)
- `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.
- `corrector`: Docker to run languagetool API
- `tts`: Docker compose to run nanotts with opentts
- `builds`: All builds for all platforms by version

### Lifecycle Schemas

_These schemas are outdated and not really readable. Visit [`INFRASTRUCTURE.md`](INFRASTRUCTURE.md) for more._

In this section you will understand Remède Lifecycle with different schemas.

**Client -> Server without dictionary downloaded**

```mermaid
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: {[...]}
```

**Client -> Server with dictionary downloaded**

```mermaid
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: {[...]}
```

### Add a custom word

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

1. Add it to `data/IPA.txt`
1. In alphabetic order, add your word with the following schema `word\t/phonetic/` (`\t` represents a <kbd>TAB</kbd> char, not spaces)
2. Add it to `data/custom_words.json`, if necessary
1. Check on the [french Wictionary](https://fr.wiktionary.org) if your word exist.
2. If it does not exist, fill his document manually in the `data/custom_words.json`. Don't forget to quote your sources in the `credits` field.
3. Before making a PR, rebuild ressources (so your word will be added newt time database is built)
1. Run `python3 scripts/pre_generate_ressources.py`, if it outputs an error, check the previous steps...

### Parsing

A complete Guide about parsing and database generation is written in french at [`PARSING.md`](https://github.com/camarm-dev/remede/blob/main/PARSING.md)

## Documentation
You can find the documentation [here](/docs/EN.md) or on [our website](https://remede.camarm.fr/EN).

Please learn more about contributing to Remède on our [online documentation](https://docs.remede.camarm.fr/docs/contributing)
5 changes: 5 additions & 0 deletions INFRASTRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ graph LR
subgraph "Database"
DB[(Database)] --> Index
DB --> Main
DB --> Rimes
subgraph Index["Search index\n(wordlist)"]
end
subgraph Main["Default table\n(dictionary)"]
end
subgraph Rimes["Rimes table\n(rimes)"]
end
end
Main <-.-> A[WebView]
Index <-.-> A[WebView]
Rimes <-.-> A[WebView]
end
subgraph "Filesystem"
DFB[[DatabaseFile]] --> DB
Expand Down
28 changes: 27 additions & 1 deletion PARSING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Générer les données Remède consiste à générer **les fichiers JSON**, pour
1. `parse.py` génère un fichier JSON par lettre (plusieurs heures)
2. `generate_sqlite.py` génère la base Sqlite, depuis les fichiers JSON (plusieurs dizaines de minutes)
3. `generate_index.py` génère un index de recherche
4. `build_rimes` ajoute les rimes au dictionnaire
4. `build_rimes.py` ajoute les rimes au dictionnaire

> [!IMPORTANT]
> Tous les programmes contenus dans le dossier `scripts` doivent être executés **à la racine du project** (eg. `python3 scripts/parse.py`)
Expand Down Expand Up @@ -66,3 +66,29 @@ Dans `api-definition`
```shell
docker build -t remede-definition-api . && docker run -p 8089:80 remede-definition-api
```

## Ajouter un mot rapidement

Le script `scripts/add_word.py` permet d'ajouter un mot rapidement à la base sans la reconstruire...

Il :
- Ajoute votre mot dans `data/mots.txt`
- Ajoute votre mot dans le JSON
- Ajoute votre mot dans `data/remede.db`
- Re-génère l'index de `data/remede.db`

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

Pour ajouter plusieurs mots:

`wordlist.txt` (tabulation entre mot et ipa: `mot\t/ipa/`)
```
acupuncture /a.ky.pɔ̃k.tyʁ/
remède /ʁəmɛd/
```
et exécuter
```shell
python3 scripts/add_word.py -f wordlist.txt
```
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Open Source and free alternative to Antidote dictionary.

[<kbd>Open application</kbd>](https://remede-app.camarm.fr)

[Data credits](https://remede.camarm.fr/FR#données-remède)[License](https://github.com/camarm-dev/remede/blob/main/LICENSE)[Website](https://remede.camarm.fr)**[Download](https://remede.camarm.fr/download)****[API](https://api-remede.camarm.fr/docs)**
[Data credits](https://docs.remede.camarm.fr/docs/database/credits)[License](https://github.com/camarm-dev/remede/blob/main/LICENSE)[Website](https://remede.camarm.fr)**[Download](https://remede.camarm.fr/download)****[API](https://api-remede.camarm.fr/docs)**

</div>

Expand All @@ -32,7 +32,10 @@ Remède is a dictionary, which can replace any proprietary dictionary, with thes
## Current: 1.2.0-beta — Brown Sheep

La version `1.2.0`, nom de code `Brown Sheep` inclue les nouvelles fonctionnalités suivantes :
- [ ] Dictionnaire de **rimes**
- [x] Dictionnaire de **rimes**
- [x] Nouvelle navigation **encore plus agréable**.
- [x] Actions natives quand **un mot est sélectionné** n'importe où dans votre téléphone !
- [x] Widget pour un accès **plus rapide**.
- [ ] Téléchargeable sur le **Play Store** !

## Télécharger
Expand All @@ -51,7 +54,7 @@ SOON: Disponible sur Play Store

## Documentation

La documentation est disponible sur [remede.camarm.fr](https://remede.camarm.fr)
La documentation est disponible sur [docs.remede.camarm.fr](https://docs.remede.camarm.fr)
- Guide de contribution: [`CONTRIBUTING.md`](https://github.com/camarm-dev/remede/blob/main/CONTRIBUTING.md)

## Screenshots
Expand Down
8 changes: 6 additions & 2 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
apply plugin: 'com.android.application'

android {

buildFeatures {
viewBinding true
}
namespace "com.camarm.remede"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.camarm.remede"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1201
versionName '1.2.0-beta.1 — Brown Sheep, beta rev 1'
versionCode 1202
versionName '1.2.0-beta.2 — Brown Sheep, beta rev 2'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions app/android/app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1201,
"versionName": "1.2.0-beta.1 — Brown Sheep, beta rev 1",
"versionCode": 1202,
"versionName": "1.2.0-beta.2 — Brown Sheep, beta rev 2",
"outputFile": "app-release.apk"
}
],
Expand Down
66 changes: 52 additions & 14 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,76 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<receiver
android:name=".RemedeSearchbarWidget"
android:exported="false">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.camarm.remede.action.OPEN_SEARCHBAR" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/remede_searchbar_info" />
</receiver>

<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:exported="true"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBarLaunch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="@string/custom_url_scheme" />
</intent-filter>
</activity>
<activity
android:name=".ActiveRemedeActivity"
android:exported="true"
android:label="@string/active_remede_label">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="text/plain" />
</intent-filter>
</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

<!-- Permissions -->

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.camarm.remede;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

public class ActiveRemedeActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CharSequence text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);

Uri page;
if (text.toString().contains(" ") && text.charAt(0) != 'à') {
page = Uri.parse(getResources().getString(R.string.custom_url_scheme) + "://correction?data=" + text);
} else {
page = Uri.parse(getResources().getString(R.string.custom_url_scheme) + "://dictionnaire/" + text.toString().toLowerCase());
}

Intent definitionIntent = new Intent(this, MainActivity.class)
.setData(page)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(definitionIntent);
}

}

Loading

0 comments on commit cd1a158

Please sign in to comment.