Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicGrobol committed Oct 28, 2022
1 parent 6428375 commit 6e2de7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 4 additions & 1 deletion ginger/libtreerender.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def tikz_dependency(tree: libginger.Tree) -> str:
# TODO: For extra display prettiness, a node should be able to have both a forward and a backward
# outgoing arrow at the same level. Same for nodes that have an incoming and an outgoing backward
# (resp. forward) arrow (Possibly too tricky to code wrt the benefits)
# TODO: center arrows
# TODO: rework this by pre-planning arrows before drawing with conflict resolution
def ascii_art(tree: libginger.Tree) -> str:
"""
Return an ASCII-art representation of the dependency tree.
Expand All @@ -179,7 +181,7 @@ def ascii_art(tree: libginger.Tree) -> str:

# The first line above the words is easy: only arrow heads (every word) and butts (for
# non-leaves) Arrow heads are over the first character (because every token has at least one)
# Arrow butts (if existent) are over the second, or, inthe case of single-letter tokens, over
# Arrow butts (if existent) are over the second, or, in the case of single-letter tokens, over
# the first following space. This part could be integrated with the rest of the code (using
# `relations`) but let's keep it here to keep the rest (c)leaner.
arrow_ends = []
Expand Down Expand Up @@ -229,6 +231,7 @@ def fill_until(index, fill_char):

while relations:
# Get the next non-crossing relation on this line
# FIXME: this is too strict
index, current_relation = next(
((i, r) for i, r in enumerate(relations) if min(r) >= current_token),
(None, None),
Expand Down
11 changes: 5 additions & 6 deletions ginger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def stream_multi_output(
stream.write(file_content)


epilog = """## Input formats:
epilog = """Input formats:
The input must be either the path to an existing file or `-` for standard input. The data that
it contains must be in one of the following formats:
Expand All @@ -72,9 +73,7 @@ def stream_multi_output(
- `mate_gold` Alias for `conll2009_gold`, used by mate-tools
- `mate_sys` Alias for `conll2009_sys`, used by mate-tools
## Output formats
### Text formats
Text formats:
To use these formats, the output destination must be either a file and thus must not be the path to
an existing directory, or `-` for the standard output.
Expand All @@ -84,7 +83,7 @@ def stream_multi_output(
- `tikz` TikZ code. Use the `positioning`, `calc` and `shapes.multipart` tikz libraries
- `tikz-dependency` LaTeX code for the `tikz-dependency` package
### Image formats
Image formats:
To use these formats, the output destination must be either a directory and thus must not be the
path of an existing file, or `-` for the standard output, in which case the byte streams
Expand All @@ -95,7 +94,7 @@ def stream_multi_output(
- `svg`
- `pdf`
## Example
Example:
`ginger -f conllu input.conll -t tikz output.tex`"""

Expand Down

0 comments on commit 6e2de7b

Please sign in to comment.