Creating filter flow for places with the same name

Hey everyone,

The city lexicon from Cognigy is pretty huge, and we wanted a local German variant with all German cities. The issue with German cities is that multiple states may have a city of the same name or there are cities with add-ons, such as "Weiding Landkreis Cham" and "Weiding Landkreis Schwandorf". The add-ons are also not consistent, they can just be "Schwaben", "Oberpfalz" or at river so-and-so. Some names may appear multiple times in one state and never in another, others may appear in multiple states.

While it is possible to plug-in an API that gathers the city code from the user, not everyone knows a city code by heart and I think having to google the code breaks the experience. Using a Google Maps API also yields only the first city Google finds, so far.

So far, I've done as the Cognigy city lexicon and slotted all city names with "city", but also included the state where it's located. What I want to do is create a filter whenever the system recognizes a city name that could apply to more than one, as users usually won't write out the entire official name.

Now, I'm wondering how to implement the filter. Do I create one keyphrase entry for "Weiding" and include "Weiding Landkreis Cham" and "Weiding Landkreis Schwandorf" as Synonyms including all ways to spell them, while also including all states in the slots (as I've done so far)? I fear this method might be ruined as soon as I add different spellings for cities which appear just once, as I imagine I would have filtered by amount of synonyms found. Or do I include each location as single keyphrase and somehow include a marker in the data field (I'm no coder, so I'm pretty lost on that)?

Thank you for any input!

 

Didn't find what you were looking for?

New post
Was this post helpful?
0 out of 0 found this helpful

Comments

1 comment

  • This is a very complex problem.
    Using the data field in the lexicon is not really a good fit here, because you cannot use nested objects or arrays there.
    While it could work, it can be very time consuming.

    I would probably go about it like this: First you would first make a keyphrase for every unique city that is as specific as it needs to be. Next you create a keyphrase that can point to all of the variants and collect the synonyms (only!) there.
    Next, if an unspecific city name is recognized (maybe you can use the data field here to sort them into "specific" and "unspecific") you can do an API call to the Lexicon and filter for all the Keyphrases that feature the users input and then build a response programmatically.

    This will need code, of course, but doing it any other way is just not really scalable!

    0

Please sign in to leave a comment.