Skip to content

Repository files navigation

rst-converter-service

Github Actions Build status
Docker image: ghcr.io/rst-workbench/rst-converter-service

REST API to convert between different Rhetorical Structure Theory file formats. It is built on top of the discoursegraphs library.

Supported Input Formats

original HILDA format

(Contrast[S][N]
  _!Although they did n't like it ,!_
  _!they accepted the offer . <P>!_)

adapted HILDA format

ParseTree('Contrast[S][N]', ["Although they did n't like it ,", 'they accepted the offer .'])

Supported Output Formats

  • dis
  • rs3
  • rstlatex (for embedding RST trees into LaTeX documents)
  • tree.prettyprint (ASCII-style tree)
  • svg (SVG image of an nltk Tree)
  • svg-base64 (base64 encoded SVG image of an nltk Tree)

Note: The old output format names svgtree and svgtree-base64 are deprecated aliases of svg and svg-base64. They still work, but responses are flagged with a Deprecation header and the aliases will be removed in a future release.

Installation

The simplest way to install the rst-converter-service is using Docker:

docker pull ghcr.io/rst-workbench/rst-converter-service:latest

Alternatively, build the image from source:

git clone https://github.com/rst-workbench/rst-converter-service.git
cd rst-converter-service/
docker build -t rst-converter-service .

Usage

To run the web service, type:

docker run -p 5000:5000 -ti ghcr.io/rst-workbench/rst-converter-service:latest

In another terminal, you can now convert RST files. To convert the file car-repair.rs3 from rs3 format to dis format, type:

curl -XPOST localhost:5000/convert/rs3/dis -F input=@car-repair.rs3
(Root
  (span 1 2)
  (Satellite
    (leaf 1)
    (rel2par background)
    (text
      _!I am having my car repaired in Santa Monica (1522 Lincoln Blvd.) this Thursday 19th._!))
  (Nucleus
    (leaf 2)
    (rel2par span)
    (text
      _!Would anyone be able to bring me to ISI from there by 5 pm please?_!)))

For "visualizing" the RST tree, you might try prettyprinted trees:

curl -XPOST localhost:5000/convert/rs3/tree.prettyprint -F input=@car-repair.rs3
                 background
        _____________|______________
       S                            N
       |                            |
I am having my               Would anyone be
car repaired in             able to bring me
 Santa Monica (                to ISI from
 1522 Lincoln                 there by 5 pm
  Blvd.) this                    please?
 Thursday 19th.

For a graphical rendering of the RST tree, use the svg output format:

curl -XPOST localhost:5000/convert/rs3/svg -F input=@car-repair.rs3 -o car-repair.svg

Here's what the conversion of short.rs3 from tests/fixtures/input looks like:

RST tree rendered as SVG

To see all supported input and output formats, type

curl localhost:5000/input-formats
["codra", "dis", "dplp", "hilda", "hs2015", "rs3"]

or

curl localhost:5000/output-formats
["dis", "rs3", "rstlatex", "svg", "svg-base64", "tree.prettyprint"]

Citation

If you use the rst-converter-service in your academic work, please cite the following paper:

Neumann, A. 2015. discoursegraphs: A graph-based merging tool and converter for multilayer annotated corpora. In Proceedings of the 20th Nordic Conference of Computational Linguistics (NODALIDA 2015), pp. 309-312.

 @inproceedings{neumann2015discoursegraphs,
   title={discoursegraphs: A graph-based merging tool and converter for multilayer annotated corpora},
   author={Neumann, Arne},
   booktitle={Proceedings of the 20th Nordic Conference of Computational Linguistics (NODALIDA 2015)},
   pages={309-312},
   year={2015}
 }

About

Convert between different Rhetorical Structure Theory file formats (Python library / command-line tool / web service).

Topics

Resources

Stars

9 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages