예제 #1
0
<?php

require_once '../../phplib/util.php';
define("MAX_LEN", 40);
// Ignore suffixes after this length
$inflectionsToUse = array('V' => array(54, 52), 'VT' => array(54, 52), 'F' => array(11), 'M' => array(3), 'N' => array(19), 'A' => array(27, 33, 35), 'MF' => array(27, 33, 35));
$dbResult = mysql_query('select * from Definition where SourceId in (10, 12) and status = ' . ST_ACTIVE . ' order by id desc');
while ($row = mysql_fetch_assoc($dbResult)) {
    $def = Definition::createFromDbRow($row);
    // Choose a lexem to inflect. We have four cases
    // - No inflected lexems
    // - Two or more inflected lexems
    // - We don't know what inflections to use for that model type
    // - All good
    $lexems = Lexem::loadByDefinitionId($def->id);
    $lexemsWithInflections = array();
    foreach ($lexems as $l) {
        if ($l->modelType != 'T') {
            $lexemsWithInflections[] = $l;
        }
    }
    $inflections = array();
    $ambiguousLexems = false;
    $noLexems = false;
    $lexem = null;
    if (count($lexemsWithInflections) == 1) {
        $lexem = $lexemsWithInflections[0];
        if (array_key_exists($lexem->modelType, $inflectionsToUse)) {
            $inflections = $inflectionsToUse[$lexem->modelType];
        }
    } else {