Skip to main content

naf2conll

Script to convert coreference data in NAF format to CoNLL format.

!! NB !! At the moment, this script only supports the following columns:

  • 1: Document ID
  • 3: Word number
  • 4: Word itself
  • 12: Coreference

The following CoNLL columns are supported by NAF, but are not (yet) processed (correctly) by this script:

  • 5: POS tag
  • 6: constituency tree
  • ...?
  • 11: named entities

See CoNLL-specification.md for an extensive description of the CoNLL format.

Usage

naf2conll.py

To automatically find all (sub)folders that contain NAF files and convert all data in those folders, run:

naf2conll.py path/to/output_dir -d path/to/some/folder [-d path/to/another/folder ...]

To only convert one file, run:

naf2conll.py path/to/output.conll path/to/input.naf

Columns of CoNLL output

By default only Column 1, 3, 4 and 12 are output.

If you choose to output more columns, the following values and place-holders are used.

Column Description Value Conform CoNLL specification?
1 Document ID file path without extension Yes
2 Part number 0 Yes
3 Word number generated Yes
4 Word itself extracted from text layer of NAF Yes
5 POS [POS] No
6 Parse bit * No
7 Predicate lemma - Yes
8 Predicate Frameset ID - Yes
9 Word sense - Yes
10 Speaker/Author UNKNOWN ???
11 Named Entities * Yes
- Predicate Arguments None: column(s) left out entirely Yes, conform example in CoNLL 2012
12 Coreference extracted from coreference layer of NAF (ISSUE! [1]) Yes

[1]: The reference spans are not closed in the correct order if they end at the same word. The following is an example of output from naf2conll.py:

          (10
            -
      (52|(55
          52)
            -
10)|55)|(133)

While pedantically correct would be:

          (10
            -
      (55|(52
          52)
            -
(133)|55)|10)

Issues

  • 'on_missing' config key is not validated before use
  • Raise an error when there is no coref layer in extract_coref_sets

Metadata

Release files for naf2conll 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for naf2conll 1.0.1
File Size Uploaded Provenance
naf2conll-1.0.1.zip 19.4 kB Without provenance Details

Release files / naf2conll-1.0.1.zip

Download URL naf2conll-1.0.1.zip
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
caeb3b9474f49ee2cf61e6955a36a3c44784b96ef282d0d6907887d2dc00dc63
BLAKE2b-256 checksum
How to use checksums
526e3641da068c13edf031b9735d5af145ec89cd9e089cd97c96138b75d27936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Security for naf2conll 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page