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.
- {python_negar-1.2.12 → python_negar-1.2.13}/Changelog.txt +3 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/PKG-INFO +1 -1
- {python_negar-1.2.12 → python_negar-1.2.13}/negar/constants.py +1 -1
- {python_negar-1.2.12 → python_negar-1.2.13}/negar/virastar.py +11 -1
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/PKG-INFO +1 -1
- {python_negar-1.2.12 → python_negar-1.2.13}/tests/test_unittest.py +9 -2
- {python_negar-1.2.12 → python_negar-1.2.13}/AUTHORS +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/LICENSE +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/MANIFEST.in +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/README.md +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/negar/__init__.py +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/negar/data/immutable.words +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/negar/gui.py +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/SOURCES.txt +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/dependency_links.txt +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/entry_points.txt +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/requires.txt +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/python_negar.egg-info/top_level.txt +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/setup.cfg +0 -0
- {python_negar-1.2.12 → python_negar-1.2.13}/setup.py +0 -0
|
@@ -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"[ ]*([
|
|
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
|
)
|
|
@@ -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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|