python-negar 1.2.12__tar.gz → 1.2.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,6 @@
1
+ 1.2.13 - 2024-12-26
2
+ -- Fixed issue with quotes after a dot where no space was allowed in between.
3
+
1
4
  1.2.12 - 2024-12-23
2
5
  -- Fix critical issue with naming `immutable.words`
3
6
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-negar
3
- Version: 1.2.12
3
+ Version: 1.2.13
4
4
  Summary: Negar is a spell corrector and Persian text editor
5
5
  Home-page: http://github.com/shahinism/python-negar
6
6
  Author: Shahin Azad
@@ -1,7 +1,7 @@
1
1
  import platform
2
2
  from pathlib import Path
3
3
 
4
- __version__ = "1.2.12"
4
+ __version__ = "1.2.13"
5
5
 
6
6
  DATAFILE = Path(__file__).parent.absolute() / "data/immutable.words"
7
7
  APPDATA = "AppData/Roaming/" if platform.system() == "Windows" else "."
@@ -291,8 +291,18 @@ class PersianEditor:
291
291
  # self.text = re.sub(rf"^[ ‌]*(.*)[ ‌]*$",
292
292
  # r"\1", self.text, flags=re.MULTILINE)
293
293
  # # : ; , ! ? and their Persian counterparts should have one space after and no space before
294
+ # self.text = re.sub(
295
+ # r"[ ‌ ]*([:;,؛،.؟!]{1})[ ‌ ]*",
296
+ # r"\1 ",
297
+ # self.text,
298
+ # )
294
299
  self.text = re.sub(
295
- r"[ ‌ ]*([:;,؛،.؟!]{1})[ ‌ ]*",
300
+ r"[ ‌ ]*([:;,،؛]{1})[ ‌ ]*",
301
+ r"\1 ",
302
+ self.text,
303
+ )
304
+ self.text = re.sub(
305
+ r"[ ‌ ]*([.؟!]{1})[ ‌ ]*(?![\)\]\}\"»])",
296
306
  r"\1 ",
297
307
  self.text,
298
308
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-negar
3
- Version: 1.2.12
3
+ Version: 1.2.13
4
4
  Summary: Negar is a spell corrector and Persian text editor
5
5
  Home-page: http://github.com/shahinism/python-negar
6
6
  Author: Shahin Azad
@@ -4,6 +4,7 @@ from negar.virastar import PersianEditor
4
4
 
5
5
 
6
6
  class Test(unittest.TestCase):
7
+ @staticmethod
7
8
  def _assertEqual(message=""):
8
9
  def decorator(func):
9
10
  @functools.wraps(func)
@@ -51,11 +52,17 @@ class Test(unittest.TestCase):
51
52
  self.input_ = "پرتره ، طبیعت و غیره یا پرتره ، طبیعت و .... ؟"
52
53
  self.output_ = "پرتره، طبیعت و غیره یا پرتره، طبیعت و… ؟"
53
54
 
54
- @_assertEqual("Persian Quotations")
55
- def test_persian_quotations(self):
55
+ @_assertEqual("Persian Quotations I")
56
+ def test_persian_quotations_i(self):
56
57
  self.input_ = "علایمی نظیر کتیشن فارسی با گیومه ؛ 'نگار'"
57
58
  self.output_ = "علایمی نظیر کتیشن فارسی با گیومه؛ «نگار»"
58
59
 
60
+ @_assertEqual("Persian Quotations II")
61
+ def test_persian_quotations_ii(self):
62
+ self.input_ = "«تاثیر نسبی داشته است. »"
63
+ self.output_ = "«تاثیر نسبی داشته است.»"
64
+
65
+
59
66
  @_assertEqual("Persian Numbers")
60
67
  def test_persian_numbers(self):
61
68
  self.input_ = "اعداد عربی '١٢٣٤٥٦٧٨٩٠' و انگلیسی '1234567890' با معادل فارسی"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes