Get currently configured synonyms

@param string $baseWord If given a base word, retrieves the synonyms for that word only
@return array
490366
public function getSynonyms($baseWord = '')
    {
        $this->initializeSynonymsUrl();
        $synonymsUrl = $this->_synonymsUrl;
        if (!empty($baseWord)) {
            $synonymsUrl .= '/' . $baseWord;
        }

        $response = $this->_sendRawGet($synonymsUrl);
        return $this->synonymParser->parseJson($baseWord, $response->getRawResponse());
    }
243271
public function getParentString()
    {
        $keywordsArray = array();

        /** @var eZTagsObject[] $path */
        $path = $this->getPath( false, true );
        if ( is_array( $path ) && !empty( $path ) )
        {
            foreach ( $path as $tag )
            {
                $synonymsCount = $tag->getSynonymsCount( true );
                $keywordsArray[] = $synonymsCount > 0 ? $tag->attribute( 'keyword' ) . ' (+' . $synonymsCount . ')' : $tag->attribute( 'keyword' );
            }
        }

        $synonymsCount = $this->getSynonymsCount( true );
        $keywordsArray[] = $synonymsCount > 0 ? $this->attribute( 'keyword' ) . ' (+' . $synonymsCount . ')' : $this->attribute( 'keyword' );

        return implode( ' / ', $keywordsArray );
    }
1015405
public static function stem($word)
    {
        $nounStem = self::roughStem(
            $word, self::$_nounMay, self::$_nounPre, self::$_nounPost, 
            self::$_nounMaxPre, self::$_nounMaxPost, self::$_nounMinStem
        );
        $verbStem = self::roughStem(
            $word, self::$_verbMay, self::$_verbPre, self::$_verbPost, 
            self::$_verbMaxPre, self::$_verbMaxPost, self::$_verbMinStem
        );
        
        if (mb_strlen($nounStem, 'UTF-8') < mb_strlen($verbStem, 'UTF-8')) {
            $stem = $nounStem;
        } else {
            $stem = $verbStem;
        }
        
        return $stem;
    }
884324
public function addSynonymsAction(string $baseWord, string $synonyms, $overrideExisting)
    {
        if (empty($baseWord) || empty($synonyms)) {
            $this->addFlashMessage(
                'Please provide a base word and synonyms.',
                'Missing parameter',
                FlashMessage::ERROR
            );
        } else {
            $baseWord = mb_strtolower($baseWord);
            $synonyms = mb_strtolower($synonyms);

            $coreAdmin = $this->selectedSolrCoreConnection->getAdminService();
            if ($overrideExisting && $coreAdmin->getSynonyms($baseWord)) {
                $coreAdmin->deleteSynonym($baseWord);
            }
            $coreAdmin->addSynonym($baseWord, GeneralUtility::trimExplode(',', $synonyms, true));
            $coreAdmin->reloadCore();

            $this->addFlashMessage(
                '"' . $synonyms . '" added as synonyms for base word "' . $baseWord . '"'
            );
        }

        $this->redirect('index');
    }
591338
public function getDirtyWordsFromString($string)
    {
        $badWords = [];
        $wordsToTest = $this->flattenArray($this->badWords);

        foreach ($wordsToTest as $word) {

            $word = preg_quote($word);

            if (preg_match($this->buildRegex($word), $string, $matchedString)) {

                $badWords[] = $matchedString[0];
            }
        }

        return $badWords;
    }
22488
public function getStopWords(): StopWords {
        if (is_null($this->stopWords)) {
            $this->stopWords = new StopWords($this);
        }

        return $this->stopWords;
    }
