From: <sk...@us...> - 2008-10-22 11:40:54
|
Revision: 1401 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1401&view=rev Author: sknappe Date: 2008-10-22 11:40:41 +0000 (Wed, 22 Oct 2008) Log Message: ----------- bugfix Modified Paths: -------------- trunk/src/dbpedia-navigator/helper_functions.php Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 11:39:17 UTC (rev 1400) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-22 11:40:41 UTC (rev 1401) @@ -7,11 +7,19 @@ } $res=utf8_to_html($res); - preg_match_all("/([A-Z])/",$res,$treffer,PREG_OFFSET_CAPTURE); - foreach ($treffer[0] as $treff){ - if ($res[$treff[1]-1]!=' '&&$res[$treff[1]-1]!='-'&&$treff[1]!=0) $res=substr($res,0,$treff[1]).' '.substr($res,$treff[1]); + $final=''; + $offset=0; + preg_match_all("/[^A-Z]([A-Z])/",$res,$treffer,PREG_OFFSET_CAPTURE); + foreach ($treffer[1] as $treff){ + if ($res[$treff[1]-1]!=' '&&$res[$treff[1]-1]!='-'&&$treff[1]!=0){ + $final.=substr($res,$offset,$treff[1]-$offset).' '; + $offset=$treff[1]; + } } + $final.=substr($res,$offset); + $res=$final; + //replacements $res=str_replace('cities','City',$res); $res=str_replace('Cities','City',$res); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |