• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • NaturallySpeaking python scripting env
  • Bugs

Grammars with certain words silently fail

Brought to you by: esjatharvee, joelgould, olmo76, quintijn
  • Summary
  • Files
  • Reviews
  • Support
  • Bugs
  • News
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#5 Grammars with certain words silently fail

open-out-of-date
nobody
None
5
2008-08-13
2007-05-12
Anonymous
No

Consider the following Vocola file:

##
## Test handling of words containing backslashes:
##

#
# These behave like the lists denote the empty string:
#

<y> := ( "/" | "\\" );
test type <y> = $1;

<z> := ( "/" | "\" );
test foo <z> = $1;

<x> := (white |"yellow " | "orange ");
Fred test <x> = $1;

#
# These aren't recognizable:
#

test Fred "\" = George;

omega test "red " = blue;
Delta test (white |"yellow " | "orange ") = $1;

#
# this one works fine:
#

alpha test = normal;

It converts to the following NatLink file:

# NatLink macro definitions for NaturallySpeaking
# Generated by vcl2py 2.5.3, Fri May 11 20:06:58 2007

import natlink
from natlinkutils import *
from VocolaUtils import *

class ThisGrammar(GrammarBase):

gramSpec = """
<y> = ('/' | '\\\\' ) ;
<1> = 'test type' <y> ;
<z> = ('/' | '\\' ) ;
<2> = 'test foo' <z> ;
<x> = ('white' | 'yellow ' | 'orange ' ) ;
<3> = 'Fred test' <x> ;
<4> = 'test Fred \\' ;
<5> = 'omega test red ' ;
<6> = 'Delta test' ('white' | 'yellow ' | 'orange ' ) ;
<7> = 'alpha test' ;
<any> = <1>|<2>|<3>|<4>|<5>|<6>|<7>;
<sequence> exported = <any>;
"""

def initialize(self):
self.load(self.gramSpec)
self.currentModule = ("","",0)
self.ruleSet1 = ['sequence']

def gotBegin(self,moduleInfo):
window = moduleInfo[2]
self.firstWord = 0
# Return if same window and title as before
if moduleInfo == self.currentModule: return None
self.currentModule = moduleInfo

self.deactivateAll()
title = string.lower(moduleInfo[1])
if string.find(title,'') >= 0:
for rule in self.ruleSet1:
self.activate(rule)

def get_y(self, word):
actions = Value()
actions.augment(word)
return actions

# test type <y>
def gotResults_1(self, words, fullResults):
actions = Value()
word = fullResults[1 + self.firstWord][0]
actions.augment(self.get_y(word))
actions.perform()
self.firstWord += 2

def get_z(self, word):
actions = Value()
actions.augment(word)
return actions

# test foo <z>
def gotResults_2(self, words, fullResults):
actions = Value()
word = fullResults[1 + self.firstWord][0]
actions.augment(self.get_z(word))
actions.perform()
self.firstWord += 2

def get_x(self, word):
actions = Value()
actions.augment(word)
return actions

# Fred test <x>
def gotResults_3(self, words, fullResults):
actions = Value()
word = fullResults[1 + self.firstWord][0]
actions.augment(self.get_x(word))
actions.perform()
self.firstWord += 2

# test Fred \\
def gotResults_4(self, words, fullResults):
actions = Value()
actions.augment('George')
actions.perform()
self.firstWord += 1
if len(words) > 1: self.gotResults_4(words[1:], fullResults)

# omega test red
def gotResults_5(self, words, fullResults):
actions = Value()
actions.augment('blue')
actions.perform()
self.firstWord += 1
if len(words) > 1: self.gotResults_5(words[1:], fullResults)

# Delta test (white | yellow | orange )
def gotResults_6(self, words, fullResults):
actions = Value()
word = fullResults[1 + self.firstWord][0]
actions.augment(word)
actions.perform()
self.firstWord += 2
if len(words) > 2: self.gotResults_6(words[2:], fullResults)

# alpha test
def gotResults_7(self, words, fullResults):
actions = Value()
actions.augment('normal')
actions.perform()
self.firstWord += 1
if len(words) > 1: self.gotResults_7(words[1:], fullResults)

thisGrammar = ThisGrammar()
thisGrammar.initialize()

def unload():
global thisGrammar
if thisGrammar: thisGrammar.unload()
thisGrammar = None

Inspection of the grammar shows that "test foo" and "test type" are not valid commands, yet they are recognized anyway. Somehow words like '\', '\\', and 'red ' break the grammar silently.

Is this a DNS bug, in which case it would be nice to know which words cause the problem. Or, is NatLink ignoring an error status code from DNS?

- Mark
mdl@alum.mit.edu

Discussion

  • Quintijn Hoogenboom

    Quintijn Hoogenboom - 2008-08-13

    Logged In: YES
    user_id=837135
    Originator: NO

    Mark, please restate the question if it is still active.

    Quintijn

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • Quintijn Hoogenboom

    Quintijn Hoogenboom - 2008-08-13
    • status: open --> open-out-of-date
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • Quintijn Hoogenboom

    Quintijn Hoogenboom - 2009-04-20

    Is this still an issue? Quintijn

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
×