Annotation of researchv10dc/cmd/wwb/prose.i, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: 
        !             4: 
        !             5: 
        !             6: 
        !             7: 
        !             8: 
        !             9: 
        !            10: 
        !            11: 
        !            12: 
        !            13: 
        !            14: 
        !            15: extern struct  _iobuf {
        !            16:        int     _cnt;
        !            17:        unsigned char   *_ptr;
        !            18:        unsigned char   *_base;
        !            19:        short   _flag;
        !            20:        char    _file;
        !            21: } _iob[120];
        !            22: 
        !            23: 
        !            24: 
        !            25: 
        !            26: 
        !            27: 
        !            28: 
        !            29: 
        !            30: 
        !            31: 
        !            32: 
        !            33: 
        !            34: 
        !            35: 
        !            36: 
        !            37: 
        !            38: 
        !            39: 
        !            40: 
        !            41: 
        !            42: 
        !            43: 
        !            44: 
        !            45: 
        !            46: 
        !            47: 
        !            48: struct _iobuf  *fopen();
        !            49: struct _iobuf  *fdopen();
        !            50: struct _iobuf  *freopen();
        !            51: struct _iobuf  *popen();
        !            52: long   ftell();
        !            53: char   *fgets();
        !            54: 
        !            55: 
        !            56: 
        !            57: 
        !            58: 
        !            59: 
        !            60: char *disclm ="BECAUSE YOUR TEXT IS SHORT \(< 2000 WORDS & < 100 SENTENCES\),\n\
        !            61: THE FOLLOWING ANALYSIS MAY BE MISLEADING.\n\n";
        !            62: 
        !            63: char *note0 =
        !            64: "NOTE: Your  document is being  compared   against  standards\n\
        !            65: derived from 30 TMs, classified as  good by Department Heads\n\
        !            66: in the Research Area.\n";
        !            67: char *note2 =
        !            68: "NOTE: Your text is being compared  against standards derived\n\
        !            69: from 34 instructional texts produced by Department 45272.\n\n";
        !            70: char *note1 =
        !            71: "NOTE:    Your text is being compared to standards for Craft\n\
        !            72: derived from the research of E. Coke.\n\n";
        !            73: char *note3 =
        !            74: "NOTE: Your text is being compared to standards given in file\n\"%s.\"\n";
        !            75: 
        !            76: char *kincaid = "\nREADABILITY\n\
        !            77: \n     The Kincaid readability formula predicts that your text\n\
        !            78: can be read by someone with %2.0f or more years  of  schooling,\n";
        !            79: 
        !            80: char *more_str =
        !            81: "\n   More Information on Sentence Structure\n\
        !            82: \n     Since passives,  nominalizations, as well as expletives\n\
        !            83: all require  some form  of the verb \"to be,\"  an easy way to\n\
        !            84: identify difficult paragraphs is to look for the overuse  of\n\
        !            85: forms  of \"be.\"  The `findbe' program makes this easy; it for-\n\
        !            86: mats a text and underlines and capitalizes all forms  of \"to\n\
        !            87: be.\"  To use it type:\n\n\
        !            88:                       findbe filename\n\n\
        !            89: You can also use the `style' program  to print your sentences\n\
        !            90: containing both a passive verb and a nominalization.  Type:\n\n\
        !            91:                       style -n filename\n";
        !            92: 
        !            93: char *read0 =
        !            94: "    Good TMs\n\
        !            95: average close to 13th grade level, even  though the audience\n\
        !            96: has more education than that.\n";
        !            97: char *read2 =
        !            98: " Good train-\n\
        !            99: ing materials  average close  to the 10th grade level,  even\n\
        !           100: though the audience has more education than that.\n";
        !           101: char *read3 =
        !           102: "  Your  good\n\
        !           103: materials average close to grade %4.1f.\n";
        !           104: char *read1 =
        !           105: "  Since Coke\n\
        !           106: found that 62%% of Bell System craft  have difficulty reading\n\
        !           107: documents  with readability scores above 12.0,  the majority\n\
        !           108: of the craft will probably not be able to read this.\n";
        !           109: 
        !           110: char *begmsg =
        !           111: "\n     Writing teachers also stress  that  no  more  than   75\n\
        !           112: percent   of  the  sentences in a text should begin with the\n\
        !           113: subject  of  the  sentence;  these  start  with the  subject\n\
        !           114: %2.0f%% of  the time.   Try starting more of your sentences with\n\
        !           115: prepositions, adverbs, or  conjunctions.  This  change  will\n\
        !           116: have  the added benefit of adding variety of sentence length\n\
        !           117: and type.\n";
        !           118: 
        !           119: char *pasnom ="\n   Passives and Nominalizations\n\
        !           120: \n     You have appropriately limited your use of passives and\n\
        !           121: nominalizations \(nouns made from verbs, e.g. \"description\"\).\n";
        !           122: 
        !           123: char *badpas =
        !           124: "\n     This text contains a %s higher percentage of passive verbs\n\
        !           125: (%4.1f%%) than is common in good documents of this type (%2.0f%%).\n";
        !           126: 
        !           127: char *badnom ="\n     This text  has  a  higher percentage of nominalizations\n\
        !           128: (%4.1f%%) than is common in good documents of this type (%2.0f%%).\n";
        !           129: 
        !           130: char *badexp ="\n   Expletives\n\
        !           131: \n     This text  contains a  higher percentage  of expletives\n\
        !           132: (%4.1f%%) than is common in good documents of this type (%2.0f%%).\n";
        !           133: 
        !           134: struct _iobuf *fp;
        !           135: main(argc,argv)
        !           136: int argc;
        !           137: char *argv[];
        !           138: {
        !           139:        char *rather="rather";
        !           140:        char *very="very";
        !           141:        char *too="too";
        !           142:        char *much="much";
        !           143:        char *null="";
        !           144:        char *qual;
        !           145:        char *note;
        !           146:        char *readmsg;
        !           147:        struct _iobuf *fpath;
        !           148:        int h,h0,fflag,sflag,ret;
        !           149:        char save[81], buf[100];
        !           150:        int i,aud,npara,p,j;
        !           151:        int numabst;
        !           152:        float kindex, avw,snonf,  simple,complex, compound,  compdx;
        !           153:        float ppron,padj, var[14],array[14][4],sc[14];
        !           154:        float passive,explet;
        !           155:        int nomin,x;
        !           156:        int numsent, maxsent, qcount, icount,ml,lsum,mg,gsum;
        !           157:        long numwds,numnonf;
        !           158:        int maxindex,minindex,minsent;
        !           159:        float aindex,cindex,fgrad,findex,avl,fnumnonf,centlsum,centgsum;
        !           160:        int nsimple,ncomplex,ncompound,ncompdx,ntobe;
        !           161:        int npassive,pron,pos,adj,art,beg,begadv,begprep,begverb,begscon;
        !           162:        int begconj, begexp,noun;
        !           163:        float ptobe,paux,pinfin,padv,pconjc,pprepc,pnoun,pnomin,tot;
        !           164:        float pbegprep,pbegadv,pbegverb,pbegscon,pbegconj,pbegexp;
        !           165:        int tobe,aux,infin,prepc,conjc,adv;
        !           166:        char path[80];
        !           167:        fflag=0;
        !           168:        sflag=0;
        !           169:        aud=0;
        !           170:        note = note0;
        !           171:        readmsg = read0;
        !           172:        strcpy(path,"/usr/lib/style");
        !           173:        if(argc >= 2){
        !           174:                i=0;
        !           175:                if(*(argv[1]+i) =='f') {
        !           176:                        fflag=1;
        !           177:                        i++;
        !           178:                }
        !           179:                if(*(argv[1]+i) =='s') {
        !           180:                        sflag=1;
        !           181:                        i++;
        !           182:                }
        !           183:                switch (*(argv[1]+i)){
        !           184:                case 'm':
        !           185:                        aud=0;
        !           186:                        note = note0;
        !           187:                        readmsg = read0;
        !           188:                        break;
        !           189:                case 't':
        !           190:                        aud=2;
        !           191:                        note = note2;
        !           192:                        readmsg = read2;
        !           193:                        strds("/usr/lib/style/train.st","training");
        !           194:                        break;
        !           195:                case 'c':
        !           196:                        aud=1;
        !           197:                        note = note1;
        !           198:                        readmsg = read1;
        !           199:                        strds("/usr/lib/style/crft.st","Craft");
        !           200:                        break;
        !           201:                case 'x':
        !           202:                        aud=3;
        !           203:                        note = note3;
        !           204:                        readmsg = read3;
        !           205:                        if((fp=fopen(argv[2],"r"))==0){
        !           206:                                fprintf((&_iob[2]),"Prose can't find your standards file \"%s,\" try specifying a more complete pathname.\n",argv[2]);
        !           207:                                exit(1);
        !           208:                        }
        !           209:                        break;
        !           210:                }
        !           211:        }
        !           212: 
        !           213:        if(aud==0)
        !           214:                strds("/usr/lib/style/tm.st","TM");
        !           215: findbeg:
        !           216:        if(fgets(save,81,(&_iob[0]))==0){
        !           217:                fprintf((&_iob[2]),"The file named after  the -f flag doesn't seem\
        !           218:  to contain a style table.\nOr else style cannot produce a table for your\
        !           219:  file.\n  Try running style alone on your file.\n");
        !           220:                                exit(1);
        !           221:        }
        !           222:        ret=sscanf(save,"%*s%f%*s%f%*s%f%*s%f (%f)",
        !           223:                &kindex,&aindex,&cindex,&fgrad,&findex);
        !           224:         if(ret !=5 ) goto findbeg;
        !           225:        fgets(buf,100,(&_iob[0]));
        !           226:        scanf("%*s%*s%d%*s%*s%ld",&numsent,&numwds);
        !           227:        scanf("%*s%*s%*s%f%*s%*s%*s%f",&avw,&avl);
        !           228:        scanf("%*s%*s%d%*s%*s%d",&qcount,&icount);
        !           229:        scanf("%*s%*s%*s%d%f%%%*s%*s%f",&numnonf,&fnumnonf,&snonf);
        !           230:        scanf("%*s%*s (<%d) %f%% (%d) %*s%*s (>%d) %f%% (%d)",
        !           231:                &ml,&centlsum,&lsum,&mg,&centgsum,&gsum);
        !           232:        scanf("%*s%*s%d%*s%*s%*s%d;%*s%*s%d%*s%*s%*s%d\n",
        !           233:                &maxsent,&maxindex,&minsent,&minindex);
        !           234:        fgets(buf,100,(&_iob[0]));
        !           235:        scanf("%*s%f%% (%d) %*s %f%% (%d)",&simple,&nsimple,&complex,&ncomplex);
        !           236:        scanf("%*s%f%% (%d) %*s%f%% (%d)\n",
        !           237:                &compound,&ncompound,&compdx,&ncompdx);
        !           238:        fgets(buf,100,(&_iob[0]));
        !           239:        fgets(buf,100,(&_iob[0]));
        !           240:        scanf("%*s%f%% (%d) %*s %f%% (%d)%*s%f%% (%d)",
        !           241:                &ptobe,&tobe,&paux,&aux,&pinfin,&infin);
        !           242:        scanf("%*s%*s %% %*s%*s%*s%f%% (%d)\n",&passive,&npassive);
        !           243:        fgets(buf,100,(&_iob[0]));
        !           244:        scanf("%*s %f%% (%d)%*s%f%% (%d)%*s%f%% (%d)",
        !           245:                &pprepc,&prepc,&pconjc,&conjc,&padv,&adv);
        !           246:        scanf("%*s%f%% (%d)%*s %f%% (%d)%*s%f%% (%d)",
        !           247:                &pnoun,&noun, &padj,&adj,&ppron,&pron);
        !           248:        scanf("%*s%f %% (%d)\n",&pnomin,&nomin);
        !           249:        fgets(buf,100,(&_iob[0]));
        !           250:        scanf("%*s%*s%*s (%d)%*s (%d)%*s (%d)%*s (%d)%*s (%d)%*s%f%%",
        !           251:                &noun,&pron,&pos,&adj,&art,&tot);
        !           252:        scanf("%*s%f%% (%d)%*s%f%% (%d) ",&pbegprep,&begprep,&pbegadv,&begadv);
        !           253:        scanf("%*s%f%% (%d) ",&pbegverb,&begverb);
        !           254:        scanf("%*s%f%% (%d)%*s%f%% (%d)",&pbegscon,&begscon,&pbegconj,&begconj);
        !           255:        scanf("%*s%f%% (%d)",&pbegexp,&begexp);
        !           256: 
        !           257:        
        !           258:        var[0]=kindex;
        !           259:        var[1]=snonf;
        !           260:        var[2]=centlsum;
        !           261:        var[3]=centgsum;
        !           262:        var[4]=simple;
        !           263:        var[5]=complex;
        !           264:        var[6]=compound;
        !           265:        var[7]=compdx;
        !           266:        var[8]=passive;
        !           267:        var[9]=pnomin;
        !           268:        var[10]=avw;
        !           269:        var[11]=pbegexp;
        !           270:        var[12]=simple-complex;
        !           271:        var[13]=compound+compdx;
        !           272: 
        !           273:        
        !           274:        ret=0;
        !           275:        for(i=0;i <14; i++)
        !           276:                for(j=0;j<4; j++){
        !           277:                        ret+=fscanf(fp,"%f",&array[i][j]);
        !           278:                }
        !           279: 
        !           280:        
        !           281:         if(ret!=(14*4)){
        !           282:                fprintf((&_iob[2]),"The standards file is not formatted\
        !           283:  properly.\nIt should have %d lines, each with 4 floating point numbers.\n",
        !           284:                14);
        !           285:                exit(1);
        !           286:        }
        !           287: 
        !           288:        
        !           289: 
        !           290:        for(i=0; i< 14; i++){
        !           291:                sc[i]=0;
        !           292:                for(j=0; j < 4;j++){
        !           293:                        if(var[i] > array[i][j]) sc[i]=j+1;
        !           294:                }
        !           295:        }
        !           296: 
        !           297:        
        !           298: 
        !           299: 
        !           300:        if(numwds < 2000 && numsent <100)
        !           301:                printf(disclm);
        !           302:        if(sflag) goto shortans ;
        !           303:        printf(note,argv[2]);
        !           304:                        
        !           305:        printf(kincaid,kindex);
        !           306:        if(sc[0]==0){
        !           307:                printf("which is a low score for  this type of document.");
        !           308:                if (aud==0)
        !           309:                        printf("  If this is\nan instructional text\
        !           310:  (in paragraph form), run prose -t  for\na more appropriate review.\n");
        !           311:                else if(aud==2)(--((&_iob[1]))->_cnt>=0? ((int)(*((&_iob[1]))->_ptr++=('\n'))):_flsbuf(('\n'),(&_iob[1])));
        !           312:        }
        !           313:        else if(sc[0] < 3)
        !           314:                printf("which is a  good score for documents like this.\n");
        !           315:        else {          
        !           316:                if(sc[0] == 3)qual=rather;
        !           317:                else qual=very;
        !           318:                printf("which is %s high for this type of document.",qual);
        !           319:                if(aud != 1)printf(readmsg,(array[0][1]+array[0][2])/2.0);
        !           320:                if(sc[1] > 2)
        !           321:                        prtfile("/usr/lib/style/rd2.t");
        !           322:                if(aud == 1)printf(readmsg);
        !           323: 
        !           324:        }
        !           325: 
        !           326: 
        !           327:        printf("\nVARIATION\n");
        !           328:        if(sc[12]==4 || sc[12]==0 || tot >79.0)
        !           329:                        prtfile("/usr/lib/style/var.t");
        !           330:        if(sc[12]==0||sc[12]==4)
        !           331:                printf("\n     In this  text %2.0f%% of  the sentences are\
        !           332:  simple, %2.0f%% are\ncomplex, giving a difference of %3.0f.  This\
        !           333:  difference should\nrange  from %2.0f to %2.0f for good documents of this\
        !           334:  type.\n",simple,complex, simple-complex,array[12][1],array[12][2]);
        !           335:        if(sc[12]==4){
        !           336:                if(sc[10] < 2)
        !           337:                        prtfile("/usr/lib/style/type.t");
        !           338:                else 
        !           339:                        prtfile("/usr/lib/style/type2.t");
        !           340:        }
        !           341:        else if(sc[12]==0){
        !           342:                if(sc[0] < 3)
        !           343:                        prtfile("/usr/lib/style/var4.t");
        !           344:                else
        !           345:                        prtfile("/usr/lib/style/var6.t");
        !           346:        }
        !           347:        else printf("\n     You have an appropriate distribution of sentence\
        !           348:  types.\n");
        !           349:        if(maxsent >= 50){
        !           350:                if(sc[12]==0 || sc[12]==4)
        !           351:                        printf("\n     Additionally,  the  longest sentence is\
        !           352:  %d  words long.\n",maxsent);
        !           353:                else printf("\n     The   longest  sentence,\
        !           354:   however,  is %d  words  long.\n",maxsent);
        !           355:                prtfile("/usr/lib/style/var5.t");
        !           356:        }
        !           357:        if(sc[10] > 2){
        !           358:                if(sc[12]==4 || sc[12]==0)
        !           359:                        printf("\n     Such  changes would  also  help  to\
        !           360:  reduce the  average\n");
        !           361:                else  printf("\n     You should,  however,  consider\
        !           362:  shortening your average\n");
        !           363:                printf("sentence length.  Your average is %2.0f words,\
        !           364:   which  is ",var[10]);
        !           365:                if(sc[10]==3)printf("high.\n");
        !           366:                if(sc[10]==4) printf(" very\nhigh.  ");
        !           367:                printf("A good average would be %2.0f to %2.0f words.\n",
        !           368:                        array[10][1],array[10][2]);
        !           369:        }
        !           370:        if(tot >79.0){
        !           371:                printf(begmsg,tot);
        !           372:        }
        !           373:        printf("\nSENTENCE STRUCTURE\n");
        !           374:        if(sc[8]<=2 && sc[9] <=2) {
        !           375:                printf(pasnom);
        !           376:        }
        !           377:        else {
        !           378:                printf("\n   Passives\n");
        !           379:                if(sc[8] > 2){
        !           380:                        if(sc[8] == 3)qual=null;
        !           381:                        else qual=much;
        !           382:                        printf(badpas,qual,var[8],(array[8][1]+array[8][2])/2.0);
        !           383:                        prtfile("/usr/lib/style/pass.t");
        !           384:                }
        !           385:                else printf("\n     You have limited your passives appropriately.\n");
        !           386:                printf("\n   Nominalizations\n");
        !           387:                if(sc[9] > 2){
        !           388:                        printf(badnom,var[9],(array[9][1]+array[9][2])/2.0);
        !           389:                        prtfile("/usr/lib/style/nom.t");
        !           390:                }
        !           391:                else printf("\n     You  have  appropriately limited  your\
        !           392:   nominalizations\n\(nouns made from verbs, e.g., \"description\"\).\n");
        !           393:        }
        !           394:        if(sc[11]==4){
        !           395:                printf(badexp,var[11],(array[11][1]+array[11][2])/2.0);
        !           396:                prtfile("/usr/lib/style/exp.t");
        !           397:        }
        !           398:        if(sc[8]>2 && sc[9]>2){
        !           399:                printf(more_str);
        !           400:        }
        !           401:        if(!fflag){
        !           402:                if(aud==0)
        !           403:                        prtfile("/usr/lib/style/popttm.t");
        !           404:                else if(aud==2)
        !           405:                        prtfile("/usr/lib/style/poptt.t");
        !           406:        }
        !           407:        prtfile("/usr/lib/style/fur.t");
        !           408:        exit(0);
        !           409: shortans : 
        !           410:        if(aud==0) printf("Compared to TMs.\n\n");
        !           411:        else if(aud==1) printf("Evaluated for Craft.\n\n");
        !           412:        else if(aud==2) printf("Compared to training material.\n\n");
        !           413:        else if(aud==3)printf("Compared to file \"%s\"\n",argv[2]);
        !           414:        printf("Reading grade level--%2.0f: ",kindex);
        !           415:        if(sc[0]==1 || sc[0]==2) printf("Good\n");
        !           416:        else if(sc[0]==0) printf("Low\n");
        !           417:        else if(sc[0]==3) printf("High\n");
        !           418:        else if(sc[0]==4)printf("Very high\n");
        !           419: 
        !           420: 
        !           421:        printf("Variation--");
        !           422:        if(sc[12] == 4)
        !           423:                 printf("Too many short, simple sentences--subordinate.\n");
        !           424:        else if(sc[12]==0) printf("Too many complex sentences.\n");
        !           425:        else printf("Good sentence type distribution.\n");
        !           426:        if(sc[10] > 2){
        !           427:                if(sc[10]==3)
        !           428:                        qual = too;
        !           429:                else qual = very;
        !           430:                printf("             Sentences are %s long--avg\
        !           431:  length=%2.1f words\n",qual,var[10]);
        !           432:                printf("                                   --Good length\
        !           433:  = %2.1f to %2.1f\n",array[10][1],array[10][2]);
        !           434:        }
        !           435:        if( maxsent >50)
        !           436:                 printf("Longest sentence is %d words---perhaps it is a list\n"
        !           437:                        ,maxsent);
        !           438:        if(tot >79.0)
        !           439:                printf("             %2.0f%%= Too many sentences begin with\
        !           440:  the subject.\n",tot);
        !           441: 
        !           442:        printf("Passives--%2.0f%%: ",passive);
        !           443:        if(sc[8]<=2)printf("Good\n");
        !           444:        else if(sc[8] ==3)printf("High\n");
        !           445:        else if(sc[8]==4)printf("Very high\n");
        !           446: 
        !           447:        printf("Nominalizations--%2.0f%%: ",pnomin);
        !           448:        if(sc[9]<=2)printf("Good\n");
        !           449:        else if(sc[9]==3)printf("High\n");
        !           450:        else if(sc[9]==4)printf("Very high\n");
        !           451: 
        !           452:        if(sc[11]==4)printf("Expletive--%2.0f%%: Very high\n",pbegexp);
        !           453:        if (!fflag) printf("Don't forget the styl.tmp file.\n");
        !           454:        (--((&_iob[1]))->_cnt>=0? ((int)(*((&_iob[1]))->_ptr++=('\n'))):_flsbuf(('\n'),(&_iob[1])));
        !           455: }
        !           456: prtfile(s)
        !           457: char *s;
        !           458: {
        !           459:        struct _iobuf *ff;
        !           460:        char ch[512];
        !           461:        int num;
        !           462:        if((ff=fopen(s,"r"))==0){
        !           463:                fprintf((&_iob[2]),"Prose can't find the file %s\n",s);
        !           464:                exit(1);
        !           465:        }
        !           466:        while((num=fread(ch,sizeof(ch[0]),512,ff)))
        !           467:                fwrite(ch,sizeof(ch[0]),num,(&_iob[1]));
        !           468:        fclose(ff);
        !           469: }
        !           470: strds(s1,s2)
        !           471: char *s1, *s2;
        !           472: {
        !           473:        if((fp=fopen(s1,"r"))==0){
        !           474:                fprintf((&_iob[2]),"Prose can't find the %s standards file %s\n",
        !           475:                        s2,s1);
        !           476:                exit(1);
        !           477:        }
        !           478: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.