Giter Site home page Giter Site logo

bratviz's Introduction

bratviz

This is a simple python wrapper around the brat visualization tool.

It currently works for the CoNLL 2012 format and can visualize SRL and coreference links. You can subclass the Reader class to write your own file readers and visualize other formats as well.

Usage

To see all options

$ python run.py --help
usage: run.py [-h] -f FILE_PATH [-n NUM_SENT]

Create brat visualizations from file

optional arguments:
  -h, --help            show this help message and exit
  -f FILE_PATH, --file_path FILE_PATH
                        Path to the file to visualize.
  -n NUM_SENT, --num_sent NUM_SENT
                        Number of sentences to parse

To visualize the first 100 sentences from a .conll file

python run.py -f dev.english.v4_gold_conll -n 100

Parsing files

Every Reader class is expected to have a read method which returns 3 things:

  • text: text to visualize (usually a sentence).
  • ents: a list of constituents/mentions. It should have the following format
[
  ['ent_id', '', [[start_char_idx, end_char_idx]]], 
  ...
]
  • rels: a list of relation links between 2 ents. It should have the following format
[
  ['rel_id', 'rel_tag', [['head', 'ent_id_1'], ['dep', 'ent_id_2']]], 
  ...
]

The brat download script and HTML templates are taken from https://github.com/gabrielStanovsky/brat-visualizer

bratviz's People

Contributors

rahular avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.