Skip to content

Commit

Permalink
🐛 Empty masks same as no masks
Browse files Browse the repository at this point in the history
Signed-off-by: Evaline Ju <[email protected]>

Co-authored-by: declark1 <[email protected]>
  • Loading branch information
evaline-ju and declark1 committed May 22, 2024
1 parent 6ca2e22 commit 65ed4a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ async fn chunk_and_detect(
masks: Option<&[(usize, usize)]>,
) -> Result<Vec<TokenClassificationResult>, Error> {
// Apply masks
let text_with_offsets = masks
.map(|masks| apply_masks(&text, masks))
.unwrap_or(vec![(0, text)]);
let text_with_offsets = match masks {
None | Some([]) => vec![(0, text)],
Some(masks) => apply_masks(&text, masks),
};
// Create a list of required chunkers
let chunker_ids = detectors
.keys()
Expand Down

0 comments on commit 65ed4a6

Please sign in to comment.