<commit_before>package furhatos.app.pizzaorder.flow

import furhatos.app.pizzaorder.*
import furhatos.app.pizzaorder.nlu.*
import furhatos.event.Event
import furhatos.flow.kotlin.*
import furhatos.nlu.common.No
import furhatos.nlu.common.Number
import furhatos.nlu.common.Time
import furhatos.nlu.common.Yes
import java.time.LocalTime

/*
    General enquiries that we want to be able to handle as well as an OrderPizzaIntent that is used for initial orders.
 */
val General: State = state(Interaction) {
    onResponse<RequestDeliveryOptionsIntent> {
        furhat.say("We can deliver to your home and to your office")
        reentry()
    }

    onResponse<RequestOpeningHoursIntent> {
        furhat.say("We are open between 7 am and 8 pm")
        reentry()
    }

    onResponse<RequestToppingOptionsIntent> {
        furhat.say("We have " + Topping().optionsToText())
        reentry()
    }
}

// Start of interaction
val Start = state(parent = General) {
    onEntry {
        furhat.ask("Welcome to Pizza house. How may I help you?")
    }

    onResponse<OrderPizzaIntent> {
        users.current.order.adjoin(it.intent)
        furhat.say("Ok, you want a pizza ${it.intent}")
        goto(CheckOrder)
    }
}

// Form-filling state
val CheckOrder = state {
    onEntry {
        val order = users.current.order
        when {
            order.topping == null -> goto(RequestTopping)
            order.deliverTo == null -> goto(RequestDelivery)
            order.deliveryTime == null -> goto(RequestTime)
            else -> {
                furhat.say("Alright, so you want to order a pizza $order")
                goto(ConfirmOrder)
            }
        }
    }
}

/*
    State for handling changes to an existing order
 */
val OrderHandling: State = state(parent = General) {

    // Handler that re-uses our pizza intent but has a more intelligent response handling depending on what new information we get
    onResponse<OrderPizzaIntent> {
        val order = users.current.order

        // Message to be constructed based on what data points we get from the user
        var message = "Okay"

        // Adding topping(s) if we get any new
        if (it.intent.topping != null) message += ", adding }"
<commit_msg>Final cleanup for review<commit_after>package furhatos.app.pizzaorder.flow

import furhatos.app.pizzaorder.*
import furhatos.app.pizzaorder.nlu.*
import furhatos.event.Event
import furhatos.flow.kotlin.*
import furhatos.nlu.common.No
import furhatos.nlu.common.Number
import furhatos.nlu.common.Time
import furhatos.nlu.common.Yes
import java.time.LocalTime

/*
    General enquiries that we want to be able to handle as well as an OrderPizzaIntent that is used for initial orders.
 */
val General: State = state(Interaction) {
    onResponse<RequestDeliveryOptionsIntent> {
        furhat.say("We can deliver to your home and to your office")
        reentry()
    }

    onResponse<RequestOpeningHoursIntent> {
        furhat.say("We are open between 7 am and 8 pm")
        reentry()
    }

    onResponse<RequestToppingOptionsIntent> {
        furhat.say("We have " + Topping().optionsToText())
        reentry()
    }
}

// Start of interaction
val Start = state(parent = General) {
    onEntry {
        furhat.ask("Welcome to Pizza house. How may I help you?")
    }

    onResponse<OrderPizzaIntent> {
        users.current.order.adjoin(it.intent)
        furhat.say("Ok, you want a pizza ${it.intent}")
        goto(CheckOrder)
    }
}

// Form-filling state that checks any missing slots and if so, goes to specific slot-filling states.
val CheckOrder = state {
    onEntry {
        val order = users.current.order
        when {
            order.topping == null -> goto(RequestTopping)
            order.deliverTo == null -> goto(RequestDelivery)
            order.deliveryTime == null -> goto(RequestTime)
            else -> {
                furhat.say("Alright, so you want to order a pizza $order")
                goto(ConfirmOrder)
            }
        }
    }
}

/*
    State for handling changes to an existing order
 */
val OrderHandling: State = state(parent = General) {

    // Handler that re-uses our pizza intent but has a more intelligent response handling depending on what new information we get
    onResponse<OrderPizzaIntent> {
        val order = users.current.order

        // Message to be constructed based on what data points we get from the user
        var message = "Okay"

        // Adding topping(s) if we get any new
        if (it.intent.topping != null) message += ", adding }"

{'fraction_non_alphanumeric': 0.09303852889667251, 'fraction_numerical': 0.0008756567425569177, 'mean_word_length': 2.5446082234290146, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '2770276', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1304, 'n_words': 406}