On 26/06/2019 11:34, mhysnm1...@gmail.com wrote:

> The reason why I am using the tree structure like a file system. Is I am
> going to attempt to write some code to walk down the tree based upon certain
> conditions which I am still working on. Based upon the test conditions will
> determine how I move up and down the tree.

Defining the test conditions is the hard part of building and
searching any tree. That's why binary trees are so much easier,
the usual comparison (<,=,>) apply. When you have multiple subtrees
your test function must return a selection index telling you which
subtree to go down.


> The high picture is I am trying to build a dynamic search functionality
> based upon keywords in the text. Like a store name or organisation name. The
> text has been cleaned up before applying it to the tree based upon text or
> punctuation and digits that are not required. Such as receipt  numbers,
> postcodes, braces, etc. This is mostly done. I am hoping the tree structure
> will help in finishing the search capability. I will only know once I have
> tried it. If not, then I will look for another method.

One thing to consider is an LDAP directory.
It is a tree structure that acts like nested dictionaries
and is specifically designed for handling hierarchies.
Specifically organisational hierarchies, but any kind
will do. It what's at the heart of most corporate Directory
systems - such an Microsoft Exchange.

And the good news is that there are open source options
available and Python modules to work with them. but it might
be overkill for your project. But worth a quick Google and
Wikipedia browse...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to