diff options
| author | Houyhnhnm <hykusb@bitmai.la> | 2018-06-02 21:51:53 +0200 |
|---|---|---|
| committer | Houyhnhnm <hykusb@bitmai.la> | 2018-06-02 21:51:53 +0200 |
| commit | 8f2251a175d8d52edd12d62168c7c0e795be6146 (patch) | |
| tree | faedd791aa3dac3cc7480dade27c0165ee233b91 /diagram.py | |
| parent | 69eb369f73f0a64898246677d40abd2f604bcb7c (diff) | |
add phonology, syntax stubs
Diffstat (limited to 'diagram.py')
| -rw-r--r-- | diagram.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/diagram.py b/diagram.py new file mode 100644 index 0000000..6401469 --- /dev/null +++ b/diagram.py @@ -0,0 +1,23 @@ +from binarytree import * + +class Diagram(object): + """represents a syntactic structure (wrapper for binary tree) + """ + def __init__(self, height=3, size=None): + self.tree = tree(height=height) + if isinstance(size, int): + if size>height and size<((2^(height+1))-1): + while self.tree.size != size: + self.tree = tree(height=height) + else: + # raise NodeNotFoundError('no node to delete at index {}') + print('syntax diagram impossible for height'+height+'and size'+size) + + def print(self): + self.tree.pprint(index=True, delimiter='\'') + +''' +# example +dee = Diagram() +dee.print() +'''
\ No newline at end of file |