Skip to main content

Merge dictionaries

Project description

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.

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

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

Delete a word

Not yet implemented. Here a proposal to implement this.

Curently, the workflow is:

[ extract ] -> { words } -> [ publish ]

You want to add a new transformation step:

[ extract ] -> { words } -> [ transform ] -> { words cleaned up } -> [ publish ]

Add a transform step with an allowlist of the words to remove.

It's not easy to detect if the user has removed a word explicitly from a dictionary, as we don't cache extracted words.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merge-dictionaries-0.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

merge_dictionaries-0.3.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file merge-dictionaries-0.3.0.tar.gz.

File metadata

  • Download URL: merge-dictionaries-0.3.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for merge-dictionaries-0.3.0.tar.gz
Algorithm Hash digest
SHA256 aaea08d495c3c092cdc0fa0d8963c6906957f5cb83ccd711e682fba4902478b3
MD5 14a4885246965d3fdf3a3992218e31f2
BLAKE2b-256 4d4554623ec84266c7009d93a81512d035eb477abbbcebe5c260d9590a04fd40

See more details on using hashes here.

File details

Details for the file merge_dictionaries-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for merge_dictionaries-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3eb8592c0016827adff55d07cebcdc7902ae2e1cc96b96ede6ef01d03bb60b56
MD5 b11681bd9959734a03f3154acee35710
BLAKE2b-256 5e638028b434353090f1981789de6a92a822ecc9aeb255633fb7b1e9fb337da4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page