Custom language or grammar rules

Is it possible to define my own language and/or grammar rules? I'd like to setup a script to check requirements against our company's internal standards. As a simple example, one simple rule would be to flag use of the word "will" (instead of "shall") in a requirement. For many of these rules, I can simply automate a text search, but there are several rules that deal more with detailed grammar (rather than simply spelling/word choice). I'd like to not have to reinvent the wheel when a grammar checker already seems to be in place. For these, I think the grammar check would be ideal, but I don't know how to define a new rule (or better yet a set of rules) to apply to my requirements. Is it possible to define user grammar rules similar to the user dictionary?

Thanks,
Jim
JimB21 - Tue Mar 06 09:54:25 EST 2012

Re: Custom language or grammar rules
Mathias Mamsch - Wed Mar 07 08:49:50 EST 2012

Hmm ... I think the spell and grammar checker was bought from an external company by Telelogic and the grammar rules are hardwired. So you might need to reinvent the wheel (which is an exciting question by the way. I always wanted to implement a grammar parser in DXL :-) ). Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Custom language or grammar rules
SystemAdmin - Wed Mar 07 16:26:27 EST 2012

Many have gone down this path to automate the detection of poor quality requirement statements. Here's my experience of trying to do this, it might help you to avoid falling into a potentially time consuming trap.

About 4-5 years ago I was tasked to write a DXL script for a large Defence company that could automate the task of seeking out ambiguous non measurable words and phrases within requirements, and tag them as being suspect - the basic concept was to parse each DOORS Object, check that it was a requirement, then search for the ambiguous nasties. It didn't take long before the DXL script started to become bogged down in trying to write rules to cater for context, grammar, semantics etc - users were complaining that whilst the script was correctly picking out ambiguous problems, it was missing some obvious ones, the rules were too literal & strict, and not really providing any better value than a human doing a peer review.

What became evident was that as the DXL script grew, it was in fact trying to become like a lexical type compiler similar to that used to compile software languages. The only problem is that the English language is not cast like a software language is. It is hideously complicated with overloaded semantics & syntax, strange tenses, fuzzy grammar rules and so on. To be of any value for the investment of time, the DXL script almost needed to take on Artificial Intelligence type logic. So in the end, the script was somewhat abandoned in favor of using Humanware which proved to be far more reliable when it came to tagging requirements as being genuinely suspect and working out the best course of action.
Paul Miller
Melbourne, Australia

Re: Custom language or grammar rules
llandale - Wed Mar 07 17:33:31 EST 2012

Miller is right, there is no substitute for a pier review. However, you are also right that if a grammer checker existed and was editable, it would be fairly easy to insert some basic rules. And I am right, you could do some basic checking with DXL:

  • Find each sentance containing 'shall'.
  • There must be words before the shall that don't contain a verb.
  • There must be words after the shall that do include a verb.
  • There is a large list of suspect words to bring to their attention, "not", "always", "never", "about", "horseshoes", bla bla bla.

-Louie

Re: Custom language or grammar rules
SystemAdmin - Wed Mar 07 18:12:34 EST 2012

llandale - Wed Mar 07 17:33:31 EST 2012
Miller is right, there is no substitute for a pier review. However, you are also right that if a grammer checker existed and was editable, it would be fairly easy to insert some basic rules. And I am right, you could do some basic checking with DXL:

  • Find each sentance containing 'shall'.
  • There must be words before the shall that don't contain a verb.
  • There must be words after the shall that do include a verb.
  • There is a large list of suspect words to bring to their attention, "not", "always", "never", "about", "horseshoes", bla bla bla.

-Louie

Yes, there is no reason why you can't keep it simple and just look for the simpler violations of good quality requirement statements - just have to weigh up if that is going to contribute to any savings in time and tears, might give some interesting metrics but only if there is a will and a budget to analyze those metrics and apply economically viable corrective action.

MSWord has a grammar checker, and whilst it does a decent job, it's possibly a good example of how complex the semantic compiling has to be to get this to work - but it's not entirely useful for parsing requirements because that requires more emphasis on weeding out ambiguity....and I don't know of many engineers who are good at grammar, so they tend to disable that feature!!


Paul Miller
Melbourne, Australia