views:

128

answers:

1

I like to use the present tense in my Git logs (for example, "Add feature" instead of "Added feature"). Currently, I have an extremely naive Git hook that aborts the commit if the first word of the log message ends in 'ed', but I'd like a more robust solution (where 'more robust' means 'not totally lame'). Is there a grammar checker that would give me the ability to write a script along the lines of:

echo $TEXT | check-grammar --present-tense || exit 1 

I don't need a perfect solution, just something better than matching /^\w*ed\W/.

+1  A: 

You might be able to use morpha for this purpose. Morpha is a lemmatizer that splits endings from base words, and then changes the base word to its uninflected form, which is conveniently the same as the underspecified third person singular in English.

As an example, the input 'added' would result in 'add+ed', meaning that you can even just prompt your exit command if the first word of the commit string has a plus sign in it, if you're looking for the most naive approach possible.

Robert Elwell