コード例 #1
0
ファイル: WordForm.php プロジェクト: maxakawizard/phpmorphy
 /**
  * @param phpMorphy_WordForm_WordFormInterface $wordForm
  * @return phpMorphy_WordForm_WordForm
  */
 function assignFromWordForm(phpMorphy_WordForm_WordFormInterface $wordForm)
 {
     $this->common_prefix = $wordForm->getCommonPrefix();
     $this->form_prefix = $wordForm->getFormPrefix();
     $this->base = $wordForm->getBase();
     $this->suffix = $wordForm->getSuffix();
     $this->part_of_speech = $wordForm->getPartOfSpeech();
     $this->grammems = array_merge($wordForm->getCommonGrammems(), $wordForm->getFormGrammems());
     $this->common_grammems_count = count($wordForm->getCommonGrammems());
     return $this;
 }
コード例 #2
0
 function printWordForm(phpMorphy_WordForm_WordFormInterface $form)
 {
     echo $form->getWord(), ' [', $form->getCommonPrefix(), self::COMMON_PREFIX_SEPARATOR, $form->getPrefix(), self::PREFIX_SEPARATOR, $form->getBase(), self::SUFFIX_SEPARATOR, $form->getSuffix(), '] (', $form->getPartOfSpeech(), ' ', implode(',', $form->getCommonGrammems()), self::COMMON_GRAMMEMS_SEPARATOR, implode(',', $form->getFormGrammems()), ')';
 }
コード例 #3
0
ファイル: Add.php プロジェクト: Garcy111/Garcy-Framework-2
 /**
  * @param string $word
  * @param phpMorphy_WordForm_WordFormInterface $patternWord
  * @return string
  */
 protected function getCommonPrefixByTemplateWord($word, phpMorphy_WordForm_WordFormInterface $patternWord)
 {
     $prefix = '';
     $possible_prefix_len = strlen($word) - strlen($patternWord->getWord());
     if (substr($word, $possible_prefix_len) === $patternWord->getWord()) {
         $prefix = substr($word, 0, $possible_prefix_len);
     }
     return $prefix;
 }