# GrammarRecognizer

> The GrammarRecognizer is a complement to the KeywordRecognizer. In many cases developers will find the KeywordRecognizer fills all their development needs. However, in some cases, more complex grammars will be better expressed in the form of an xml file on disk. The GrammarRecognizer uses Extensible Markup Language (XML) elements and attributes, as specified in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS) Version 1.0. These XML elements and attributes represent the rule structures that define the words or phrases (commands) recognized by speech recognition engines.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine.Windows.Speech](/engine/6000.7/script-reference/unityengine/windows/speech.md)
* **Assembly:** UnityEngine.CoreModule
* **Inherits from:** [PhraseRecognizer](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer.md)
* **Implements:** [IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

```csharp
public sealed class GrammarRecognizer : PhraseRecognizer, IDisposable
```

## Remarks

For more information on this format, refer to [](http://www.w3.org/TR/speech-grammar/)[www.w3.org/TR/speech-grammar](http://www.w3.org/TR/speech-grammar) or on MSDN.

There can be many grammar recognizers active at any given point in time, but no two grammar recognizers may use the same grammar file.

Grammar recognizer is currently functional only on Windows 10.

## Constructors

| Constructor                                                                                                                                                                                                     | Description                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [GrammarRecognizer(System.String)](/engine/6000.7/script-reference/unityengine/windows/speech/grammarrecognizer/ctor.md#grammarrecognizer\(string\))                                                            | Creates a grammar recognizer using specified file path and minimum confidence. |
| [GrammarRecognizer(System.String,UnityEngine.Windows.Speech.ConfidenceLevel)](/engine/6000.7/script-reference/unityengine/windows/speech/grammarrecognizer/ctor.md#grammarrecognizer\(string-confidencelevel\)) | Creates a grammar recognizer using specified file path and minimum confidence. |

## Properties

| Property                                                                                                           | Description                                                                               |
| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| [GrammarFilePath](/engine/6000.7/script-reference/unityengine/windows/speech/grammarrecognizer/grammarfilepath.md) | Returns the grammar file path which was supplied when the grammar recognizer was created. |

## Inheritance

**Inherited Members:**

* [PhraseRecognizer.Start()](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer/start.md)
* [PhraseRecognizer.Stop()](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer/stop.md)
* [PhraseRecognizer.Dispose()](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer/dispose.md)
* [PhraseRecognizer.IsRunning()](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer/isrunning.md)
* [PhraseRecognizer.OnPhraseRecognized()](/engine/6000.7/script-reference/unityengine/windows/speech/phraserecognizer/onphraserecognized.md)
