• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using regular expressions in JSGF file

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to make a speech UI using cloud garden' implementation of JSAPI. When the user says "Create a frame with name <name>' my speech recognition software should recognize that the user wants to create a frame and it should take the name of the frame. So, I make a .jsgf file which has my grammar like this:

public <componentGrammar> = <command> <article> <component> <connector> <rule>;
<command> = create | make | remove ;
<article> = a | an | the | one ;
<component> = frame | panel | tabbedpane|splitpane|scrollpane|toolbar|internalfr ame|layeredpane|label|button|togglebutton|checkbox |radiobutton|buttongroup|combobox|list|textfield|t extarea|scrollbar|slider|progressbar|formattedfiel d|passwordfield|spinner;
<connector> = [with] name [equal to] ;
<rule> = ?

The problem with this is that this grammar should be able to detect the frame name which can be anything like this /a-zA-Z0-9/*. This is what should go into my <rule>. But putting

<rule> = /a-zA-Z0-9/*

is not taking it correctly. It is not recognizing this as a regular expression. I have also tried

<rule> = (/a-zA-Z0-9/)

but nothing is working. Please let me know how to do this. Without this, my whole project is limited.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cross-posted: java-forums.org thread

Hello and welcome to the Ranch! Please have a look at the FAQ on posting questions here including the one on cross-posting: HowToAskQuestionsOnJavaRanch
including the faq on BeForthrightWhenCrossPostingToOtherSites

Also, please check out an important administrative matter that I will send to you by private message.

Thanks for your cooperation and again, welcome!
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic