An open API service indexing awesome lists of open source software.

https://github.com/yohasebe/rsyntaxtree

Syntax tree generator for linguistic research
https://github.com/yohasebe/rsyntaxtree

linguistics ruby rubynlp svg syntax-tree visualization

Last synced: about 2 months ago
JSON representation

Syntax tree generator for linguistic research

Awesome Lists containing this project

README

        

**RSyntaxTree** is a graphical syntax tree generator for linguistic research

## Documentation

Documentation is currently available in the following languages:

- [Documentation in English](https://yohasebe.github.io/rsyntaxtree/documentation)
- [日本語ドキュメント](https://yohasebe.github.io/rsyntaxtree/documentation_ja)

- [Example Gallery](https://yohasebe.github.io/rsyntaxtree/examples)

## Web Interface

See updates and a working web interface available at .

You can run RSyntaxTree's web interface on your local machine using Docker Desktop. See [RSyntaxTree Web UI](https://github.com/yohasebe/rsyntaxtree_web)

## Examples

See [RSyntaxTree Example Gallery](https://yohasebe.github.io/rsyntaxtree/examples) page for examples for

- Generative Grammar
- Combinatory Categorial Grammar
- Head-Driven Phrase Structure Grammar
- Cognitive Grammar
- Construction Grammar
- Pragmatics
- Phonology
- etc.

**NOTE**: Some tree structures in the example gallery are experimental in the sense that they are not drawn according to conventions of the field.

**Input text**

```text
[S
[NP |R|<>SyntaxTree]
[VP
[V generates]
[NP
[Adj #\+multilingual\
\+beautiful]
[NP syntax\
trees]
]
]
]
```

**Output (PNG or SVG)**

## Installation

```
gem install rsyntaxtree
```

### macOS Installation Notice

**Important for macOS users:** If you are installing the RSyntaxTree gem directly on macOS, you might encounter build errors for some native extensions (specifically for `gobject-introspection`, `cairo-gobject`, and `gio2`). These errors occur due to macOS linker requirements for dynamic symbol resolution. To work around this issue, please run the following commands in your terminal **before** installing RSyntaxTree:

```bash
gem install gobject-introspection -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
gem install cairo-gobject -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
gem install gio2 -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
```

After executing these commands, you can install RSyntaxTree normally:

```bash
gem install rsyntaxtree
```

Alternatively, if you prefer a smoother installation process, consider using the [Docker image](https://hub.docker.com/r/yohasebe/rsyntaxtree) or the [web interface](https://yohasebe.com/rsyntaxtree).

## Usage

For the web interface, see Usage section of .

For the command-line interface, type `$rsyntaxtree -h` after installation. Here's what you get:

```text
RSyntaxTree, (linguistic) syntax tree generator written in Ruby.

Usage:
1) rsyntaxtree [options] "[VP [VP [V set] [NP bracket notation]] [ADV here]]"
2) rsyntaxtree [options] "/path/to/text/file"
where [options] are:
-o, --outdir= Output directory (default: ./)
-u, --outfilename= Output file base name (default: syntree)
-f, --format= Output format: png, gif, jpg, pdf, or svg (default: png)
-l, --leafstyle= visual style of tree leaves: auto, triangle, bar, or nothing (default: auto)
-n, --fontstyle= Font style (available when ttf font is specified): sans, serif, cjk, mono (default: sans)
-t, --font= Path to a ttf font used to generate tree (optional)
-s, --fontsize= Size: 8-26 (default: 16)
-i, --linewidth= Size: 1-5 (default: 1)
-v, --vheight= Connector Height: 0.5-5.0 (default: 2.0)
-c, --color= Color text and bars: modern, traditional, or off (default: modern)
-y, --symmetrize= Generate radically symmetrical, balanced tree: on or off (default: off)
-r, --transparent= Make background transparent: on or off (default: off)
-p, --polyline= draw polyline connectors: on or off (default: off)
-d, --hide-default-connectors= make default connectors transparent: on or off (default: off)
-h, --help This is a custom help message
-e, --version Print version and exit
```

See the [documentation](https://yohasebe.github.io/rsyntaxtree/documentation) for more detailed info about the syntax.

## References

Please use the following BibTeX entry when referring to RSyntaxTree.

```
@misc{rsyntaxtree_2024,
author = {Yoichiro Hasebe},
title = {RSyntaxTree: A graphical syntax tree image generator}
url = {https://yohasebe.com/rsyntaxtree},
year = {2024}
}
```

## Development

For the latest updates and downloads please visit

## Author

Yoichiro Hasebe

## License

RSyntaxTree is distributed under the [MIT License](http://www.opensource.org/licenses/mit-license.php).