improving recognition

This commit is contained in:
Vladislav Khorev 2014-12-01 07:22:08 +00:00
parent 40388ffbb3
commit 9f1ec812d2
8 changed files with 361 additions and 154 deletions

View File

@ -1,25 +1,25 @@
<?php <?php
//ini_set('error_reporting', E_ALL); ini_set('error_reporting', E_ALL);
//ini_set('display_errors', 'On'); //On or Off ini_set('display_errors', 'On'); //On or Off
// change the following paths if necessary // change the following paths if necessary
if (strncasecmp(PHP_OS, 'WIN', 3) == 0) if (strncasecmp(PHP_OS, 'WIN', 3) == 0)
{ {
$yii=dirname(__FILE__).'/../../../yii1.1.15/framework/yii.php'; $yii=dirname(__FILE__).'/../../../yii1.1.15/framework/yii.php';
} }
else else
{ {
$yii=dirname(__FILE__).'/../../yii1.1.15/framework/yii.php'; $yii=dirname(__FILE__).'/../../yii1.1.15/framework/yii.php';
} }
$config=dirname(__FILE__).'/protected/config/main.php'; $config=dirname(__FILE__).'/protected/config/main.php';
// remove the following lines when in production mode // remove the following lines when in production mode
//defined('YII_DEBUG') or define('YII_DEBUG',true); defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message // specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii); require_once($yii);
Yii::createWebApplication($config)->run(); Yii::createWebApplication($config)->run();

View File

@ -0,0 +1,45 @@
<?php
return array(
'Most likely, original word is <b>{nounNominative}</b>' => '很可能该单词原形就是 <b>{nounNominative}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_MALE' => '该单词本身即为单数第一格形式。 例句: Это один <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_FEMALE' => '该单词本身即为单数第一格形式。 例句: Это одна <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_NEUTER' => '该单词本身即为单数第一格形式。 例句: Это одно <b>{noun}</b>',
'NGC_P2_GENITIVE_NC_SINGULAR' => '该单词是单数第二格形式。 例句: Я возле одного <b>{noun}</b>',
'NGC_P3_DATIVE_NC_SINGULAR' => '该单词是单数第三格形式。 例句: Я дарю подарок одному <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_ANIMATE' => '该单词是单数第四格形式。 例句: Я не трогаю одного <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_MALE' => '该单词是单数第四格形式。例句: Я не трогаю один <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_FEMALE' => '该单词是单数第四格形式。例句: Я не трогаю одну <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_NEUTER' => '该单词是单数第四格形式。例句: Я не трогаю одно <b>{noun}</b>',
'NGC_P5_INSTRUMENTAL_NC_SINGULAR' => '该单词是单数第五格形式。 例句: Я с одним <b>{noun}</b>',
'NGC_P6_PREPOSITIONAL_NC_SINGULAR' => '该单词是单数第六格形式。 例句: Я разговариваю об одном <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_PLURAL' => '该单词是复数第一格形式。 例句: Это разные <b>{noun}</b>',
'NGC_P2_GENITIVE_NC_PLURAL' => '该单词是复数第二格形式。 例句: Я возле разных <b>{noun}</b>',
'NGC_P3_DATIVE_NC_PLURAL' => '该单词是复数第三格形式。 例句: Я дарю подарок разным <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_ANIMATE' => '该单词是复数第四格形式。 例句: Я не трогаю разных <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_INANIMATE' => '该单词是复数第四格形式。 例句: Я не трогаю разные <b>{noun}</b>',
'NGC_P5_INSTRUMENTAL_NC_PLURAL' => '该单词是复数第五格形式。 例句: Я с разными <b>{noun}</b>',
'NGC_P6_PREPOSITIONAL_NC_PLURAL' => '该单词是复数第六格形式。 例句: Я разговариваю о разных <b>{noun}</b>',
'ANIMATE' => '该单词是动物名词。',
'INANIMATE' => '该单词是非动物名词。',
'{n} records found.' => '与 {n} 相关的搜索结果.',
);
?>

View File

@ -2,23 +2,48 @@
return array( return array(
'Most likely, original word is {nounNominative}' => 'Most likely, original word is {nounNominative}', 'Most likely, original word is {nounNominative}' => 'Most likely, original word is {nounNominative}',
'Nominative case' => 'This word is in nominative case. I am <b>{noun}</b>', 'NGC_P1_NOMINATIVE_NC_SINGULAR_MALE' => 'This word is in nominative case, in the singular. For example: This is one <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_FEMALE' => 'This word is in nominative case, in the singular. For example: This is one <b>{noun}</b>',
'Genitive case' => 'This word is in genitive case. I am near <b>{noun}</b>', 'NGC_P1_NOMINATIVE_NC_SINGULAR_NEUTER' => 'This word is in nominative case, in the singular. For example: This is one <b>{noun}</b>',
'Dative case' => 'This word is in dative case. I give gift to <b>{noun}</b>',
'Accusative case' => 'This word is in accusative case. I don\'t disturb <b>{noun}</b>',
'Instrumental case' => 'This word is in instrumental case. I am with <b>{noun}</b>',
'Prepositional case' => 'This word is in prepositional case. I talk about <b>{noun}</b>',
'Singular form' => 'This word is in singular form. One ', 'NGC_P2_GENITIVE_NC_SINGULAR' => 'This word is in genitive case, in the singular. For example: I am near one <b>{noun}</b>',
'Plural form' => 'This word is in plural form. Many ',
'NGC_P3_DATIVE_NC_SINGULAR' => 'This word is in dative case, in the singular. For example: I give gift to one <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_ANIMATE' => 'This word is in accusative case, in the singular. For example: I don\'t disturb one <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE' => 'This word is in accusative case, in the singular. For example: I don\'t disturb one <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_MALE' => 'This word is in accusative case, in the singular. For example: I don\'t disturb one <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_FEMALE' => 'This word is in accusative case, in the singular. For example: I don\'t disturb one <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_NEUTER' => 'This word is in accusative case, in the singular. For example: I don\'t disturb one <b>{noun}</b>',
'NGC_P5_INSTRUMENTAL_NC_SINGULAR' => 'This word is in instrumental case, in the singular. For example: I am with one <b>{noun}</b>',
'NGC_P6_PREPOSITIONAL_NC_SINGULAR' => 'This word is in prepositional case, in the singular. For example: I talk about one <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_PLURAL' => 'This word is in nominative case, in the plural. For example: There are many <b>{noun}</b>',
'NGC_P2_GENITIVE_NC_PLURAL' => 'This word is in genitive case, in the plural. For example: I am near many <b>{noun}</b>',
'NGC_P3_DATIVE_NC_PLURAL' => 'This word is in dative case, in the plural. For example: I give gift to many <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_ANIMATE' => 'This word is in accusative case, in the plural. For example: I don\'t disturb many <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_INANIMATE' => 'This word is in accusative case, in the plural. For example: I don\'t disturb many <b>{noun}</b>',
'NGC_P5_INSTRUMENTAL_NC_PLURAL' => 'This word is in instrumental case, in the plural. For example: I am with many <b>{noun}</b>',
'NGC_P6_PREPOSITIONAL_NC_PLURAL' => 'This word is in prepositional case, in the plural. For example: I talk about many <b>{noun}</b>',
'ANIMATE' => 'Now this word is animate',
'INANIMATE' => 'Now this word is inanimate',
'{n} records found.' => '{n} records found.', '{n} records found.' => '{n} records found.',
); );
?> ?>

View File

@ -2,22 +2,45 @@
return array( return array(
'Most likely, original word is <b>{nounNominative}</b>' => 'Скорее всего, это слово <b>{nounNominative}</b>', 'Most likely, original word is <b>{nounNominative}</b>' => 'Скорее всего, это слово <b>{nounNominative}</b>',
'Nominative case' => 'Это слово в именительном падеже. Я - <b>{noun}</b>', 'NGC_P1_NOMINATIVE_NC_SINGULAR_MALE' => 'Это слово в именительном падеже в единственном числе. Например: Это один <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_FEMALE' => 'Это слово в именительном падеже в единственном числе. Например: Это одна <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_SINGULAR_NEUTER' => 'Это слово в именительном падеже в единственном числе. Например: Это одно <b>{noun}</b>',
'Genitive case' => 'Это слово в родительном падеже. Я возле <b>{noun}</b>', 'NGC_P2_GENITIVE_NC_SINGULAR' => 'Это слово в родительном падеже в единственном числе. Например: Я возле одного <b>{noun}</b>',
'Dative case' => 'Это слово в дательном падеже. Я дарю подарок <b>{noun}</b>', 'NGC_P3_DATIVE_NC_SINGULAR' => 'Это слово в дательном падеже в единственном числе. Например: Я дарю подарок одному <b>{noun}</b>',
'Accusative case' => 'Это слово в винительном падеже. Я не трогаю <b>{noun}</b>', 'NGC_P4_ACCUSATIVE_NC_SINGULAR_ANIMATE' => 'Это слово в винительном падеже в единственном числе. Например: Я не трогаю одного <b>{noun}</b>',
'Instrumental case' => 'Это слово в творительном падеже. Я с <b>{noun}</b>', 'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE' => 'Это слово в винительном падеже в единственном числе. Например: Я не трогаю один <b>{noun}</b>',
'Prepositional case' => 'Это слово в предложном падеже. Я разговариваю о <b>{noun}</b>', 'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_MALE' => 'Это слово в винительном падеже в единственном числе. Например: Я не трогаю один <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_FEMALE' => 'Это слово в винительном падеже в единственном числе. Например: Я не трогаю одну <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_SINGULAR_INANIMATE_NEUTER' => 'Это слово в винительном падеже в единственном числе. Например: Я не трогаю одно <b>{noun}</b>',
'Singular form' => 'Это слово в единственном числе.', 'NGC_P5_INSTRUMENTAL_NC_SINGULAR' => 'Это слово в творительном падеже в единственном числе. Например: Я с одним <b>{noun}</b>',
'Plural form' => 'Это слово в множественном числе.',
'NGC_P6_PREPOSITIONAL_NC_SINGULAR' => 'Это слово в предложном падеже в единственном числе. Например: Я разговариваю об одном <b>{noun}</b>',
'NGC_P1_NOMINATIVE_NC_PLURAL' => 'Это слово в именительном падеже в множественном числе. Например: Это разные <b>{noun}</b>',
'NGC_P2_GENITIVE_NC_PLURAL' => 'Это слово в родительном падеже в множественном числе. Например: Я возле разных <b>{noun}</b>',
'NGC_P3_DATIVE_NC_PLURAL' => 'Это слово в дательном падеже в множественном числе. Например: Я дарю подарок разным <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_ANIMATE' => 'Это слово в винительном падеже в множественном числе. Например: Я не трогаю разных <b>{noun}</b>',
'NGC_P4_ACCUSATIVE_NC_PLURAL_INANIMATE' => 'Это слово в винительном падеже в множественном числе. Например: Я не трогаю разные <b>{noun}</b>',
'NGC_P5_INSTRUMENTAL_NC_PLURAL' => 'Это слово в творительном падеже в множественном числе. Например: Я с разными <b>{noun}</b>',
'NGC_P6_PREPOSITIONAL_NC_PLURAL' => 'Это слово в предложном падеже в множественном числе. Например: Я разговариваю о разных <b>{noun}</b>',
'ANIMATE' => 'В данном случае это слово одушевленное.',
'INANIMATE' => 'В данном случае это слово неодушевленное.',
'{n} records found.' => 'Найдено: {n} записей.', '{n} records found.' => 'Найдено: {n} записей.',
); );

View File

@ -1,69 +1,69 @@
<?php <?php
class DictionaryForm extends CFormModel class DictionaryForm extends CFormModel
{ {
public $request; public $request;
public $serverIsWorking; public $serverIsWorking;
public $jsonString; public $jsonString;
public $response; public $response;
public function rules() public function rules()
{ {
return array( return array(
// username and password are required // username and password are required
array('request', 'required', 'message'=>'{attribute} ' . Yii::t('app', 'Field should not be blank')), array('request', 'required', 'message'=>'{attribute} ' . Yii::t('app', 'Field should not be blank')),
); );
} }
function attributeLabels(){ function attributeLabels(){
return array( return array(
'request' => Yii::t('app', 'Please enter request:'), 'request' => Yii::t('app', 'Please enter request:'),
); );
} }
public function getResponse() public function getResponse()
{ {
$this->serverIsWorking = false; $this->serverIsWorking = false;
$this->response = false; $this->response = false;
try try
{ {
set_error_handler(function() { /* ignore errors */ }); set_error_handler(function() { /* ignore errors */ });
$this->jsonString = file_get_contents('http://localhost:8843/' . $this->request); $this->jsonString = file_get_contents('http://127.0.0.1:8843/' . $this->request);
$this->response = json_decode($this->jsonString, true); $this->response = json_decode($this->jsonString, true);
restore_error_handler(); restore_error_handler();
if ($this->jsonString) if ($this->jsonString)
{ {
$this->serverIsWorking = true; $this->serverIsWorking = true;
} }
} }
catch(Exception $ex) catch(Exception $ex)
{ {
$this->serverIsWorking = false; $this->serverIsWorking = false;
} }
$this->serverIsWorking = true; $this->serverIsWorking = true;
} }
public function resultCount() public function resultExists()
{ {
return count($this->response['nouns']); return ($this->response['nouns'] !== "");
} }
public function getDataProvider() public function getDataProvider()
{ {
$dataProvider=new CArrayDataProvider($this->response['nouns'], array( $dataProvider=new CArrayDataProvider($this->response['nouns'], array(
'id'=>'dictionaryResultDataProvider', 'id'=>'dictionaryResultDataProvider',
'pagination'=>array( 'pagination'=>array(
'pageSize'=>10, 'pageSize'=>10,
), ),
)); ));
return $dataProvider; return $dataProvider;
} }
} }

View File

