<commit_before>import { parse as parseUrl } from 'url';

import _ from 'lodash';

const KNOWN_REPOSITORIES = {
    'github.com': parsedRepositoryUrl => {
        const repositoryId = /^(.+?\/.+?)(?:\/|\.|$)/.exec(parsedRepositoryUrl.pathname.slice(1))[1];
        const rootUrl = `https://github.com/${repositoryId}`;

        return {
            repositoryId,
            fileUrlBuilder: filename => `${rootUrl}/blob/master/${filename}`,
            releasesPageUrl: `${rootUrl}/releases`
        };
    }
};

export function getRepositoryInfo(repositoryUrl) {
    const parsedUrl = parseUrl(repositoryUrl);
    const { hostname } = parsedUrl;

    return _.has(KNOWN_REPOSITORIES, hostname) ? KNOWN_REPOSITORIES[hostname](parsedUrl) : null;<commit_msg>Fix regexp extracting `repositoryId` for GitHub if it contains dot<commit_after>import { parse as parseUrl } from 'url';

import _ from 'lodash';

const KNOWN_REPOSITORIES = {
    'github.com': parsedRepositoryUrl => {
        const repositoryId = /^(.+?\/.+?)(?:\/|\.git$|$)/.exec(parsedRepositoryUrl.pathname.slice(1))[1];
        const rootUrl = `https://github.com/${repositoryId}`;

        return {
            repositoryId,
            fileUrlBuilder: filename => `${rootUrl}/blob/master/${filename}`,
            releasesPageUrl: `${rootUrl}/releases`
        };
    }
};

export function getRepositoryInfo(repositoryUrl) {
    const parsedUrl = parseUrl(repositoryUrl);
    const { hostname } = parsedUrl;

    return _.has(KNOWN_REPOSITORIES, hostname) ? KNOWN_REPOSITORIES[hostname](parsedUrl) : null;
{'fraction_non_alphanumeric': 0.1525207402680281, 'fraction_numerical': 0.0025526483726866626, 'mean_word_length': 3.3314917127071824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2322288', 'n_tokens_mistral': 488, 'n_tokens_neox': 488, 'n_words': 88}