1309987
public function getNamesWithDifferentExtension(string $fileName)
    {
        if (! file_exists($this->basePath)) {
            return [];
        }

        $extension = pathinfo($fileName, PATHINFO_EXTENSION);

        $baseName = substr($fileName, 0, strlen($fileName) - strlen($extension) - 1);

        $allNames = scandir($this->basePath);

        $namesWithDifferentExtension = array_filter($allNames, function ($existingName) use ($baseName, $extension) {
            $existingExtension = pathinfo($existingName, PATHINFO_EXTENSION);

            $existingBaseName = substr($existingName, 0, strlen($existingName) - strlen($existingExtension) - 1);

            return $existingBaseName === $baseName && $existingExtension !== $extension;
        });

        return array_values($namesWithDifferentExtension);
    }
488676
public function baseName($baseName = null)
    {
        if ($baseName !== null) {
            $this->baseName = rtrim($baseName, '/') . '/';
        }

        return $this->baseName;
    }
1296207
function get_suggestions($word)
    {
        $this->init();

        if (!$this->plink) {
            return array();
        }

        $suggestions = pspell_suggest($this->plink, $word);

        if (count($suggestions) > self::MAX_SUGGESTIONS)
            $suggestions = array_slice($suggestions, 0, self::MAX_SUGGESTIONS);

        return is_array($suggestions) ? $suggestions : array();
    }
1314020
public function getBasenames(Finder $finder, $suffix = ''): array
    {
        $names = [];

        foreach ($finder as $splFileInfo) {
            /** @var \SplFileInfo $splFileInfo */
            $names[] = $splFileInfo->getBasename($suffix);
        }

        sort($names);

        return $names;
    }
871903
public function addSynonym($baseWord, array $synonyms)
    {
        $this->initializeSynonymsUrl();
        $json = $this->synonymParser->toJson($baseWord, $synonyms);
        $response = $this->_sendRawPost($this->_synonymsUrl, $json, 'application/json');
        return $response;
    }
1179451
public function getKeyword($keyword)
    {
        $k = $this->getAvailableKeywords();

        if ($keyword == 'Link') {
            $link = Director::makeRelative($this->owner->Link());

            return Controller::join_links(Director::absoluteBaseURL(), $link);
        }

        if (isset($k[$keyword])) {
            return $this->owner->$keyword;
        }

        return;
    }
934393
private static function _getPrefix($word)
    {
        $questionMarkPosition = strpos($word, '?');
        $astrericPosition     = strpos($word, '*');

        if ($questionMarkPosition !== false) {
            if ($astrericPosition !== false) {
                return substr($word, 0, min($questionMarkPosition, $astrericPosition));
            }

            return substr($word, 0, $questionMarkPosition);
        } else if ($astrericPosition !== false) {
            return substr($word, 0, $astrericPosition);
        }

        return $word;
    }
1303705
protected function getOptionWordsWithValues()
    {
        $strings = array();

        foreach ($this->getAllOptions() as $option) {
            if ($option->isValueRequired()) {
                $strings[] = '--' . $option->getName();

                if ($option->getShortcut()) {
                    $strings[] = '-' . $option->getShortcut();
                }
            }
        }

        return $strings;
    }
1283981
public function suggest($word) 
    {
        if (!pspell_check($this->pSpell, $word)) {
            return pspell_suggest($this->pSpell, $word);
        }
        else {
            return [$word];
        }
    }
738654
public function suggest(string $word)
    {
        $this->processAbbreviations();
        $word = strtolower($word);
        $suggestions = [];

        if ($this->abbreviations) {
            $len = mb_strlen($word);

            foreach ($this->words as $w) {
                if (substr($w, 0, $len) === $word) {
                    $suggestions[] = $w;
                }
            }
        }

        return $suggestions;
    }
1003095
public function getFilterExpressions(array $filterConfigurations, Query $baseQuery): array
    {
        $filterExpressions = [];
        foreach ($filterConfigurations as $filterConfiguration) {
            $filterObject = $this->constructFilterObject($filterConfiguration);
            if ($filterObject instanceof DoctrineFilterInterface) {
                foreach ($filterObject->getFilterExpressions($baseQuery) as $filterExpression) {
                    $filterExpressions[] = $filterExpression;
                }
            }
        }
        return $filterExpressions;
    }