Order of flattened Keywords

Started by Tveloso, December 15, 2022, 05:00:14 AM

Previous topic - Next topic

Tveloso

This is pretty trivial, and maybe not worth the work needed to make the change...but I would like to see the flat keywords sort of represent the hierarchy of the Keywords from which they came.

Currently, when IMatch is configured to write path elements into the flat keywords, each hierarchical keywords is inspected in turn, and the elements of each are emitted, in order, as long as there is no duplication.  So we wind up with a mix of higher-level, and leaf node elements, within the flat keywords.

For example, a photo of Davie Jones, his daughter Jane, and her husband John, eating ice cream cones, might have these Hierarchical Keywords (the person record for Jane created two Keywords for her):

    People|Jones|Davie
    People|Jones|Jane
    People|Doe|Jane
    People|Doe|John
    Food|ice cream cone
    Object|furniture|table
    Object|furniture|chair

...and IMatch flattens these Keywords like this:
   
    Source Keywords           Flattened Keywords become
    People|Jones|Davie        People;Jones;Davie
    People|Jones|Jane         People;Jones;Davie;Jane
    People|Doe|Jane           People;Jones;Davie;Jane;Doe
    People|Doe|John           People;Jones;Davie;Jane;Doe;John
    Food|ice cream cone       People;Jones;Davie;Jane;Doe;John;Food;ice cream cone
    Object|furniture|table    People;Jones;Davie;Jane;Doe;John;Food;ice cream cone;furniture;table
    Object|furniture|chair    People;Jones;Davie;Jane;Doe;John;Food;ice cream cone;furniture;table;chair
    (Note: Object is configured with "Exclude in flat keywords = Yes")

...so we wind up with flat keywords that are a mix of higher-level, and leaf nodes:

    People;Jones;Davie;Jane;Doe;John;Food;ice cream cone;furniture;table;chair

It would be nice if IMatch would emit the flat keywords in the order of their levels in the hierarchy...(I guess this would require multiple iterations through the source keywords, instead of just one pass)...so the flat keywords would look like this instead:

    People;Food;furniture;Jones;Doe;ice cream cone;table;chair;Davie;Jane;John

So, now that I've finished writing this post, I'm thinking..."yeah, that's probably really not necessary".  But I do still like the idea, so I'll go ahead and post this, to see what others might think.
--Tony

thrinn

But the same flat keyword can appear multiple times, and at different levels of the hierarchy. For example, I know several people whose last names are also commonly used as first names. As an example, there might be a "Klaus Peter" and also a "Peter Klaus".

People|Klaus|Peter
People|Peter|Klaus

Then, it would still depend on the order of processing which would end up first. But if the order of flat keywords is not really reliable or deterministic, I can not see much benefit in the change.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Tveloso

Thank you Thorsten.  You make a valid point.

And having thought about it a little more, I'm not really happy with the "final result" flattened keywords in my request:

    People;Food;furniture;Jones;Doe;ice cream cone;table;chair;Davie;Jane;John

If I were going to manually order them, I would want something like this:

    People;Jones;Doe;Davie;Jane;John;furniture;table;chair;Food;ice cream cone

...so really a hybrid of what I originally asked for, and what IMatch already does.

So I guess that in order to achieve that, IMatch would first need to sort the Hierarchical Keywords, then iterate through each group separately, until all levels are exhausted, before moving on to the next Groups/Keywords.

But then that would result in the Food Keywords appearing first, and I would like to have the People Group first.  So now maybe IMatch needs to provide a "level precedence" parameter in the Thesaurus, for IMatch to sort by ahead of the Keyword value at the top level.  Out of control!
--Tony

Mario

Hierarchical keywords are maintained in the order in which you enter them in the KW panel.
When flattening, IMatch processes them in that order, breaking them up based on your settings.

The default is to write hierarchical keywords also to flat keywords, because this is what seems to work best. As far as I can tell, most users never change that setting or deal with flat keywords at all. Or change it to export the leaf keywords only, for simpler applications and web usage.

I estimate that adding more logic to the flattening process, user-defined preferences for sorting hierarchical keywords before flattening, re-ordering flattened keywords and all the UI elements, logic and documentation (plus adding all the stuff not immediately clear from the beginning) would require a couple of developer days + X.

Let's see how many likes this request gets.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook