<commit_before>$def with (text="", summary="", languages={})
$var title: Summarizer

<div class="container">
<a href="https://github.com/summanlp/textrank"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 9999;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

    <div class="row">
        <div class="col-md-12">
            <h2>Summarization tool</h2>
        </div>
    </div>

    <br />

    <div class="row">
        <div class="col-md-10">
            <form role="form" class="form-horizontal">
                <textarea class="form-control" name="text" id="text" style="resize: none; font-size:15px; line-height: 120%;" 
                cols="90" rows="15" placeholder="Enter a text to summarize..." required>$text</textarea>    

                <br />

                <button class="btn btn-default btn-sm" type="button" id="showOptions">Show options</button>
                
                <div id="options" style="display:none; margin: 15px;">
                    <div class="form-group">
                        <label class="control-label col-md-2" for="length">Length</label>
                        <div class="col-md-6">
                            <input id="ex1" name="length" data-slider-id='ex1Slider' type="text" data-slider-min="1" data-slider-max="100" data-slider-step="1" data-slider-value="20" class="form-control" />
                        </div>
                    </div> 

                    <div class="form-group">
                        <label class="control-label col-md-2" for="language">Language</label>
                        <div class="col-md-6">
                            <select class="form-control" name="language" id="language">
                                $for key,name in languages.iteritems():
                                    $if key == "english":
                                        <option value="$key" selected>$name</option>
                                    $else:
                                        <option value="$key">$name</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2" for="scores">Scores</label>
                        <div class="col-md-6"><input id="showScores" name="scores" type="checkbox"></div>
                    </div>
                </div>

                <div class="pull-right">
                    <div class="btn-group">
                        <a class="btn btn-success btn-lg submits" data-value="keywords">Keywords</a>
                        <a href="#" class="btn btn-success btn-lg dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a class="exports" data-value="keywords">Export graph</a></li>
                        </ul>
                    </div>

                    <div class="btn-group">
                        <a class="btn btn-primary btn-lg submits" data-value="summarize">Summarize</a>
                        <a href="#" class="btn btn-primary btn-lg dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a class="exports" data-value="summarize">Export graph</a></li>
                        </ul>
                    </div>
                </div>
            </form>
        </div>
        
        <div class="col-md-2">
            <a class="btn btn-default btn-s" id="btn-load-sample">Load sample text</a>
        </div>
    </div> <!-- /row -->

    <br />

    <div class="col-md-offset-1 col-md-6 progress progress-striped active" style="display:none;">
        <div class="progress-bar" style="width: 100%"></div>
    </div>

    <div id="results" class="row" style="display:none; margin-bottom: 20px;">
        <div class="col-md-offset-1">
            <h4 id="resulttitle"></h4>
        </div>        
        <div class="col-md-offset-2 col-md-6">    
            <p id="summary"></p>
        </div>
    </div>
</div>        

<script>
    $$(document).ready(function() {
        var options = false;
        $$("#showOptions").on("click", function() {
            if (! options) {
                $$("#options").show();
                $$(this).html("Hide options");
            } else {
                $$("#options").hide();
                $$(this).html("Show options");
            }
            options = !options;
        });

        $$('#ex1').slider({
            formatter: function(value) {
                return value + "%";
            }
        });

        $$("#showScores").bootstrapSwitch();

        $$(".submits").click(function(event) {
            event.preventDefault();
            if ($$("#text").val().length > 0) {
                $$("#results").hide();
                $$(".progress").toggle();
                postData($$(this).data("value"));
            }
        });

        $$(".exports").click(function(event) {
            event.preventDefault();
            if ($$("#text").val().length > 0) {
                $$("#results").hide();
                $$(".progress").toggle();
                exportData($$(this).data("value"));
            }
        });
        
        jQuery('#btn-load-sample').click(
            function() {
                jQuery.ajax({
                    url: "sample"
                }).done(
                    function(data) {
                        jQuery('#text').val(data);
                    }
                );
            }
        );

        function postData(methodName) {
            $$.post("/", {
                text: $$("#text").val(),
                scores: $$("#showScores").bootstrapSwitch('state'),
                length: $$("#ex1").val(),
                language: $$("#language").val(),
                method: methodName
            }, function(data) {
                $$(".progress").toggle();<commit_msg>Removed graph export feature due to low memory in the server.<commit_after>$def with (text="", summary="", languages={})
$var title: Summarizer

<div class="container">
<a href="https://github.com/summanlp/textrank"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 9999;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>

    <div class="row">
        <div class="col-md-12">
            <h2>Summarization tool</h2>
        </div>
    </div>

    <br />

    <div class="row">
        <div class="col-md-10">
            <form role="form" class="form-horizontal">
                <textarea class="form-control" name="text" id="text" style="resize: none; font-size:15px; line-height: 120%;" 
                cols="90" rows="15" placeholder="Enter a text to summarize..." required>$text</textarea>    

                <br />

                <button class="btn btn-default btn-sm" type="button" id="showOptions">Show options</button>
                
                <div id="options" style="display:none; margin: 15px;">
                    <div class="form-group">
                        <label class="control-label col-md-2" for="length">Length</label>
                        <div class="col-md-6">
                            <input id="ex1" name="length" data-slider-id='ex1Slider' type="text" data-slider-min="1" data-slider-max="100" data-slider-step="1" data-slider-value="20" class="form-control" />
                        </div>
                    </div> 

                    <div class="form-group">
                        <label class="control-label col-md-2" for="language">Language</label>
                        <div class="col-md-6">
                            <select class="form-control" name="language" id="language">
                                $for key,name in languages.iteritems():
                                    $if key == "english":
                                        <option value="$key" selected>$name</option>
                                    $else:
                                        <option value="$key">$name</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-2" for="scores">Scores</label>
                        <div class="col-md-6"><input id="showScores" name="scores" type="checkbox"></div>
                    </div>
                </div>

                <div class="pull-right">
                    <a class="btn btn-success btn-lg submits" data-value="keywords">Keywords</a>
                    <a class="btn btn-primary btn-lg submits" data-value="summarize">Summarize</a>
                </div>
            </form>
        </div>
        
        <div class="col-md-2">
            <a class="btn btn-default btn-s" id="btn-load-sample">Load sample text</a>
        </div>
    </div>

    <br />

    <div class="col-md-offset-1 col-md-6 progress progress-striped active" style="display:none;">
        <div class="progress-bar" style="width: 100%"></div>
    </div>

    <div id="results" class="row" style="display:none; margin-bottom: 20px;">
        <div class="col-md-offset-1">
            <h4 id="resulttitle"></h4>
        </div>        
        <div class="col-md-offset-2 col-md-6">    
            <p id="summary"></p>
        </div>
    </div>
</div>        

<script>
    $$(document).ready(function() {
        var options = false;
        $$("#showOptions").on("click", function() {
            if (! options) {
                $$("#options").show();
                $$(this).html("Hide options");
            } else {
                $$("#options").hide();
                $$(this).html("Show options");
            }
            options = !options;
        });

        $$('#ex1').slider({
            formatter: function(value) {
                return value + "%";
            }
        });

        $$("#showScores").bootstrapSwitch();

        $$(".submits").click(function(event) {
            event.preventDefault();
            if ($$("#text").val().length > 0) {
                $$("#results").hide();
                $$(".progress").toggle();
                postData($$(this).data("value"));
            }
        });
       
        jQuery('#btn-load-sample').click(
            function() {
                jQuery.ajax({
                    url: "sample"
                }).done(
                    function(data) {
                        jQuery('#text').val(data);
                    }
                );
            }
        );

        function postData(methodName) {
            $$.post("/", {
                text: $$("#text").val(),
                scores: $$("#showScores").bootstrapSwitch('state'),
                length: $$("#ex1").val(),
                language: $$("#language").val(),
                method: methodName
            }, function(data) {
                $$(".progress").toggle();
{'fraction_non_alphanumeric': 0.168129409740148, 'fraction_numerical': 0.03519187747375667, 'mean_word_length': 1.4990324661363148, 'pattern_counts': {'":': 2, '<': 182, '<?xml version=': 0, '>': 185, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1755797', 'n_tokens_mistral': 3532, 'n_tokens_neox': 3139, 'n_words': 554}