Data Parser
Extract any data from Text
Last updated
Extract any data from Text
Last updated
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 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
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/
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;
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
The Replace Text action in Formatter is a powerful tool that allows you to modify and refine your data by replacing specific text. This feature is particularly useful for correcting or standardising text across a dataset.
How It Works:
Select Field to Format: Choose the field that contains the text you want to modify. You can either map an attribute from your data or manually enter the text you want to process.
Regular Expression Field: Enter the text or regular expression pattern that matches the text you want to replace. Regular expressions allow for more complex and flexible text matching if needed.
Replace Text Field: Specify the text that you want to use as the replacement. This is the new text that will replace occurrences of the matched text or pattern from the Regular Expression field.
In a customer database, you have Indian phone numbers recorded with a leading "0" (e.g., “0123456789”), and you want to replace that leading "0" with "91" (e.g., “91123456789”).
Select Field to Format: Choose the field that contains the Indian phone numbers.
Regular Expression Field: Enter the following regular expression pattern to match phone numbers starting with "0":
Replace Text Field: Enter 91 as the replacement text. This will replace the leading "0" with "91".
Store Converted Result: Name the field where the updated phone numbers will be stored, such as “Updated Phone Number.”
The Replace Text action will convert phone numbers from “0123456789” to “91123456789,” replacing the leading "0" with "91" across your dataset.
The Replace Multiple Texts allows you to modify and refine your data by replacing multiple specific texts simultaneously. This feature is particularly useful for correcting or standardising multiple texts across a dataset in one step, saving time and ensuring consistency.
Select Field to Format: Choose the field that contains the text you want to modify. You can either map an attribute from your data or manually enter the text you want to process.
Regular Expression Field: Enter multiple regular expression patterns separated by commas to match the texts you want to replace. Ensure that each pattern corresponds precisely to the text you want to find and replace.
Replace Text Field: Enter the replacement texts separated by commas. The order of the replacements must match the order of the patterns in the Regular Expression field.
Store Converted Result: Give a name to store the updated texts.
For Example; Suppose you have a dataset containing customer notifications, and you need to correct common typographical errors to ensure professional communication.
Select Field to Format: Choose the field containing the text with typographical errors. For example, Your orddddder has shipped. Please wait for the delvihery.
Regular Expression Field: Enter orddddder,delvihery.
Replace Text Field: Enter order,delivery.
Store Converted Result: Name the new field “Corrected Customer Notification” to store the updated texts.
The Replace Multiple Texts action will update all specified errors in the sentence:Your orddddder has shipped. Please wait for the delvihery. , ensuring that each instance of "orddddder" and "delvihery" is replaced with "order" and "delivery", respectively, across your dataset. This correction improves the clarity and professionalism of your customer notifications.