/*********************************************************************************** * File: mood.h * Created: 6 JA 2000 * Modified 12 JA 2000 * Author: Jeff Jenkins, R. DeArmond * * This file contains mood structs and array declaration for the lexicon, and * the prototypes for all of the functions specific to prepositions, to be used with the * grammars one through eight. The functions are used to manipulate the prepositions in * an array of prepositions, which represents the preposition portion of a lexicon. * * The current implementation, using an array to store the lexical entries for each * type of word is adequate for now, but if the lexicon is to be allowed to grow to * any size, this will have to change. In that case, the lexicon will have to be * used in the file, and file access performed whenever the lexicon is to be used. * Currently, a maximum number of prepositions (MAX_prepositions = 32) is imposed so that the * array can be declared. ***********************************************************************************/ #ifndef MOOD_H #define MOOD_H #include "tense.h" // /*********************************************************************************** * internal defines ***********************************************************************************/ #define STRING_SIZE STRING_SIZE #define MAXLINE 64 #define MAX_PREPOSITIONS 32 //extern int plural; //extern char quant[STRING_SIZE]; /*********************************************************************************** * internal data structures ***********************************************************************************/ /*********************************************************************************** * The mood struct must be defined so that file access can be performed when reading * and writing to the actual lexicon file. If the size of this struct were to change * after students have already started to create their lexicons (ie in later * versions of the grammars), their lexicons would be useless, since the new version * would be reading the wrong length struct. As a result, a few extra spaces are left * for additional features if they need to be added at a later date. If a new feature * is needed, the 'extra's in the struct only need to be renamed to that new * feature's name. lexicons created with older versions will still work, with the * new feature being blank. ***********************************************************************************/ /*********************************************************************************** * the mood phrase (complementizer phrase) ***********************************************************************************/ struct mood_struct { int mood_cat; char mood_cat_feat[STRING_SIZE]; int mood; char mood_feat[STRING_SIZE]; int interr; char interr_feat[STRING_SIZE]; int strong; char strong_feat[STRING_SIZE]; int mplfeat; char mpl_feat[STRING_SIZE]; int tensefeat; char past_feat[STRING_SIZE]; int mpersfeat; char mpers_feat[STRING_SIZE]; int mscndfeat; char mfirst_feat[STRING_SIZE]; int mhost; char mhost_verb[STRING_SIZE]; struct promn_struct prom1; struct vp_struct vp1; struct tense_struct tense1; struct verb_struct verb1; struct aspect_struct aspect1; struct mood_struct mood1; struct voice_struct voice1; // struct mp_struct mp_phrase; int mpextra1; char mpextra_feat1[STRING_SIZE]; int mpextra2; char mpextra_feat2[STRING_SIZE]; int mpextra3; char mpextra_feat3[STRING_SIZE]; int mphrase; char mp_phrase; }; mood1 struct mp_struct //struct for mood. { int mp_cat; char mp_cat_feat[STRING_SIZE]; struct mood_struct mood1; struct promn_struct prom1; }; /*********************************************************************************** * an array of mood_struct. * at start-up, the moodwords in the lexicon file are read into this array. All * manipulation of the lexicon is done through the arrays. At program close (and at * various times during execution) the arrays are written to the file. ***********************************************************************************/ extern struct mood_struct mood_list[MAX_MOOD]; /*********************************************************************************** * the current number of prepositions in mood. This is read from and written to the * lexicon header. ***********************************************************************************/ extern int mood; //?? /*********************************************************************************** * Not sure we will need any. RCD ***********************************************************************************/ /*********************************************************************************** * input: a string holding a possibly complex modal word, made up of one or * more simple modal words. eg 'two hundred' is made up of 'two' * and 'hundred'. * output: 0 if all simple modal words have the same features, -1 if any of * the simple quantifiers have any different features * upon returning, the modal word passed as a parameter has the * entire complex modal word as the 'quantifier' in the struct, and * features, which all agree. * description: when a user enters a quantifier, it is passed to this function. * One by one, the simple quantifiers features are compared. If a * simplequantifier's features do not match those of the simple * quantifiers before it, a message stating which one didn't agree is * printed before returning -1. * No checking is done as to the validity of the individual simple * quantifiers, only that their features match. eg. 'three dog four' * would return success as long as the features of three, dog, and four * all matched. ***********************************************************************************/ int delete_mood(void); /*********************************************************************************** * output: 0 if successful -1 if unsuccessful (the quan was not in the lexicon) * description: prompts for the quan to be deleted. If it exists, copy the last quan * in quan_list over the quan to be deleted, reduce 'prepositions', and sort. ***********************************************************************************/ void display_mood(); /*********************************************************************************** * input: * output: * description: prompts for a quan to be displayed. If it exists, send it to * print_quan_features, if not display message that it isn't in lex. ***********************************************************************************/ void do_mood(char* mood_entered); /*********************************************************************************** * input: a string containing a possible complex quantifier (eg 'two hundred * fifty three') * output: * description: splits the quantifier into tokens and adds each to the lexicon if * they are not already in it. ***********************************************************************************/ void edit_mood(); /*********************************************************************************** * input: * output: * description: prompts for the quan to be edited. If it exists, display its * features, and prompt for the correct quan. If this newly typed quan * doesn't already exist, or is the same as the quan we are editing, * call get_n, call sort_prepositions, and get the new index of the edited * quan. else print a message that it already exists, and return * without editing. ***********************************************************************************/ void enter_mood(char *s); /*********************************************************************************** * input: a string, containing the quan itself to be entered. * description: the variable 'prepositions' is incremented, the quan is copied into the * array 'quan_list' at the position 'prepositions' (since arrays count from * zero we incremented prepositions first, then added at the position of the * newly incremented value). get_n is called to fill the features of * the quan. ***********************************************************************************/ int find_mood_index(char *s); /*********************************************************************************** * input: a string, containing the mood word itself to be searched for. * output: the index in quan_list of the quan passed in. If the quan is not found, * output is -1 ***********************************************************************************/ int get_mood(struct mood_struct *qnt); /*********************************************************************************** * input: a pointer to the mood_struct that contains the quan, and will have * its features entered. * output: * description: prompts the user for features, and fills the struct accordingly. ***********************************************************************************/ void get_mp(struct mp_struct *qp); /*********************************************************************************** * input: a pointer to a prep_struct * output: * description: sets the count feature of the modal word in the modal phrase * according to the count feature of the quantifier. ***********************************************************************************/ void list_mood(); /*********************************************************************************** * input: * output: * description: print to stdout the number of mood words in the lexicon, and list them * five to a line. ***********************************************************************************/ void new_mood(); /*********************************************************************************** * input: * output: * description: prompts the user for a mood word. If it is already in the lexicon, print * a message saying so. If not, call enter_mood, passing the string * holding the modal word entered by the user. ***********************************************************************************/ void mood_defaults(struct mood_struct* q); /*********************************************************************************** * input: a pointer to a mood_struct that is to have its features 'blanked out' * output: * description: copies an empty string into each feature. ***********************************************************************************/ void sort_mood(void); /*********************************************************************************** * description: uses bubble sort to sort the array of mood words. ***********************************************************************************/ #endif //Note: the grammatical operators 'tense, relevance, aspect, and voice' don't take any lexical items per se, //but they will require the insertion of a dummy verb (be,have, do). Neg is represented by one lexical //item 'not' and its variant "n't": struct neg_struct { int neg_cat; char neg_cat_feat; int bound_cat; char bound_cat_feat; char neg_word[STRING_SIZE]; //add a feature extra blank or two here. }; neg1 struct negp_struct //struct for negative phrase. { int negp_cat; char negp_cat_feat[STRING_SIZE]; int strong; char strong_feat[STRING_SIZE]; struct neg_struct neg1; struct mood_struct mood1; }; negp1 struct promn_struct //This is the position for the subject of the sentence. The features //of either the internal or the external argument will be copied here. { struct noun_struct noun_prom1; struct adj_struct adj_prom1; struct quant_struct quant_prom1; struct det_struct det_prom1; int promfeat; char prom_feat[STRING_SIZE]; }; prom1 struct prom_phrase_struct //prominence phrase. PromP--> Prom + TP { int promphrase_cat; char promphrase_cat_feat[STRING_SIZE]; struct promn_struct prom1; struct tense_phrase_struct tensep1; int promphrase; };