Created
February 18, 2017 07:36
-
-
Save Kcko/b74842d1941e1bfcbbb429502eaf26ed to your computer and use it in GitHub Desktop.
Filter do Latte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public static function predlozky($string) { | |
| /* | |
| $string = preg_replace('~ ([akosvzAKOSVZ]) ~', ' $1 ', $string); | |
| $string = preg_replace('~^([AKOSVZ]) ~', ' $1 ', $string); | |
| return $string; | |
| */ | |
| $string = preg_replace('~ ([akosvuzAKOSVZ]) ~', ' $1 ', $string); | |
| $string = preg_replace('~^([AKOSVZ]) ~', ' $1 ', $string); | |
| // predlozky, tituly, jednotky | |
| for($i = 1; $i <= 3; $i++) | |
| $string = preg_replace('~( | )(i|na|ve|pod|nad|od|do|před|ke|ku|ze|bez|ob|pro|při|po|skrz|za|Ing|MUDr|JUDr|Mgr|Bc|BcA|Ing. arch|MVDr|PhDr|RNDr|Pharmr|ThLic|ThDr|prof|doc|PaeDr|Dr|PhMr) ~', '$1$2 ', $string); | |
| $string = preg_replace('~(Na|Ve|Pod|Nad|Od|Do|Před|Ke|Ku|Ze|Bez|Ob|Pro|Při|Po|Skrz|Za) ~', '$1 ', $string); | |
| // en | |
| for($i = 1; $i <= 3; $i++) | |
| $string = preg_replace('~( | )(for|the|its|high-school|was|of|in|on|an|a|are|who|is|we|to|as|and|by|from|has|be|about|I) ~', '$1$2 ', $string); | |
| $string = preg_replace('~(For|The|Its|High-school|Was|Of|In|On|An|Are|Who|Is|We|To|As|And|By|From|Has|Be|About|I) ~', '$1 ', $string); | |
| // ru | |
| $string = preg_replace('~( | )(в|с|и|из|на|со) ~i', '$1$2 ', $string); | |
| // veliciny | |
| $string = preg_replace('~([0-9]{1,}) (m{1,2}|cm|dm|ml|l|dcl|dl|g|kg|%|dkg|kg|s|A|K|cd|mol|rad|sr|Hz|N|Pa|J|W|C|V|F|Ω|S|Wb|T|H|lm|lx|Bq|Gy|Sv|kat)( |\.|\,|$)~', '$1 $2$3', $string); | |
| // procenta | |
| //$string = preg_replace('~([0-9]{1,}) %~', "$1 %", $string); | |
| // kalendarni data | |
| $string = preg_replace('~(\d{1,})\. (\d{1,})\. (\d{1,})~', "$1. $2. $3", $string); | |
| //$string = preg_replace('^(([ ][a-zA-Z\&]{1,2})|([a-zA-Z0-9 ,\.\(][0-9]{1,5}))[ ]^','$1 ', $string); | |
| return $string; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment