Adjective added to web

This commit is contained in:
Vladislav Khorev 2014-12-09 12:30:16 +00:00
parent a32b08cbf1
commit 418ceea507
5 changed files with 147 additions and 13 deletions

View File

@ -49,6 +49,13 @@ return array(
'ANIMATE' => 'Now this word is animate',
'INANIMATE' => 'Now this word is inanimate',
'_MALE' => 'In this case, grammatical gender is Male',
'_FEMALE' => 'In this case, grammatical gender is Female',
'_NEUTER' => 'In this case, grammatical gender is Neuter',
'This is noun' => 'This is noun',
'This is adjective' => 'This is adjective',
'{n} records found.' => '{n} records found.',

View File

@ -50,6 +50,12 @@ return array(
'ANIMATE' => 'В данном случае это слово одушевленное.',
'INANIMATE' => 'В данном случае это слово неодушевленное.',
'_MALE' => 'В данном случае это слово имеет мужской род.',
'_FEMALE' => 'В данном случае это слово имеет женский род.',
'_NEUTER' => 'В данном случае это слово имеет средний род.',
'This is noun' => 'Это существительное.',
'This is adjective' => 'Это прилагательное.',
'{n} records found.' => 'Найдено: {n} записей.',

View File

@ -52,12 +52,12 @@ class DictionaryForm extends CFormModel
public function resultExists()
{
return ($this->serverIsWorking) && ($this->response) && ($this->response['nouns'] !== "");
return ($this->serverIsWorking) && ($this->response) && ($this->response['words'] !== "");
}
public function getDataProvider()
{
$dataProvider=new CArrayDataProvider($this->response['nouns'], array(
$dataProvider=new CArrayDataProvider($this->response['words'], array(
'id'=>'dictionaryResultDataProvider',
'pagination'=>array(
'pageSize'=>10,

View File

@ -1396,3 +1396,47 @@ REQUEST_URI=/cj/index.php?r=site/dictionary
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (13)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69)
in C:\Workplace\Apache2.4\htdocs\cj\index.php (25)
2014/12/09 14:36:15 [error] [php] Undefined index: nouns (C:\Workplace\Apache2.4\htdocs\cj\protected\models\DictionaryForm.php:55)
Stack trace:
#0 C:\Workplace\yii1.1.15\framework\web\CBaseController.php(95): SiteController->renderInternal()
#1 C:\Workplace\yii1.1.15\framework\web\CController.php(869): SiteController->renderFile()
#2 C:\Workplace\yii1.1.15\framework\web\CController.php(782): SiteController->renderPartial()
#3 C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php(69): SiteController->render()
#4 C:\Workplace\yii1.1.15\framework\web\actions\CInlineAction.php(49): SiteController->actionDictionary()
#5 C:\Workplace\yii1.1.15\framework\web\CController.php(308): CInlineAction->runWithParams()
#6 C:\Workplace\yii1.1.15\framework\web\CController.php(286): SiteController->runAction()
#7 C:\Workplace\yii1.1.15\framework\web\CController.php(265): SiteController->runActionWithFilters()
#8 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(282): SiteController->run()
#9 C:\Workplace\yii1.1.15\framework\web\CWebApplication.php(141): CWebApplication->runController()
#10 C:\Workplace\yii1.1.15\framework\base\CApplication.php(180): CWebApplication->processRequest()
#11 C:\Workplace\Apache2.4\htdocs\cj\index.php(25): CWebApplication->run()
REQUEST_URI=/cj/index.php?r=site/dictionary
in C:\Workplace\Apache2.4\htdocs\cj\protected\models\DictionaryForm.php (55)
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (11)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69)
2014/12/09 14:36:52 [error] [php] Undefined index: nominativeSingularForm (C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php:15)
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(30): 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
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\_dictionaryResultView.php (15)
in C:\Workplace\Apache2.4\htdocs\cj\protected\views\site\dictionaryResult.php (30)
in C:\Workplace\Apache2.4\htdocs\cj\protected\controllers\SiteController.php (69)

View File

@ -10,15 +10,35 @@ $this->pageTitle=Yii::t('app', Yii::app()->name);
<hr>
<p>
<?=str_replace('{nounNominative}', $data["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nounNominative}</b>'))?>
<?php
$wordType = $data["word"];
$nounData = null;
$adjectiveData = null;
if ($wordType === "noun")
{
$nounData = $data["noun"];
echo str_replace('{nominative}', $nounData["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nominative}</b><BR>'));
echo Yii::t('dict', "This is noun") . "<BR>";
}
if ($wordType === "adjective")
{
$adjectiveData = $data["adjective"];
echo str_replace('{nominative}', $adjectiveData["nominativeSingularForm"], Yii::t('dict', 'Most likely, original word is <b>{nominative}</b><BR>'));
echo Yii::t('dict', "This is adjective") . "<BR>";
}
?>
</p>
<p>
<?php
if ($wordType === "noun")
{
$animateSuffix = "";
if ($data["animated"] === "true")
if ($nounData["animated"] === "true")
{
$animateSuffix = "ANIMATE";
}
@ -28,13 +48,13 @@ else
}
$genderSuffix = "";
if ($data["count"] === "NC_SINGULAR")
if ($nounData["count"] === "NC_SINGULAR")
{
if ($data["gender"] === "0")
if ($nounData["gender"] === "0")
{
$genderSuffix = "_MALE";
}
else if ($data["gender"] === "1")
else if ($nounData["gender"] === "1")
{
$genderSuffix = "_FEMALE";
}
@ -46,29 +66,86 @@ if ($data["count"] === "NC_SINGULAR")
if ($data["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
if ($nounData["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . "_" . $animateSuffix . $genderSuffix;
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . "_" . $animateSuffix . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else if ($data["grammaticalCase"] === "NGC_P1_NOMINATIVE")
else if ($nounData["grammaticalCase"] === "NGC_P1_NOMINATIVE")
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . $genderSuffix;
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else
{
$combinedStr = $data["grammaticalCase"] . "_" . $data["count"] . $genderSuffix;
$combinedStr = $nounData["grammaticalCase"] . "_" . $nounData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
echo Yii::t('dict', $animateSuffix) . "<BR>";
}
if ($wordType === "adjective")
{
$animateSuffix = "";
if ($adjectiveData["animated"] === "true")
{
$animateSuffix = "ANIMATE";
}
else
{
$animateSuffix = "INANIMATE";
}
$genderSuffix = "";
if ($adjectiveData["count"] === "NC_SINGULAR")
{
if ($adjectiveData["gender"] === "0")
{
$genderSuffix = "_MALE";
}
else if ($adjectiveData["gender"] === "1")
{
$genderSuffix = "_FEMALE";
}
else
{
$genderSuffix = "_NEUTER";
}
}
if ($adjectiveData["grammaticalCase"] === "NGC_P4_ACCUSATIVE")
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . "_" . $animateSuffix . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else if ($adjectiveData["grammaticalCase"] === "NGC_P1_NOMINATIVE")
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
else
{
$combinedStr = $adjectiveData["grammaticalCase"] . "_" . $adjectiveData["count"] . $genderSuffix;
echo str_replace('{noun}', $request, Yii::t('dict', $combinedStr)) . "<BR>";
}
echo Yii::t('dict', $animateSuffix) . "<BR>";
echo Yii::t('dict', $genderSuffix) . "<BR>";
}
?>
</p>