# Enchant 2

- Thread: https://externals.io/message/100882
- Original archive: https://news-web.php.net/php.internals/100882
- Started by Christoph M. Becker on 2017-10-12T17:18:41+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #100882 — Christoph M. Becker — 2017-10-12T17:18:41+00:00

URL: https://externals.io/message/100882#100882

Hi!

I've noticed the other day that Enchant 2.0.0 has been released in
August[1].  ext/enchant does not support Enchant 2 yet, however.  Only a
few fixes are necessary to make it compile[2], but there is an issue
regarding the PHP functions enchant_broker_set_dict_path() and
enchant_broker_get_dict_path(), which rely on enchant_broker_get_param()
which has been completely removed.  Instead there is now a single
function to specify the path where to look for the dictionary files:
enchant_set_prefix_dir()[3].  Apparently, it would be possible to store
the individual paths internally, and to call enchant_set_prefix_dir()
whenever a dictionary is requested or checked for existence, thus
retaining the old functionality.

I have some doubts if this would be sensible, though, because
enchant_broker_(s|g)et_dict_path() only supported the Ispell and
Myspell/Hunspell back-ends anyway.  Instead it may be more reasonable to
introduce a new PHP function enchant_set_prefix_dir() which would
directly map to the C function with the same name.  Depending on whether
ext/enchant had been compiled with Enchant 1 and 2, respectively, the
other function(s) would not be available.  If done this way, the
constants PHP_ENCHANT_MYSPELL and PHP_ENCHANT_ISPELL should neither be
available, if compiled with Enchant 2, because they are only useful for
enchant_broker_(s|g)et_dict_path().

Somewhat related to supporting Enchant 2 would be the question if we can
lift the requirements to Enchant 1.6.0 (released 2010-04-01).  This
version introduced enchant_get_version() (which is still there in
Enchant 2), and would allow us to simplify and clean the libenchant
version info in PHP info[4].

Thoughts?  Would that require an RFC?

[1] <https://github.com/AbiWord/enchant/releases>
[2] <https://gist.github.com/cmb69/aa2e5adfc3a08daf16566165d237fba6>
[3] <https://github.com/AbiWord/enchant/blob/v2.0.0/src/enchant.h#L358>
[4]
<https://github.com/php/php-src/blob/php-7.2.0RC4/ext/enchant/enchant.c#L321-L325>

-- 
Christoph M. Becker

---

## #109910 — Christoph M. Becker — 2020-04-29T09:52:04+00:00

URL: https://externals.io/message/100882#109910 · In reply to: #100882

Hi all!



> I've noticed the other day that Enchant 2.0.0 has been released in
> August[1].  ext/enchant does not support Enchant 2 yet, however.  Only a
> few fixes are necessary to make it compile[2], but there is an issue
> regarding the PHP functions enchant_broker_set_dict_path() and
> enchant_broker_get_dict_path(), which rely on enchant_broker_get_param()
> which has been completely removed.  Instead there is now a single
> function to specify the path where to look for the dictionary files:
> enchant_set_prefix_dir()[3].  Apparently, it would be possible to store
> the individual paths internally, and to call enchant_set_prefix_dir()
> whenever a dictionary is requested or checked for existence, thus
> retaining the old functionality.
>
> I have some doubts if this would be sensible, though, because
> enchant_broker_(s|g)et_dict_path() only supported the Ispell and
> Myspell/Hunspell back-ends anyway.  Instead it may be more reasonable to
> introduce a new PHP function enchant_set_prefix_dir() which would
> directly map to the C function with the same name.  Depending on whether
> ext/enchant had been compiled with Enchant 1 and 2, respectively, the
> other function(s) would not be available.  If done this way, the
> constants PHP_ENCHANT_MYSPELL and PHP_ENCHANT_ISPELL should neither be
> available, if compiled with Enchant 2, because they are only useful for
> enchant_broker_(s|g)et_dict_path().
>
> Somewhat related to supporting Enchant 2 would be the question if we can
> lift the requirements to Enchant 1.6.0 (released 2010-04-01).  This
> version introduced enchant_get_version() (which is still there in
> Enchant 2), and would allow us to simplify and clean the libenchant
> version info in PHP info[4].
>
> Thoughts?  Would that require an RFC?
>
> [1] <https://github.com/AbiWord/enchant/releases>
> [2] <https://gist.github.com/cmb69/aa2e5adfc3a08daf16566165d237fba6>
> [3] <https://github.com/AbiWord/enchant/blob/v2.0.0/src/enchant.h#L358>
> [4]
> <https://github.com/php/php-src/blob/php-7.2.0RC4/ext/enchant/enchant.c#L321-L325>

Apparently, not much has been changed in the meantime, besides that new
Enchant 2 releases are rolled out regularly.  The latest release of
Enchant 1 (1.6.1) happened on 2017-02-08, and I don't expect to see new
Enchant 1 releases.  This basically means that we rely on an
unmaintained library.  So if nobody is interested in bringing
ext/enchant up-to-date with Enchant 2, it might be best to unbundle the
extension.

Thoughts?

--
Christoph M. Becker

---

## #109911 — michal.brzuchalski@gmail.com — 2020-04-29T10:00:32+00:00

URL: https://externals.io/message/100882#109911 · In reply to: #109910

Hi Christoph,

śr., 29 kwi 2020 o 11:52 Christoph M. Becker <cmbecker69@gmx.de> napisał(a):

> Apparently, not much has been changed in the meantime, besides that new
> Enchant 2 releases are rolled out regularly.  The latest release of
> Enchant 1 (1.6.1) happened on 2017-02-08, and I don't expect to see new
> Enchant 1 releases.  This basically means that we rely on an
> unmaintained library.  So if nobody is interested in bringing
> ext/enchant up-to-date with Enchant 2, it might be best to unbundle the
> extension.
>
> Thoughts?
>

TIL there's a spell check ext in PHP.
I've never used it and actually was asking myself why is it in the core.
I would vote for unbundling of it.

Cheers,
Michał Brzuchalski

---

## #109912 — Christoph M. Becker — 2020-04-29T11:23:48+00:00

URL: https://externals.io/message/100882#109912 · In reply to: #109911

> TIL there's a spell check ext in PHP.

Well, actually there are two: ext/enchant and ext/pspell.

--
Christoph M. Becker

---

## #109913 — Remi Collet — 2020-04-29T11:29:34+00:00

URL: https://externals.io/message/100882#109913 · In reply to: #109910

Le 29/04/2020 à 11:52, Christoph M. Becker a écrit :

> Apparently, not much has been changed in the meantime, besides that new
> Enchant 2 releases are rolled out regularly.  The latest release of
> Enchant 1 (1.6.1) happened on 2017-02-08, and I don't expect to see new
> Enchant 1 releases.  This basically means that we rely on an
> unmaintained library.  So if nobody is interested in bringing
> ext/enchant up-to-date with Enchant 2, it might be best to unbundle the
> extension.

See https://github.com/php/php-src/pull/5490



Remi

---

## #109914 — Remi Collet — 2020-04-29T11:35:06+00:00

URL: https://externals.io/message/100882#109914 · In reply to: #109912

Le 29/04/2020 à 13:23, Christoph M. Becker a écrit :
> 
> 
> > […]
> 
> Well, actually there are two: ext/enchant and ext/pspell.

The problem is that some distro may not have usable dictionnary
Ex: in RHEL / CentOS there is no aspell dictionnary,
so the pspell extension is mostly unusable
and have even been removed in 8.0

So enchant is really useful
(it uses available hunspell dictionnaries)



Remi
