python-negar 1.2.7__tar.gz → 1.2.9__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,10 @@
1
+ 1.2.9 - 2024-05-07
2
+ -- Fix subtle issue with untoucahle words which stick to nonliteral symbols like Parantheses
3
+ -- new test for untoucahle words
4
+
5
+ 1.2.8 - 2023-09-21
6
+ -- Fix subtle issue with triple dots at the end of sentence followed by another [?!.]
7
+
1
8
  1.2.7 - 2023-08-07
2
9
  -- Remove dot from saving directory under Windows OS.
3
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-negar
3
- Version: 1.2.7
3
+ Version: 1.2.9
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.7"
4
+ __version__ = "1.2.9"
5
5
 
6
6
  DATAFILE = Path(__file__).parent.absolute() / "data/untouchable.dat"
7
7
  APPDATA = "AppData/Roaming/" if platform.system() == "Windows" else "."
@@ -59,7 +59,7 @@ class PersianEditor:
59
59
  self.fix_three_dots() if self._fix_three_dots else None
60
60
  self.aggressive() if self._aggresive else None
61
61
  self.text = re.sub(
62
- r"[ ‌ ]*([:;,؛،.؟!]{1})[ ‌ ]*",
62
+ r"[ ‌ ]*([…:;,؛،.؟!]{1})[ ‌ ]*",
63
63
  r"\1 ",
64
64
  self.text,
65
65
  )
@@ -80,6 +80,11 @@ class PersianEditor:
80
80
  if self._fix_spacing_for_braces_and_quotes else None
81
81
  self.cleanup_redundant_zwnj()
82
82
  self.cleanup_spacing() if self._cleanup_spacing else None
83
+ self.text = re.sub(
84
+ r"…([.؟!])",
85
+ r"… \1",
86
+ self.text,
87
+ )
83
88
  self._handle_urls(State.restore)
84
89
  return self.text
85
90
 
@@ -106,7 +111,7 @@ class PersianEditor:
106
111
 
107
112
  def fix_three_dots(self):
108
113
  """Replace three dots with an ellipsis."""
109
- self.text = re.sub(r"\s*\.{3,}", r"…", self.text)
114
+ self.text = re.sub(r"\s*\.{3,}(\s)*", r"…\1", self.text)
110
115
 
111
116
  def fix_english_quotes(self):
112
117
  """Replace English quotes with their Persian counterparts."""
@@ -227,7 +232,7 @@ class PersianEditor:
227
232
  [تمش]ان|
228
233
  ها(ی(ی|ت|م|ش|تان|شان)?)?|""" if self._exaggerating_zwnj else ""
229
234
  regx = re.compile(
230
- rf"""(\S+?) # not-greedy fetch to handle some case like هایشان instead شان
235
+ rf"""\b(\S+?) # not-greedy fetch to handle some case like هایشان instead شان
231
236
  ({exag}
232
237
  # تر(ی(ن)?)?
233
238
  # [تمش]ان|
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-negar
3
- Version: 1.2.7
3
+ Version: 1.2.9
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes