#!/bin/sh

# 
#  FASt Term Recognizer
# 
#   DISTRIB/lib/WordNetPreProc
#   Version 2.04/04-02-01
# 
#   Copyright (C) 2004  Christian Jacquemin, LIMSI-CNRS
# 
#   Building semantic families from the WordNet database
# 

# THESE VARIABLES HAVE TO BE SET:

source /etc/fastr.conf
[ -f $HOME/.fastrrc ] && source $HOME/.fastrrc

# Collecting WordNet synsets
cat ${WORDNETDICT}/index.verb | perl -ne 'chop; s/ .*//; if( $_ ){ $_ =~ s/\x27/\\\x27/g; system "wn $_ -synsv"; }' > ${FASTR}/lib/wordnet.synsets.orig
cat ${WORDNETDICT}/index.noun | perl -ne 'chop; s/ .*//; if( $_ ){ $_ =~ s/\x27/\\\x27/g; system "wn $_ -synsn"; }' >> ${FASTR}/lib/wordnet.synsets.orig
cat ${WORDNETDICT}/index.adj | perl -ne 'chop; s/ .*//; if( $_ ){ $_ =~ s/\x27/\\\x27/g; system "wn $_ -synsa"; }' >> ${FASTR}/lib/wordnet.synsets.orig
cat ${WORDNETDICT}/index.adv | perl -ne 'chop; s/ .*//; if( $_ ){ $_ =~ s/\x27/\\\x27/g; system "wn $_ -synsr"; }' >> ${FASTR}/lib/wordnet.synsets.orig

# synsets are transformed into the standard format for fastr
cat ${FASTR}/lib/wordnet.synsets.orig \
    | ${FASTRBIN}/WordNetPreProc.pl -nocompound \
    | sort -u > ${FASTR}/lib/sem-classes-en



