GithubHelp home page GithubHelp logo

josemreis / docmatch-annotator Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1 MB

A simple document matching annotation framework using only csv files, a text editor, and a terminal window

Python 100.00%

docmatch-annotator's Introduction

docmatch-annotator

This is a simple annotation tool for document matching. I wrote this CLI tool to avoid resorting to annotation tools which either have high set up costs or that are more focused in other (more complex) NLP tasks. It uses gedit to display document dyads, a terminal window to annotate whether they match, and exports the results into a csv file.

How it looks

The tool can be configured via the following command line arguments

usage: docmatch_annotator.py [-h] [-i PATH_TO_INPUT_FILE] [-o PATH_TO_OUTPUT_FILE]
                            [-tt TARGET_DOC_TEXT_COLNAME] [-rt REFERENCE_DOC_TEXT_COLNAME]
                            [-ti TARGET_DOC_ID_COLNAME] [-ri REFERENCE_DOC_ID_COLNAME]
                            [-m INCLUDE_METADATA] [-c CONFIG_FILE]

A gedit based annotation tool CLI.

optional arguments:
  -h, --help            show this help message and exit
  -i PATH_TO_INPUT_FILE, --input-csv-file PATH_TO_INPUT_FILE
                        Input csv file containing the documents to annotate.
  -o PATH_TO_OUTPUT_FILE, --output-csv-file PATH_TO_OUTPUT_FILE
                        Output csv file following the annotation
  -tt TARGET_DOC_TEXT_COLNAME, --target-doc-text-colname TARGET_DOC_TEXT_COLNAME
                        Name of the column containing the text of the target document
  -rt REFERENCE_DOC_TEXT_COLNAME, --reference-doc-text-colname REFERENCE_DOC_TEXT_COLNAME
                        Name of the column containing the text of the reference document
  -ti TARGET_DOC_ID_COLNAME, --target-doc-id-colname TARGET_DOC_ID_COLNAME
                        Name of the column containing the id of the target document
  -ri REFERENCE_DOC_ID_COLNAME, --reference-doc-id-colname REFERENCE_DOC_ID_COLNAME
                        Name of the column containing the id of the reference document
  -m INCLUDE_METADATA, --csv-include-metadata INCLUDE_METADATA
                        Comma delimited list of metadata columns from the input file to keep in the
                        output file as well as to display in the header of the gedit window of the
                        docs, e.g. 'date,nchar,language'
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Output csv file following the annotation

Or, alternatively, via a config file saved in a json file like the one below.

{
    "path_to_input_file": "/home/jr/Desktop/test_input.csv",
    "path_to_output_file": "/home/jr/Desktop/test_output.csv",
    "target_doc_text_colname": "leading_paragraph_translated",
    "reference_doc_text_colname": "ruling_text",
    "target_doc_id_colname": "article_id",
    "reference_doc_id_colname": "case_id",
    "include_metadata": [
        "judgment_date",
        "date_published"
    ]
}

Usage

Using the config file above.

python3 docmatch-annotator -c "config.json.sample"

Using the CLI flags

python3 docmatch-annotator -i "/home/jr/Desktop/test_input.csv" -o "/home/jr/Desktop/test_output.csv" -tt "article_text" -rt "ruling_text" -ti "article_id" -ri "ruling_id" -m "judgment_date,date_published"

docmatch-annotator's People

Contributors

josemreis avatar

Watchers

 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.