changes to Tokenizer and starting works with Syntaxer
Esse commit está contido em:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* This class will work with the tokenized strucure and
|
||||
* the original code, due to identify patterns and apply
|
||||
* any needed rules
|
||||
*
|
||||
* @author felipe
|
||||
*/
|
||||
class Syntaxer {
|
||||
// TODO: create this class
|
||||
}
|
||||
@@ -19,7 +19,9 @@ define('MT_QMUST' , 64);
|
||||
define('MT_QMAY' , 128);
|
||||
define('MT_QNOTNULL', 254);
|
||||
define('MT_QKEY' , 564);
|
||||
define('MT_ANY' , 1024);
|
||||
define('MT_QOF' , 1024);
|
||||
define('MT_QBE' , 2048);
|
||||
define('MT_ANY' , 4096);
|
||||
|
||||
/**
|
||||
* This class will apply the most important tokens to be used.
|
||||
@@ -87,6 +89,8 @@ class Tokenizer {
|
||||
self::$qualifiers['may'] = explode(',', str_replace(', ', ',', (String)$xml->may));
|
||||
self::$qualifiers['notnull'] = explode(',', str_replace(', ', ',', (String)$xml->notnull));
|
||||
self::$qualifiers['key'] = explode(',', str_replace(', ', ',', (String)$xml->key));
|
||||
self::$qualifiers['of'] = explode(',', str_replace(', ', ',', (String)$xml->of));
|
||||
self::$qualifiers['be'] = explode(',', str_replace(', ', ',', (String)$xml->be));
|
||||
return self::$qualifiers;
|
||||
}
|
||||
|
||||
@@ -185,6 +189,7 @@ class Tokenizer {
|
||||
{
|
||||
self::$spine[]= MT_MANY;
|
||||
continue;
|
||||
|
||||
}
|
||||
if(self::isQuantifier('or', $word))
|
||||
{
|
||||
@@ -207,6 +212,16 @@ class Tokenizer {
|
||||
self::$spine[]= MT_QNOTNULL;
|
||||
continue;
|
||||
}
|
||||
if(self::isQualifier('of', $word))
|
||||
{
|
||||
self::$spine[]= MT_QOF;
|
||||
continue;
|
||||
}
|
||||
if(self::isQualifier('be', $word))
|
||||
{
|
||||
self::$spine[]= MT_QBE;
|
||||
continue;
|
||||
}
|
||||
if(self::isQualifier('key', $word))
|
||||
{
|
||||
self::$spine[]= MT_QKEY;
|
||||
|
||||
@@ -54,11 +54,15 @@ class Verbalizer {
|
||||
);
|
||||
|
||||
/**
|
||||
* Words that should NOT be changed
|
||||
* @static
|
||||
* @var AssocArray A list of fixed exceptions
|
||||
*/
|
||||
static $exceptions= Array(
|
||||
'sei' => 'saber',
|
||||
'do' => 'do',
|
||||
'da' => 'da',
|
||||
'de' => 'de',
|
||||
'dei' => 'dar',
|
||||
'dou' => 'dar',
|
||||
'deu' => 'dar',
|
||||
|
||||
@@ -10,5 +10,7 @@
|
||||
<must>dever,precisar,demandar,necessitar</must>
|
||||
<may>poder</may>
|
||||
<notnull>obrigatório,not null,notnull,não nulo,requerido,required,necessário</notnull>
|
||||
<of>de,do,da,dos,das</of>
|
||||
<be>é,são,será,serão</be>
|
||||
<key>chave,key,pk,indice,índice</key>
|
||||
</root>
|
||||
@@ -61,16 +61,14 @@ EOT
|
||||
// search for special/unknown characters
|
||||
if(!Mind::$lexer->sweep($main))
|
||||
return false;
|
||||
// keep substantives and verbs on their canonical form
|
||||
// on male singular
|
||||
if(!Mind::$canonic->sweep())
|
||||
return false;
|
||||
// mark specific tokens
|
||||
if(!Mind::$tokenizer->sweep())
|
||||
return false;
|
||||
// keep substantives and verbs on their canonical form
|
||||
// on male singular, for example
|
||||
//if(!Mind::canonic::sweep($main))
|
||||
return false;
|
||||
// prepares te model to be used to process data
|
||||
// prepares the model to be used to process data
|
||||
// it transforms the original text into the mind code
|
||||
// itself
|
||||
//if(!Mind::sintaxer::sweep($main))
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
todos os professores tem um ou vários alunos.
|
||||
Chave, notnull, precisa, pode.
|
||||
Chave, notnull, precisa, pode.
|
||||
O nome do usuário é caractere.
|
||||
Referência em uma Nova Issue
Bloquear um usuário