summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-01-17 10:54:34 +0100
committerLászló Németh <nemeth@numbertext.org>2018-01-17 10:54:34 +0100
commitedfac327f69ae50d73dcaaffcbde5152e16e6e89 (patch)
treeecc65174247f61471922c48e793f3347855a393a
parentc775f5f97f5051ffe28909d59ab8c7b289a62205 (diff)
support lower case suggestions for capitalized patterns:
Start the suggestion with the character sequence "!CASE!". Rule example: Foo -> !CASE!foo # Did you mean: or in multiple suggestions Foo -> FOO|!CASE!foo # Did you mean: (FOO and foo suggestions for the input word "Foo", instead of FOO and the capitalized Foo)
-rw-r--r--doc/syntax.txt13
-rw-r--r--pythonpath/lightproof_impl___implname__.py6
2 files changed, 17 insertions, 2 deletions
diff --git a/doc/syntax.txt b/doc/syntax.txt
index be280b8..bcca2be 100644
--- a/doc/syntax.txt
+++ b/doc/syntax.txt
@@ -98,6 +98,19 @@ Example:
foobar -> _ # Message
+== Avoid automatic capitalization of suggestions ==
+
+Start the suggestion with the character sequence "!CASE!":
+
+Foo -> !CASE!foo # Did you mean:
+
+or in multiple suggestions
+
+Foo -> FOO|!CASE!foo # Did you mean:
+
+(FOO and foo suggestions for the input word "Foo", instead
+of FOO and the capitalized Foo)
+
== Longer explanations ==
Warning messages can contain optional URLs for longer explanations separated by "|" or "\n":
diff --git a/pythonpath/lightproof_impl___implname__.py b/pythonpath/lightproof_impl___implname__.py
index bab4e9d..5b76e17 100644
--- a/pythonpath/lightproof_impl___implname__.py
+++ b/pythonpath/lightproof_impl___implname__.py
@@ -193,8 +193,10 @@ def proofread( nDocId, TEXT, LOCALE, nStartOfSentencePos, nSuggestedSentenceEndP
return tuple(aErrs)
def cap(a, iscap, rLoc):
- if iscap:
- for i in range(0, len(a)):
+ for i in range(0, len(a)):
+ if a[i][0:6] == "!CASE!":
+ a[i] = a[i][6:]
+ elif iscap:
if a[i][0:1] == "i":
if rLoc.Language == "tr" or rLoc.Language == "az":
a[i] = u"\u0130" + a[i][1:]