#!/bin/sh
# compoundCheck: check for a list of words if they are compounds
# usage:         echo words | compoundCheck
# note:          this program relies on the Prolog program compound.p
# 960312 erik.tjong@ling.uu.se

# get the first word
read WORD
# while the word is not empty
while [ -n "$WORD" ]
do
   # test if word is a compound by calling Prolog (this takes time!)
   ANSWER="`echo \"['compound.p'],compound($WORD,_).\"|prolog 2>&1|tail -1`"
   # if the word is no compound
   if [ "$ANSWER" = "no" ]
   then
      # then print the word
      echo $WORD
   fi
   # else don't print it
   # read the next words
   read WORD
done

# Done
exit 0
