Ignore:
Timestamp:
09/22/03 09:46:05 (9 years ago)
Author:
jamesoff
Message:

more intelligent handling of "-ing" words

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/en/complex_want_catch.tcl

    r292 r293  
    11## bMotion plugin: want catcher 
    2 # 
    3 # Jolly sneaky.. if someone wants something, we'll remember it for ourselves :) 
    4 # 
    5 # $Id$ 
     2 
    63# 
    74 
    8 ############################################################################### 
    9 # This is a bMotion plugin 
    10 # Copyright (C) James Michael Seward 2000-2002 
     5# Jolly sneaky.. if someone wants something, we'll remember it for ourselves :) 
     6 
    117# 
    12 # This program is covered by the GPL, please refer the to LICENCE file in the 
    13 # distribution; further information can be found in the headers of the scripts 
    14 # in the modules directory. 
     8 
     9# $Id$ 
     10 
     11# 
     12 
     13 
     14 
    1515############################################################################### 
    1616 
     17# This is a bMotion plugin 
     18 
     19# Copyright (C) James Michael Seward 2000-2002 
     20 
     21# 
     22 
     23# This program is covered by the GPL, please refer the to LICENCE file in the 
     24 
     25# distribution; further information can be found in the headers of the scripts 
     26 
     27# in the modules directory. 
     28 
     29############################################################################### 
     30 
     31 
     32 
    1733bMotion_plugin_add_complex "want-catch" "i (want|need) (.+)" 100 bMotion_plugin_complex_want_catcher "en" 
     34 
    1835bMotion_plugin_add_complex "mmm-catch" "^mmm+ (.+)" 100 bMotion_plugin_complex_mmm_catcher "en" 
     36 
    1937bMotion_plugin_add_complex "noun-catch" {[[:<:]](?:a|an|the) ([[:alpha:]]+)} 100 bMotion_plugin_complex_noun_catcher "en" 
    2038 
     39 
    2140proc bMotion_plugin_complex_want_catcher { nick host handle channel text } { 
     41 
    2242  if [regexp -nocase "i (want|need) (?!to)(.+? )" $text matches verb item] { 
     43 
    2344    #that's a negative lookahead ---^ 
     45 
    2446    bMotion_flood_undo $nick 
     47 
    2548    bMotion_abstract_add "sillyThings" $item 
    2649  } 
     50 
    2751} 
    2852 
     53 
    2954proc bMotion_plugin_complex_mmm_catcher { nick host handle channel text } { 
     55 
    3056  if [regexp -nocase "^mmm+ (.+?) " $text matches item] { 
     57 
    3158    bMotion_flood_undo $nick 
     59 
    3260    bMotion_abstract_add "sillyThings" $item 
    3361  } 
     62 
    3463} 
    3564 
     65 
     66 
    3667proc bMotion_plugin_complex_noun_catcher { nick host handle channel text } { 
    37   if [regexp -nocase {[[:<:]](a|an|the|some) ([[:alpha:]]+(?!ed|ing|ce|ly))} $text matches prefix item] { 
     68 
     69  if [regexp -nocase {[[:<:]](a|an|the|some) ([[:alpha:]]+)( [[:alpha:]]+[[:>:]])?} $text matches prefix item second] { 
     70 
    3871    bMotion_flood_undo $nick 
     72 
    3973    set item [string tolower $item] 
     74 
     75    if [regexp "(ly)$" $item] { 
     76      return 0 
     77    } 
     78     
     79    if [regexp "(ing|ed)$" $item] { 
     80      if {$second == ""} { 
     81        return 0 
     82      } 
     83      append item $second 
     84    } 
     85 
    4086    set prefix [string tolower $prefix] 
    4187    if {$prefix == "the"} { 
Note: See TracChangeset for help on using the changeset viewer.