Skip to content

Commit c1afb66

Browse files
authored
Refactor cut variable assignment and usage
1 parent b8a531d commit c1afb66

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pythainlp/tokenize/han_solo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def featurize(
7575
features = []
7676
else:
7777
features = {}
78-
cut: Union[int, str] = 0
78+
cut = 0
7979
char = sentence[current_position]
8080
if char == self.delimiter:
8181
cut = 1
@@ -135,8 +135,9 @@ def featurize(
135135
cast(list[str], features).append(ngram_key)
136136
all_features.append(features)
137137
if return_type == "list":
138-
cut = str(cut)
139-
all_labels.append(cut)
138+
all_labels.append(str(cut))
139+
else:
140+
all_labels.append(cut)
140141

141142
return {"X": all_features, "Y": all_labels}
142143

0 commit comments

Comments
 (0)