Merge dictionaries
Root problem
You uses everal IDEs and each maintain its own spelling dictionary.
You want to merge them so words from PyCharm are available in PhpStorm too.
Usage
Merge all dictionaries
To discover dictionaries in your computer, extract words and merge them:
$ merge-dictionaries --merge
This is a potentially destructive operation: your dictionary files will be overwritten.
Extract dictionaries words
To print all the words:
$ merge-dictionaries --extract
This is a safe operation.
Build an Hunspell-compatible dictionary
To create a personal dictionary file for your Hunspell dictionary:
$ merge-dictionaries --extract > $HOME/.hunspell_default
This is a safe read-only operation for your IDE files. This can overwrite your default Hunspell dictionary if it already exists.
Build a dictionary in a IDE specific format
You can specify --format=<format> as argument to the extract task:
$ merge-dictionaries --extract --format=JetBrains
It will output a dictionary file you can use in any IDE compatible with that format.
This is a safe read-only operation.
Sync with a Git repository
Create a $HOME/.config/merge-dictionaries.conf with the following content:
git:
- git@github.com:luser/dictionary.git
See below if you wish to host the Git repository locally.
Delete words from a dictionary
Now your dictionaries are synced, it can be tricky to delete words from them, as the next sync will overwrite them and restore words you removed if still in the Git repository or one local fi le.
If you added a word in a dictionary, you can delete it:
$ merge-dictionaries --delete-words <word> [word ...]
This is a potentially destructive operation: your dictionary files will be overwritten.
IDE support
Currently, the following IDEs are supported
- All JetBrains IDEs: application-level dictionary
- Hunspell: read personal dictionaries
- Git repository
Extend the code
How to add an IDE?
To add an IDE, you need to provide the following methods:
- sources
- a list of paths candidates for the IDE dictionary
- a method extracting words from the dictionary
- output
- a method to dump the extracted words in the IDE format
- write
- a method to save the files, normally you can call the ones created
- a method to rewrite a file with a list of words, so delete works too
How can I contribute?
You can commit your changes to the upstream by following instructions at https://agora.nasqueron.org/How_to_contribute_code
The canonical repository is https://devcentral.nasqueron.org/source/merge-dictionaries.git
FAQ
Host locally the Git repository
If you want to host the repository on your local machine, use a bare repository:
$ git init --bare ~/.cache/dictionary
Initialized empty Git repository in /usr/home/luser/.cache/dictionary/
You can push to a bare repository, but non-bare ones are protected against pushes, to avoid a desync between your index and the working files.
Alternatively, you can prepare a script to do this sequence of operation:
$ merge-dictionaries --merge
$ cd ~/.cache/dictionary
$ git reset
License
BSD-2-Clause, see LICENSE file.
Release files for merge-dictionaries 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| merge_dictionaries-0.4.1.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| merge_dictionaries-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.7 kB
Release files / merge_dictionaries-0.4.1.tar.gz
| Download URL | merge_dictionaries-0.4.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
588afa9630739abfbed4227c281dc1bf39ede82d9c3b6d284ea65ffdd5d24ab4
|
|
BLAKE2b-256 checksum How to use checksums |
d77c7633c2d548269b97ab4e873d22d084c89144b8f1234c4f852b6ef4e5e0cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / merge_dictionaries-0.4.1-py3-none-any.whl
| Download URL | merge_dictionaries-0.4.1-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1f042bedd5eb19ae2f83227b5ce2708c71270864583fbfb74a9c0fe5b77b31e
|
|
BLAKE2b-256 checksum How to use checksums |
eacd8ae3c5b395b2a316eb2fa8a96b5b82c04601edaa63440ebfdbda0cbfb5ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|