Parse out names, addresses, complex fields using AI

We've had several clients working with memberships, who have a single name field with the full name of a person. And then they ask us to build a directory that is sorted by last name. This is a bit hard to do if there's a first name in front of it!

Names don't follow rules very well. Some have apostrophes in them, some have multiple words -- you can't just take the last word of a name and assume that's the last name, because often it just isn't.

I asked Perplexity AI for a list of names with these challenges, and it came up with a decent list:

  1. Jean-Luc D'Armand
  2. Isabella DeAngelo
  3. Maximilian Von Zeigeiser
  4. Aaliyah O'Connor
  5. Nia McAllister-Jones
  6. Pierre Leclercq
  7. Fiona Van der Meer
  8. Jaden O'Malley
  9. Sofia di Giovanni
  10. Liam Fitzpatrick-Smith
  11. Chloe D'Costa
  12. Hugo de la Cruz
  13. Maria Teresa Rodriguez-Sanchez
  14. Samuel St. Laurent
  15. Eliana Van der Linden
  16. Kieran O'Sullivan
  17. Amara N'Guessan
  18. Rachael LaFontaine
  19. Marcus de Souza
  20. Talia Quintero-Cruz

Faced with such a list, how do you get the correct last name?

This is a particularly good task for AIs. It's very difficult to code something to do this task correctly, but AIs handle it easily. And the AI module for Drupal can easily do this for you.

To make this work, you would have one field for the source -- the full name. And then for the first name and last name, you can use the AI Automators to extract the first name from the source field, and then the last name from the source field. 

It's also easy to do similar tasks for other complex fields: addresses, invoices, ingredients.

Bonus tip: See Marcus's video on using a Custom Field to parse out ingredients in a recipe, on the Workflows of AI site.

Add new comment

The content of this field is kept private and will not be shown publicly.

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <blockquote cite> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h1> <h2 id> <h3 id> <h4 id> <h5 id> <p> <br> <img src alt height width>
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.