Archive for the ‘NuGram’ Category

November 30th, 2009 2 Comments

by Dominique Boucher

Effective sentence generation

There has been some activity lately on the Yahoo VUIDs group about the difficulty of generating sentences from a speech recognition grammar. This is a recurrent problem in speech grammar engineering, one that really deserves a full blog post (and maybe more than one), especially since we’ve worked hard on this problem in the last year. So I’ll share my thoughts on this subject.

First, let me surmmarize why this problem is so difficult.

The problem

You have an  ABNF (or GrXML, or GSL) grammar for which you would like to generate sentences. Except if it’s a toy grammar or a small item-list, the grammar will most certainly generate thousands, millions, or even more different sentences, if not an infinite number of them. Why? That’s simple:

  • It can contain repeated items. If you have 10 words repeated 4 times, you have 10,000 sentences. When you have unbounded repeats, of course you get an infinite language.
  • It can contain all sort of filler words, to better handle disfluencies (hesitations, corrections, etc.). When you have those fillers at the start and end of every possible sentence, the number of sentences grows very rapidly. For example, just adding 9 optional filler words at the start and end of every sentences multplies the number of sentences by a factor of 100.

For example, one of our VoiceXML applications has a grammar that generates 29,822,907,679,607,676,696 sentences! (after removing some fillers that would have made the language infinite.) And it’s just a grammar for collecting a building number, albeit a highly tuned one. Pretty standard stuff.

As you have certainly guessed, it is rather impractical to generate all sentences. Are you really interested in reviewing tens of thousands of sentences? Remember that most sentences will only differ in very uninteresting ways (the pre/post fillers, a “two” instead of a “three”, etc.).

What would you want to generate sentences for?

Sentence generation can be helpful in many situations:

  • Grammar coverage. Coverage test sets can be built in many different ways. But one that works very well is to start with the grammar and generate sentences. As you do so, you add some or all of them to the coverage set, either as ING (in-grammar) or OOG (out-of-grammar) sentences.
  • To detect problems. Sentence generation is often an effective way to find potential problems with a grammar. Typical problems are over-generation (which can lead to reduced recognition accuracy) and grammar problems (misplaced parentheses, missing parentheses, misplaced vertical bar, etc.).
  • Application testing. Some people use the generated sentences in manual application test scripts. Automated, text-based testing tools could also use sentence generation to “navigate” an application call flow.

Some available tools

Many, if not most, recognition engine vendors provide tools to generate sentences from a grammar. For example, Nuance 9 comes with parseTool, which lets you generate a fixed number of random sentences from either a GrXML grammar or a compiled grammar.

Those tools, however, are rarely adequate at dealing with a large number of sentences in an effective way. They either exhaustively generate all sentences, or they generate a fixed number of random sentences. As I mentioned above, the exhaustive generation strategy works well only for very simple grammars. The random strategy, on the other hand, doesn’t provide any control mechanisms that enable us to only generate the sentences we want. As a result, we typically end up with mostly redundant sentences in which some sentence patterns are grossly over-represented while others are missing.

Our approach

In NuGram IDE Pro, we have implemented a very different approach to sentence generation. I won’t go into explaining all the details here, but let me emphasize some aspects of our approach:

  • The generation strategies can be configured on a rule-by-rule basis.
  • The generation algorithm can be started on arbitrary expansions (sequences of words and rule references) that can be derived from the root rule. These expansions are usually produced by the Sentence Explorer tool.
  • The available strategies are:
    • All sentences - This is the default strategy. As one would expect, it consists in exhaustively generating all the sentences. However, all referenced rules will obey their own strategy.
    • First sentence - This strategy generates a single sentence, the “first” in the document order.
    • Random sentences - This strategy generates a configurable number of random sentences each time the rule is referenced from another rule.
    • Tags coverage - This strategy generates the smallest set of sentences that will cover all the semantic actions in the rule and its referenced rules (and recursively). This is a very effective strategy to build coverage sets to test all the semantic tags in a grammar/rule.
    • All paths - This strategy is a variable of the tags coverage strategy. It generates the smallest set of sentences to cover all the paths in a rule and its referenced rules (and recursively).
    • Rule examples - This strategy consists in using the examples in the rule’s documentation comment. This strategy is dangerous in that it can generate sentences that are not parsable by the grammar if the examples are not changed when the rule is modified.

