<commit_before><?php

/*
 * This file is part of the Linkify library.
 *
 * (c) University of Cambridge
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Misd\Linkify;

/**
 * Linkify.
 *
 *
 *
 * @author <NAME> <<EMAIL>>
 */
class Linkify
{
    /**
     * Process text.
     *
     * Adds in links to both URLs and email addresses.
     *
     * @param string $text Text to process
     * @return string Processed text
     */
    public function process($text)
    {
        return $this->processEmails($this->processUrls($text));
    }

    /**
     * Process URLs.
     *
     * @param string $text Text to process
     * @return string Processed text
     */
    public function processUrls($text)
    {
        $pattern = <<<EOT
~(?xi)
\b
(
  (?:
    ((https?|ftps?)://)                     # scheme://
    (?:
      /{1,3}                                # 1-3 slashes
      |                                     #   or
      [a-z0-9%]                             # Single letter or digit or '%'
                                            # (Trying not to match e.g. "URI::Escape")
    )
    |                                       #   or
    www\d{0,3}[.]                           # "www.", "www1.", "www2." … "www999."
    |                                       #   or
    www\-                                   # "www-"
    |                                       #   or
    [a-z0-9.\-]+[.][a-z]{2,4}/              # looks like domain name followed by a slash<commit_msg>Replace character classes containing only a dot with an escaped dot to avoid problems with newer versions of POSIX<commit_after><?php

/*
 * This file is part of the Linkify library.
 *
 * (c) University of Cambridge
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Misd\Linkify;

/**
 * Linkify.
 *
 *
 *
 * @author <NAME> <<EMAIL>>
 */
class Linkify
{
    /**
     * Process text.
     *
     * Adds in links to both URLs and email addresses.
     *
     * @param string $text Text to process
     * @return string Processed text
     */
    public function process($text)
    {
        return $this->processEmails($this->processUrls($text));
    }

    /**
     * Process URLs.
     *
     * @param string $text Text to process
     * @return string Processed text
     */
    public function processUrls($text)
    {
        $pattern = <<<EOT
~(?xi)
\b
(
  (?:
    ((https?|ftps?)://)                     # scheme://
    (?:
      /{1,3}                                # 1-3 slashes
      |                                     #   or
      [a-z0-9%]                             # Single letter or digit or '%'
                                            # (Trying not to match e.g. "URI::Escape")
    )
    |                                       #   or
    www\d{0,3}\.                            # "www.", "www1.", "www2." … "www999."
    |                                       #   or
    www\-                                   # "www-"
    |                                       #   or
    [a-z0-9.\-]+\.[a-z]{2,4}/               # looks like domain name followed by a slash
{'fraction_non_alphanumeric': 0.12396440625958884, 'fraction_numerical': 0.010432648051549556, 'mean_word_length': 1.134905042567125, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3075088', 'n_tokens_mistral': 938, 'n_tokens_neox': 898, 'n_words': 263}