Commits

David McClosky  committed 7f0320e

Better error messages when using external POS tags.
If you specify a tag which isn't in terms.txt, you'll get a warning and
the tag will be ignored.

  • Participants
  • Parent commits 323e01f

Comments (0)

Files changed (1)

File first-stage/PARSE/ExtPos.C

 
 #include "ExtPos.h"
+#include "utils.h"
 #include <sstream>
 
 /*
     }
     vector<const Term*> vt;
     stringstream ss(buf);
-    string wrd;
+    ECString wrd;
     ss>>wrd;  //First entry on each line is the word, not a tag.
+    escape_parens(wrd);
+    if (wrd != sr[i].lexeme()) {
+      cerr << "wrd:            '" << wrd << "'" << endl;
+      cerr << "sr[i].lexeme(): '" << sr[i].lexeme() << "'" << endl;
+    }
     assert(wrd==sr[i].lexeme());
     while(ss){
       ss>>wrd;
       if (!ss) break;
       const Term* trm=Term::get(wrd);
-      vt.push_back(trm);
+      if (trm) {
+        vt.push_back(trm);
+      } else {
+        cerr << "Warning: Haven't seen term '" << wrd << "' in terms.txt" << endl;
+      }
     }
     push_back(vt);
   }