Skip to content

Commit

Permalink
[Issue #38] Handle ModuleNotFoundError for word_levenshtein
Browse files Browse the repository at this point in the history
  • Loading branch information
wq2012 committed Oct 21, 2024
1 parent b115f0f commit f86543d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion DiarizationLM/diarizationlm/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
from scipy import optimize
import tqdm
from diarizationlm import utils
import word_levenshtein as levenshtein
try:
import word_levenshtein as levenshtein
except ModuleNotFoundError:
import levenshtein


@dataclasses.dataclass
Expand Down
5 changes: 4 additions & 1 deletion DiarizationLM/diarizationlm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import numpy as np
from scipy import optimize

import word_levenshtein as levenshtein
try:
import word_levenshtein as levenshtein
except ModuleNotFoundError:
import levenshtein

PUNCTUATIONS = [",", ".", "_", "?", "!", "-", '"', "'"]

Expand Down

0 comments on commit f86543d

Please sign in to comment.