mekras/php-speller

Doesn't provide correct suggestion for the words with single quote (')

Closed this issue · 9 comments

For example yo'ure havn't

Can you provide expected and actual results?

yo'ure should show you're

This is expected. And what is the actual result?

For "you're" it gives:
"ure":["rue","ire","re","sure","urea","lure","cure","dure","urge","pure","ere","use","uri","are","urn"]

Though hunspell standalone works correctly.

My env: Ubuntu 14.04, Hunspell 1.4

Can you provide output of the following script:

<?php
use Mekras\Speller\Hunspell\Hunspell;
use Mekras\Speller\Source\StringSource;

require __DIR__ . '/vendor/autoload.php';

$speller = new Hunspell();
$source = new StringSource("yo'ure");
$issues = $speller->checkText($source, ['en_US', 'en']);

print_r($issues[0]->suggestions);

My output, for example, is:

~/w/M/php-speller> php test.php 
Array
(
    [0] => you’re
    [1] => yore
    [2] => your
    [3] => Urey
    [4] => arroyo
    [5] => Europe
)

Sorry for mixing it up. My local pc runs hunspell 1.4 where the library is working. But the server runs Hunspell 1.2.6.

Which produces:

Array
(
[0] => rue
[1] => ire
[2] => re
[3] => sure
[4] => urea
[5] => lure
[6] => cure
[7] => urge
[8] => pure
[9] => ere
[10] => use
[11] => are
[12] => urn
[13] => ore
[14] => Ore
)

Is it a issue with Hunspell itself ?

Can you show output of the following command on your server?

echo "yo'ure" | hunspell -i UTF-8 -a -d en_US

For example, my output is:

@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)
& yo'ure 6 0: you’re, yore, your, Urey, arroyo, Europe

Ok, Interesting. I have upgraded my server's hunspell. It is showing this:

@(#) International Ispell Version 3.2.06 (but really Hunspell 1.4.0)
*
& ure 15 3: rue, ire, re, sure, urea, lure, cure, urge, pure, ere, use, are, urn, ore, Ore

My server is Amazon EC2 with AMI.

My local pc shows this output:

@(#) International Ispell Version 3.2.06 (but really Hunspell 1.4.0)
& yo'ure 5 0: you're, yore, your, arroyo, eureka

My PC is ubuntu 14.04

My be you have different dictionaries on server and desktop. Anyway, this is not a php-speller problem, so I'm closing this issue.