Skip to content

Commit 3d7e786

Browse files
authored
performance: optimize PUNCT_TBL creation (#791)
1 parent 89581f3 commit 3d7e786

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

trafilatura/deduplication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
BIN_COUNT_FUNC = getattr(int, "bit_count", lambda x: bin(x).count("1"))
2424

25-
PUNCT_TBL = str.maketrans({i: ' ' for i in range(0x10FFFF) if unicodedata.category(chr(i)).startswith('P')})
25+
PUNCT_TBL = str.maketrans({i: " " for i in range(0x10FFFF) if unicodedata.category(chr(i))[0] == "P"})
2626

2727

2828
@lru_cache(maxsize=1024)

0 commit comments

Comments
 (0)