Patch for 3 new features (backport from the French grammar version)

Bug #682509 reported by --deleted--
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Lightproof
Fix Committed
Undecided
Unassigned

Bug Description

Hi,

In order to make the French grammar checker, I made few improvements that other people might find useful for their own checker.

1. It’s sometimes very difficult or impossible to know what to suggest, so the first feature allows to report mistakes without making suggestions. I chose the underscore (_) as command to prevent suggestions.

Syntax in the template file:

this is a wrong sequence of words -> _ # This is a mistake!

2. It’s sometimes useful to say in the message what word(s) (is|are) wrong in a long sentence. So I change the code to substitute in the warning message the backreferences from the pattern.

Example in the template file:

this is a (wrong) sequence of words -> _ # The word “\1” is not correct!

3. At this moment, the function “morph” looks for an unambiguous answer in all the possible morphologies of a word. But sometimes, we don’t need such a strict behavior. So I add the possibility to check if only one morphology of a word matches what is asked, whatever the other morphologies might be. If there is one match, the function returns it. I added a third paramater to “morph” and “affix”, a boolean (True by default) to switch the behavior. The strict behavior is implicit, so there is no need to change what already exists.

Syntax (example):

this is a (wrong) sequence of words <- morph(\1, r"po:v", False) -> suggestion # The word “\1” is probably not correct!
this is a (wrong) sequence of words <- morph(\1, r"po:v") -> suggestion # The word “\1” is not correct!

That’s all.

Note: the indentation of your scripts is awful: this a mix of spaces and tabulations. :)

Anyway, Lightproof is really a great tool. Thanks!

Tags: patch
Revision history for this message
--deleted-- (trash-noreply) wrote :
Revision history for this message
--deleted-- (trash-noreply) wrote :

Finally, instead of creating a new parameter “strict“ for the function morph, it should be better to create another function, called “pmorph” (probable morphology), which would have the same behavior than “morph” with “stric=False”.
That’s shorter to write, and I assume that undefined parameter slows down a little the checking.

2 cents more. ;)

Revision history for this message
--deleted-- (trash-noreply) wrote :

Point 3 done in Lightproof 1.4.1.

Revision history for this message
László Németh (nemeth-libreoffice) wrote :

Hi Olivier,

Unfortunately, I forgot your suggestion and morph() patch, but I added the same parameter to the morph function. I'm sorry, I will credit your name in the next release. Next month I will integrate your other great patches,

Thanks for your work,
László

Changed in lightproof:
status: New → Fix Committed
papukaija (papukaija)
tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.