Skip to content

Commit

Permalink
re.finditer replaces re.search
Browse files Browse the repository at this point in the history
  • Loading branch information
javadr committed Apr 3, 2022
1 parent 858210c commit fb398e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.9.9 - 2022-04-03
-- re.search is replaced with re.finditer as the former just finds the first occurrence of the pattern not all of them

0.9.8 - 2022-04-03
-- Fixed the issue with multiple consecutive newlines

Expand Down
2 changes: 1 addition & 1 deletion negar/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

__version__ = "0.9.8"
__version__ = "0.9.9"

LOGO = (Path(__file__).parent.absolute()/"logo.png").as_posix()
DATAFILE = Path(__file__).parent.absolute()/"data/untouchable.dat"
Expand Down
8 changes: 4 additions & 4 deletions negar/virastar.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ def fix_prefix_separate(self):

wlist = self.text.split(" ")
for word in wlist:
p = regex.search(word)
if p:
regx_iter = regex.finditer(word)
for p in regx_iter:
# Checks that the prefix (mi* nemi* bi*) is part a a word or not, like میلاد.
if p.group() not in UnTouchable.words:
self.text = re.sub(
Expand Down Expand Up @@ -196,8 +196,8 @@ def fix_suffix_separate(self):
)
wlist = self.text.split(" ")
for word in wlist:
p = regex.search(word)
if p:
regx_iter = regex.finditer(word)
for p in regx_iter:
# Checks that the suffix (tar* haye*) is part of a word or not, like بهتر.
if p.group() not in UnTouchable.words:
self.text = re.sub(
Expand Down

0 comments on commit fb398e9

Please sign in to comment.