bool is_sentence() { string input; cin >> input; if (!is_noun(input)) return false; cin >> input; if (!is_verb(input)) return false; cin >> input; if (input == ".") return true; if (!is_conjunction(input)) return false; else return is_sentence(); }
main() { char line[BUFSIZ]; char savel[BUFSIZ]; char curw[BUFSIZ]; char firstkey[BUFSIZ]; char seckey[BUFSIZ]; char thrdkey[BUFSIZ]; char *s; int rval = 0; if( ! (fverbs=fopen("/tmp/lsj.vbs","w"))) { fprintf(stderr,"could not open /tmp/lsj.vbs!\n"); exit(-1); } while(fgets(line, BUFSIZ, stdin)) { /* remove trailing newline */ int lastchar = strlen(line); if (lastchar > 0) --lastchar; if (line[lastchar] == '\n') line[lastchar] = '\0'; if( ! line[0]) continue; if( ! isdigit(line[0])) continue; strcpy(savel,line); firstkey[0] = seckey[0] = thrdkey[0] = 0; /* skip tokens 1 and 3, but keep #2 */ s = strtok(line," \t"); s = strtok((char * )NULL," \t"); strcpy(curw,s); if( is_verb(curw) ) continue; s=strtok((char * )NULL," \t"); s=strtok((char * )NULL," \t"); if(s) strcpy(firstkey,s); s=strtok((char * )NULL," \t"); if(s) strcpy(seckey,s); s=strtok((char * )NULL," \t"); if(s) strcpy(thrdkey,s); if( ! strncmp(firstkey,"<gen",4)) { /* printf("%s %s\n", curw , firstkey );*/ if( ! do_simpnom(curw,firstkey) ) { printf("0:%s\n", savel ); } continue; } if( ! strncmp(firstkey,"<itype>",7)) { if( ! do_regnom(curw,firstkey,seckey,thrdkey) ) { printf("0:%s\n", savel ); } continue; } if( is_adverb(curw,firstkey) ) continue; if( is_teos(curw) ) continue; printf("0:%s\n", savel ); } fclose(fverbs); }