<commit_before>
<h1>VFOOD</h1>
<script>
    function clearFields() {

        document.getElementById("comment").value = '';
    }
</script>
<div>

<p>Speak your order</p>
    <p id="recognizedText"></p>

    <section>
        <fieldset>
            <legend></legend>
            <p><button id="button">Speak</button></p>
            <p>
                <label class="general"></label>
                <textarea id="comment" class="note" rows="3" cols="60" wrap="SOFT"></textarea>
            </p>
            <input type="submit" name="submit" class="submitbutton" value="Recommend"/>
            <input type="submit" name="submit" class="submitbutton" value="Order"/>
            <input type="reset" name="reset" class="resetbutton" value="Clear" onclick="clearFields();"/>
            <span style="color:#EE2222"></span>
        </fieldset>
    </section>
</div>
<!--

    <h2>Press the 'mic' button and speak</h2>
    <button id="button">mic</button>
    <p id="recognizedText"></p>
</section>
-->

<script src="speech.js"></script>

<script style="display: hide;">
    var speech = SpeechToText;
    var activeSTT;
    var message = ' ';
    function listen() {
        activeSTT = speech.listen({
            onStart: function() {
                console.log('onStart Speech event');
            },
            onResult: function(e) {
                console.log('onResult Speech event', e.text);
                message = e.text;
                if (e.isFinal) {
                    stopListening();
                }
            },
            onError: function(e) {
                console.log('onError Speech event', e);
            },
            onEnd: function(e) {
                console.log('onEnd Speech event', e);
                document.getElementById("comment").value = message;
                stopListening();
            }
        });
    }
    function startListening() {
        if (activeSTT) {
            // do nothing, speech is active
        } else if (speech.isSupported) {
            listen();
        } else {
            alert('speech not supported by this browser');
        }
    }
    function stopListening() {
        if (activeSTT) {
            activeSTT.stop();
            activeSTT = null;
        }
    }
    document.querySelector('#button').onclick = startListening;
</script><commit_msg>working shits<commit_after>
<h1>VFOOD</h1>
<script>
    function clearFields() {
        document.getElementById("comment").value = '';
    }
    function getLocation() {
        event.preventDefault();
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(setPosition, showError);
        } else {
            alert("Geolocation is not supported by this browser.");
        }
    }

    function setPosition(position) {
        var lng = position.coords.longitude,
                lat = position.coords.latitude;
        document.getElementById('curr_long').value = lng;
        document.getElementById('curr_lat').value = lat;
        document.getElementById("order").submit();
    }
    function showError(error) {
        switch (error.code) {
            case error.PERMISSION_DENIED:
                alert("Request for geolocation permission denied.");
                break;
            case error.POSITION_UNAVAILABLE:
                alert("Location information is unavailable.");
                break;
            case error.TIMEOUT:
                alert("The request to get user location timed out.");
                break;
            case error.UNKNOWN_ERROR:
                alert("An unknown error occurred.");
                break;
        }
    }
</script>
<div>

<!--
        <form action="/recommend" id="recommend" method="post">

        <input type="hidden" id="curr_long" name="curr_long">
        <input type="hidden" id="curr_lat" name="curr_lat">

        <input type="text" id="txt" name="txt" value="hardcoded I want beer" />
        <input type="submit" value="Send message" onclick="getLocation()"/>

    </form>
-->

<p>Speak your order</p>
    <p id="recognizedText"></p>

    <section>
        <fieldset>
            <legend></legend>
            <p><button id="button">Speak</button></p>
            <form action="/recommend" id="recommend" method="post">


                <p><textarea id="comment" rows="3" cols="60" wrap="SOFT"></textarea></p>


                <input type="submit" name="submit"  value="Recommend" onclick="getLocation();"/>

                <input type="hidden" id="curr_long" name="curr_long">
                <input type="hidden" id="curr_lat" name="curr_lat">

                <input type="reset" name="reset" value="Clear" onclick="clearFields();"/>
            </form>

            <input type="submit" name="submit"  value="Order"/>


            <span style="color:#EE2222"></span>
        </fieldset>
    </section>
</div>


<script src="speech.js"></script>

<script style="display: hide;">
    var speech = SpeechToText;
    var activeSTT;
    var message = ' ';
    function listen() {
        activeSTT = speech.listen({
            onStart: function() {
                console.log('onStart Speech event');
            },
            onResult: function(e) {
                console.log('onResult Speech event', e.text);
                message = e.text;
                if (e.isFinal) {
                    stopListening();
                }
            },
            onError: function(e) {
                console.log('onError Speech event', e);
            },
            onEnd: function(e) {
                console.log('onEnd Speech event', e);
                document.getElementById("comment").value = message;
                stopListening();
            }
        });
    }
    function startListening() {
        if (activeSTT) {
            // do nothing, speech is active
        } else if (speech.isSupported) {
            listen();
        } else {
            alert('speech not supported by this browser');
        }
    }
    function stopListening() {
        if (activeSTT) {
            activeSTT.stop();
            activeSTT = null;
        }
    }
    document.querySelector('#button').onclick = startListening;
</script>
{'fraction_non_alphanumeric': 0.14373385012919895, 'fraction_numerical': 0.003229974160206718, 'mean_word_length': 1.8226982680036463, 'pattern_counts': {'":': 0, '<': 90, '<?xml version=': 0, '>': 90, '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': '4069895', 'n_tokens_mistral': 1760, 'n_tokens_neox': 1662, 'n_words': 359}