• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using regular expressions in JSGF file

 
ui project
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • 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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!