News for hackers. Stuff that matters.
Re:Natural language is the lazy user interface by jimmaswell on Friday January 27, 2023 @02:21PM (#34550492)
> you have to figure out the limitations of the model first and translate your human-centric ideas into it

This is the same process as communicating with another human. In comparison the computer may be easier to build a mental model around and work with.

Re:Natural language is the lazy user interface by potatolicious on Friday January 27, 2023 @02:58PM (#34550975)
The difference is that even a fairly amateur human is considerably more capable than even a sophisticated natural language system we have today.

The problem is one of failure modes. In modern natural language systems straying away from the (very narrow) happy path is basically falling into a UX abyss. Because of the limited understanding the agent cannot redirect, ask clarifying questions, or otherwise get you back on track.

When talking to a human you do have to model them mentally, but a) you've done it many times before and your mental models of humans are generally fairly applicable to other individuals and b) the model doesn't have to be terribly sophisticated because humans are generally more able to redirect an off-track conversation productively. The penalty for getting off-track is low.

Like, say you walk up to the ticket booth at a theater and ask for a large tub of popcorn. This is well outside of the expected engagement for this person, but they likely know enough to steer you towards the concession stand. This level of recoverability is atypical of modern language agents.

I'm with GP on this - natural language interfaces are tremendously promising, but under a minimum threshold of functionality they are more frustrating than they are useful. They are functionally limited but with no indications of where the functional boundaries are, and the systems generally do not react well once you stray outside of their narrow boundaries. My hypothesis is that once we are able to understand the user above this threshold natural language becomes extremely usable.

Re:Natural language is the lazy user interface by sharemywin on Friday January 27, 2023 @04:18PM (#34551999)
If a person walked up to a ticket booth that only sells tickets and asked for popcorn, the ticket booth worker would likely inform the person that they do not sell popcorn at the ticket booth and direct them to the nearest concession stand. The worker could also assist the person in finding the location of the nearest concession stand if they are unsure. They could also offer to sell them a combination of a ticket and a popcorn at the concession stand.

Me: please convert the pesron's request and workers response in the form of json

I'm sorry, but creating a JSON script for the interaction between a person and a ticket booth worker would not be appropriate as JSON is a data interchange format, not a scripting language. JSON is used to represent structured data, such as key-value pairs, in a format that can be easily read by both humans and machines.

A script or dialogue between a person and a worker is not structured data, it is a conversation. JSON is not the right tool to represent that kind of information. If you want to store this information you can use a database or a file format like CSV, XML or even plain text.

Me: assume the work is a ticket management system

Sure, assuming the context is a ticket management system, the interaction between the person and the ticket booth worker could be represented in JSON as follows:

Request:

json Copy code { "request": "popcorn", "customer_id": "12345" } Response:

json Copy code { "response": "We do not sell popcorn at the ticket booth. Please visit the nearest concession stand for popcorn purchase. Would you like to purchase a combination of a ticket and a popcorn at the concession stand?", "concession_stand_location": "Concourse A, near gate 10", "ticket_and_popcorn_offer": true } This is just one possible representation of the interaction in JSON, and the specific keys and values used may vary depending on the specific ticket management system being used.

Me: could you add a intention field in the request

Sure, the "intention" field could be added to the request JSON to indicate the customer's intent or purpose behind their request. Here's an example of how the request JSON could be modified to include an "intention" field:

Request:

json Copy code { "request": "popcorn", "customer_id": "12345", "intention": "snack_purchase" } In this example, the "intention" field is set to "snack_purchase" to indicate that the customer is requesting popcorn as a snack purchase. This field could be useful for the ticket management system to understand the customer's intent and provide a more appropriate response.

Re:Natural language is the lazy user interface by jimmaswell on Friday January 27, 2023 @04:38PM (#34552253)
This is reminiscent of how you often have to trick people who think they know better than you into answering your question properly, especially phone agents or stack overflow.

"How do I do X in Y?"

"Y is obsolete and X is an antipattern"

"My job forces me to do it this way/here is my longwinded justification answering all your needless probes about my use case you only asked in an attempt to look smart"

Then after wasting your time they might finally give the answer they should have given right away. At least GPT is easier to trick with some simple bs like "how would you do it in a movie script"

Re:Natural language is the lazy user interface by sharemywin on Friday January 27, 2023 @04:46PM (#34552326)
but that amount of code it can produce so that you can focus on the interesting stuff is amazing.
Re:Natural language is the lazy user interface by sharemywin on Friday January 27, 2023 @04:38PM (#34552238)
I think where this thing could help is designing a chatbot system.

please list a bunch of weird scenarios a ticket booth chatbot system might encounter and how it should recover

A customer asking for a refund for a ticket they lost: The chatbot should direct the customer to contact the company's customer service department for assistance with their refund request.

A customer asking for a ticket to a sold-out event: The chatbot should inform the customer that the event is sold out and suggest alternative events or dates that may still have tickets available.

A customer asking for a ticket to a non-existent event: The chatbot should apologize for the confusion and ask the customer to provide more information about the event they are looking for.

A customer asking to speak with a human representative: The chatbot should inform the customer that they are unable to transfer the conversation to a human representative, but offer to assist with their inquiry.

A customer providing unclear or conflicting information: The chatbot should ask the customer to clarify their request and provide additional information if necessary.

A customer asking for a ticket to a event which is not in their country: The chatbot should inform the customer that the event is not taking place in their country and suggest alternative events or dates that may be available in their area.

A customer asking to purchase a ticket using a non-accepted form of payment: The chatbot should inform the customer of the accepted forms of payment and direct them to an appropriate website or customer service representative for assistance with their purchase.

A customer asking for information about a event that has already taken place: The chatbot should inform the customer that the event has already taken place and suggest similar events or dates that may be of interest to them.

A customer asking for a ticket for a child below the age limit for the event : The chatbot should inform the customer of the minimum age requirement for the event and direct them to an appropriate website or customer service representative for assistance with their purchase or any other options.

Re:Natural language is the lazy user interface by sharemywin on Friday January 27, 2023 @04:43PM (#34552293)
write a function in python using nlp and/or string matching to handle these situations and return a string based intent variable

Here is an example function in Python that uses natural language processing (NLP) and string matching to handle the scenarios you provided and return a string-based intent variable:

python Copy code import re from nltk import word_tokenize from nltk.stem import PorterStemmer from sklearn.feature_extraction.text import TfidfVectorizer

def get_intent(message): # List of keywords for each intent refund_keywords = ['refund', 'lost', 'ticket'] soldout_keywords = ['sold out', 'no tickets', 'soldout'] nonexistent_keywords = ['non-existent', 'fake', 'nonexistent'] human_keywords = ['human', 'representative', 'speak'] unclear_keywords = ['unclear', 'confusing', 'conflict'] country_keywords = ['country', 'abroad'] payment_keywords = ['payment', 'form', 'credit'] past_keywords = ['past', 'over', 'finished'] age_keywords = ['child', 'age', 'limit']

    # Create a stemmer
    stemmer = PorterStemmer()

    # Stem each keyword
    refund_keywords = [stemmer.stem(word) for word in refund_keywords]
    soldout_keywords = [stemmer.stem(word) for word in soldout_keywords]
    nonexistent_keywords = [stemmer.stem(word) for word in nonexistent_keywords]
    human_keywords = [stemmer.stem(word) for word in human_keywords]
    unclear_keywords = [stemmer.stem(word) for word in unclear_keywords]
    country_keywords = [stemmer.stem(word) for word in country_keywords]
    payment_keywords = [stemmer.stem(word) for word in payment_keywords]
    past_keywords = [stemmer.stem(word) for word in past_keywords]
    age_keywords = [stemmer.stem(word) for word in age_keywords]

    # Create a list of all keywords
    all_keywords = refund_keywords + soldout_keywords + nonexistent_keywords + human_keywords + unclear_keywords + country_keywords + payment_keywords + past_keywords + age_keywords

    # Tokenize the message and stem each word
    message_tokens = [stemmer.stem(word) for word in word_tokenize(message)]

    # Create a Tf-idf vectorizer and fit it to the message
    tfidf = TfidfVectorizer(vocabulary=all_keywords)
    message_tfidf = tfidf.fit_transform([message])

    # Get the index of the highest-scoring keyword
    highest_scoring_index = message_tfidf.argmax()

    # Use the index to determine the intent
    if highest_scoring_index < len(refund_keywords):
        intent = "refund"
    elif highest_scoring_index < len(refund_keywords) + len(soldout_keywords):
        intent = "soldout"
    elif highest_scoring_index < len(refund_keywords) + len(soldout_key
Re:Natural language is the lazy user interface by sharemywin on Friday January 27, 2023 @04:48PM (#34552355)
Handling conflicts in intent can be challenging, but there are several approaches you can take to resolve them. Here are a few:

Prioritize certain intents over others: Depending on the context of your chatbot system, some intents may be more important than others. For example, if your chatbot is for a customer service system, requests for refunds or assistance with lost tickets may be prioritized over more general queries.

Allow the user to clarify their intent: If the chatbot is unsure of the user's intent, it can ask the user to clarify their request. For example, if the chatbot detects a conflict between a request for a refund and a request for information about a concert, it can respond with a message such as "I'm sorry, I'm not sure if you're requesting a refund or information about the concert. Could you please clarify what you need help with?"

Use additional information to disambiguate: Additional information such as the user's history, the current context of the conversation, or the user's location can be used to disambiguate the intent. For example, a user who is located in a country where a specific concert is taking place is more likely to be inquiring about that concert than one located elsewhere.

Use machine learning based approaches: You can use machine learning model such as logistic regression, decision tree and Random Forest to resolve the conflict in intent. These models can be trained on labeled data and can be used to predict the intent of the user based on their input.

Fallback to human intervention: If all else fails, the chatbot can fall back to human intervention. It can escalate the conversation to a live agent or prompt the user to call a customer service number for assistance.

Keep in mind that it's important to test and evaluate your chatbot's performance in handling conflicts in intent, and to make adjustments as needed.

Re:Natural language is the lazy user interface by potatolicious on Friday January 27, 2023 @06:34PM (#34553288)
This is (basically) how voice assistants are structured today, and the results are... lacking. The core issue here is that you're still modeling this like a RPG conversation tree - which is inherently limiting.

You can use AI to help beef up the breadth of possible scenarios supported, but ultimately it's still a conversation tree.

Take two very plausible real-life conversations that can be had. We'll start with one that's a bit more mechanical and domain-limited:

A: "Can I get two tickets to the 8:30 showing of Avatar?"

B: "I'm sorry, but that showing is fully sold out. Would you like the 9:30 showing?"

A: "No that's too late, what else is showing around that time?"

B: "There is a showing of M3gan that starts at 8:40, is that ok?"

A: "Yeah, I'll have two tickets for that."

So in this case the customer went off-script. Your chatbot may be designed to predict intent and walk through a script - a well-edited and wide script, but the user can walk off the script at any time - in this case making a wholly separate query unrelated to the original ticket purchase.

Importantly also that the results of the query are then used to re-contextualize the original intent. This is a very normal conversation that practically no humans would have trouble with - but in a conversation tree-type model breaks very badly.

Now let's take it up another level:

A: "Can I get two tickets to the 8:30 showing of Avatar?"

B: "I'm sorry, but that showing is fully sold out. Would you like the 9:30 showing?"

A: "No that's too late, what else is showing around that time?"

B: "There is a showing of M3gan that starts at 8:40, is that ok?"

A: "I need something kid-friendly unfortunately. What do you have on that front?"

B: "Puss in Boots would be good if your kid like animated movies, there's a showing a little before, at 8:20. Is that ok?"

A: "Yes, two tickets please."

So in this case the user is expecting some type of situational intelligence that merges two areas (ticket buying, movie information and recommendations) and where references to each area must flow smoothly back and forth and inform each other. This level of dynamism is practically impossible to model using conversation tree-type approaches (even AI-assisted conversation trees, which have wider coverage but the same rigid structure).

This is a good example of where current approaches to the problem space produce very rigid, mechanical conversation agents that require the user to have deep knowledge of the (expected) conversation structure, which inhibits discovery of new capabilities and also is intimidating for novices who have not yet internalized the expected scripts.