Homework 3

Due:

Introduction

This homework assignment lets you begin to work with the character data type. The two problems make up another mini-project where you first develop and test some utility functions, and then use those functions to write a simple spell checker for the Hawaiian language.

For this homework, you will work in your revised teams, and submit only ONE set of files per team. Again, ALL members of the team should contribute to the homework. You can break up the assignment any way you want, however, ALL members of the team should understand how all of the programs work. As before, you should assign a coordinator for this homework, who will be responsible for seeing that everyone is completing their tasks on time and who should collect and turn in one set of files for the team. The job of coordinator should rotate among all members of the team with each homework assignment.

Again, for this homework, you should pay particular attention to the format (indenting) and documentation of your program; i.e. the comments in your code (describing the MEANING of your algorithm, not the code) and the comments describing the interface and operation of your functions. Style, as well as correctness, will be a component of the grade for this project.

A mini project
Hawaiian Language Spell Checking

Task:

Write a program that reads a data file containing Hawaiian language text and produces a line of output for each word in the text, classifying it as either a valid or invalid Hawaiian spelling based on the spelling rules given below.
Utility Functions (8 Points).
In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, and ` (this backwards apostrophe is called an `okina, and is considered a consonant)). (Unfortunately, there is no easy way to write the kahako in ascii text). For this problem you should write two functions, int is_vowel(char); and int is_h_consonant(char); which are each given a character and return True or False. The function is_vowel() returns True is the character is a vowel (upper or lower case), and is_h_consonant() returns True if the character is a consonant (upper or lower case) in written Hawaiian.

You should write a simple (throw away) test driver to test your functions. Be sure you prompt the user (grader) of your test driver on what they should do to test your program. You should write this program in two files; driver1.c containing your test driver, and letters.c containing your functions. You should also have a file, letters.h, containing the prototypes and macros used in letters.c. I have provided a makefile for you in ~ee160/Homework/Hw3 which you can copy to your Hw3 directory. To compile this program, use the command:


          make driver1

Your executable will be called driver1.
Spell Checking (12 Points).
Written Hawaiian also has fairly simple spelling rules for determining if a word is a valid word in the language (even if the meaning is unknown). They are: Write a program which reads lines of Hawaiian text from a file (using redirection, so you will not need to prompt), and lists each word found on a separate line indicating whether it is a valid Hawaiian spelling or it is invalid. Any non-letter characters (e.g. white space or punctuation characters) in the file should be treated as delimiters, but otherwise ignored and not appear in the output.

You should think about your algorithm before beginning to code this function, and you might want to look at the program wds.c from lecture (and on wiliki in ~ee160/Code.lect/Chars/wds.c) for guidance. (That file is similar, but better, than the code in Chapter 4). The general algorithm for your program will be similar to the word counting program, but the details will vary. Implement your algorithm in the file spchk.c and use the functions in letters.c to test for the appropriate letters.

(Hint: You might want to write another function similar to delimitp() used in wds.c, but your code will be different from the delimitp() in the text. You can put any additional functions and/or macros you use in your letters.c and letters.h files).

I have provided you with a sample data file in ~ee160/Homework/Hw3/moolelo, but you should test your program first with your own data. The makefile in that directory can also be used to compile this program with the command:


          make spchk

Your executable will be called spchk.

What You Turn In

You will submit ONE copy of all of the files for this homework per team all at one time. So transfer the version of your files your team wants to submit to your coordinator for this assignment, and the coordinator will send them in. I recommend the coordinator put all the files for this problem in a separate Hw3 directory. (It might be a good idea to compile and test them one last time before sending them in to make sure they work). Please DO NOT send different files from different members - we do not want to hunt around to find all of your team's programs. Use the "grade" command to turn in all of the .c and .h files to make the two versions of the program. Your command will look like the following:

If you are in Section 001, use:

            grade -3s1,ee160 *.c *.h
If you are in Section 002 use:
            grade -3s2,ee160 *.c *.h
If you are in Section 003 use:
            grade -3s3,ee160 *.c *.h
If you are in Section 004 use:
            grade -3s4,ee160 *.c *.h
If you are in Section 005 use:
            grade -3s5,ee160 *.c *.h
You should verify that you turned in things successfully, which you can do with the command (which simply leaves the file names off from the previous command).
            grade -3s1,ee160
 
            OR
 
            grade -3s2,ee160
 
            OR
 
            grade -3s3,ee160

            OR
 
            grade -3s4,ee160

            OR
 
            grade -3s5,ee160

NOTE: after the files are prepared for grading, you will no longer be able to see your file listing using the above command.

In addition, as with hw 1 and 2, each member of the team should send me a confidential evaluation of the effort of each member of the team, INCLUDING YOURSELF in email using the ratings provided and in the format given in the ~ee160/eval file. Include a description in your comments of what parts of the programs where done by each member of the team, including yourself, and an assessment of how teamwork was used to complete this assignment. This evaluation WILL be used to adjust the individual homework grades for hw3 only. Your evaluation is due at the same time as the assignment. LATE EVALUATIONS WILL BE PENALIZED. If you do not email your eval on time, your homework grades will be adjusted based on your teammates' inputs and your voice will not be heard. In addition, your individual score will receive a 10% penalty for not turning in the eval.

As usual, should you have any questions just send mail or stop by and see me or the TA.