Lexical Tools

SPT - Permutation Design

I. Introduction
This section describes the method to find all permutations with synonyms from pattern permutation results from the previous section.

II. Algorithm

  • Go through all elements (synonym list) of the inList
    • In the order from the last to the first (to looks nicer)
    • Get the synonyms list of each element
      • Duplicate the current permutation list to the number of synonym list
      • Add all synonyms to the beginning of permutation list

III. Java Classes & Method

  • Permutation.java: a Java class for finding all permutation
  • public Vector<String> GetPermutation(Vector<Vector<String>> inList)

IV. Examples

  • Inputs:

    Pattern 1
    word|synonyms
    who|
    let|
    dog|canine|k9|bull dog|
    and|
    cat|feline|
    out|

    Pattern 2
    word|synonyms
    who|
    let|
    dog and cat|pets|puppy and kitty|
    out|

  • Algorithm Walk Through:

    Pattern-Stepcurrent elementpermutation
    1-1out|
    • out
    1-2cat|feline|
    • cat out
    • feline out
    1-3and|
    • and cat out
    • and feline out
    1-4dog|canine|k9|bull dog|
    • dog and cat out
    • dog and feline out
    • canine and cat out
    • canine and feline out
    • k9 and cat out
    • k9 and feline out
    • bull dog and cat out
    • bull dog and feline out
    1-5let|
    • let dog and cat out
    • let dog and feline out
    • let canine and cat out
    • let canine and feline out
    • let k9 and cat out
    • let k9 and feline out
    • let bull dog and cat out
    • let bull dog and feline out
    1-6who|
    • who let dog and cat out (original input)
    • who let dog and feline out
    • who let canine and cat out
    • who let canine and feline out
    • who let k9 and cat out
    • who let k9 and feline out
    • who let bull dog and cat out
    • who let bull dog and feline out

    Pattern-Stepcurrent elementpermutation
    2-1out|
    • out
    2-2dog and cat|pets|puppy and kitty|
    • dog and cat out
    • pets out
    • puppy and kitty out
    2-3let|
    • let dog and cat out
    • let pets out
    • let puppy and kitty out
    2-4who|
    • who let dog and cat out (original input)
    • who let pets out
    • who let puppy and kitty out

  • Outputs:
    • who let dog and cat out
    • who let dog and feline out
    • who let canine and cat out
    • who let canine and feline out
    • who let k9 and cat out
    • who let k9 and feline out
    • who let bull dog and cat out
    • who let bull dog and feline out
    • who let pets out
    • who let puppy and kitty out