Skip to content

Commit 0b678d7

Browse files
committed
Use os.path.join in load_from_json
1 parent 157292c commit 0b678d7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nltk/tag/perceptron.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ def save_to_json(self, lang="xxx", loc=None):
276276
def load_from_json(self, lang="eng", loc=None):
277277
# Automatically find path to the tagger if location is not specified.
278278
if not loc:
279-
loc = find(f"taggers/averaged_perceptron_tagger_{lang}/")
279+
loc = find(f"taggers/averaged_perceptron_tagger_{lang}")
280280
jsons = lang_jsons(lang)
281-
with open(loc + jsons["weights"]) as fin:
281+
with open(path_join(loc, jsons["weights"])) as fin:
282282
self.model.weights = json.load(fin)
283-
with open(loc + jsons["tagdict"]) as fin:
283+
with open(path_join(loc, jsons["tagdict"])) as fin:
284284
self.tagdict = json.load(fin)
285-
with open(loc + jsons["classes"]) as fin:
285+
with open(path_join(loc, jsons["classes"])) as fin:
286286
self.classes = set(json.load(fin))
287287
self.model.classes = self.classes
288288

0 commit comments

Comments
 (0)