<commit_before>package com.raychenon.licensedroid;

import com.raychenon.licensedroid.license.LicenseInfos;

/**
 * @author <NAME>
 */
public class OpenSourceTransformer {

    public OpenSourceTransformer() {
    }

    public OpenSourceModel transform(final OpenSource openSource) {
        return new OpenSourceModel(openSource.getProjectName(), openSource.getAuthor(), constructLicense(openSource));
    }

    private OpenSourceModel.License constructLicense(final OpenSource openSource) {
        return new OpenSourceModel.License(extractName(openSource), extractLicenseText(openSource), extractFullDescription(openSource));
    }

    private String extractLicenseText(final OpenSource openSource) {
        if (openSource.isLicenseText) {
            return openSource.getLicenseText();
        } else {
            LicenseInfos sourceLicense = openSource.getLicense();
            if (sourceLicense.hasCopyrightFormat()) {
                return sourceLicense.getNiceCopyright(sourceLicense.getYear(), openSource.getAuthor()) + "\n" + sourceLicense.getLicenseText();
            } else {
                return sourceLicense.getLicenseText();
            }
        }
    }

    private String extractName(final OpenSource openSource) {
        if (openSource.getLicense() == null) {
            // custom license
            int endIndex = openSource.getLicenseText().indexOf(" ", 20);
            return openSource.getLicenseText().substring(0, endIndex) + " ...";
        }
        return openSource.getLicense().getName();
    }

    private String extractFullDescription(final OpenSource openSource) {
        if (openSource.getLicense() != null && openSource.getLicense().hasLongerLicenseText()) {
            return openSource.getLicense().getLongerLicenseText();
        }
        return openSource.getLicenseText();
    }

}<commit_msg>rename methods internally<commit_after>package com.raychenon.licensedroid;

import com.raychenon.licensedroid.license.LicenseInfos;

/**
 * @author <NAME>
 */
public class OpenSourceTransformer {

    public OpenSourceTransformer() {
    }

    public OpenSourceModel transform(final OpenSource openSource) {
        return new OpenSourceModel(openSource.getProjectName(), openSource.getAuthor(), constructLicense(openSource));
    }

    private OpenSourceModel.License constructLicense(final OpenSource openSource) {
        return new OpenSourceModel.License(extractLicenseName(openSource), extractLicenseText(openSource), extractLicenseFullDescription(openSource));
    }

    private String extractLicenseText(final OpenSource openSource) {
        if (openSource.isLicenseText) {
            return openSource.getLicenseText();
        } else {
            LicenseInfos sourceLicense = openSource.getLicense();
            if (sourceLicense.hasCopyrightFormat()) {
                return sourceLicense.getNiceCopyright(sourceLicense.getYear(), openSource.getAuthor()) + "\n" + sourceLicense.getLicenseText();
            } else {
                return sourceLicense.getLicenseText();
            }
        }
    }

    private String extractLicenseName(final OpenSource openSource) {
        if (openSource.getLicense() == null) {
            // custom license
            int endIndex = openSource.getLicenseText().indexOf(" ", 20);
            return openSource.getLicenseText().substring(0, endIndex) + " ...";
        }
        return openSource.getLicense().getName();
    }

    private String extractLicenseFullDescription(final OpenSource openSource) {
        if (openSource.getLicense() != null && openSource.getLicense().hasLongerLicenseText()) {
            return openSource.getLicense().getLongerLicenseText();
        }
        return openSource.getLicenseText();
    }

}
{'fraction_non_alphanumeric': 0.10192102454642477, 'fraction_numerical': 0.0016008537886872999, 'mean_word_length': 3.1243124312431245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2564933', 'n_tokens_mistral': 944, 'n_tokens_neox': 918, 'n_words': 174}