Skip to content

Latest commit

 

History

History
75 lines (51 loc) · 2.07 KB

README.md

File metadata and controls

75 lines (51 loc) · 2.07 KB

bracket-to-tikz-qtree

A bracketed text to tikz-qtree format converter.

This tool provides users with automatic conversion froma a bracketed text to the corresponding tikz-qtree format. The bracketed text format is widely used to represent a phrase structure tree in natural language processing such as the data format in Penn Treebank and output data format of statistical parsers (e.g., Stanford parser and Berkeley parser).

The code is known to work on Linux and OS X.

Software Requirements

  • Python 2.6 or later
  • pdfTeX (pdfLaTeX) [optional]

Note that to run this tool, there is no need to install the code and additional Python packages. However, tikz-qtree package is required when you want to compile the generated latex files with this converter.

Usage

$ ./bracket_to_tikz_qtree.py [options] FILE

or

$ ./bracket_to_tikz_qtree.py [options] [FILE] -

Please note that you need to prepare for the input file FILE which contains bracket texts that you want to convert to the tikz-qtree format.

Use pdfLaTeX to export PDF

If you specify the option --enable-pdf, pdf file(s) will be generated by executing pdflatex internally.

$ ./bracket_to_tikz_qtree.py --enable-pdf FILE

Please see -h or --help for all possible options.

An example

$ cat sample/sample.parse | ./bracket_to_tikz_qtree.py | pdflatex

sample output

Data format

under construction.

Here is a sample bracketed text:

(S
  (NP (NNP International) (NN terrorism))
  (VP (VBZ is)
    (NP
      (NP (DT a) (JJ grave) (NN threat))
      (PP (TO to)
        (NP (NN world) (NN peace)
          (CC and)
          (NN security)))))
  (. .))

License

This code is distributed under the New BSD License. See the file LICENSE.