Data Parser

Extract any data from Text

Data Parser helps you to extract specific values or text from a given sentence or paragraph, we support 2 types of data parsers now "Split Text & Regular Expression", for example "Your order id is 1234 and status is Delivered" from this sentence its possible to extract the order id as 1234 and status as Delivered

Similarly, you can extract any values using the data parser in the Picky Assist

You can select Formatter -> Data Parser -> Split Text / Regular Expression as shown below;

Split Text

Split Text helps you split a text which follows a pattern like "ORDERID 1234" here you can extract the ORDERID 1234 which is separated by a space, so the settings should be as below

In the above example, you can see that we have input the data which needs to be formatted, you can use attributes to dynamically use this feature

Split Separator: This is where you instruct the system when to split like new line, space, comma or any value you input will be considered as a delimiter to split, here we have used space

Select Segmentation Index : This is where you instruct the system which element you need after the split for example "ORDERID 1234" if you input "First Element" then the system extracts only "ORDERID" and if you select the second element then it will extract only 1234 etc

Store Converted Result To : You can give any value where the system needs to save the converted value which can be used further in the attributes under formatter

You can experiment with different combinations using the "Test" button feature by passing a sample value

Regular Expression

Using the split method you may not be able to extract all types of patterns for example, extract email addresses from the below paragraph

"Our support email address is support@pickyassist.com and our sales email address is sales@pickyassist.com"

If we want to extract the email address from the above paragraph we need to make use of regular expression so Regular expression or "Regex" is a special sequence of characters that helps you match or find patterns within a string of text.

You can refer complete code of regular expression here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

Regular Expression: Here we have used /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}\b/ as regular expression code which can match an email address pattern and able to extract the same from the given text

Select Segmentation Index: This is where you instruct the system which element you need after the split for example the given sentence have 2 email address so whether we need the first email address or 2nd email address, the Last email address or all, if you select "All" then data will come as array in the formatter for you to select.

Store Converted Result To : You can give any value where the system needs to save the converted value which can be used further in the attributes under formatter

If you are using ChatGPT to generate Regular expressions then please add / (forward slash) starting and ending of the regular expression as shown below;

If ChatGPT gives you \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}\b then add /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}\b/

Extract JSON

JSON extractor helps you to extract JSON objects from a given string and able to map the JSON data in your connector, let's take an example usage with ChatGPT

Let's assume that you are an HR and want to analyze the CV with the help of ChatGPT and extract the following details 1) Education Background 2) Key Skills 3) Work Experience 4) Contact Details and then you want to automatically send a WhatsApp message or email to the candidate for scheduling the interview

Now ChatGPT can extract the above details from a CV and the output will be given in text format but in order to send a WhatsApp message or email automatically we need the details in a structured way like phone=4343434 & email=picky@pickyassist.com and this is where the JSON extractor will play its role

So in our ChatGPT prompt, we will add an instruction at the end of the prompt as below

"extract name, email, and phone number from the data, prefix 91 to the phone number if its length is less than or equal to 10 digits long, and create a JSON object with the extracted contact information"

Now the ChatGPT will include a JSON object in the output and it will look something as shown below;

So when you make an HTTP API call the output of the ChatGPT will have the above JSON object and this can be passed to the JSON extractor our system will extract only the JSON and make it available for you to select further in your connector as shown below;

Setting Up JSON Extractor Fromatter

Go to Connector -> Formatter -> Select -> Data Parser then select - JSON Extractor and copy and paste the output text from the ChatGPT API response then give any number to store the output variable and click on Test, you see a JSON structure as output then system mapped the JSON structure as shown below

After mapping the JSON structure with sample data, always replace it with the dynamic output from the ChatGPT as sample output is required only once for mapping the JSON structure with the connector

Last updated