Changeset 1082 for trunk/plugins/en/output_VAR.tcl
- Timestamp:
- 08/26/10 11:32:47 (21 months ago)
- File:
-
- 1 edited
-
trunk/plugins/en/output_VAR.tcl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/en/output_VAR.tcl
r1053 r1082 110 110 set replacement [bMotion_plugins_settings_get "output:VAR" "last" $channel "$abstract"] 111 111 } 112 "prevtriplet" { 113 set replacement [bMotion_plugins_settings_get "output:VAR" "last:pretriplet" $channel $abstract] 114 } 112 115 "strip" { 113 116 set replacement [bMotion_strip_article $replacement] … … 139 142 set replacement [string toupper $replacement] 140 143 } 144 "triplet" { 145 bMotion_plugins_settings_set "output:VAR" "last:pretriplet" $channel $abstract $replacement 146 set temp [bMotion_find_triplet $replacement] 147 if {$temp == ""} { 148 putlog "triplet is blank" 149 return "" 150 } 151 set replacement $temp 152 } 153 141 154 } 142 155 bMotion_putloglev 1 * "current replacement is $replacement" … … 160 173 } 161 174 175 proc bMotion_find_triplet { word } { 176 set start 0 177 if {[string length $word] < 3} { 178 return "" 179 } 180 181 set results [list] 182 183 while {[regexp -start $start -nocase -indices {([^aeiou ][aeiou][^aeiou ])} $word matches a]} { 184 lappend results [string range $word [lindex $a 0] [lindex $a 1]] 185 set start [lindex $a 1] 186 } 187 188 if {[llength $results] == 0} { 189 return "" 190 } 191 192 return [pickRandom $results] 193 } 162 194 163 195 bMotion_plugin_add_output "VAR" bMotion_plugin_output_VAR 1 "en" 3
Note: See TracChangeset
for help on using the changeset viewer.
