Repository navigation
Add document_id option to visualize() for multi-document JSONL - #596
Open
inamdarmihir wants to merge 1 commit into
Open
inamdarmihir wants to merge 1 commit into
inamdarmihir wants to merge 1 commit into
Conversation
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 11 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
lx.visualize(path)on a JSONL file always rendered the first document, so there was no way to look at the results for a later document in a batch without loading the file and passing anAnnotatedDocumentyourself (#563).This adds an optional keyword-only
document_idargument tovisualize(). Whendata_sourceis a JSONL path, it renders the document with thatdocument_id. The default is unchanged (first document). An unknown id raisesValueErrorlisting the ids in the file. If several documents share an id, the first match is used. For an in-memoryAnnotatedDocumentthe argument has no effect.document_idis already written bysave_annotated_documents, so no format change is needed.Note: #562 proposed the same API and was closed without review; this is an independent implementation with the edge cases below covered.
Fixes #563
Feature
How Has This Been Tested?
Added tests in
tests/visualization_test.pyfor: default is the first document, selecting the first/last document,strandPathinputs, unknown id (error lists available ids), empty-string id (not treated as "no id"), duplicate ids (first match), in-memory document withdocument_id, and a missing file.Checklist:
Code of conduct.
Contributing
page, and I either signed the Google
Individual CLA
or am covered by my company's
Corporate CLA.
issue(s) and we have agreed upon the general approach.
issue(s) that documentation elsewhere needs updating.
pylintover the affected code.