예제 #1
0
 /**
  * @param phpMorphy_Paradigm_ParadigmInterface $paradigm
  * @param string $base
  * @param string $additionalCommonPrefix
  * @return phpMorphy_Dict_Lemma
  */
 protected function createLemma(phpMorphy_Paradigm_ParadigmInterface $paradigm)
 {
     $flexia_model = $this->createFlexiaModel($paradigm);
     $base = $paradigm->getPseudoRoot();
     $common_prefix = $paradigm[0]->getCommonPrefix();
     $lemma = new phpMorphy_Dict_Lemma($base, $flexia_model->getId(), null);
     if (strlen($common_prefix)) {
         $prefix_set = new phpMorphy_Dict_PrefixSet(null);
         $prefix_set->append($common_prefix);
         $prefix_set_id = $this->source->appendPrefix($prefix_set)->getId();
         $lemma->setPrefixId($prefix_set_id);
     }
     if (count($paradigm->getCommonGrammems())) {
         $common_ancode = $this->createAncode(null, $paradigm->getCommonGrammems());
         $lemma->setAncodeId($common_ancode->getId());
     }
     return $this->source->appendLemma($lemma);
 }
예제 #2
0
 protected function processLine($line)
 {
     //if(6 != count($tokens = array_map('trim', explode(' ', $line)))) {
     $line = $this->iconv($line);
     if (6 != count($tokens = explode(' ', $line))) {
         throw new phpMorphy_Aot_Mrd_Exception("Invalid lemma str('{$line}'), too few tokens");
     }
     $base = trim($tokens[0]);
     if ($base === '#') {
         $base = '';
     }
     $lemma = new phpMorphy_Dict_Lemma($base, (int) $tokens[1], (int) $tokens[2]);
     if ('-' !== $tokens[4]) {
         $lemma->setAncodeId($tokens[4]);
     }
     if ('-' !== $tokens[5]) {
         $lemma->setPrefixId((int) $tokens[5]);
     }
     return $lemma;
 }
예제 #3
0
 public function setPrefixId($prefixId)
 {
     $result = $this->object->setPrefixId($prefixId);
     return $result === $this->object ? $this : $result;
 }