Skip to content

Commit

Permalink
chore: remove deprecated use of delim_whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-pages authored Oct 18, 2024
1 parent 6816228 commit 63685ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
#########

develop
~~~~~~~~

- chore: remove deprecated use of `delim_whitespace`

Version 5.1.0 (2024-04-05)
~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 3 additions & 3 deletions pyannote/database/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def load_trial(file_trial):
"""

trials = pd.read_table(
file_trial, delim_whitespace=True, names=["reference", "uri1", "uri2"]
file_trial, sep="\s+", names=["reference", "uri1", "uri2"]
)

for _, reference, uri1, uri2 in trials.itertuples():
Expand Down Expand Up @@ -289,7 +289,7 @@ def __init__(self, ctm: Path):
"confidence": float,
}
self.data_ = pd.read_csv(
ctm, names=names, dtype=dtype, delim_whitespace=True
ctm, names=names, dtype=dtype, sep="\s+"
).groupby("uri")

def __call__(self, current_file: ProtocolFile) -> Union["Doc", None]:
Expand Down Expand Up @@ -354,7 +354,7 @@ def __init__(self, mapping: Path):
"uri": str,
}
self.data_ = pd.read_csv(
mapping, names=names, dtype=dtype, delim_whitespace=True
mapping, names=names, dtype=dtype, sep="\s+"
)

# get colum 'value' dtype, allowing us to acces it during subset
Expand Down
10 changes: 5 additions & 5 deletions pyannote/database/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def load_rttm(file_rttm, keep_type="SPEAKER"):
file_rttm,
names=names,
dtype=dtype,
delim_whitespace=True,
sep="\s+",
keep_default_na=True,
)

Expand Down Expand Up @@ -213,7 +213,7 @@ def load_stm(file_stm):
dtype = {"uri": str, "speaker": str, "start": float, "end": float}
data = pd.read_csv(
file_stm,
delim_whitespace=True,
sep="\s+",
usecols=[0, 2, 3, 4],
dtype=dtype,
names=list(dtype),
Expand Down Expand Up @@ -250,7 +250,7 @@ def load_mdtm(file_mdtm):
file_mdtm,
names=names,
dtype=dtype,
delim_whitespace=True,
sep="\s+",
keep_default_na=False,
)

Expand Down Expand Up @@ -281,7 +281,7 @@ def load_uem(file_uem):

names = ["uri", "NA1", "start", "end"]
dtype = {"uri": str, "start": float, "end": float}
data = pd.read_csv(file_uem, names=names, dtype=dtype, delim_whitespace=True)
data = pd.read_csv(file_uem, names=names, dtype=dtype, sep="\s+")

timelines = dict()
for uri, parts in data.groupby("uri"):
Expand All @@ -306,7 +306,7 @@ def load_lab(path, uri: str = None) -> Annotation:

names = ["start", "end", "label"]
dtype = {"start": float, "end": float, "label": str}
data = pd.read_csv(path, names=names, dtype=dtype, delim_whitespace=True)
data = pd.read_csv(path, names=names, dtype=dtype, sep="\s+")

annotation = Annotation(uri=uri)
for i, turn in data.iterrows():
Expand Down

0 comments on commit 63685ff

Please sign in to comment.