44import edu .stanford .nlp .ling .CoreLabel ;
55import edu .stanford .nlp .pipeline .Annotation ;
66import edu .stanford .nlp .pipeline .StanfordCoreNLP ;
7- //import edu.stanford.nlp.trees.TreeCoreAnnotations;
87import edu .stanford .nlp .util .StringUtils ;
98import org .junit .*;
109
@@ -39,7 +38,6 @@ public class OperatorScopeITest {
3938 private Optional <OperatorSpec >[] annotate (String text ) {
4039 Annotation ann = new Annotation (text );
4140 pipeline .annotate (ann );
42- //System.out.println(ann.get(CoreAnnotations.SentencesAnnotation.class).get(0).get(TreeCoreAnnotations.TreeAnnotation.class));
4341 List <CoreLabel > tokens = ann .get (CoreAnnotations .SentencesAnnotation .class ).get (0 ).get (CoreAnnotations .TokensAnnotation .class );
4442 Optional <OperatorSpec >[] scopes = new Optional [tokens .size ()];
4543 Arrays .fill (scopes , Optional .empty ());
@@ -322,7 +320,7 @@ public void fracasSentencesWithEvery() {
322320 checkScope ("{ Every } [ customer who owns a computer ] [ has a service contract for it ]" );
323321 checkScope ("{ Every } [ department ] [ rents a line from BT ]" );
324322 checkScope ("{ Every } [ executive who had a laptop computer ] [ brought it to take notes at the meeting ]" );
325- checkScope ("{ Every } [ four - legged mammal ] [ is a four - legged animal ]" );
323+ checkScope ("{ Every } [ four- legged mammal ] [ is a four- legged animal ]" );
326324 checkScope ("{ Every } [ individual who has the right to live anywhere in Europe ] [ can travel freely within Europe ]" );
327325 checkScope ("{ Every } [ individual who has the right to live in Europe ] [ can travel freely within Europe ]" );
328326 checkScope ("{ Every } [ inhabitant of Cambridge ] [ voted for a Labour MP ]" );
@@ -420,21 +418,21 @@ public void fracasSentencesWithSome() {
420418 public void fracasSentencesWithThe () {
421419 checkScope ("{ The } [ Ancient Greeks ] [ were all noted philosophers ]" );
422420 checkScope ("{ The } [ Ancient Greeks ] [ were noted philosophers ]" );
423- checkScope ("{ The } [ ITEL - XZ ] [ is fast ]" );
424- checkScope ("{ The } [ ITEL - ZX ] [ is an ITEL computer ]" );
425- checkScope ("{ The } [ ITEL - ZX ] [ is slower than 500 MIPS ]" );
426- checkScope ("{ The } [ PC - 6082 ] [ is as fast as the ITEL-XZ ]" );
427- checkScope ("{ The } [ PC - 6082 ] [ is fast ]" );
428- checkScope ("{ The } [ PC - 6082 ] [ is faster than 500 MIPS ]" );
429- checkScope ("{ The } [ PC - 6082 ] [ is faster than any ITEL computer ]" );
430- checkScope ("{ The } [ PC - 6082 ] [ is faster than every ITEL computer ]" );
431- checkScope ("{ The } [ PC - 6082 ] [ is faster than some ITEL computer ]" );
432- checkScope ("{ The } [ PC - 6082 ] [ is faster than the ITEL - XZ ]" );
433- checkScope ("{ The } [ PC - 6082 ] [ is faster than the ITEL - ZX ]" );
434- checkScope ("{ The } [ PC - 6082 ] [ is faster than the ITEL - ZX and the ITEL - ZY ]" );
435- checkScope ("{ The } [ PC - 6082 ] [ is faster than the ITEL - ZX or the ITEL - ZY ]" );
436- checkScope ("{ The } [ PC - 6082 ] [ is slow ]" );
437- checkScope ("{ The } [ PC - 6082 ] [ is slower than the ITEL - XZ ]" );
421+ checkScope ("{ The } [ ITEL- XZ ] [ is fast ]" );
422+ checkScope ("{ The } [ ITEL- ZX ] [ is an ITEL computer ]" );
423+ checkScope ("{ The } [ ITEL- ZX ] [ is slower than 500 MIPS ]" );
424+ checkScope ("{ The } [ PC- 6082 ] [ is as fast as the ITEL-XZ ]" );
425+ checkScope ("{ The } [ PC- 6082 ] [ is fast ]" );
426+ checkScope ("{ The } [ PC- 6082 ] [ is faster than 500 MIPS ]" );
427+ checkScope ("{ The } [ PC- 6082 ] [ is faster than any ITEL computer ]" );
428+ checkScope ("{ The } [ PC- 6082 ] [ is faster than every ITEL computer ]" );
429+ checkScope ("{ The } [ PC- 6082 ] [ is faster than some ITEL computer ]" );
430+ checkScope ("{ The } [ PC- 6082 ] [ is faster than the ITEL- XZ ]" );
431+ checkScope ("{ The } [ PC- 6082 ] [ is faster than the ITEL- ZX ]" );
432+ checkScope ("{ The } [ PC- 6082 ] [ is faster than the ITEL- ZX and the ITEL- ZY ]" );
433+ checkScope ("{ The } [ PC- 6082 ] [ is faster than the ITEL- ZX or the ITEL- ZY ]" );
434+ checkScope ("{ The } [ PC- 6082 ] [ is slow ]" );
435+ checkScope ("{ The } [ PC- 6082 ] [ is slower than the ITEL- XZ ]" );
438436 checkScope ("{ The } [ chairman of the department ] [ is a person ]" );
439437 checkScope ("{ The } [ chairman ] [ read out every item on the agenda ]" );
440438 checkScope ("{ The } [ chairman ] [ read out the items on the agenda ]" );
@@ -492,8 +490,7 @@ public void fracasSentencesWithProperNouns() {
492490 checkScope ("[ { APCOM } ] [ has been paying mortgage interest for a total of 15 years or more ]" );
493491 checkScope ("[ { APCOM } ] [ lost some orders ]" );
494492 checkScope ("[ { APCOM } ] [ lost ten orders ]" );
495- checkScope ("[ { APCOM } ] [ signed the contract ]" );
496- checkScope ("[ { APCOM } ] [ signed the contract ] Friday" );
493+ checkScope ("[ { APCOM } ] [ signed the contract Friday , 13th ]" );
497494 checkScope ("[ { APCOM } ] [ sold exactly 2500 computers ]" );
498495 checkScope ("[ { APCOM } ] [ won some orders ]" );
499496 checkScope ("[ { APCOM } ] [ won ten orders ]" );
@@ -525,11 +522,11 @@ public void fracasSentencesWithProperNouns() {
525522 checkScope ("[ { Bill } ] [ will speak to Mary ]" );
526523 checkScope ("[ { Bill } ] [ wrote a report ]" );
527524
528- checkScope ("[ { Dumbo } ] [ is a four - legged animal ]" );
525+ checkScope ("[ { Dumbo } ] [ is a four- legged animal ]" );
529526 checkScope ("[ { Dumbo } ] [ is a large animal ]" );
530527 checkScope ("[ { Dumbo } ] [ is a small animal ]" );
531528 checkScope ("[ { Dumbo } ] [ is a small elephant ]" );
532- checkScope ("[ { Dumbo } ] [ is four - legged ]" );
529+ checkScope ("[ { Dumbo } ] [ is four- legged ]" );
533530 checkScope ("[ { Dumbo } ] [ is larger than Mickey ]" );
534531
535532 checkScope ("[ { GFI } ] [ owns several computers ]" );
@@ -550,7 +547,7 @@ public void fracasSentencesWithProperNouns() {
550547 checkScope ("[ { ITEL } ] [ has developed a new editor since 1992 ]" );
551548 checkScope ("[ { ITEL } ] [ has expanded since 1992 ]" );
552549 checkScope ("[ { ITEL } ] [ has made a loss since 1992 ]" );
553- checkScope ("[ { ITEL } ] [ has sent most of the reports which Smith needs ]" );
550+ checkScope ("[ { ITEL } ] [ has sent most of the reports Smith needs ]" );
554551 checkScope ("[ { ITEL } ] [ made a loss in 1993 ]" );
555552 checkScope ("[ { ITEL } ] [ maintains all the computers that GFI owns ]" );
556553 checkScope ("[ { ITEL } ] [ maintains them ]" );
@@ -607,10 +604,8 @@ public void fracasSentencesWithProperNouns() {
607604 checkScope ("[ { John } ] [ said Bill had been hurt ]" );
608605 checkScope ("[ { John } ] [ said Bill had hurt himself ]" );
609606 checkScope ("[ { John } ] [ said Bill wrote a report ]" );
610- // FIXME this should work even if the parse changed some, right?
611- //checkScope("[ { John } ] [ said Mary wrote a report , and Bill did too ]"); // interesting example
612- // TODO(gabor) fix me (bad scope)
613- //checkScope("[ { John } ] [ said that Mary wrote a report ] , and that Bill did too");
607+ checkScope ("[ { John } ] [ said Mary wrote a report ] , and Bill did too" ); // interesting example
608+ // checkScope("[ { John } ] [ said that Mary wrote a report ] , and that Bill did too"); // TODO(gabor) fix me (bad scope)
614609 checkScope ("[ { John } ] [ spoke to Mary ]" );
615610 checkScope ("[ { John } ] [ spoke to Mary at four o'clock ]" );
616611 checkScope ("[ { John } ] [ spoke to Mary on Friday ]" );
@@ -623,11 +618,9 @@ public void fracasSentencesWithProperNouns() {
623618 checkScope ("[ { John } ] [ wants to know how many women work part time ]" );
624619 checkScope ("[ { John } ] [ wants to know which men work part time ]" );
625620 checkScope ("[ { John } ] [ went to Paris by car ]" );
626- // FIXME should this encompass "and Bill by train"?
627- // checkScope("[ { John } ] [ went to Paris by car , and Bill by train ]");
621+ checkScope ("[ { John } ] [ went to Paris by car , and Bill by train ]" );
628622 checkScope ("[ { John } ] [ went to Paris by car , and Bill by train to Berlin ]" );
629- // FIXME should this encompass "and Bill to Berlin"?
630- // checkScope("[ { John } ] [ went to Paris by car , and Bill to Berlin ]");
623+ checkScope ("[ { John } ] [ went to Paris by car , and Bill to Berlin ]" );
631624 checkScope ("[ { John } ] [ wrote a report ]" );
632625// checkScope("[ { John } ] [ wrote a report ] , and Bill said Peter did too ]"); // TODO(gabor) fix me
633626
0 commit comments