/*
 * Copyright 1999, 2000, 2001, Brown University, Providence, RI.
 * 
 *                         All Rights Reserved
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose other than its incorporation into a
 * commercial product is hereby granted without fee, provided that the
 * above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Brown University not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.
 * 
 * BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
 * PARTICULAR PURPOSE.  IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR
 * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

This parser takes ascii text with sentences delimited by <s> ...</s>,
and outputs the parsed versions in Penn tree-bank style.  So if the input is

<s> (``He'll work at the factory.'') </s>

the output will be:

(S1 (PRN (-LRB- -LRB-)
     (S (`` ``)
      (NP (PRP He))
      (VP (MD 'll)
       (VP (VB work) (PP (IN at) (NP (DT the) (NN factory)))))
      (. .)
      ('' ''))
     (-RRB- -RRB-)))

The parser is that described in the paper "A maximum-entropy-inspired
parser" Eugene Charniak, Brown TR CS99-12.  One parameter was adjusted
to produce parses at an average rate of about 2 seconds per sentence
on my 450 MH Sun (after about 45 seconds to load all of the data
files).  This version is has a precision/recall of about 89.8% on the
stadard Penn treebank test set, about 0.3% lower than what can be
aclieved with significantly more search.

The program was created from this file by

make parseIt


The program is run from this directory by:
parseIt <path to data directory>  <text file>
e.g.,
parseIt DATA/ DATA/test.raw

In this version it will ignore any sentence consisting of > 70 
words+punctuation.   To change this to, say 80 one would give
it the on-line argument -l80.  Currently there are various array
sizes that make 99 the absolute maximum sentence length.

To see debugging information give it the on-line argument -d#
where # is a number > 5.  As the numbers get larger, the verbosity of
the information increases.


*************************************************

Note for the 2000 Release:
This version differs in a few ways from the 1999 version.
1) Some bugs in the previous version have been fixed.
2) The statistics for guessing the preterminals of unknown words have
been slightly improved.
3) This version compiles under Sun's C++ compiler and Gnu's, althought
at the moment there are some rough spots.  At the moment
it is set to compile under Solaris.  To switch this to Gnu's
a) use makefile.gnu
b) in the file ECString.h change the line
	#define ECS sun
to
	#define ECS gnu

*************************************************


*************************************************

Note for the version nllparser (2001)
This version differs from the 2000 release in a few ways

1) only gnu (g++) is supported, so there is no makefile.gnu.  Just
makefile.
2) I made a trivial improvement should make the parser about three
times faster than the 2000 version.

Other than the speed, I expect this version to be identical in
performance to the previous release.  If I do not hear anything
to the contrary, the 2000 version (nlparser) will go away in
a few months and this version will replace it.

*************************************************



*************************************************
Note for the 2001 Release

I have now removed the old version of the parser and am only
distributing the version that runs under gnu g++. Too many
people were having too many problems with the Solaris version.

Thus this version is the descendant of the 2001 release of nllparser.
It differs from that primarily in its ability to handle deviant
sentences.  In particular:

a) The maximum sentence length has been increased to 399 words and
punctuation.  Without any command line argument the parser ignores
sentences of length > 80.  To increase this to, say, 250, add "-l 250"
as a command line argument to parseIt.

b) The parser now goes into a "last ditch parsing"  mode if it at first
fails to parse the sentence.  This will attempt to find some parse
at the expense of accuracy.

c)  If the parser still fails to find a parse it should (most of the 
time, I hope), send a message to cerr saying "<Map>Parse failed on: ..."
and then just go on to the next sentence.  

d) VERY IMPORTANT.  MANY IMPLEMENTATIONS OF UNIX HAVE VERY LOW DEFAULT
STACK SIZE LIMITS.  THIS CAN CAUSE MY PARSER TO ABORT.  IT IS
GENERALLY A GOOD IDEA TO SET THE STACK SIZE TO "unlimited" BEFORE YOU
RUN THE PARSER.

e) Lastly, the memory leaks in the previous versions have been elimiated.

*************************************************

Note for the 2001 November Release

This verison has a new subdirectory TRAIN which contains the
programs used to collect the statistics the parser requires
from tree-bank data.  As the parser comes with the statistics
it needs you will only need this if you want to try experiments
with the parser on more (or less, or different) tree-bank data.
For more information see the README file in TRAIN.

There are slight differences in the parser's deleted interpolation
mechanism that should, in principle, allow deleted interpolation to
scale well with more or less data.  This should not be visable to
the casual user.

*************************************************
