Skip to main content

A CLI for retrieving a corpus annotated with named entities from INCEpTION to an archived, reusable and versionable corpus.

Project description

inception2corpus-CLI

A CLI for retrieving a corpus annotated with named entities from INCEpTION instance to an archived and reusable corpus in context of any NER project.

This tool was created in the context of the NER4Archives project (INRIA/Archives nationales); it is adaptable and reusable for any other project under the terms of the MIT license.

Python Version License: MIT PyPI version

The CLI launches a linear process, called a "pipeline", which executes the components in the following order:

  • Fetch curated documents (XMI format) from an INCEpTION instance (check state of document in Inception > "Monitoring" window);

curated-doc

  • preprocessing curated documents (retokenize, remove unprintable characters etc.);
  • Convert XMI to CONLL files (inception2corpus use xmi2conll cli as a module);
  • Merge CONLL files in one;
  • Provides a report containing statistics and metadata about the corpus;
  • Reduce (get only sentences annotated and reject other) and serialize dataset in 2 (train/dev) and 3 sets (train/dev/test) according to a ratio defined by the user

At the end of the execution of the program, an output_annotated_corpus folder/ is provided at the root working directory, for more details see this section.

🛠️ Installation (easy way)

  1. You need Python 3.7 or higher installed (if not, install it here).

  2. First, create a new directory and set up a code environment with virtualenv and correct Python version, follow these steps (depending on your OS):

    MacOSx / Linux

    virtualenv --python=/usr/bin/python3.7 venv
    

    then, activate this new code environment with:

    source venv/bin/activate
    

    Windows

    py -m venv venv
    

    then, activate this new code environment with:

    .\venv\Scripts\activate
    
  3. Finally, install inception2corpus CLI via pip with:

    pip install inception2corpus
    

🛠️ Installation (for developers only)

# 1. clone git repository
git clone https://github.com/NER4Archives-project/inception2corpus-CLI.git
# 2. Go to repository and create a new virtual env (follow steps in easy way installation)
# 3. install packages
# (on MACOSx/LINUX): 
pip install -r requirements.txt
# (on Windows): 
pip install -r .\requirements.txt

▶️ Usage

  1. inception2corpus CLI use a YAML file as argument to specify INCEpTION HOST information, corpus metadata, conll format, serialization options etc. You can use and update the template here USER_VAR_ENV.yml.

  2. When configuration YAML file is completed use this command:

    inception2corpus ./USER_VAR_ENV.yml
    
  3. At the end of this process, a new output directory is created at the root of working directory (./output_annotated_corpus folder/) that contains your final corpus, ready to train. Also, a new temp_files/ folder is created at the root, leave it or delete it as you want.

📁 Full output folder description

./output_annotated_corpus folder/
 |
 |- output_annotated_corpus folder.zip/
 |           |
 |           |- data_split_n2/ : The all_reduced.conll divided into 2 sets (train, dev)
 |           |
 |           |- data_split_n3/ : The all_reduced.conll divided into 3 sets (train, dev, test)
 |           |
 |           |- data_split_n3_idx/ : The all_reduced.conll divided into 3 sets (train, dev, test) with sentences ID
 |           |
 |           |- data_split_n2_idx/ : The all_reduced.conll divided into 2 sets (train, dev) with sentences ID
 |           |
 |           |- XMI_curated/ : Original XMI to import into INCEpTION
 |           |
 |           |- all.conll : All documents in CONLL format
 |           |- all_reduced.conll : All documents in CONLL format reduced to only annotated sentences
 |
 |- meta_corpus.json : corpus metadata and statistics

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inception2corpus-0.1.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

inception2corpus-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file inception2corpus-0.1.1.tar.gz.

File metadata

  • Download URL: inception2corpus-0.1.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for inception2corpus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 04fbce689b711086a14831426530c24043b7687928b187929ee631a16941c03d
MD5 21d5e0f18464c076409e2f4d99096914
BLAKE2b-256 3da1c23ccec43d7164d0449774c3e05c91d5961c330902846de4f383437fad53

See more details on using hashes here.

File details

Details for the file inception2corpus-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inception2corpus-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f13ef1af372c10c391110d3d5d1002d4710d20ec844dcbea56efeabe835d1569
MD5 dfff2c69aafbd559ee37f46c2c792f24
BLAKE2b-256 ce5201dceef32a8c78d51f56e6edf3fc41f84a8cf61144660cbafc62636af118

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page