Get your App to Understand Dates and Times from Everyday Language
Introducing the Numbers & Time Skill
The Challenge Today
As devs, we're used to plugging standardized dates and times into our code. They need to be in a very clear format so that we don't encounter an error.
Here are a few examples of how you might create a proper date format in your code today:
But what happens when we want to extract dates and times from natural conversations, say between a sales rep and a customer? Those dates and times won't be in the format you need. Your code won't know how to make sense of them.
Let's take the word 'Yesterday' - how can we get our app to convert that text into a proper date?
Let's see how we handle this in the One AI Studio:
Above I choose the Numbers & Time skill and apply it to the text.
And, Viola! As you can see, One AI recognized 'Yesterday' as '2022-11-09'.
If we want to implement this in our code, we can copy the snippet from the Studio:
const text = "Yesterday\nAll my troubles seemed so far away\nNow it looks as though they're here to stay\nOh, I believe in yesterday";
const pipeline = new oneai.Pipeline(
const output = await pipeline.run(text);
It's that easy. You now can start detecting 'natural' dates and times in your code.
So what can we do with this?
Think about it - with a simple API call, we can now understand dates and times from millions of conversations.
Imagine you work in an enterprise and would like to automatically schedule ALL meetings mentioned in conversations from the past week. All you'd have to do is get the code to scan the emails and extract the potential meeting times.
For each meeting time, you would then set up a calendar event with the email participants. You'd save thousands of work hours each week with a simple script.