@ -1043,3 +1043,70 @@ Stack trace:
REQUEST_URI=/cj/index.php?r=site/dictionary REQUEST_URI=/cj/index.php?r=site/dictionary
HTTP_REFERER=http://localhost/cj/index.php?r=site/dictionary HTTP_REFERER=http://localhost/cj/index.php?r=site/dictionary
--- ---
2014/11/29 02:55:14 [error] [php] Undefined index: nominativeSingularForm (C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php:13)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(291): SiteController->renderFile()
#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(167): CListView->renderItems()
#2 unknown(0): CListView->renderSection()
#3 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(150): preg_replace_callback()
#4 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(135): CListView->renderContent()
#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CListView->run()
#6 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php(20): SiteController->widget()
#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require()
#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#9 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#10 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#11 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render()
#12 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary()
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#14 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#15 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#16 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#17 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#18 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#19 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/dictionary
2014/11/29 02:58:27 [error] [php] Undefined index: nominativeSingularForm (C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php:13)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(291): SiteController->renderFile()
#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(167): CListView->renderItems()
#2 unknown(0): CListView->renderSection()
#3 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(150): preg_replace_callback()
#4 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(135): CListView->renderContent()
#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(173): CListView->run()
#6 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php(22): SiteController->widget()
#7 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require()
#8 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#9 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#10 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#11 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render()
#12 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary()
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#14 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#15 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#16 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#17 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#18 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#19 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/dictionary
2014/11/29 03:01:19 [error] [php] array_slice() expects parameter 1 to be array, string given (C:\Workplace\yii1.1.15\framework\web\CArrayDataProvider.php:95)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\zii\widgets\CBaseListView.php(111): CArrayDataProvider->getData()
#1 C:\Workplace\yii1.1.15\framework\zii\widgets\CListView.php(211): CListView->init()
#2 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(147): CListView->init()
#3 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(172): SiteController->createWidget()
#4 C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php(23): SiteController->widget()
#5 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(126): require()
#6 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#7 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#8 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#9 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render()
#10 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary()
#11 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#12 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#13 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#14 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#15 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#16 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#17 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/dictionary

View File

@ -10,15 +10,64 @@ $this->pageTitle=Yii::t('app', Yii::app()->name);
<hr> <hr>
<p> <p>
<?=str_replace('{nounNominative}', $data["nominative"], Yii::t('dict', 'Most likely, original word is <b>{nounNominative}</b>'))?> <?=str_replace('{nounNominative}', $data["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nounNominative}</b>'))?>
</p> </p>
<p> <p>
<?=str_replace('{noun}', $request, Yii::t('dict', $data["grammaticalCase"]))?> <?php
</p>
<p>
<?=str_replace('{noun}', $request, Yii::t('dict', $data["number"]))?> $animateSuffix = "";
if ($data["animated"] === "true")
{
$animateSuffix = "ANIMATE";
}
else
{
$animateSuffix = "INANIMATE";
}
$genderSuffix = "";
if ($data["animated"] !== "true" && $data["count"] === "NC_SINGULAR")
{
if ($data["gender"] === "0")
{
$genderSuffix = "_MALE";
}
else if ($data["gender"] === "1")
{
$genderSuffix = "_FEMALE";
}
else
{
$genderSuffix = "_NEUTER";
}
}
if ($data["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . "_" . $animateSuffix . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else if ($data["grammaticalCase"] === "NGC_P1_NOMINATIVE")
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"];
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
echo Yii::t('dict', $animateSuffix) . "<BR>";
?>
</p> </p>

View File

@ -1,32 +1,30 @@
<?php <?php
$this->pageTitle=Yii::t('app', Yii::app()->name) . ' - ' . Yii::t('app', 'Dictionary'); $this->pageTitle=Yii::t('app', Yii::app()->name) . ' - ' . Yii::t('app', 'Dictionary');
?> ?>
<h1><?=Yii::t('app', 'Dictionary')?></h1> <h1><?=Yii::t('app', 'Dictionary')?></h1>
<p><?=Yii::t('app', 'Result page:')?></p> <p>
<?=str_replace('{n}', $model->getDataProvider()->itemCount, Yii::t('dict', '{n} records found.'))?>
<?php </p>
<?php
echo str_replace('{n}', $model->resultCount(), Yii::t('app', '{n} records found.'));
if ($model->resultExists())
echo '<BR>'; {
$this->widget('zii.widgets.CListView', array(
if ($model->resultCount() !== 0) 'dataProvider'=>$model->getDataProvider(),
{ 'itemView'=>'_dictionaryResultView',
$this->widget('zii.widgets.CListView', array( 'template'=>"{items}\n{pager}",
'dataProvider'=>$model->getDataProvider(), 'viewData'=>array( 'request' => $model->request ),
'itemView'=>'_dictionaryResultView', ));
'template'=>"{items}\n{pager}", }
'viewData'=>array( 'request' => $model->request ),
));
}
?>
?> </div><!-- form -->
</div><!-- form -->