Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Wasserwirtschaft" (German) is not hyphenated #40

Closed
Defcon0 opened this issue Apr 19, 2018 · 4 comments
Closed

"Wasserwirtschaft" (German) is not hyphenated #40

Defcon0 opened this issue Apr 19, 2018 · 4 comments

Comments

@Defcon0
Copy link

Defcon0 commented Apr 19, 2018

Hi,

at first thanks for your great module which we use widely. Unfortunately we have an issue with the word "Wasserwirtschaft" which is not hyphenated.

We investigated and it seems that the dictionary doesn't contain it. Could you please check if its an issue or have any other suggestion?

Bye Defcon0

@heiglandreas
Copy link
Owner

Thanks for reporting that! I'll dig into it.

In the meantime would you be able to share your configuration?

@heiglandreas
Copy link
Owner

I wrote a quick test to see whether "Wasserwirtschaft" will get hyphenated or not. This Build shows that it indeed will get hyphenated.

So I assume that the issue is within the configuration or the setup. If you could share a bit of that it'd be easier for me to find the cause of the word ending up not hyphenated.

@Defcon0
Copy link
Author

Defcon0 commented Apr 23, 2018

OK, here's the way we use the module:

$o = new \Org\Heigl\Hyphenator\Options();

        $o->setHyphen(\Config::get('hyphenator_hyphen'))
            ->setDefaultLocale(static::getLocaleFromLanguage($objPage->language))
            ->setRightMin(\Config::get('hyphenator_rightMin'))
            ->setLeftMin(\Config::get('hyphenator_leftMin'))
            ->setWordMin(\Config::get('hyphenator_wordMin'))
            ->setFilters(\Config::get('hyphenator_filter'))
            ->setQuality(\Config::get('hyphenator_quality'))
            ->setTokenizers(\Config::get('hyphenator_tokenizers'));

        $h = new \Org\Heigl\Hyphenator\Hyphenator();
        $h->setOptions($o);

        var_dump($o);
        var_dump($h->hyphenate('Wasserwirtschaft'));

And here's the output of that:

object(Org\Heigl\Hyphenator\Options)#2121 (10) {
  ["noHyphenateString":"Org\Heigl\Hyphenator\Options":private]=>
  NULL
  ["hyphen":"Org\Heigl\Hyphenator\Options":private]=>
  string(5) "­"
  ["leftMin":"Org\Heigl\Hyphenator\Options":private]=>
  int(5)
  ["rightMin":"Org\Heigl\Hyphenator\Options":private]=>
  int(5)
  ["wordMin":"Org\Heigl\Hyphenator\Options":private]=>
  int(10)
  ["quality":"Org\Heigl\Hyphenator\Options":private]=>
  int(9)
  ["customHyphen":"Org\Heigl\Hyphenator\Options":private]=>
  string(2) "--"
  ["filters":"Org\Heigl\Hyphenator\Options":private]=>
  array(1) {
    [0]=>
    string(6) "Simple"
  }
  ["tokenizers":"Org\Heigl\Hyphenator\Options":private]=>
  array(2) {
    [0]=>
    string(10) "Whitespace"
    [1]=>
    string(11) "Punctuation"
  }
  ["defaultLocale":"Org\Heigl\Hyphenator\Options":private]=>
  string(5) "de_DE"
}
array(1) {
  [0]=>
  string(16) "Wasserwirtschaft"
}

@jdreesen
Copy link
Contributor

You're having the same problem as #31 here.

In your example you're trying to hyphenate a single word, only using the SimpleFilter.

This won't work because of a special assumption that is made in the hyphenate() method: https://github.com/heiglandreas/Org_Heigl_Hyphenator/blob/master/src/Hyphenator.php#L365-L368

So you either have to force multiple tokens (e.g. by appending a space to your word) or to add another filter (e.g. the CustomMarkupFilter which is basically a no-op, used in the default configuration to prevent this case).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants