Can we use ChatGPT to identify if an inappropriate word was mentioned in a text entry? Or would we have to create the entire list and compare if the text entry includes any of the inappropriate words?
We can definitely use ChatGPT for this. You can create a prompt in a template column.
Could you give me a little more guidance on this? Should it also be on an Action Button so when someone submits their text it can reject if it contains inappropriate words? Or should it be in the data editor where it can flag the text?
Maybe not in a native form, but I assume you can have a list of inappropriate words, comma-delimited, then split that into an array.
For your input, first strip all non-alphabetical characters (i.e comma, slash, period etc), then split them into an array with the delimiter being space.
Make a relation between the two. If the relation is not empty, that should signal at least one inappropriate word in the text entry value.
Thanks! Do you have an easy recommendation to strip all non-alphabetical characters? I looked at the Text Plugins but didnt see any that fit.
You can do it like this in a JavaScript column.
const regex = /[a-zA-Z]+/g;
const matches = p1.match(regex);
return matches ? matches.join('') : '';
I used p1 to point to my text column. However, it removes all spaces from the sentance as well as the non-alpha chars. Thus if I split that using a space, it just does individual letters
Sorry, it should be like this.
const regex = /[a-zA-Z\s]+/g;
const matches = p1.match(regex);
return matches ? matches.join('').toLowerCase() : '';
Input:
Ham turducken ribeye, turkey short ribs pig venison drumstick shankle shoulder flank capicola pork chop. Pancetta landjaeger t-bone tail. Flank pork chop ham leberkas pork pig bacon ribeye cow capicola chuck swine pork loin chicken. Short ribs ball tip landjaeger chislic kevin hamburger, chuck beef ribs meatball pork chop pig tenderloin strip steak shank.
Output:
ham turducken ribeye turkey short ribs pig venison drumstick shankle shoulder flank capicola pork chop pancetta landjaeger tbone tail flank pork chop ham leberkas pork pig bacon ribeye cow capicola chuck swine pork loin chicken short ribs ball tip landjaeger chislic kevin hamburger chuck beef ribs meatball pork chop pig tenderloin strip steak shank.
I remember you should make it all lowercase so the relation can work on the same “scale”, so I added the toLowerCase part.
worked perfectly, thank you sir!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.