in reply to Re: retain longest multi words units from hash
in thread retain longest multi words units from hash

Thank you for the suggestion (PS: sorry for having missed the comma!). This approach is interesting, still doesn't solve the problem of recursiveness, i.e. deleting 2 units words in a 3 multi words unit. Or, for what it matters, of a 3 multi words unit in a 4 multi words unit.

Probably:

This approach should work, but I am not sure if it make sense in terms of performances with big hashes

  • Comment on Re^2: retain longest multi words units from hash

Replies are listed 'Best First'.
Re^3: retain longest multi words units from hash
by LanX (Saint) on Jul 28, 2018 at 12:25 UTC
    > This approach should work, but I am not sure if it make sense in terms of performances with big hashes

    I had the same idea, performance depends on the nature of your data. After sorting you'd have O(n²) i.e. (n**2 -n)/2  n *(n+1) * 1/2 == (n**2 + n)/2 comparisons from smaller in bigger keys.*

    NB: you need to specify what words "are" and be careful not to delete "automation tech" because of "automation technology"

    In my approach you'd calculate all subgroups of key (5 for "automation technology process") and delete them.

    Performance depends then on the number of long groups you have.

    As already mentioned, I don't know the nature of your data ²...

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    *) this can be improved by preparing a lookup table for single words, "automation technology" would listed for "automation" and "technology", so as soon you see "automation technology process" you only need to check the entries in the lookup table.

    ²) when looking for algorithms check the mathematics of Posets

    UPDATE

    I think we had the same question here already, better check the archives.