Skip to content

Custom dictionary and additional CLI arguments. #65

Description

@earthlingdavey

Hi Philippe,

Thanks for this awesome library. It's saved my a fair amount of time :)

I just wanted to share my current workaround for using a custom dictionary with hunspell.

Currently I don't think there is a better way of doing this. Is that right?

// Start a workaround to set the dictionary file.
// This is needed because the Hunspell class does not allow setting the dictionary file directly.

// 1. Get the binary path.
$binary_path = $this->hunspell->getBinaryPath();

// 2. Add the dictionary file as an argument.
$binary_path = $binary_path->addArgs(['-p', $dictionary_file]);

// 3. Reconstruct the Hunspell instance with the new binary path.
// Note that `__construct` is a public method, so we can call it directly.
$this->hunspell->__construct($binary_path);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions