<commit_before>from __future__ import print_function

import sys

import sputnik
from sputnik.package_list import (PackageNotFoundException,
                                  CompatiblePackageNotFoundException)

from . import about


def download(lang, force=False):
    if force:
        sputnik.purge(about.__title__, about.__version__)

    try:
        sputnik.package(about.__title__, about.__version__, about.__models__[lang])
        print("Model already installed. Please run 'python -m "
              "spacy.%s.download --force' to reinstall." % lang, file=sys.stderr)
        sys.exit(0)
    except (PackageNotFoundException, CompatiblePackageNotFoundException):<commit_msg>Add parameter to download() for application to not exit if a Model exists. The default behavior is unchanged.<commit_after>from __future__ import print_function

import sys

import sputnik
from sputnik.package_list import (PackageNotFoundException,
                                  CompatiblePackageNotFoundException)

from . import about


def download(lang, force=False, fail_on_exist=True):
    if force:
        sputnik.purge(about.__title__, about.__version__)

    try:
        sputnik.package(about.__title__, about.__version__, about.__models__[lang])
        if fail_on_exist:
            print("Model already installed. Please run 'python -m "
                  "spacy.%s.download --force' to reinstall." % lang, file=sys.stderr)
            sys.exit(0)
    except (PackageNotFoundException, CompatiblePackageNotFoundException):
{'fraction_non_alphanumeric': 0.08070866141732283, 'fraction_numerical': 0.0013123359580052493, 'mean_word_length': 3.155313351498638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3780385', 'n_tokens_mistral': 407, 'n_tokens_neox': 392, 'n_words': 107}