Skip to content

Commit

Permalink
renames variable in DictModel
Browse files Browse the repository at this point in the history
stllfe committed Oct 11, 2023
1 parent fa615bf commit e4f9c1c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions yoric/models/dictionary.py
Original file line number Diff line number Diff line change
@@ -15,19 +15,18 @@ class DictModel(YoModel):

def __init__(self, safe: bool = True) -> None:
super().__init__()
yo_dict = yodict.get_safe() if safe else yodict.get_not_safe()
self.model = Eyo(yo_dict)
self.model = Eyo(yodict.get_safe() if safe else yodict.get_not_safe())

def _predict(self, text: str) -> list[YoWordSubstring]:
"""Predicts yo word substrings for a single string."""

res = []
spans = []
for replacement in self.model.lint(text):
assert isinstance(replacement.position, Position) # fix: see replacement class
start = replacement.position.index
end = start + len(replacement.after)
res.append(YoWordSubstring(start, end, 1))
return res
spans.append(YoWordSubstring(start, end, 1))
return spans

def predict(self, data: list[str], verbose: bool = False) -> list[list[YoWordSubstring]]:
"""Predicts yo word substrings."""

0 comments on commit e4f9c1c

Please sign in to comment.