Subject: Looking for a grammar/spelling tool for XML I-D

From: "Eric Vyncke (evyncke)" <[email-masked]>
Date: Thu, 20 Aug 2020 09:38:42 +0000

Written by a non-English speaker...

The IESG believes that the I-D review (in last call, in IESG telechat, ...) could be improved for some documents if the grammar was correct and typos absent (and I plead guilty to do typos in my documents). Easier said than done of course.

Most modern word processors have this feature but I know about no tools able to do this check on .XML or .TXT...

So, we are looking forward for any tools on-line/off-line being able to do this. It could be a tool-chain built on GNU aspell or course (but aspell does not check grammar) or via an API to https://languagetool.org/ .

Henrik wrote https://tools.ietf.org/tools/idspell/idspell.pyht but is dated 2007 and we could probably do better in 2020 ;-)

Thank you for pointers, suggestions, comments

-éric

---

From: Ladislav Lhotka <[email-masked]>
Date: Thu, 20 Aug 2020 15:58:47 +0200

Hi Eric,

my GitHub project [1] is oriented on preparing I-D with YANG modules,
but it also contains a RELAX NG schema for xml2rfc version 3:

https://github.com/llhotka/YANG-I-D/blob/master/.tools/schema/xml2rfcv3.rnc

This can be used e.g. with the fantastic nXML mode of Emacs for
on-the-fly validation, element completion etc.

Emacs also integrates ispell/aspell, so spell checking can be done as well.

Also of general interest may be some internal entities that contain
boilerplate text, such as the magic phase about RFC 2119 keywords:

https://github.com/llhotka/YANG-I-D/tree/master/.tools/bplate

Lada

[1] https://github.com/llhotka/YANG-I-D

On 20. 08. 20 11:38, Eric Vyncke (evyncke) wrote:
> The IESG believes that the I-D review (in last call, in IESG telechat,
> ...) could be improved for some documents if the grammar was correct and
> typos absent (and I plead guilty to do typos in my documents). Easier
> said than done of course.
> 
>  
> 
> So, we are looking forward for any tools on-line/off-line being able to
> do this. It could be a tool-chain built on GNU aspell or course (but
> aspell does not check grammar) or via an API to https://languagetool.org/ .
> 
>  
> 
> Henrik wrote https://tools.ietf.org/tools/idspell/idspell.pyht but is
> dated 2007 and we could probably do better in 2020 ;-)
> 
>  
> 

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

---

From: Lars Eggert <[email-masked]>
Date: Thu, 20 Aug 2020 16:58:52 +0300

On 2020-8-20, at 12:38, Eric Vyncke (evyncke) <evyncke=[email-masked]> wrote:
> So, we are looking forward for any tools on-line/off-line being able to do this.

https://github.com/codespell-project/codespell works on md, xml and txt (and more).

Lars

---

From: Robert Sparks <[email-masked]>
Date: Thu, 20 Aug 2020 09:05:00 -0500

And https://github.com/ietf-tools/RfcEditor/tree/master/rfclint makes 
some of the basic checks Éric asks for.

---

From: Lars Eggert <[email-masked]>
Date: Thu, 20 Aug 2020 17:11:27 +0300

> https://github.com/codespell-project/codespell works on md, xml and txt (and more).

Ah, sorry. You wanted a grammar checker.

https://eggert.org/software/idreview has some scripting around languangetool that boils down to something like this:

rfcstrip "$id" | \
sed -e 's/^[ ]\{1,\}//g; s/[ ]\{2,\}/ /g; s/^o /\* /' | \
languagetool -l en-US -d WHITESPACE_RULE,EN_QUOTES,\
COMMA_PARENTHESIS_WHITESPACE,UPPERCASE_SENTENCE_START,\
THREE_NN,DOUBLE_PUNCTUATION,THREE_NN,DOUBLE_PUNCTUATION,\
WORD_CONTAINS_UNDERSCORE,COPYRIGHT,\
DASH_RULE,PLUS_MINUS,MULTIPLICATION_SIGN,ARROWS

There are still a bunch of false positives, often due to ASCII diagrams, etc.

Lars

---

From: Lars Eggert <[email-masked]>
Date: Thu, 20 Aug 2020 17:15:42 +0300

> DASH_RULE,PLUS_MINUS,MULTIPLICATION_SIGN,ARROWS

And if you want to work on the XML, you can use --xmlfilter and pass it an XML file instead of the rfcstripped/sedded text version.

Lars

PS: I'll stop with the follow-ons now.

---

From: Nico Williams <[email-masked]>
Date: Thu, 20 Aug 2020 13:34:50 -0500

On Thu, Aug 20, 2020 at 09:38:42AM +0000, Eric Vyncke (evyncke) wrote:
> ...) could be improved for some documents if the grammar was correct
> and typos absent (and I plead guilty to do typos in my documents).
> Easier said than done of course.
> 
> Most modern word processors have this feature but I know about no
> tools able to do this check on .XML or .TXT...

Well, this isn't what you're looking for, but my now-pretty-much-
abandoned lyx2rfc tool lets you edit I-Ds in LyX, which is a WYSIWYM GUI
editor and has spell checking (though maybe not grammar checking, not
that I recall).

lyx2rfc is/was a hack though -- a working and workable hack, but hacky
anyways -- using custom insets (hack) for xml2rfc metadata and a format
converter/exporter that first converts to LyXML and then uses XSLTs to
convert to xml2rfc (v2) and then xml2rfc to do final rendering.  Better
LyX integration would be nice, but I don't think anyone is going to put
the effort into it.  Still, using LyX is very nice, and the only
downside is the lack of VIM keybindings.

If the tools team wanted to do something truly awesome, it should look
for a suitable, cross-platform, at least free-as-in-$ editor that
supports some sort of structured text and can be extended to do the
kinds of things I did with LyX, then build the necessary integration
with xml2rfc.  LyX might be one such suitable editor.

Nico
--