Changeset 425


Ignore:
Timestamp:
Oct 31, 2013 7:34:46 PM (11 years ago)
Author:
anonymous
Message:

Added unicdoe case to word split.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SpellCheck.inc.php

    r396 r425  
    266266    {
    267267        $corrections = array();
    268         $words = preg_split('/([\W]+?)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
     268        // Split words on punctuation except apostrophes
     269        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
     270        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}-–—]+|(\+|(\p{P}+$))/", $string);
    269271        // Remove non-word elements.
    270272        $words = preg_grep('/\w+/', $words);
Note: See TracChangeset for help on using the changeset viewer.