Skip to content

Commit 1d8a7c3

Browse files
committed
fix path handling
1 parent 8e12448 commit 1d8a7c3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

chebai/result/analyse_sem.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import traceback
44
from datetime import datetime
5+
from pathlib import Path
56
from typing import List, LiteralString, Optional, Tuple
67

78
import pandas as pd
@@ -155,9 +156,11 @@ def get_disjoint_groups(disjoint_files):
155156
disjoint_files = os.path.join("data", "chebi-disjoints.owl")
156157
disjoint_pairs, disjoint_groups = [], []
157158
for file in disjoint_files:
158-
if file.split(".")[-1] == "csv":
159+
if isinstance(file, Path):
160+
file = str(file)
161+
if file.endswith(".csv"):
159162
disjoint_pairs += pd.read_csv(file, header=None).values.tolist()
160-
elif file.split(".")[-1] == "owl":
163+
elif file.endswith(".owl"):
161164
with open(file, "r") as f:
162165
plaintext = f.read()
163166
segments = plaintext.split("<")

0 commit comments

Comments
 (0)