1
0
Fork 0

Build scripts cleanup and dictionary loading optimization

* moved the source languages out of assets/ into their own directory (#356)
  
  * split build.gradle into several smaller files

  * improved word frequency validation during build time

  * slightly optimized dictionary loading speed using pre-calculated file size

  * fixed a potential crash when loading invalid assets

  * fixed dictionary loading progress starting at 100% then jumping to 0% when manually loading two dictionaries one after another

  * documentation update
This commit is contained in:
Dimo Karaivanov 2023-08-21 15:29:30 +03:00 committed by GitHub
parent d8c2f7fc15
commit 44ecb8999e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 367 additions and 320 deletions

View file

@ -48,11 +48,11 @@ Make sure you have a signing key. If you don't have one, follow the [official ma
## Adding a New Language
To support a new language one needs to:
- Find a suitable dictionary and add it to the `assets/languages/dictionaries/` folder. Two file formats are supported, [see below](#dictionary-formats).
- Find a suitable dictionary and add it to the `languages/dictionaries/` folder. Two file formats are supported, [see below](#dictionary-formats).
- Do not forget to include the dictionary license (or readme) file in the `docs/` folder.
- Create a new `.yml` file in `assets/languages/definitions/` and define the language properties.
- Create a new `.yml` file in `languages/definitions/` and define the language properties.
- `locale` contains the language and the country codes (e.g. "en-US", "es-AR", "it-IT"). Refer to the list of [supported locales in Java](https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#util-text).
- `dictionaryFile` is the name of the dictionary in `assets/languages/dictionaries/` folder.
- `dictionaryFile` is the name of the dictionary in `languages/dictionaries/` folder.
- `layout` contains the letters and punctuation marks associated with each key.
- For 0-key `[SPECIAL]`, will be fine in most languages, but you could define your own set of special characters, for example: `[@, #, $]`.
- For 1-key, you could use `[PUNCTUATION]` and have standard English/computer punctuation; or `[PUNCTUATION_FR]` that includes the French quotation marks: `«`, `»`; or `[PUNCTUATION_DE]` that includes the German quotation marks: `„`, `“`. And if the language has extra punctuation marks, like Spanish, you could complement the list like this: `[PUNCTUATION, ¡, ¿]`. Or you could define your own list, like for 0-key.
@ -70,6 +70,7 @@ Constraints:
- No single lowercase letters. They will be added automatically.
- No repeating words.
- No digits or garbage characters as part of the words.
- The words must consist only of the letters definied in the respective YML definition file.
_The constraints will be verified automatically upon building._
@ -88,7 +89,7 @@ Constraints:
- No header.
- The separator is `TAB`.
- The frequency is optional. If missing, it is assumed to be 0.
- The frequency must be a non-negative integer, when present.
- The frequency must be an integer between 0 and 255, when present.
_The TXT format constraints listed above also apply._