2323
2424
2525class TextModeTrees (BaseWriter ):
26- """An ASCII pretty printer of dependency trees.
26+ r """An ASCII pretty printer of dependency trees.
2727
2828 .. code-block:: bash
2929
@@ -110,7 +110,7 @@ class TextModeTrees(BaseWriter):
110110 │ ╰─┶ boxer NOUN acl:relcl
111111 ╰─╼ . PUNCT punct
112112
113- Some non-projective trees cannot be printed witout crossing edges.
113+ Some non-projective trees cannot be printed without crossing edges.
114114 TextModeTrees uses a special "bridge" symbol ─╪─ to mark this::
115115
116116 ─┮
@@ -123,17 +123,17 @@ class TextModeTrees(BaseWriter):
123123 (not file or pipe), each node attribute is printed in different color.
124124 If a given node's MISC contains any of `ToDo`, `Bug` or `Mark` attributes
125125 (or any other specified in the parameter `mark`), the node will be highlighted
126- (by reveresing the background and foreground colors).
126+ (by reversing the background and foreground colors).
127127
128128 This block's method `process_tree` can be called on any node (not only root),
129129 which is useful for printing subtrees using ``node.draw()``,
130130 which is internally implemented using this block.
131131
132132 For use in LaTeX, you can insert the output of this block (without colors)
133- into \b egin{verbatim}...\end{verbatim}, but you need to compile with pdflatex (xelatex not supported)
134- and you must add the following code into the preambule ::
133+ into `` \begin{verbatim}...\end{verbatim}`` , but you need to compile with pdflatex (xelatex not supported)
134+ and you must add the following code into the preamble ::
135135
136- \\ usepackage{pmboxdraw}
136+ \usepackage{pmboxdraw}
137137 \DeclareUnicodeCharacter{256D}{\textSFi} %╭
138138 \DeclareUnicodeCharacter{2570}{\textSFii} %╰
139139
@@ -149,36 +149,38 @@ def __init__(self, print_sent_id=True, print_text=True, add_empty_line=True, ind
149149 """Create new TextModeTrees block object.
150150
151151 Args:
152- print_sent_id: Print ID of the tree (its root, aka "sent_id") above each tree?
153- print_sentence: Print plain-text detokenized sentence on a line above each tree?
154- add_empty_line: Print an empty line after each tree?
155- indent: Number of characters to indent node depth in the tree for better readability.
156- minimize_cross: Minimize crossings of edges in non-projective trees?
157- Trees without crossings are subjectively more readable, but usually
158- in practice also "deeper", that is with higher maximal line length.
159- color: Print the node attribute with ANSI terminal colors?
160- Default = 'auto' which means that color output only if the output filehandle
161- is interactive (console). Each attribute is assigned a color (the mapping is
162- tested on black background terminals and can be changed only in source code).
163- If you plan to pipe the output (e.g. to "less -R") and you want the colors,
164- you need to set explicitly color=1, see the example in Synopsis.
165- attributes: A comma-separated list of node attributes which should be printed. Possible
166- values are ord, form, lemma, upos, xpos, feats, deprel, deps, misc.
167- print_undef_as: What should be printed instead of undefined attribute values (if any)?
168- print_doc_meta: Print `document.meta` metadata before each document?
169- print_comments: Print comments (other than sent_id and text)?
170- print_empty: Print empty nodes?
171- mark: a regex. If `re.search(mark + '=', str(node.misc))` the node is highlighted.
172- If `print_comments and re.search(r'^ %s = ' % mark, root.comment, re.M)`
173- the comment is highlighted.
174- Empty string means no highlighting. Default = 'ToDo|ToDoOrigText|Bug|Mark'.
175- marked_only: print only trees containing one or more marked nodes/comments. Default=False.
176- hints: use thick-marked segments (┡ and ┢) to distinguish whether a given node precedes
177- or follows its parent. Default=True. If False, plain ├ is used in both cases.
178- layout: 'classic' (default) shows word attributes immediately next to each node,
179- 'compact' never print edges after (right to) words even in non-projectivities,
180- 'align-words' as 'compact' but all first attributes (forms by default) are aligned,
181- 'align' as 'align-words' but all attributes are aligned in columns.
152+ print_sent_id: Print ID of the tree (its root, aka "sent_id") above each tree?
153+ print_text: Print plain-text detokenized sentence on a line above each tree?
154+ add_empty_line: Print an empty line after each tree?
155+ indent: Number of characters to indent node depth in the tree for better readability.
156+ minimize_cross: Minimize crossings of edges in non-projective trees?
157+ Trees without crossings are subjectively more readable, but usually
158+ in practice also "deeper", that is with higher maximal line length.
159+ color: Print the node attribute with ANSI terminal colors?
160+ Default = 'auto' which means that color output only if the output filehandle
161+ is interactive (console). Each attribute is assigned a color (the mapping is
162+ tested on black background terminals and can be changed only in source code).
163+ If you plan to pipe the output (e.g. to "less -R") and you want the colors,
164+ you need to set explicitly color=1, see the example in Synopsis.
165+ attributes: A comma-separated list of node attributes which should be printed. Possible
166+ values are ``ord``, ``form``, ``lemma``, ``upos``, ``xpos``, ``feats``, ``deprel``, ``deps``, ``misc``.
167+ print_undef_as: What should be printed instead of undefined attribute values (if any)?
168+ print_doc_meta: Print ``document.meta`` metadata before each document?
169+ print_comments: Print comments (other than ``sent_id`` and ``text``)?
170+ print_empty: Print empty nodes?
171+ mark: A regex pattern. If ``re.search(mark + '=', str(node.misc))`` matches, the node is highlighted.
172+ If ``print_comments`` and ``re.search(r'^ %s = ' % mark, root.comment, re.M)`` matches,
173+ the comment is highlighted. Empty string means no highlighting.
174+ Default = ``'(ToDo|ToDoOrigText|Bug|Mark)'``.
175+ marked_only: Print only trees containing one or more marked nodes/comments. Default ``False``.
176+ hints: Use thick-marked segments (┡ and ┢) to distinguish whether a given node precedes
177+ or follows its parent. Default ``True``. If ``False``, plain ├ is used in both cases.
178+ layout: Tree layout style:
179+
180+ - ``'classic'`` (default): shows word attributes immediately next to each node
181+ - ``'compact'``: never print edges after (right to) words even in non-projectivities
182+ - ``'align-words'``: like ``'compact'`` but all first attributes (forms by default) are aligned
183+ - ``'align'``: like ``'align-words'`` but all attributes are aligned in columns
182184 """
183185 super ().__init__ (** kwargs )
184186 self .print_sent_id = print_sent_id
0 commit comments