Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- import `conllu` parsing errors: Add file name to error message

## [0.50.1] - 2026-03-31

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion src/importer/conllu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ impl ImportCoNLLU {
let mut decoder = DecodeReaderBytes::new(f);
let mut file_content = String::new();
decoder.read_to_string(&mut file_content)?; // TODO this needs to be buffered. UD Files can be very large
let conllu: Pairs<Rule> = CoNLLUParser::parse(Rule::conllu, &file_content)?;
let conllu: Pairs<Rule> = CoNLLUParser::parse(Rule::conllu, &file_content)
.map_err(|e| anyhow!("Could not parse {document_path:?}:\n{e}"))?;
self.map_document(step_id, update, document_node_name, conllu, tx)?;
Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
source: src/importer/conllu/tests.rs
expression: run.err().unwrap()
---
Could not parse "tests/data/import/conll/invalid/test_file.conllu":
--> 1:1
|
1 | a _
| ^---
|
= expected sentence
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
source: src/importer/conllu/tests.rs
expression: job.err().unwrap()
expression: job.err().unwrap().to_string()
---
Could not parse "tests/data/import/conll/invalid/test_file.conllu":
--> 1:1
|
1 | a _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
source: src/importer/conllu/tests.rs
expression: job.err().unwrap().to_string()
---
Could not parse "tests/data/import/conll/missing-column/website_example.conllu":
--> 10:17
|
10 | 6 . . PUNCT . _ punct 2:punct _
Expand Down
18 changes: 8 additions & 10 deletions src/importer/conllu/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ fn test_conll_fail_invalid() {
let mut u = GraphUpdate::default();
let import = ImportCoNLLU::default();
let step_id = StepID::from_importer_step(&import_step);
assert!(
import
.import_document(
&step_id,
&mut u,
import_path.join("test_file.conllu").as_path(),
import_path.join("test_file").to_str().unwrap().to_string(),
&None
)
.is_err()
let run = import.import_document(
&step_id,
&mut u,
import_path.join("test_file.conllu").as_path(),
import_path.join("test_file").to_str().unwrap().to_string(),
&None,
);
assert!(run.is_err());
assert_snapshot!(run.err().unwrap());
}

#[test]
Expand Down
Loading