Rangoon
Posts: 83
Joined: 9/25/2013 Status: offline
|
I received a PM asking for more details on how I got my RegEx lines working for Weapon log entries and such. Here is an explanation and some examples which I hope will help. Avoid using the first line (top row, first rule) in SeaHag for now; it seems to be broken, at least for me. But you'll likely want to use one of the earlier rules in the list. At any rate, understand that while the debugger ("More Diagnostics" checkbox) will show the input line as matching the original, the actual input line is updated as it goes through the rules. So if a rule replaces numbers with letters, or removes hyphens, etc., then some of my RegEx code examples won't work if they're looking for specific asset types (like MiG-23ML Flogger G) and identifying them by the hyphens or numbers (vs. BOGEY, which has only letters, and in some of my rules I want left in tact). You could code it more cleverly, or just place the RegEx rule higher so that it correctly locates the "MiG-23" in the text and doesn't get thrown off the trail by "MiG two three", for example. I personally created a dummy rule in slot 1, disabled it, and left it empty. My personal RegEx rules begin at rule #5, after the stock "/" Replace rule. For testing, I'm doing a few things. In SeaHag, I paste the entire single log entry (from past CMANO log files) of whatever I want to test into the handy Parse Line function below the Log Window - with or without More Diagnostics checked (with SeaHag Stopped, then hit Parse Line). I either use or don't use "Voice On". I uncheck "AutoDetect Playerside" and input the Player Side manually. That way I know I'm testing real-sim log events completely in SeaHag. I use Expresso 3.0 for testing the RegEx code (It's free, has a handy tutorial, and plenty of slick functionality) before importing to SeaHag. I just paste the CMANO log entry into Expresso, excluding the Time Stamp and Player Side (since SeaHag will handle those natively). I test the desired voice results in TextAloud because various voices seem to have strengths and weaknesses. I changed "Weapon HIT" to "Weapon engaging" finally to "Weapon impact" because I thought it sounded the best with the voice I'm using. A few other things like that are catering to the specific voice I'm using, which happens to be "Ivona English, British Amy" - of course you can always use SeaHag to test the TTS voice idiosyncrasies, especially when you're using the default Windows voice. Example 1: I wanted to change ": Weapon:...HIT" entries to just "Weapon imact" since I don't like TTS reading the entire line. I just want a quick update and perhaps an indication that I should check the log for more information. Sample entry: "2/21/1983 5:07:25 PM - : Weapon: AIM-54A Phoenix #303 is attacking MiG-23ML Flogger G with a base PH of 80%. PH adjusted for distance: 66%. PH adjusted for actual target speed (601 kts): 64%. MiG-23ML Flogger G has nominal agility: 3. Agility adjusted for proficiency (Regular): 2.4. High-deflection impact (no effect on agility). Final agility modifier: -24%. Final PH: 40%. Result: 11 - HIT" Rule: Verbosity 1-9 Prevent Repeat 0 type is REGEXP Text to Look for / Regexp: "\:\sWeapon\:.*\bHIT\b" without quotes. Reduce Char: leave empty (delete the asterisk) Replacement: "Weapon impact" without quotes. Continue Volume 10 (I think this does nothing with TTS, only sounds). What the code does is searches for the colon which begins these entries in the CMANO log, then a space, followed by the word "Weapon:", followed by any characters other than "new line", followed by the word "HIT". It is selecting the entire match. SeaHag then will replace that entire match with "Weapon impact". I then have a Find rule in SeaHag, toward the bottom, which searches for "Weapon " (with the space at the end) to trigger speach. The line itself was reduced entirely to "Weapon impact" after the Time Stamp and Player Side were removed by SeaHag. I replaced the word ": Weapon:" because it made it easy for me to search and also remove the colons. There is probably a smarter way to do this. I remove the colon after Weapon for TTS reasons (remove the pause). Example 2: I wanted to change ": Weapon:...MISS" entries to just "Weapon MISS". Sample entry: 2/21/1983 5:07:15 PM - : Weapon: AIM-54A Phoenix #300 is attacking MiG-21bis Fishbed N with a base PH of 80%. PH adjusted for distance: 66%. PH adjusted for actual target speed (569 kts): 64%. MiG-21bis Fishbed N has nominal agility: 3.5. Agility adjusted for proficiency (Regular): 2.8. High-deflection impact (no effect on agility). Final agility modifier: -28%. Final PH: 36%. Result: 64 - MISS Rule: Verbosity 1-9 Prevent Repeat 0 type is REGEXP Text to Look for / Regexp: "\:\sWeapon\:.*(?=\bMISS\b)" without quotes. Reduce Char: leave empty (delete the asterisk) Replacement: "Weapon " without quotes, but with the space Continue Volume 10 (I think this does nothing with TTS, only sounds). What the code does is searches for the colon which begins these entries in the CMANO log, then a space, followed by the word "Weapon:", followed by any characters other than "new line", followed by the word "HIT". It is matching everything *except* for the word "MISS". SeaHag then will replace that entire match with "Weapon " and leave "MISS" in tact. I then have a Find rule in SeaHag, toward the bottom, which searches for "Weapon " (with the space at the end) to trigger speach. The line itself was reduced entirely to "Weapon MISS" after the Time Stamp and Player Side were removed by SeaHag. I replaced the word ": Weapon:" because it made it easy for me to search and also remove the colons. There is probably a smarter way to do this. I remove the colon after Weapon for TTS reasons (remove the pause). Example 3: I wanted to change "Weapon:... ... self-destructing" entries to just "Weapon self-destructing". Sample entry: 2/21/1983 5:08:30 PM - CVW-15: Weapon: AIM-7F Sparrow III #315 is running blind for more than 5 sec... self-destructing. Rule: Verbosity 1-9 Prevent Repeat 0 type is REGEXP Text to Look for / Regexp: "\bWeapon\:.*(?=\bself-destructing)" without quotes. Reduce Char: leave empty (delete the asterisk) Replacement: "Weapon " without quotes, but with the space Continue Volume 10 (I think this does nothing with TTS, only sounds). What the code does is searches for the word "Weapon:", followed by any characters other than "new line", followed by the word "self-destructing". It is matching everything *except* for the word "self-destructing". SeaHag then will replace that entire match with "Weapon " and leave "self-destructing" in tact. I then have a Find rule in SeaHag, toward the bottom, which searches for "Weapon " (with the space at the end) to trigger speach. The line itself was reduced entirely to "Weapon self-destructing" after the Time Stamp and Player Side were removed by SeaHag. I replaced the word "Weapon:" because it made it easy for me to search and also remove the colon. There is probably a smarter way to do this. I remove the colon after Weapon for TTS reasons (remove the pause). Example 4: I wanted to change "[some kind of specific sim contact like MiG-23ML Flogger G #64] has been lost." entries to just "ID'd contact [number] has been lost". Rather than create rules to try and get TTS to render all of these specific asset names correctly, I just wanted to shorten the whole thing up and have it say something which it could always say correctly (dare I say "naturally"?). I can then just look at the log for more information. Sample entry: 2/21/1983 5:10:13 PM - CVW-15: Contact MiG-23ML Flogger G #64 has been lost. Rule: Verbosity 1-9 Prevent Repeat 0 type is REGEXP Text to Look for / Regexp: "(?<=\bContact\b\s).*\d+.*(?=\#)" without quotes. Reduce Char: leave empty (delete the asterisk) Replacement: "ID'd contact" without quotes Continue Volume 10 (I think this does nothing with TTS, only sounds). What the code does is searches for the word "Contact " (with the space), followed by (or not) any characters other than "new line", followed by at least one number, followed by (or not) any characters other than "new line", followed by the "#" symbol. It is matching everything between, but not including, the word "Contact " and the "#" symbol. SeaHag then will replace that entire match with "ID'd contact". I then have a Find rule in SeaHag, toward the bottom, which searches for "has been lost" to trigger speach. There are default Replace rules to change numerals to words for the numbers. I have a Replace rule which changes "#" symbols to a space. The line itself was reduced entirely to "ID'd contact six four has been lost." after the Time Stamp and Player Side were removed by SeaHag. Example 5: I wanted to change "[some kind of specific sim unit designation like VA-105 Gunslingers, NE-401] has been destroyed!" entries to just "Asset has been destroyed!". Rather than create rules to try and get TTS to render all of these specific asset names correctly, I just wanted to shorten the whole thing up and have it say something which it could always say well. I can then just look at the log for more information. Sample entry: 2/21/1983 5:25:33 PM - CVW-15: VA-105 Gunslingers, NE-401 has been destroyed! Rule: Verbosity 1-9 Prevent Repeat 0 type is REGEXP Text to Look for / Regexp: "^.*(?=has\sbeen\sdestroyed)" without quotes. Reduce Char: leave empty (delete the asterisk) Replacement: "Asset " without quotes, including the space Continue Volume 10 (I think this does nothing with TTS, only sounds). What the code does is searches for the the start of a string beginning with any characters other than "new line", followed by the words "has been destroyed". It is matching everything before the words "has been destroyed". SeaHag then will replace that entire match with "Asset ". I then have a Find rule in SeaHag, toward the bottom, which searches for "has been destroyed" to trigger speach. The line itself was reduced entirely to "Asset has been destroyed!" after the Time Stamp and Player Side were removed by SeaHag.
|