Reply to post

Hot!@Voice did not allow to use same group name (RegEx) for Edit Speech

Author
Sorawut
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2019/01/21 07:50:55
  • Status: offline
2019/07/09 00:35:45 (permalink)

@Voice did not allow to use same group name (RegEx) for Edit Speech

Hi,
 
From this documentation,
http://www.regexlab.com/en/deelx/syntax/bas_name.htm
 
DEELX allows more than one groups have the same group name. Logically, they are the same group, for example: (?<string>".*?")|(?<string>'.*?') .
 
but I got this error dialog in @Voice.

 
Could you please suggest any other way to use a same group name for RegEx?
 
Thank you,

8 Replies Related Threads

    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: online
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/09 04:48:47 (permalink)
    Maybe this is because @Voice uses DEELX internally to process all substitutions (because it's written in C++, faster), but for checking syntax I use Android Java RegEx implementation (because DEELX does not give me the precise error messages and locations). So far for many years it worked OK, you are the first to report a problem with this issue. Maybe I could suggest an alternative approach, but would need to understand first exactly what you want to do - what text you want to match and how do you want to replace it.
    Sorawut
    User
    • Total Posts : 0
    • Reward points: 0
    • Joined: 2019/01/21 07:50:55
    • Status: offline
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/09 07:11:02 (permalink)
    It was needed because there is no separate character between Thai words. Many of them were speech incorrectly.
     
    Example sentence. "อย่าเออออว่าของทนทาน"
    It should be speech as "อย่า เออ ออ ว่า ของ ทน ทาน"
    but it was speech as "อย่า เอ ออ ว่า ของ ทะ นะ ทาน" that was wrong.
     
    So I have created below pattern.
    Pattern: "(ทน)(ทาน)|(เออ)(ออ)"
    Replace: "$1·$2·$3·$4·"
    Result: "อย่า··เออ·ออ·ว่าของทน·ทาน···" which was speech correctly.
     
    Above pattern is for only 2 Thai words but there are much more than these.
     
    So if @Voice allow me to use same group name, I can create below pattern.
    Pattern:(?<a>ทน)(?<b>ทาน)|(?<a>เออ)(?<b>ออ)|(?<a>ก็)(?<b>อด)|(?<a>อด)(?<b>รน)|....|....|etc
    Replace: ${a}·${b}·
    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: online
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/09 16:50:49 (permalink)
    I see. It really is a tough nut to crack. The TTS voice software that says handles Thai language should to this splitting correctly, but apparently it fails... The only solution that comes to my mind would be to warn the user about the suspect syntax error, but let you click something and still accept the RegEx, handle it to DEELX at the reading time and see what happens...
     
    However, let's stop for a moment and ask: instead of entering many alternatives with | operator in one RegEx expressions, wouldn't the final result be the same, if you created a number of separate replacements, e.g.:
     
    Replacement 1:
    Pattern: (?<a>ทน)(?<b>ทาน)
    Replace: ${a}·${b}·
     
    Replacement 2:
    Pattern: (?<a>เออ)(?<b>ออ)
    Replace: ${a}·${b}·
     
    etc....
    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: online
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/09 16:53:52 (permalink)
    Or even give up on RegEx here to save time, battery and memory in processing all of this, and use replacement type "Case sensitive" (because it's the fastest), and write replacements like:
     
    Replacement 1:
    Pattern: ทนทาน
    Replace: ทน·ทาน·
     
    etc.
     
    It would be many times faster than using RegEx. If this is wrong, what am I missing here?
     
    Sorawut
    User
    • Total Posts : 0
    • Reward points: 0
    • Joined: 2019/01/21 07:50:55
    • Status: offline
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/09 18:22:55 (permalink)
    I see. It really is a tough nut to crack. The TTS voice software that says handles Thai language should to this splitting correctly, but apparently it fails... The only solution that comes to my mind would be to warn the user about the suspect syntax error, but let you click something and still accept the RegEx, handle it to DEELX at the reading time and see what happens...

    That is ok, thank you.
     

    Or even give up on RegEx here to save time, battery and memory in processing all of this, and use replacement type "Case sensitive" (because it's the fastest), and write replacements like:
     
    Replacement 1:
    Pattern: ทนทาน
    Replace: ทน·ทาน·
     
    etc.

    I used to do this replacement but it was inconvenient when I want to add a new replacement because I have to open old replacement to copy "·" first then back to insert new replacement to paste it.
     
    with same group name RegEx capability, I just open the replacement, copy part of pattern ex."(?<a>ทน)(?<b>ทาน)|" then paste in front of pattern and only change Thai word to new one ex."(?<a>ก็)(?<b>อด)|"
     
    I have just figured out what I really needed when I tried to explain you my reason. Actually I need a "Copy" or "Clone" or "Duplicate" button for Edit speech so I do not need to open old replacement to copy "·" then back to insert new replacement to paste it.
    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: online
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/10 04:39:57 (permalink)
    Maybe I could add an action on a long-press on the "Insert" button, to insert and edit a copy of the current item. A list of simple, case sensitive replacements is definitely preferable to a long RegEx, or even a list of RegEx replacement - eventually if you added a lot of them, you could have long delays before each sentence was spoken, needed for processing all of these items.
    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: online
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/11 14:42:46 (permalink)
    I now released @Voice version 17.2.0b to the beta test area on Google Play, where a long press on add or insert a new item to the Edit Speech list adds/inserts a copy of the currently highlighted item.
    Sorawut
    User
    • Total Posts : 0
    • Reward points: 0
    • Joined: 2019/01/21 07:50:55
    • Status: offline
    Re: @Voice did not allow to use same group name (RegEx) for Edit Speech 2019/07/11 21:36:33 (permalink)
    It works great. Thank you so much.
    Jump to:
    © 2019 APG vNext Commercial Version 5.1