Changeset 426


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

Added unicdoe case to word split 2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/SpellCheck.inc.php

    r289 r426  
    199199    {
    200200        $corrections = array();
    201         $words = preg_split('/([\W]+?)/', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
     201        // Split words on punctuation except apostrophes
     202        // http://stackoverflow.com/questions/790596/split-a-text-into-single-words
     203        $words = preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|[\p{Pd}-–—]+|(\+|(\p{P}+$))/", $string);
    202204        // Remove non-word elements.
    203205        $words = preg_grep('/\w+/', $words);
Note: See TracChangeset for help on using the changeset viewer.