Extracting data from text
You can use Smart Write to even extract data in a specific format,
Β
Here are some fruits and their benefits.
Extract the data in the following format:
{list of each fruit}
Color:color_of_the_fruit,
Fruits: comma-separated fruit names
Prevents: list of disease names
{linebreak}
Red foods β like tomatoes and watermelon. These contain lycopene, which is thought to be important for fighting prostate cancer and heart disease
Green vegetables β like spinach and kale. These contain lutein and zeaxanthin, which may help protect against age-related eye disease
Blue and purple foods β like blueberries and eggplant. These contain anthocyanins, which may help protect the body from cancer
White foods β like cauliflower. These contain sulforaphane and may also help protect against some cancers.
Β
Β
Output:
Color: red,
Fruits: tomatoes, watermelon,
Prevents: prostate cancer, heart disease
Β
Color: green,
Fruits: spinach, kale,
Prevents: age-related eye disease
Β
Color: blue, purple,
Fruits: blueberries, eggplant,
Prevents: cancer
Β
Color: white,
Fruits: cauliflower,
Prevents: some cancers
Β
You can use this to do two things,
- Extract any data, like names, locations, or any patterns.
- Output that in any format you like.
Β
Let's try to get the above data in a JSON format,
Here are some fruits and their benefits.
Extract the data in the following format:
{list of each fruit}
{"COLOR_NAME":["LIST_OF_FRUITS"]}
Red foods β like tomatoes and watermelon. These contain lycopene, which is thought to be important for fighting prostate cancer and heart disease
Green vegetables β like spinach and kale. These contain lutein and zeaxanthin, which may help protect against age-related eye disease
Blue and purple foods β like blueberries and eggplant. These contain anthocyanins, which may help protect the body from cancer
White foods β like cauliflower. These contain sulforaphane and may also help protect against some cancers.
Β
Output:
{"Red":["Tomatoes", "Watermelon"], "Green":["Spinach", "Kale"], "Blue":["Blueberries", "Eggplant"], "White":["Cauliflower"]}
Β
Did this answer your question?
π
π
π€©