|
3 | 3 | namespace SEOService2020\Morphy; |
4 | 4 |
|
5 | 5 | use InvalidArgumentException; |
| 6 | + |
6 | 7 | use phpMorphy; |
| 8 | +use phpMorphy_GrammemsProvider_GrammemsProviderInterface; |
7 | 9 |
|
8 | 10 |
|
9 | 11 | class Morphy extends phpMorphy |
10 | 12 | { |
| 13 | + use PreprocessWord; |
| 14 | + |
11 | 15 | public const russianLang = 'ru_RU'; |
12 | 16 | public const englishLang = 'en_EN'; |
13 | 17 | public const ukrainianLang = 'uk_UA'; |
@@ -55,4 +59,100 @@ public function __construct( |
55 | 59 |
|
56 | 60 | parent::__construct($this->dictsPath, $this->language, $this->options); |
57 | 61 | } |
| 62 | + |
| 63 | + public function findWord($word, $type = self::NORMAL) { |
| 64 | + return parent::findWord(self::preprocessedWord($word, $this), $type); |
| 65 | + } |
| 66 | + |
| 67 | + public function getBaseForm($word, $type = self::NORMAL) { |
| 68 | + return parent::getBaseForm(self::preprocessedWord($word, $this), $type); |
| 69 | + } |
| 70 | + |
| 71 | + public function getAllForms($word, $type = self::NORMAL) { |
| 72 | + return parent::getAllForms(self::preprocessedWord($word, $this), $type); |
| 73 | + } |
| 74 | + |
| 75 | + public function getPseudoRoot($word, $type = self::NORMAL) { |
| 76 | + return parent::getPseudoRoot(self::preprocessedWord($word, $this), $type); |
| 77 | + } |
| 78 | + |
| 79 | + public function getPartOfSpeech($word, $type = self::NORMAL) { |
| 80 | + return parent::getPartOfSpeech(self::preprocessedWord($word, $this), $type); |
| 81 | + } |
| 82 | + |
| 83 | + public function getAllFormsWithAncodes($word, $type = self::NORMAL) { |
| 84 | + return parent::getAllFormsWithAncodes(self::preprocessedWord($word, $this), $type); |
| 85 | + } |
| 86 | + |
| 87 | + public function getAllFormsWithGramInfo($word, $asText = true, $type = self::NORMAL) { |
| 88 | + return parent::getAllFormsWithGramInfo( |
| 89 | + self::preprocessedWord($word, $this), $asText, $type |
| 90 | + ); |
| 91 | + } |
| 92 | + |
| 93 | + public function getAncode($word, $type = self::NORMAL) { |
| 94 | + return parent::getAncode(self::preprocessedWord($word, $this), $type); |
| 95 | + } |
| 96 | + |
| 97 | + public function getGramInfo($word, $type = self::NORMAL) { |
| 98 | + return parent::getGramInfo(self::preprocessedWord($word, $this), $type); |
| 99 | + } |
| 100 | + |
| 101 | + public function getGramInfoMergeForms($word, $type = self::NORMAL) { |
| 102 | + return parent::getGramInfoMergeForms(self::preprocessedWord($word, $this), $type); |
| 103 | + } |
| 104 | + |
| 105 | + public function castFormByAncode( |
| 106 | + $word, |
| 107 | + $ancode, |
| 108 | + $commonAncode = null, |
| 109 | + $returnOnlyWord = false, |
| 110 | + $callback = null, |
| 111 | + $type = self::NORMAL |
| 112 | + ) { |
| 113 | + return parent::castFormByAncode( |
| 114 | + self::preprocessedWord($word, $this), |
| 115 | + self::preprocessedWord($ancode, $this), |
| 116 | + self::preprocessedWord($commonAncode, $this), |
| 117 | + $returnOnlyWord, |
| 118 | + $callback, |
| 119 | + $type |
| 120 | + ); |
| 121 | + } |
| 122 | + |
| 123 | + public function castFormByGramInfo( |
| 124 | + $word, |
| 125 | + $partOfSpeech, |
| 126 | + $grammems, |
| 127 | + $returnOnlyWord = false, |
| 128 | + $callback = null, |
| 129 | + $type = self::NORMAL |
| 130 | + ) { |
| 131 | + return parent::castFormByGramInfo( |
| 132 | + self::preprocessedWord($word, $this), |
| 133 | + self::preprocessedWord($partOfSpeech, $this), |
| 134 | + $grammems, |
| 135 | + $returnOnlyWord, |
| 136 | + $callback, |
| 137 | + $type |
| 138 | + ); |
| 139 | + } |
| 140 | + |
| 141 | + public function castFormByPattern( |
| 142 | + $word, |
| 143 | + $patternWord, |
| 144 | + phpMorphy_GrammemsProvider_GrammemsProviderInterface $grammemsProvider = null, |
| 145 | + $returnOnlyWord = false, |
| 146 | + $callback = null, |
| 147 | + $type = self::NORMAL |
| 148 | + ) { |
| 149 | + return parent::castFormByPattern( |
| 150 | + self::preprocessedWord($word, $this), |
| 151 | + self::preprocessedWord($patternWord, $this), |
| 152 | + $grammemsProvider, |
| 153 | + $returnOnlyWord, |
| 154 | + $callback, |
| 155 | + $type |
| 156 | + ); |
| 157 | + } |
58 | 158 | } |
0 commit comments