STxT: The Book

A language for the web

Chapter 3: AI-Powered

With the arrival of generative AI, one thing that has surprised me is how naturally it handles STxT. It seems as if it knows it, with just a brief introduction. I’m going to share a conversation, and you can judge for yourself.

Conversation

Human

Hello, I'm going to talk to you about the STXT (SemanticText) language.
It’s a language for writing structured documents. The documents have tags 
separated by the ":" character, and they are nested using tabs.
With the same language, you can define a namespace that will define 
a document type and the allowed and disallowed tags.

Here’s an example of a namespace:

Namespace: www.kocinando.com/receta.stxt
    Recipe:
        Description: (?) TEXT
        Servings: (?) NUMBER
        Difficulty: (?) ENUM
               : easy
               : medium
            : hard
        Ingredients: (1)
            Ingredient: (+)
        Steps: (1)
            Step: (+)
            
Here’s an example of a document from that namespace:

Recipe (www.kocinando.com/receta.stxt): Macaroni Recipe
    Description:
        This is the description of...
        This is the description of...
    Servings: 3
    Difficulty: easy
    Ingredients:
        Ingredient: (100g) Tomato
        Ingredient: (240g) Macaroni
    Steps:
        Step: (1) Make the sauce
        Step: (2) Brown the meat

Did you understand what I explained to you?

AI

Yes, I understood what you explained to me about the STXT (SemanticText) language. It’s a language for structuring documents using tags that are organized hierarchically through tabulations. Additionally, the tags are defined within a namespace, which establishes the allowed tags and their possible values or formats.

In your example, you defined a specific namespace for cooking recipes (www.kocinando.com/receta.stxt) that includes tags like Recipe, Description, Servings, Difficulty, Ingredients, Ingredient, Steps, and Step. Each tag can have certain associated value types, such as free text (TEXT), numbers (NUMBER), or enumerated values (ENUM) with specific options like easy, medium, and hard.

Then, you showed how a recipe document can be structured using this namespace, following the hierarchy and rules defined within it. For example, in the macaroni recipe document, the description, the number of servings, the difficulty, the ingredients with their respective quantities, and the steps to follow are all specified, adhering to the structure defined in the namespace.

Is there anything more specific you would like to discuss or clarify about this language?

Human

I’d like you to create a real recipe for macaroni bolognese following the namespace www.kocinando.com/receta.stxt.

AI

Here is a recipe for macaroni bolognese following the namespace www.kocinando.com/receta.stxt:

Recipe (www.kocinando.com/receta.stxt): Macaroni Bolognese
    Description:
        Macaroni Bolognese is a classic Italian dish consisting of pasta and a delicious meat sauce with tomato, onion, carrot, and celery. Perfect for any occasion.
    Servings: 4
    Difficulty: medium
    Ingredients:
        Ingredient: (400g) Macaroni
        Ingredient: (400g) Ground beef
        Ingredient: (1) Onion
        Ingredient: (2) Garlic cloves
        Ingredient: (1) Carrot
        Ingredient: (1) Celery stalk
        Ingredient: (400g) Crushed tomatoes
        Ingredient: (2 tablespoons) Olive oil
        Ingredient: (1/2 cup) Red wine
        Ingredient: (To taste) Salt
        Ingredient: (To taste) Black pepper
        Ingredient: (To taste) Grated Parmesan cheese
        Ingredient: (1 leaf) Bay leaf
        Ingredient: (1 teaspoon) Sugar
    Steps:
        Step: (1) Finely chop the onion, garlic, carrot, and celery.
        Step: (2) Heat the olive oil in a large pan and sauté the onion, garlic, carrot, and celery until soft.
        Step: (3) Add the ground beef and cook until browned.
        Step: (4) Pour in the red wine and cook over medium heat until the alcohol evaporates.
        Step: (5) Add the crushed tomatoes, bay leaf, sugar, salt, and pepper. Let it simmer over low heat for 30 minutes, stirring occasionally.
        Step: (6) While the sauce is cooking, boil salted water in a large pot and cook the macaroni according to the package instructions.
        Step: (7) Drain the macaroni and mix with the Bolognese sauce.
        Step: (8) Serve hot and sprinkle with grated Parmesan cheese to taste.

Analysis

  1. Well, first of all: now it’s real. Maybe this recipe is better than mine :-D
  2. Secondly: how easily the AI handled the documents :-O
  3. Finally, note that when displaying the result, it was identified as YAML instead of STXT. I understand they are very similar; we will discuss the similarities and differences later on.
This website uses cookies to ensure you get the best experience on our website. [cookies.html|Learn more] Got it! More info