Skip to content

Doc.save_conllu; lima command writes CoNLL-U with metadata - #50

Merged
kleag merged 1 commit into
masterfrom
save-conllu
Nov 28, 2026
Merged

kleag merged 1 commit into
masterfrom
save-conllu

Conversation

@kleag

@kleag kleag commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Closes #8.

Doc.to_conllu() already wrote the # sent_id and # text metadata. This PR adds the missing parts:

  • Doc.save_conllu(path, doc_id=None): writes to_conllu() to a file in UTF-8 with Unix line endings, so the Windows wheel doesn't write CRLF.
  • Doc.to_conllu(doc_id=None): with an id, adds a # newdoc id comment and makes the sentence ids <doc_id>-<n>, so they stay unique when several documents share a file. Without an id the output is unchanged.
  • lima command: writes CoNLL-U with the metadata comments instead of repr(doc), to stdout or to -o/--output. With several input files, each file's name is its document id. Input files are read as UTF-8.
  • Test test_save_conllu, which needs no models (it builds the doc with from_conllu), plus updates to CHANGES (## Unreleased) and README.

The new test was not run locally because the extension isn't built here; it runs in CI.

🤖 Generated with Claude Code

Doc.save_conllu(path, doc_id=None) saves to_conllu() to a UTF-8 file with
Unix line endings. to_conllu(doc_id) adds a "# newdoc id" comment and
"<doc_id>-<n>" sentence ids, unique in a file of several documents; the
default output is unchanged. The lima command writes CoNLL-U with the
metadata comments instead of repr(doc), to stdout or -o/--output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@kleag
kleag merged commit c42dcd3 into master Nov 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a method to save a doc to conllu format

1 participant