parsing simple strings into trees
Project description
Tree Parser
A simple tree parser for trees in bracket notation written in python. For example the following code (with default values for fontdict
and textkwargs
explicitly specified)
from tree_parser import TreeParser
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1, figsize=(20, 10))
string = "[C[C[C[C[C][C[G7[Dm7][G7]][C]]][G[G[D7[Am][D7]][G]][G[D7[Am[CM7][Am]][D7]][G]]]][C[C[Bo7[Dm[C#o7][Dm]][Bo7]][C]][C[G7[Dm7[FM7][Dm7]][G7]][C [C][C[G7[FM7[C7][FM7]][G7[G7[F#o7][G7[Fm6][G7]]][G7[G7[G64][G7[G47][G7]]][G7[G47[G64[F#o7][G64]][G47]][G7]]]]][C[G7[C64[C7][C64]][G7]][C]]]]]]]]"
parser = TreeParser(string, True)
parser.plot(ax=ax, padding=1, fontdict={'fontsize': 12}, textkwargs={'bbox': {'facecolor': 'red', 'pad': 10}, 'style': 'italic'})
results in:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
treeparser-0.1.0.tar.gz
(1.6 kB
view hashes)
Built Distribution
treeparser-0.1.0-py3-none-any.whl
(13.9 kB
view hashes)
Close
Hashes for treeparser-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47a53a43d04c10ae13aca2138a402dc4e702372a876556705e3100a01f5b3810 |
|
MD5 | 48016f5d4f737989e7bb7d671a2977a3 |
|
BLAKE2b-256 | e82a7deace185c43444bc7b8a88041151d558a71d523bb9e7eb764f8922e7e29 |