<commit_before>from flask import render_template, request
from app import app
from .analyze import Politician


POLITICIANS = {"realDonaldTrump": "<NAME>",
               "HillaryClinton": "<NAME>",
               "BernieSanders": "<NAME>",
               "BarackObama": "<NAME>",
               "tedcruz": "<NAME>",
               "JoeBiden": "<NAME>",
               "GovPenceIN": "<NAME>",
               "SylvesterTurner": "<NAME>",
               "GregAbbott_TX": "<NAME>",
               "SarahPalinUSA": "<NAME>",
               "GovGaryJohnson": "<NAME>",
               "DrJillStein": "<NAME>"
               }


@app.route('/')
@app.route('/index')
def index():
    return render_template('index.html',
                           politicians=POLITICIANS
                           )


def personality_compare(trait, value_1, value_2, name_1, name_2):
    percentage = 100 * abs(value_1 - value_2)
    if percentage < 0.1:
        return "{} and {} have an equal amount of {}.".format(name_1,
                                                              name_2,
                                                              trait
                                                              )
    elif value_1 > value_2:
        return "{} has {:.1f}% more {} than {}.".format(name_1,
                                                        percentage,
                                                        trait,
                                                        name_2
                                                        )
    elif value_1 < value_2:
        return "{} has {:.1f}% more {} than {}.".format(name_2,
                                                        percentage,
                                                        trait,
                                                        name_2
                                                        )<commit_msg>Added comment to personality compare function<commit_after>from flask import render_template, request
from app import app
from .analyze import Politician


POLITICIANS = {"realDonaldTrump": "<NAME>",
               "HillaryClinton": "<NAME>",
               "BernieSanders": "<NAME>",
               "BarackObama": "Bar<NAME>ama",
               "tedcruz": "<NAME>",
               "JoeBiden": "<NAME>",
               "GovPenceIN": "<NAME>",
               "SylvesterTurner": "<NAME>",
               "GregAbbott_TX": "<NAME>",
               "SarahPalinUSA": "<NAME>",
               "GovGaryJohnson": "<NAME>",
               "DrJillStein": "<NAME>"
               }


@app.route('/')
@app.route('/index')
def index():
    return render_template('index.html',
                           politicians=POLITICIANS
                           )


def personality_compare(trait, value_1, value_2, name_1, name_2):
    """
    Creates a string that compares the values for the two inputted traits.
    """
    percentage = 100 * abs(value_1 - value_2)
    if percentage < 0.1:
        return "{} and {} have an equal amount of {}.".format(name_1,
                                                              name_2,
                                                              trait
                                                              )
    elif value_1 > value_2:
        return "{} has {:.1f}% more {} than {}.".format(name_1,
                                                        percentage,
                                                        trait,
                                                        name_2
                                                        )
    elif value_1 < value_2:
        return "{} has {:.1f}% more {} than {}.".format(name_2,
                                                        percentage,
                                                        trait,
                                                        name_2
                                                        )
{'fraction_non_alphanumeric': 0.103430749682338, 'fraction_numerical': 0.011689961880559084, 'mean_word_length': 0.8574799433695139, 'pattern_counts': {'":': 24, '<': 31, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 44, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3686844', 'n_tokens_mistral': 863, 'n_tokens_neox': 814, 'n_words': 201}