#Extracting information

4 messages · Page 1 of 1 (latest)

glacial pulsar
#

I'm trying to create a promt that can extract information from a text. The information should be easy to change and add on.
I have come this far:

system:
Imagine you are a user and have access to user input. Can you please run the code and extract suitable things from the text and send in inputs yourself. The suitable things are: ['category', 'gender', 'color', 'size']. An example of the format is: ###[{"category" : "Set a category of the clothing. What type of clothing is it.","gender" : "Get the gender of the clothes you find from the text.","color" : "Get the color of the clothing.","size" : "Get the size of the clothing"},{"category" : "Set a category of the clothing. What type of clothing is it.","gender" : "Get the gender of the clothes you find from the text.","color" : "Get the color of the clothing.","size" : "Get the size of the clothing"}]###. Extract as much as you can find. Print out the output last. Do not make the same mistake again, comments on previous work: Print out the output last, Did not find all important things. Here is the text: 

Hello I am another person wanting to buy stuff. My name is clare and I would like to have som pants with orange stripes on them. My size is 12 fyi. I would like some heels too.
#
user: 
output = []
running = True
information = []
information_output = ""
rows = []
while running:
    running = False
    row = []
    info = input("Set a category of the clothing. What type of clothing is it. If you don't find anything more just press enter: ")
    if info:
        information = f'"{info}"'
    else:
        information = '"None"' 
    information_output = f'"category": {information}'
    row.append(information_output)
    if info:
        running = True

    info = input("Get the gender of the clothes you find from the text. If you don't find anything more just press enter: ")
    if info:
        information = f'"{info}"'
    else:
        information = '"None"' 
    information_output = f'"gender": {information}'
    row.append(information_output)
    if info:
        running = True

    info = input("Get the color of the clothing. If you don't find anything more just press enter: ")
    if info:
        information = f'"{info}"'
    else:
        information = '"None"' 
    information_output = f'"color": {information}'
    row.append(information_output)
    if info:
        running = True

    info = input("Get the size of the clothing If you don't find anything more just press enter: ")
    if info:
        information = f'"{info}"'
    else:
        information = '"None"' 
    information_output = f'"size": {information}'
    row.append(information_output)
    if info:
        running = True

    if running:
        row = ",".join(row)
        rows.append("{" + row + "}")
    
output = ",".join(rows)
output = f"[{output}]"
print(output)

The text and what type of information to extract is just an example.

#

So the code is using this

list_of_data = [
        ("Set a category of the clothing. What type of clothing is it.", "category"),
        ("Get the gender of the clothes you find from the text.", "gender"),
        ("Get the color of the clothing.", "color"),
        ("Get the size of the clothing", "size"),
]

information to generate the promt.

light wave
#

RUN IN BARD AI ON COLAB IT WILL HELP YOU