Enchant 2

php.internals

Christoph Becker

8 years ago
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

Christoph Becker

6 years ago
Hi all! On 12.10.2017 at 19:18, Christoph M. Becker wrote:
> 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

Michał Brzuchalski

6 years ago
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

Christoph Becker

6 years ago
On 29.04.2020 at 12:00, Michał Brzuchalski wrote:
> TIL there's a spell check ext in PHP.
Well, actually there are two: ext/enchant and ext/pspell.
-- Christoph M. Becker

Remi Collet

6 years ago
Le 29/04/2020 à 13:23, Christoph M. Becker a écrit :
> On 29.04.2020 at 12:00, Michał Brzuchalski wrote: > >> TIL there's a spell check ext in PHP. > > 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

Remi Collet

6 years ago
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