Dave Cinege Git Repo thesaurus / 52c3784 README.rst
52c3784

Tree @52c3784 (Download .tar.gz)

README.rst @52c3784view markup · raw · history · blame

Python Thesaurus and ThesaurusCfg

Copyright (c) 2012-2019 Dave Cinege. All rights reserved.

See the end of this file for further copyright and license information

Quick start

$ python thesauruscfg_sample.py

Then review thesauruscfg_sample.py and thesauruscfg_sample.cfg and you will get an idea what Thesaurus and ThesaurusCfg are all about.

General Information

Source code:https://git.cinege.com//thesaurus
Telegram Group:https://t.me/PythonThesaurus

At the momement there is no email list, wiki, etc.

About

Thesaurus is a mapping data type with key recursion and attribute aliasing. It is a subclass of dict() and compatible as a dictionary replacement baring where key path recursion may take place.

Thesaurus prefers to be imported and called as thes() in the same way you would use dict(). Thesaurus likes to think of itself as a Python data type primative that should be used along side of dict(), similar to the relationship between list() and tuple(); they are overlappingly similar but serve different purposes and diverge to incompatibilities. Thesaurus is currently content with not having it's own data type tokens. Hopefully so are you.

ThesaurusExtended is a subclass of Thesaurus providing additional usablity methods.

ThesaurusCfg is a subclass of ThesaurusExtended providing a configuration file parser and per key data coercion methods.

The Thesaurus family works with Python 2.6+ to 3.8+.

Currect State of Code - 2019-11-13

Thesaurus first came about in December 2012. It has gone through a total of maybe 6 complete re-writes. In mid 2019 I think I finally got it right with the implemintation of Keypath's and also the creation of ThesaurusCfg, something I've been wishing I've had to use for myself for at least the last 4 years.

The current version you will find here has recently had the recent addition of Keypaths and while it is quite usable might still have a few bugs to iron out.

Additonally parts should be cleaned and reimplemented now that Keypath's have been implemented. If you are reviewing the code, this will likely stand out. With that said, please remember that at this stage few things have been done by accident. There are certainly section that can be cleaned for readablity, however they are this way, on purpose, for performance.

ThesaurusCfg is quite new. It works. I have a version of it frozen in production code. But it's not had the maturity of Thesaurus in practise and requires a more thorough re-write.

I'm putting this code out now to gain feedback to finalize for a proper release. As such, both modules are very subject to change at this time. Specifically I have the following decisions to make:

  • Finalize name conventions. Use set_path() or setpath()?

  • Finalize specialtiy method names, Are merge(), mesh() and screen() good names that make sense? I am struggling with the ThesaurusExtended method names myself.

  • Resolve Thesaurus's schizophrenia :: v = t['a.b.c'] # This recurses t['a.b.c'] = v # This does not. Use set_path()

    I want to be comfortable this feels naturale to others or make changes.

  • Review how I do recursive copy/deepcopys.

  • Decide how to properly handle copying ThesaurusCfg coercion methods.