Results 1 to 3 of 3
  1. #1
    uiproject is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default Using regular expressions in JSGF file

    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.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,008
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by uiproject View Post
    but nothing is working. Please let me know how to do this. Without this, my whole project is limited.
    According to the grammar definition there's no way to specify a regular expression in a rule expansion.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    uiproject is offline Member
    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0

    Default Re:anks

    Thanks Jos. Is there any other way to detect any name and get that name?

Similar Threads

  1. Using regular expressions for search
    By carderne in forum New To Java
    Replies: 9
    Last Post: 05-24-2009, 04:58 AM
  2. Regular Expressions in java
    By blue404 in forum Advanced Java
    Replies: 2
    Last Post: 09-26-2008, 03:43 AM
  3. Using Quantifiers in regular expressions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-10-2008, 10:43 AM
  4. Capturing Groups using regular expressions
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-25-2007, 11:19 AM
  5. Regular expressions quantifiers
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-25-2007, 11:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •