Пример #1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $wf = new phpMorphy_WordForm_WordForm();
     $wf->setBase('test');
     $wf->setFormPrefix('');
     $wf->setSuffix('ing');
     $wf->setPartOfSpeech('pos');
     $wf->setFormGrammems(array('gr'));
     $this->object = new phpMorphy_Paradigm_ArrayBased();
     $this->object->append($wf);
 }
$para_no = 1;
/** @var phpMorphy_Dict_Lemma $lemma */
foreach ($source->getLemmas() as $lemma) {
    $common_grammems = array();
    if ($lemma->hasAncodeId()) {
        /** @var phpMorphy_Dict_Ancode $common_ancode */
        $common_ancode = $ancodes[$lemma->getAncodeId()];
        $common_grammems = $common_ancode->getGrammems();
    }
    $flexia_model = $flexias[$lemma->getFlexiaId()];
    $paradigm = new phpMorphy_Paradigm_ArrayBased(false);
    /** @var phpMorphy_Dict_Flexia $flexia */
    foreach ($flexia_model as $flexia) {
        /** @var phpMorphy_Dict_Ancode $ancode */
        $ancode = $ancodes[$flexia->getAncodeId()];
        $wf = new phpMorphy_WordForm_WordForm();
        $wf->setBase($lemma->getBase());
        $wf->setFormPrefix($flexia->getPrefix());
        $wf->setSuffix($flexia->getSuffix());
        $wf->setCommonGrammems($common_grammems);
        $wf->setPartOfSpeech($ancode->getPartOfSpeech());
        $wf->setFormGrammems($ancode->getGrammems());
        $paradigm->append($wf);
    }
    printf("  Paradigm %2d.\n%s", $para_no++, $formatter->format($paradigm, '  '));
}
echo '}' . PHP_EOL;
function remap_to_ids($ary)
{
    $result = array();
    foreach ($ary as $value) {
Пример #3
0
 function testPrefix()
 {
     $this->assertEquals($this->object->getCommonPrefix() . $this->object->getFormPrefix(), $this->object->getPrefix());
 }