Searching for passages that contain x out of y terms

Irvin Wan
Irvin Wan Member Posts: 8
edited November 2024 in English Forum

Hi all, would anyone know how to search for passages that contain x out of y terms?

For example, searching for passages that contain any 3 terms out of "hope", "peace", "joy" and love".

Thank you!

Tagged:

Comments

  • Dave Hooton
    Dave Hooton MVP Posts: 35,841

    Without getting too complicated:

    (hope AND peace AND joy ) OR  (hope AND peace  AND love) OR (hope  AND joy AND love) OR (peace AND joy AND love)

    which comes from this table which omits one term from each combination:

    hope AND peace AND joy AND love

      X               X                  X               -

      X               X                  -               X 

      X               -                  X               X

      -               X                  X               X

    Dave
    ===

    Windows 11 & Android 13

  • Dave Hooton
    Dave Hooton MVP Posts: 35,841

    which comes from this table which omits one term from each combination:

    Strictly, we also have to exclude the remaining word(s), so you don't get all four in a verse!:-

    (hope AND peace AND joy NOT love) OR  (hope AND peace  AND love NOT joy) OR (hope  AND joy AND love NOT peace) OR (peace AND joy AND love NOT hope)

    The number of combinations is   y! / (x! (y-x)!) , where 4! = 4x3x2x1,   3! = 3x2x1, 1! = 1 etc.

      4! / 3!x1 = 4 for any 3 out of 4

      4! / 2!x2! = 6 for any 2 out of 4   -- > so you need a table with 4  columns and 6 rows

      6! / 4!x2! = 15  for any 4 out of 6   ---> now you need  a table with 6 columns and 15 rows.

    So don't get too ambitious.

    Dave
    ===

    Windows 11 & Android 13