static char sccsid[] = "@(#)part.l 4.1 (Berkeley) 82/11/06";
int beg[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
sentp->cc = sentp->ic = yytext[0];
if(sentp >= &sent[SLENG-1]){
if(over)fprintf(stderr,"sentence %d too many words\n",numsent+2);
if(sptr+yyleng >= &s[SCHAR-1]){
if(over)fprintf(stderr,"sentence %d too many characters\n",numsent+2);
for(i=2;i<yyleng;i++)*sptr++=yytext[i];
for(i=2;i<yyleng;i++)*sptr++=yytext[i];
if(yytext[2]=='?')question=1;
if(quote == 1 && sent[jj].cc == ED){
if(sent[jj].cc=='"')jj++;
if(sent[jj].cc==SUBCONJ){
if(sent[jj+1].cc == ','){
if(sent[jj].cc==CONJ || sent[jj].cc=='"')jj++;
while((jj=scan(jj,END,cflg)) != -1){
if(sent[jj].cc == SUBCONJ && sent[jj+1].cc == ','){
if(*st == '?' || *st == '!')quote = 1;
nomin = atoi(&yytext[1]);
float cindex,kindex,findex,fgrad;
float syl, avsy, adjs,snonf;
if(numwds == 0 || numsent == 0)exit(0);
avw = (float)(numwds)/(float)(numsent);
avl = (float)(numlet)/(float)(numwds);
aindex = 4.71*avl + .5*avw -21.43;
syl = .9981*vowel-.3432*twds;
kindex = 11.8*avsy+.39*avw-15.59;
findex = 206.835-84.6*avsy-1.015*avw;
if(findex < 30.)fgrad = 17.;
else if(findex > 100.) fgrad = 4.;
else if(findex > 70.)fgrad=(100.-findex)/10 +5.;
else if(findex > 60.)fgrad =(70.-findex)/10+8.;
else if(findex >50.)fgrad=(60.-findex)/5+10;
else fgrad=(50.-findex)/6.66 +13.;
adjs = 100 * (float)numsent/numwds;
cindex = 5.89*avl-.3*adjs-15.8;
printf("readability grades:\n (Kincaid) %4.1f (auto) %4.1f (Coleman-Liau) %4.1f (Flesch) %4.1f (%4.1f)\n",kindex,aindex,cindex,fgrad,findex);
printf("sentence info:\n");
printf(" no. sent %d no. wds %ld\n",numsent,numwds);
printf(" av sent leng %4.1f av word leng %4.2f\n",avw,avl);
printf(" no. questions %d no. imperatives %d\n",qcount,icount);
snonf = (float)(letnonf)/(float)(numnonf);
printf(" no. nonfunc wds %ld %4.1f%% av leng %4.2f\n",numnonf,(float)(numnonf)*100/numwds,snonf);
if(ii < ml)lsum += sleng[ii];
else if(ii > mg)gsum+= sleng[ii];
printf(" short sent (<%d)%3.0f%% (%d) long sent (>%d) %3.0f%% (%d)\n",ml,sperc(lsum),lsum,mg,sperc(gsum),gsum);
printf(" longest sent %d wds at sent %d; shortest sent %d wds at sent %d\n",maxsent,maxindex,minsent,minindex);
printf("sentence types:\n");
printf(" simple %3.0f%% (%d) complex %3.0f%% (%d)\n",sperc(simple),simple,sperc(complex),complex);
printf(" compound %3.0f%% (%d) compound-complex %3.0f%% (%d)\n",sperc(compound),compound,sperc(compdx),compdx);
printf(" verb types as %% of total verbs\n");
printf(" tobe %3.0f%% (%d) aux %3.0f%% (%d) inf %3.0f%% (%d)\n",vperc(tobe),tobe,vperc(aux),aux,vperc(infin),infin);
if(verbc != 0)adjs = (float)(passive)*100/(float)(verbc);
printf(" passives as %% of non-inf verbs %3.0f%% (%d)\n",adjs,passive);
printf(" types as %% of total\n");
printf(" prep %3.1f%% (%d) conj %3.1f%% (%d) adv %3.1f%% (%d)\n",wperc(prepc),prepc,wperc(conjc),conjc,wperc(adv),adv);
printf(" noun %3.1f%% (%d) adj %3.1f%% (%d) pron %3.1f%% (%d)\n",wperc(noun),noun,
wperc(adj),adj,wperc(pron),pron);
printf(" nominalizations %3.0f %% (%d)\n",wperc(nomin),nomin);
printf("sentence beginnings:\n");
ii=beg[0]+beg[7]+beg[6]+beg[3]+beg[8];
printf(" subject opener: noun (%d) pron (%d) pos (%d) adj (%d) art (%d) tot %3.0f%%\n",
beg[0],beg[7],beg[6],beg[3],beg[8],sperc(ii));
printf(" prep %3.0f%% (%d) adv %3.0f%% (%d) \n",sperc(beg[9]),beg[9],sperc(beg[4]),beg[4]);
printf(" verb %3.0f%% (%d) ",sperc(beg[1]+beg[10]+beg[12]),beg[1]+beg[10]+beg[12]);
printf(" sub_conj %3.0f%% (%d) conj %3.0f%% (%d)\n",sperc(beg[13]),beg[13],sperc(beg[5]),beg[5]);
printf(" expletives %3.0f%% (%d)\n",sperc(beg[14]),beg[14]);
return((float)(a)*100/numwds);
return((float)(a)*100/numsent);
return((float)(a)/numsent);
if(tverbc == 0)return(0);
return((float)(a)*100/tverbc);
while(--argc > 0 && (++argv)[0][0] == '-' ){
case 'p': pastyle=style=1;
case 'a': pstyle=style=1;
case 'e': estyle = style = 1;
case 'l': style=lstyle=1;
lthresh = atoi(*(++argv));
rthresh = atoi(*(++argv));
fprintf(stderr,"unknown flag to part %s\n",*argv);