Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Dictation grammar????

Dictation grammar????

Scheduled Pinned Locked Moved Visual Basic
helpquestiongraphicssysadminxml
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Speedular
    wrote on last edited by
    #1

    Good day to all I have this problem with the code below; I want the system to simply write what it hears with out using the grammar. is there any way to do that? I've tried removing the grammar file but it did not work. any help or suggestions

    'Default Imports
    Imports System
    Imports System.Data
    Imports System.Deployment
    Imports System.Drawing
    Imports System.Windows.Forms
    Imports System.Xml

    'Custom Imports
    Imports SpeechLib

    Public Class Form1
    'Declares

    Dim WithEvents RecoContext As SpSharedRecoContext       'The Main Recognition Object Used throughout the whole program. -- Shared Object: More Info on this later.
    Dim Grammar As ISpeechRecoGrammar                       'The Grammar Object so the program knows what is going on. -- Instanced Object: More Info on this later.
    Dim CharCount As Integer                                'This is used to count the amount of chars that are in the text box.
    
    
    
    ''''Subs Start Here
    'Start Button. This will engage reco, and start the entire process.
    Private Sub btnStart\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    
        'First check to see if reco has been loaded before. If not lets load it.
        If (RecoContext Is Nothing) Then
            RecoContext = New SpSharedRecoContextClass          'Create a new Reco Context Class
    
            Grammar = RecoContext.CreateGrammar(1)              'Setup the Grammar
            Grammar.DictationLoad()                             'Load the Grammar
        End If
    
        lblStatus.Text = "Recognition Started"                  'Change the Label to let the user know whats up
        Grammar.DictationSetState(SpeechRuleState.SGDSActive)   'Turns on the Recognition. This is Vitally important
    
        'This is so the user doesn't break the program by 
        'trying to start the recognition after its already started.
        btnStart.Enabled = False
        btnStop.Enabled = True
    End Sub
    
    
    ''''
    
    
    'Stop Button. This will stop stop the recoginition
    Private Sub btnStop\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
    
        Grammar.DictationSetState(SpeechRuleState.SGDSInactive) 'Turns off the Recognition. It will go dormant.
        lblStatus.Text = "Recognition Stopped"                  'Change the label to let the user know whats up
    
        'Again This is so the user doesn't go breaking things accidently
        btnStart.Enabled = True
    
    _ 1 Reply Last reply
    0
    • S Speedular

      Good day to all I have this problem with the code below; I want the system to simply write what it hears with out using the grammar. is there any way to do that? I've tried removing the grammar file but it did not work. any help or suggestions

      'Default Imports
      Imports System
      Imports System.Data
      Imports System.Deployment
      Imports System.Drawing
      Imports System.Windows.Forms
      Imports System.Xml

      'Custom Imports
      Imports SpeechLib

      Public Class Form1
      'Declares

      Dim WithEvents RecoContext As SpSharedRecoContext       'The Main Recognition Object Used throughout the whole program. -- Shared Object: More Info on this later.
      Dim Grammar As ISpeechRecoGrammar                       'The Grammar Object so the program knows what is going on. -- Instanced Object: More Info on this later.
      Dim CharCount As Integer                                'This is used to count the amount of chars that are in the text box.
      
      
      
      ''''Subs Start Here
      'Start Button. This will engage reco, and start the entire process.
      Private Sub btnStart\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
      
          'First check to see if reco has been loaded before. If not lets load it.
          If (RecoContext Is Nothing) Then
              RecoContext = New SpSharedRecoContextClass          'Create a new Reco Context Class
      
              Grammar = RecoContext.CreateGrammar(1)              'Setup the Grammar
              Grammar.DictationLoad()                             'Load the Grammar
          End If
      
          lblStatus.Text = "Recognition Started"                  'Change the Label to let the user know whats up
          Grammar.DictationSetState(SpeechRuleState.SGDSActive)   'Turns on the Recognition. This is Vitally important
      
          'This is so the user doesn't break the program by 
          'trying to start the recognition after its already started.
          btnStart.Enabled = False
          btnStop.Enabled = True
      End Sub
      
      
      ''''
      
      
      'Stop Button. This will stop stop the recoginition
      Private Sub btnStop\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
      
          Grammar.DictationSetState(SpeechRuleState.SGDSInactive) 'Turns off the Recognition. It will go dormant.
          lblStatus.Text = "Recognition Stopped"                  'Change the label to let the user know whats up
      
          'Again This is so the user doesn't go breaking things accidently
          btnStart.Enabled = True
      
      _ Offline
      _ Offline
      _Damian S_
      wrote on last edited by
      #2

      If you don't want grammar, could you not simply have each line of text saved into a variable, then remove any grammatical items from that variable before outputting it to your textbox (or wherever it is going to)?

      Knowledge is knowing that the tomato is a fruit. Wisdom is not putting it in fruit salad!! Booger Mobile - Camp Quality esCarpade 2010

      S 1 Reply Last reply
      0
      • _ _Damian S_

        If you don't want grammar, could you not simply have each line of text saved into a variable, then remove any grammatical items from that variable before outputting it to your textbox (or wherever it is going to)?

        Knowledge is knowing that the tomato is a fruit. Wisdom is not putting it in fruit salad!! Booger Mobile - Camp Quality esCarpade 2010

        S Offline
        S Offline
        Speedular
        wrote on last edited by
        #3

        firstly thnx O tried to do what u suggested but it did not work; :( it keeps writing the english word that have a meaning.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups