Skip to content

Commit 012d0e4

Browse files
committed
sep and tables pattern must be provided together
1 parent 38b658e commit 012d0e4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sep = r"¦"
1+
sep = r"'¦|\|'"
22
regex = dict(
33
tables=rf"(\b.*{sep}.*\n)+",
44
)

edsnlp/pipes/misc/tables/tables.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@ def __init__(
127127
attr: Union[Dict[str, str], str] = "TEXT",
128128
ignore_excluded: bool = True,
129129
):
130-
if tables_pattern is None:
130+
if tables_pattern is None and sep_pattern is None:
131131
self.tables_pattern = patterns.regex
132-
else:
133-
self.tables_pattern = tables_pattern
134-
135-
if sep_pattern is None:
136132
self.sep = patterns.sep
133+
elif tables_pattern is None or sep_pattern is None:
134+
raise ValueError(
135+
"Both tables_pattern and sep_pattern must be provided "
136+
"for custom eds.table pipeline."
137+
)
137138
else:
139+
self.tables_pattern = tables_pattern
138140
self.sep = sep_pattern
139141

140142
super().__init__(

0 commit comments

Comments
 (0)