fixed problem with SOME strange chars when trying to encode them

Esse commit está contido em:
Felipe Nascimento de Moura
2011-02-16 15:36:15 -02:00
commit 157a655cd4
5 arquivos alterados com 57 adições e 13 exclusões
+1 -1
Ver Arquivo
@@ -97,7 +97,7 @@
$type= $tmpType;
// identifying the name
$this->name= substr($str, 0, $typeStart);
$this->name= substr($str, 0, $typeStart-1);
// identifying details
if(preg_match(PROP_DETAILS, $str, $details))
+15 -1
Ver Arquivo
@@ -6,7 +6,7 @@
*/
class MindRelation {
public $name;
public $name;
private $linkTypes = Array('possibility', 'must', 'action');
private $linkType = 'action';
private $quantifiers = Array(0, 1, 'n');
@@ -16,6 +16,20 @@
private $focus = null;
private $rel = null;
/**
* Return properties from the current relation
* These properties were set to private due to set limitations
* but they may be open for get operations
*
* @param String $what
* @return Mixed
*/
public function __get($what)
{
if(isset($this->$what))
return $this->$what;
}
public function setLinkType($linkType)
{
if(in_array($linkType, $this->linkTypes))
+17 -4
Ver Arquivo
@@ -36,6 +36,15 @@ class Lexer
// place each character of the string into and array
$split=1;
$array = array();
/*
* SOMEONE HERE, PLEASE! Explain that for me!
* ONLY the 'ó' char isnt working when treated...even 'Ó' is!
* ALL the other characteres are working just fine!
* Someone who could fix it in a better way, please
*/
$str= str_replace('ó', 'o', $str);
for ( $i=0; $i < strlen( $str ); ){
$value = ord($str[$i]);
if($value > 127){
@@ -87,15 +96,15 @@ class Lexer
*/
public function fixWordChars($word)
{
$word= strtolower($word);
$word= preg_replace('/^\\\/', '', strtolower($word));
$word= $this->str_split_utf8($word);
$str= "";
for($i=0, $j=sizeof($word); $i<$j; $i++)
{
//$str.= strtr(utf8_decode($word[$i]), utf8_decode("ã"), "a");
$str.= $this->translateChars($word[$i]);
}
return $str;
return strtolower($str);
}
/**
@@ -105,7 +114,11 @@ class Lexer
*/
public function translateChars($str)
{
$str= strtolower($str);
//$str= strtolower($str);
if($str == 'ó')
echo "ERA A PORRA DO OOOO";
else
echo $str.'.';
$from = $this->replacements[0];
$to = $this->replacements[1];
return strtr(utf8_decode($str), utf8_decode($from), $to);
+17 -4
Ver Arquivo
@@ -34,15 +34,28 @@ class Analyst {
);
}
public static function printWhatYouGet($detailed=false)
public static function printWhatYouGet($detailed=true)
{
$props= 0;
echo "Entities: ".sizeof(self::$entities)."\n";
foreach(self::$entities as $entity)
{
echo " ".$entity->name."\n";
if($detailed)
echo " ".$entity->name."\n";
foreach($entity->properties as $prop)
{
$props++;
echo " ".$prop->name."\n";
}
}
echo "Properties: "."\n";
echo "Relations: "."\n";
foreach(self::$relations as $rel)
{
echo " ".
$rel->name.': '.$rel->focus->name.' -> '.$rel->rel->name.
"\n";
}
echo "Properties: ".$props."\n";
echo "Relations: ".sizeof(self::$relations)."\n";
}
public static function reset()
+7 -3
Ver Arquivo
@@ -1,7 +1,9 @@
aluno tem pai, mãe, avó e páéíóúãẽõâêôapagaio.
aluno tem professor
professor tem aluno
aluno tem foto:arquivo(xx)
/*
blablabla
@@ -9,8 +11,10 @@ mimimi
xxx
blabelaebamimi
*/
aluno tem pai, mãe e papagaio.
/*
aluno tem pai, mae, avós e papagaio.
aluno tem nome:caractere(128, obrigatório, não nulo, "josé's da conceição")
pai tem \pilha.
mae tem nome:varchar, idade:int e sexo:char().
mãe tem nome:varchar, idade:int e sexo:char().
mãe tem nome:varchar, idade:int e sexo:char().
pai tem nome:varchar, idade:int e sexo:char().
*/