Returns misspelled words

@param string $text The content for spellchecking. If empty content
used for check() method will be used.

@return array List of misspelled words
163354
function get_words($text = null, $is_html=false)
    {
        if ($is_html) {
            $text = $this->html2text($text);
        }

        if ($this->backend) {
            return $this->backend->get_words($text);
        }

        return array();
    }
756775
public function filterCamelCaseToUnderscore($text)
    {
        $text = StaticFilter::execute($text, 'Word\CamelCaseToUnderscore');
        $text = StaticFilter::execute($text, 'StringToLower');

        return $text;
    }
879997
static private function leetify( $text )
    {
        $searchMap = array( '/to/i', '/for/i', '/ate/i', '/your/i', '/you/i', '/l/i', '/e/i', '/o/i', '/a/i', '/t/i' );
        $replaceMap = array( '2', '4', '8', 'ur', 'u', '1', '3', '0', '4', '7' );

        $textBlocks = preg_split( '/(%[^ ]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
        $newTextBlocks = array();
        foreach ( $textBlocks as $text )
        {
            if ( strlen( $text ) && $text[0] == '%' )
            {
                $newTextBlocks[] = (string) $text;
                continue;
            }
            $text = preg_replace( $searchMap, $replaceMap, $text );

            $newTextBlocks[] = (string) $text;
        }
        $text = implode( '', $newTextBlocks );
        return $text;
    }
625535
protected static function checkColons($text)
    {
        if (strpos($text, ':') !== false
        || strpos($text, '[') !== false
        || strpos($text, '{') !== false
        || strpos($text, '-') !== false
        || strpos($text, '<') !== false
        || strpos($text, '&') !== false
        ) {
            return '"'.str_replace('"', '\"', $text).'"';
        }

        return $text;
    }
640176
public function remove($text)
    {
        $words = explode(' ', $text);

        foreach ($words as $i => $word) {
            if ($this->dictionary->contains($word)) {
                unset($words[$i]);
            }
        }

        return implode(' ', $words);
    }
52113
public function readPlace(string $text): array
    {
        $text = trim($text);

        return preg_split(self::PLACE_SEPARATOR_REGEX, $text, PREG_SPLIT_NO_EMPTY);
    }
541092
public function purge($text)
    {
        foreach ($this->parsers as $parser) {
            $text = $parser->purge($text);
        }

        return $text;
    }
730823
protected function replaceTextTokens($text)
    {
        foreach ($this->tokens as $key => $val) {
            $text = str_replace('<' . $key . '>', $val, $text);
        }

        return $text;
    }
1355747
private function getTags(string $text): array
    {
        $tags    = [];
        $matches = [];

        preg_match_all('/#([^#]+)#/', $text, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $params = explode(':', $match[1]);
            $method = array_shift($params);

            if (method_exists($this, $method)) {
                $tags[$match[0]] = $this->$method(...$params);
            }
        }

        return $tags;
    }
272326
protected function normalize(string $text) : string
    {
        $search = ['jan.','feb.','mar.','apr.','may.','jun.','jul.','aug.','sep.','oct.','nov.','dec.'];
        $replace = [
            "january",
            "february",
            "march",
            "april",
            "may",
            "june",
            "july",
            "august",
            "september",
            "october",
            "november",
            "december"
        ];        
        return str_ireplace($search, $replace, $text);
    }
708756
public function parseAttributes(string $text): array
    {
        $atts = [];
        $patterns = implode('|', [
            '([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)', // attribute="value"
            '([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)', // attribute='value'
            '([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)', // attribute=value
            '"([^"]*)"(?:\s|$)', // "attribute"
            '\'([^\']*)\'(?:\s|$)', // 'attribute'
            '(\S+)(?:\s|$)', // attribute
        ]);
        $pattern = "/{$patterns}/";
        $text = preg_replace("/[\x{00a0}\x{200b}]+/u", ' ', $text);
        if (preg_match_all($pattern, (string) $text, $match, PREG_SET_ORDER)) {

            // Reject any unclosed HTML elements
            foreach ($this->generateAttributes($match) as $att => $value) {
                if ($value !== true && strpos((string) $value, '<') !== false) {
                    if (preg_match('/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', (string) $value) !== 1) {
                        $value = '';
                    }
                }
                $atts[$att] = $value;
            }
        }

        return $atts;
    }
257255
public List<Mistake> checkText(String text) {
    List<Mistake> mistakes = null;
    try {
      mistakes = analyseAndCheckText(text).mistakes;
    } catch (IndexOutOfBoundsException e) {
      LOGGER.fatal("Failed to process text: " + text, e);
      throw new RuntimeException(e);
    }
    return mistakes;

  }
935971
public function split($text) {
        if (count($this->patterns) === 0) {
            return false;
        }
        if ($this->concatenatedPatterns === null) {
            $this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
                    return $pattern['pattern'];
                }, $this->patterns)) . '/msSi';
        }

        if (!preg_match($this->concatenatedPatterns, $text, $matches)) {
            return false;
        }

        $match = array_shift($matches);
        $patternNo = count($matches) - 1;
        $childRuleName = $this->patterns[$patternNo]['childRuleName'];
        list($first, $end) = preg_split($this->patterns[$patternNo]['pattern'] . 'msSi', $text, 2);

        return [$first, $match, $end, $childRuleName];
    }
356456
private static function inflect($text)
    {
        $words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));

        return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
    }
428717
public function clean($text)
    {
        if (!$this->filters) {
            return $text;
        }

        foreach ($this->filters as $filter) {
            $text = $filter->clean($text);
        }

        return $text;
    }
44703
public static function undent($text)
	{
		preg_match('/^\s+/', $text, $matches);
		list ($indent) = $matches;
		if ($indent)
		{
			$text = preg_replace("/^$indent/m", '', $text);
		}
		return $text;
	}
1289491
public static function cleanText(string $text)
    {
        $text = preg_replace('/<script[^>]*>.*?</script>/si', '', $text);
        $text = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text);
        $text = preg_replace('/<!--.+?-->/', '', $text);
        $text = preg_replace('/{.+?}/', '', $text);
        $text = preg_replace('/&nbsp;/', ' ', $text);
        $text = preg_replace('/&amp;/', ' ', $text);
        $text = preg_replace('/&quot;/', ' ', $text);
        $text = strip_tags($text);
        $text = htmlspecialchars($text);

        return $text;
    }