Detect words within content ex: Sam - name (detected as name)


I’m looking for a way to detect words as categories for example if a word is found as Sam, Sami, Tom, Thomas, etc (all these are human names) the word will get highlighted as a word and maybe the bg color for that specific word will change to ex: red.

Is there any way to implement this in bubble?

This would for sure be an AI API integration.

You could technically just upload a csv of a list of names and then search through all the words in the text and see if they match any of the names but that search will likely be slow depending on how many names you want to match. Also, this would not be able to differentiate names that are also words, like Chase, or Patty. That wouldn’t happen super often but would technically still be an issue.

For more intelligent implementations, GPT would definitely be an option but you would need to do some prompt engineering to get it to output in a way that bubble can read it and highlight the correct words. If I was building this out, I would almost certainly be using some custom javascript to bridge the gap between the GPT output and bubble.

Surely, I thought that too, and if multiple detecting categories are there the problems increase.

I forgot Js years ago, any suggestions on implementing this without that?
or any guidance implementing with JS?

@paul29 imagine I detected the word in “Sammy (name)” pattern, so how do I use this to make changes at the output to highlight?

I’m sure its possible to figure out how to implement this functionality with just bubble but it likely won’t be pretty. The tricky part is getting bubble to correctly process the response from GPT. It techinically can be done with a few of “:extract with regex” expressions but LLM’s are non-deterministic so any slighlt deviation from the regex pattern you’ve programmed in will break your whole thing.
If I was implementing I wouldn’t even attempt to do it without JS unless it was as specific requirement from one of my clients. It’s just so much easier to do this with code.

In terms of guidance implementing with JS, I don’t really know what to tell you. Highly unlikely there will be a tutorial on something super similar that you can adapt. This is a pretty custom requirement. Either your try to refresh your memory or you hire someone to program it for you.

To highlight the names, I remember looking at a highlight plugin once before but it didn’t do exactly what I wanted so I implemented my own custom highlighting solution in JS.

This topic was automatically closed after 70 days. New replies are no longer allowed.