Skip to content

Commit 64bfc99

Browse files
Copilotbact
andcommitted
Remove variable shadowing for clearer code
Co-authored-by: bact <128572+bact@users.noreply.github.com>
1 parent 150ce69 commit 64bfc99

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

pythainlp/tokenize/han_solo.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,18 @@ def featurize(
124124

125125
# Convert to the requested return type
126126
if return_type == "list":
127-
all_features: list[list[str]] = all_features_list
128-
all_labels: list[str] = [str(label) for label in all_labels_int]
127+
return {
128+
"X": all_features_list,
129+
"Y": [str(label) for label in all_labels_int]
130+
}
129131
else:
130-
all_features: list[dict[str, int]] = [
131-
{key: 1 for key in feature_list}
132-
for feature_list in all_features_list
133-
]
134-
all_labels: list[int] = all_labels_int
135-
136-
return {"X": all_features, "Y": all_labels}
132+
return {
133+
"X": [
134+
{key: 1 for key in feature_list}
135+
for feature_list in all_features_list
136+
],
137+
"Y": all_labels_int
138+
}
137139

138140

139141
_to_feature = Featurizer()

0 commit comments

Comments
 (0)