new function find inverse op

Just a short one. "create inverse" was painfully slow, most of that is because of the O(n^2) for add_learn, and the long lists created by "inverse-supported-ops". So, speed up was, we specify what ops we want inverse for, side-stepping the expensive ones. If you still want full inverse, we can still run "create inverse", but now, most of the time this is sufficient:
find-inverse[op]
Here is a short example:
sa: load fred-sam-friends.sw
sa: dump
----------------------------------------
|context> => |context: friends>

friends |Fred> => |Jack> + |Harry> + |Ed> + |Mary> + |Rob> + |Patrick> + |Emma> + |Charlie>

friends |Sam> => |Charlie> + |George> + |Emma> + |Jack> + |Rober> + |Frank> + |Julie>
----------------------------------------

sa: find-inverse[friends]
sa: dump
----------------------------------------
|context> => |context: friends>

friends |Fred> => |Jack> + |Harry> + |Ed> + |Mary> + |Rob> + |Patrick> + |Emma> + |Charlie>

friends |Sam> => |Charlie> + |George> + |Emma> + |Jack> + |Rober> + |Frank> + |Julie>

inverse-friends |Jack> => |Fred> + |Sam>

inverse-friends |Harry> => |Fred>

inverse-friends |Ed> => |Fred>

inverse-friends |Mary> => |Fred>

inverse-friends |Rob> => |Fred>

inverse-friends |Patrick> => |Fred>

inverse-friends |Emma> => |Fred> + |Sam>

inverse-friends |Charlie> => |Fred> + |Sam>

inverse-friends |George> => |Sam>

inverse-friends |Rober> => |Sam>

inverse-friends |Frank> => |Sam>

inverse-friends |Julie> => |Sam>
----------------------------------------
Anyway, main point is this is much faster (and cleaner) than the old "create inverse". And of course is a brother to find-unique[op].

That's it for this post.


Home
previous: announcing command line guess file name tool
next: towards processing all of wikipedia

updated: 19/12/2016
by Garry Morrison
email: garry -at- semantic-db.org