Skip to content

Commit

Permalink
Use safer ast.literal_eval
Browse files Browse the repository at this point in the history
  • Loading branch information
bact committed Nov 3, 2024
1 parent ac3eeab commit fc3970f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pythainlp/corpus/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
Common lists of words.
"""

import ast

__all__ = [
"countries",
"find_synonyms",
Expand Down Expand Up @@ -304,7 +306,7 @@ def thai_wsd_dict() -> dict:
thai_wsd = thai_dict()
_THAI_WSD_DICT = {"word": [], "meaning": []}
for i, j in zip(thai_wsd["word"], thai_wsd["meaning"]):
all_value = list(eval(j).values())
all_value = list(ast.literal_eval(j).values())
use = []
for k in all_value:
use.extend(k)
Expand Down

0 comments on commit fc3970f

Please sign in to comment.