Skip to content

Commit

Permalink
🐛 Empty masks same as no masks (#43)
Browse files Browse the repository at this point in the history
* 🐛 Empty masks same as no masks

Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>

Co-authored-by: declark1 <daniel.clark@ibm.com>

* 🎨 Formatting

Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>

---------

Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
Co-authored-by: declark1 <daniel.clark@ibm.com>
  • Loading branch information
evaline-ju and declark1 authored May 22, 2024
1 parent 6ca2e22 commit 3e38689
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 3e38689

Please sign in to comment.