0

I have 2 routines that should be completely parallel. I want Snowball to execute them and choose the one with the longest match.

Currently, I run them using or. That means execute the first, if fails execute the second.

I thought of perform a test for both routines get the length of match, store it in variables, then compare them and execute the routine with the longest match.

Is there a standard instruction to do it or a better solution?

pseudo code:

 Verb_Suffixes 
 or 
 Noun_Suffixes

real code

    //Suffixes for verbs
  ( 
   is_verb
   (
       (
          (atleast 1 Suffix_Verb_Step1) 
          ( Suffix_Verb_Step2a or Suffix_Verb_Step2c  or next)
        )
        or Suffix_Verb_Step2b
        or Suffix_Verb_Step2a
    )
   )
    //Suffixes for nouns 
    or (
       is_noun
        ( 

         try ( 
             Suffix_Noun_Step2c2
             or (not is_defined Suffix_Noun_Step1a ( 
                    Suffix_Noun_Step2a 
                    or Suffix_Noun_Step2b 
                    or Suffix_Noun_Step2c1 
                    or next))
             or (Suffix_Noun_Step1b ( 
                    Suffix_Noun_Step2a 
                    or Suffix_Noun_Step2b 
                    or Suffix_Noun_Step2c1))
             or (not is_defined Suffix_Noun_Step2a)
             or (Suffix_Noun_Step2b)
         )
         Suffix_Noun_Step3
         )
    )
Assem
  • 11,574
  • 5
  • 59
  • 97
  • 1
    This is a well researched question asking a sensible and interesting question about the language features of an important though obscure stemming language--- upvote. – Tom Apr 04 '16 at 12:53

1 Answers1

0

There is no standard instruction for it but it can be done by get the cursor value after each routine, than compare them and back where it should be:

$c = 0 
do test (Verb_Suffixes  $c = cursor)
do test (Noun_Suffixes ($c < cursor $c = cursor))
tomark c

($c < cursor $c = cursor) means if ($c < cursor) $c = cursor

And for test, the definitions from snowball manual:

test C

This does command C but without advancing c. Its signal is the same as the signal of C, but following signal t, c is set back to its old value.

Assem
  • 11,574
  • 5
  • 59
  • 97