Here is a screencast showing these concepts in action:

That’s it for now. My next post will be about how to use the sentence generation tool to effectively find common problems with grammars and how to fix them.

And I’d be very interested in knowing how you deal yourself with this problem. So leave me a comment!

November 10th, 2009 No Comments

by Dominique Boucher

Learn grammar development from the grammar experts!

In response to many requests from NuGram users, Nu Echo is pleased to announce that it’s now offering a two-day, on-site grammar development course.

This course – Effective Grammar Development with NuGram IDE – teaches participants how to systematically deliver high-quality, high-performance grammars by fully leveraging the features and tools available in NuGram IDE. Using hands-on exercises and numerous examples, the course provides a breadth of knowledge, best practices, and tips and tricks that have shown their effectiveness at addressing the main challenges of grammar development and at delivering better grammars faster.

Topics covered include:

  • Fundamental speech recognition and grammar concepts
  • The ABNF Grammar Syntax
  • Semantic tags – SISR, pre-SISR, swi-semantics, GSL, Nuance extensions.
  • NuGram IDE Tools – ABNF editor, Coverage tool, sentence interpreter, sentence generation,
    sentence explorer, semantics stepper, grammar conversion tools, etc.
  • The Grammar Development Process – Importance of a rigorous and systematic process, how
    NuGram IDE supports it, integration into a build process, etc.
  • Tips and Tricks – Style issues, guidelines for writing semantic tags, common sources of errors and how to detect and fix them
  • Dynamic Grammars – Use cases, traditional approaches, NuGram support (dynamic grammar
    language directives, testing/debugging tools, NuGram Server)
  • Managing phonetic pronunciations
  • Special Topics – Ambiguities, compound words, decoys, disfluencies (voiced pauses, false starts, corrections, etc.), grammar weights, Nuance-specific features.

You have special topics that you’d like us to cover? No problem. We can customize the course to fit your specific requirements. Contact us for details.

October 14th, 2009 No Comments

by Dominique Boucher

NuGram Hosted Server client APIs now available

In order to ease the integration of dynamic grammars hosted on NuGram Hosted Server, the NuGram team has developed client APIs in a variety of programming languages. The code is available on Github, but a zip file can be downloaded directly from the NuGram web site.

Supported languages/systems are currently:

And there are more to come.

Using these APIs, it becomes really easy to create dynamically-generated grammars for use by your favorite hosted communication platform (be it a VoiceXML platform or one of the many new API-based platforms), or compute the semantic interpretation of a textual sentencehe following grammar template.

An example

Suppose we’d like to implement a simple voice dialing application. A dynamic grammar template (called voicedialer.abnf) for this application would look like the following:

To get a valid recognition grammar from this template, we need to provide data to the template engine (in this case the contact list) to fill in the blanks using call-specific information. This is called instantiating the dynamic grammar.

So to instantiate the template above and retrieve the URL for the SRGS XML representation of the generated grammar in Ruby, only four lines of code are needed:

As can be seen in this example, data used by the templating engine to create the resulting grammar is specified using native data structures of the host language (Ruby dictionaries/hashmaps in this case).

Adding dynamic grammars to voice applications has never been easier! All you need is register for a free account on NuGram Hosted Server and download the APIs.

October 1st, 2009 No Comments

by Dominique Boucher

Take the NuGram User Survey

It’s been exactly six months since we released NuGram IDE Basic Edition to the developer community. We thought this was a good time to ask for some feedback from all users out there.

Whatever your experience has been with NuGram so far, we want to hear from you. Please let us know what you think by taking the NuGram User Survey. It will only take a few minutes of your time and it will help us make NuGram a better product.

On September 16th, I will be giving a joint Developer Jam Session with Tobias Göbel from Voxeo on Advanced Speech Grammar Management with the professional edition of NuGram IDE on the VoiceObjects platform. In this talk, I will explain the main differences between NuGram IDE Basic Edition and the Professional Edition. More precisely, I will cover the following topics:

  • Advanced sentence generation and coverage
  • Batch tools to test and convert your grammars at application build time
  • The automatic builder
  • The NuGram Server SDK

and more. I will also give an overview of the NuGram roadmap for the upcoming months. Finally, Tobias will talk about the integration with the VoiceObjects environment.

Don’t miss this opportunity to learn more about NuGram IDE Professional Edition!