def run(language, force_multilingual=False, fold_case=True, gpu=True):
    'Run the experiment for `language`.\n\n    Parameters\n    ----------\n    language : str\n    force_multilingual : bool\n        Whether to use the multilingual model even on English\n    fold_case : bool\n        Whether to ignore caseing differences after making predictions\n    gpu : bool\n        Whether to run on GPU or not (useful for debugging)\n\n    Returns\n    -------\n    pd.DataFrame\n\n    '
    if ((language == 'English') and (not force_multilingual)):
        bert = BERT(ENGLISH_MODEL, gpu=gpu)
    else:
        bert = BERT(MULTILINGUAL_MODEL, gpu=gpu)
    vocab = bert.vocab
    if fold_case:
        vocab = [word.lower() for word in vocab]
    code = LANGUAGES[language]
    cloze = pd.read_csv(os.path.join(CLOZE_DIR, f'{code}.csv'))
    num_examples = (len(cloze) * 2)
    print(f'''

Number of examples for {language}: {num_examples}''')
    print_every = (num_examples // 100)
    features = pd.read_csv(os.path.join(FEATURES_DIR, f'{code}.csv'), dtype={'person': str})
    features = features[features['word'].isin(vocab)]
    cols = ['number', 'gender', 'case', 'person']
    result = []
    (count, total) = (0, 0)
    for (_, example) in cloze.iterrows():
        for mask in ['masked', 'other_masked']:
            try:
                predictions = bert.predict(example[mask], fold_case)
            except ValueError:
                continue
            predictions = features.merge(predictions, how='left', left_on='word', right_index=True)
            predictions = predictions[(predictions['pos'] == example['pos'])]
            predictions['correct'] = (predictions[cols] == example[cols]).all(axis=1)
            predictions = predictions.groupby('word').agg({'correct': any, 'p': 'first'})
            mean = predictions.groupby('correct')['p'].mean()
            try:
                example['correct'] = mean[True]
            except KeyError:
                example['correct'] = 0.0
            try:
                example['incorrect'] = mean[False]
            except KeyError:
                example['incorrect'] = 0.0
            masked_index = index_of_masked_word(example['masked'], bert)
            other_index = index_of_masked_word(example['other_masked'], bert)
            example['distance'] = abs((masked_index - other_index))
            result.append(example)
            if (example['correct'] > example['incorrect']):
                count += 1
            total += 1
            if ((total % print_every) == 0):
                percent_correct = round((100 * (count / total)), 3)
                percent_done = round((100 * (total / num_examples)), 3)
                print(f'{percent_correct}% correct with {percent_done}% done')
    result = pd.DataFrame(result)
    result['right'] = (result['correct'] > result['incorrect'])
    file_name = os.path.join(EXPERIMENTS_DIR, f'{code}.csv')
    result.to_csv(file_name, index=False)
    return result
Run the experiment for `language`.

Parameters
----------
language : str
force_multilingual : bool
    Whether to use the multilingual model even on English
fold_case : bool
    Whether to ignore caseing differences after making predictions
gpu : bool
    Whether to run on GPU or not (useful for debugging)

Returns
-------
pd.DataFrame
def run(language, force_multilingual=False, fold_case=True, gpu=True):
    'Run the experiment for `language`.\n\n    Parameters\n    ----------\n    language : str\n    force_multilingual : bool\n        Whether to use the multilingual model even on English\n    fold_case : bool\n        Whether to ignore caseing differences after making predictions\n    gpu : bool\n        Whether to run on GPU or not (useful for debugging)\n\n    Returns\n    -------\n    pd.DataFrame\n\n    '
    if ((language == 'English') and (not force_multilingual)):
        bert = BERT(ENGLISH_MODEL, gpu=gpu)
    else:
        bert = BERT(MULTILINGUAL_MODEL, gpu=gpu)
    vocab = bert.vocab
    if fold_case:
        vocab = [word.lower() for word in vocab]
    code = LANGUAGES[language]
    cloze = pd.read_csv(os.path.join(CLOZE_DIR, f'{code}.csv'))
    num_examples = (len(cloze) * 2)
    print(f'

Number of examples for {language}: {num_examples}')
    print_every = (num_examples // 100)
    features = pd.read_csv(os.path.join(FEATURES_DIR, f'{code}.csv'), dtype={'person': str})
    features = features[features['word'].isin(vocab)]
    cols = ['number', 'gender', 'case', 'person']
    result = []
    (count, total) = (0, 0)
    for (_, example) in cloze.iterrows():
        for mask in ['masked', 'other_masked']:
            try:
                predictions = bert.predict(example[mask], fold_case)
            except ValueError:
                continue
            predictions = features.merge(predictions, how='left', left_on='word', right_index=True)
            predictions = predictions[(predictions['pos'] == example['pos'])]
            predictions['correct'] = (predictions[cols] == example[cols]).all(axis=1)
            predictions = predictions.groupby('word').agg({'correct': any, 'p': 'first'})
            mean = predictions.groupby('correct')['p'].mean()
            try:
                example['correct'] = mean[True]
            except KeyError:
                example['correct'] = 0.0
            try:
                example['incorrect'] = mean[False]
            except KeyError:
                example['incorrect'] = 0.0
            masked_index = index_of_masked_word(example['masked'], bert)
            other_index = index_of_masked_word(example['other_masked'], bert)
            example['distance'] = abs((masked_index - other_index))
            result.append(example)
            if (example['correct'] > example['incorrect']):
                count += 1
            total += 1
            if ((total % print_every) == 0):
                percent_correct = round((100 * (count / total)), 3)
                percent_done = round((100 * (total / num_examples)), 3)
                print(f'{percent_correct}% correct with {percent_done}% done')
    result = pd.DataFrame(result)
    result['right'] = (result['correct'] > result['incorrect'])
    file_name = os.path.join(EXPERIMENTS_DIR, f'{code}.csv')
    result.to_csv(file_name, index=False)
    return result