Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ffpriv_means_cases.c

Go to the documentation of this file.
00001 /*
00002  * finflect - Algorithms and tools for inflecting Finnish nouns
00003  * Copyright (C) 2004, 2005  The FinFlect Team
00004  * 
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  * 
00019  * 
00020  * For the complete legal text of the GNU Lesser General Public License,
00021  * see the file LICENSE. For a complete list of authors and copyright
00022  * holders, see the file AUTHORS.
00023  */
00024 
00025 /**
00026  * @file ffpriv_means_cases.c Implements functions for inflecting words
00027  * in means cases. They are declared in ffpriv_means_cases.h.
00028  */
00029 
00030 #include "ffpriv_means_cases.h"
00031 #include "ffpriv_genitive_stem.h"
00032 #include "ffutil.h"
00033 #include "ffpriv_plural_stem.h"
00034 #include "ffcase.h"
00035 #include "ffpriv_single_letter.h"
00036 
00037 ffint32 ffpriv_abessive_singular(ffword* word) {
00038   ffint32 err;
00039 
00040   if (word->data.len < 2) {
00041     return ffpriv_single_letter(word, FFCASE_ABESSIVE, FFCOUNT_SINGULAR);
00042   }
00043 
00044   if ((err = ffpriv_genitive_stem(word))) {
00045     return err;
00046   }
00047 
00048   return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "tta", "ttä"));
00049 }
00050 
00051 ffint32 ffpriv_abessive_plural(ffword* word) {
00052   ffint32 err;
00053 
00054   if (word->data.len < 2) {
00055     return ffpriv_single_letter(word, FFCASE_ABESSIVE, FFCOUNT_PLURAL);
00056   }
00057 
00058   word->metadata.cg = 0;
00059 
00060   if ((err = ffpriv_plural_stem(word))) {
00061     return err;
00062   }
00063 
00064   return ffstring_append(&word->data, ffpriv_vowel_harmony(&word->data, "tta", "ttä"));;
00065 }
00066 
00067 ffint32 ffpriv_comitative_plural(ffword* word) {
00068   ffint32 err;
00069 
00070   if (word->data.len < 2) {
00071     return ffpriv_single_letter(word, FFCASE_COMITATIVE, FFCOUNT_PLURAL);
00072   }
00073 
00074   word->metadata.cg = 1;
00075 
00076   if ((err = ffpriv_plural_stem(word))) {
00077     return err;
00078   }
00079 
00080   return ffstring_append(&word->data, "ne");
00081 }
00082 
00083 ffint32 ffpriv_instructive_singular(ffword* word) {
00084   ffint32 err;
00085 
00086   if (word->data.len < 2) {
00087     return ffpriv_single_letter(word, FFCASE_INSTRUCTIVE, FFCOUNT_SINGULAR);
00088   }
00089 
00090   if ((err = ffpriv_genitive_stem(word))) {
00091     return err;
00092   }
00093 
00094   return ffstring_append(&word->data,"n");
00095 }
00096 
00097 ffint32 ffpriv_instructive_plural(ffword* word) {
00098   ffint32 err;
00099 
00100   if (word->data.len < 2) {
00101     return ffpriv_single_letter(word, FFCASE_INSTRUCTIVE, FFCOUNT_PLURAL);
00102   }
00103 
00104   word->metadata.cg = 0;
00105 
00106   if ((err = ffpriv_plural_stem(word))) {
00107     return err;
00108   }
00109 
00110   return ffstring_append(&word->data, "n");
00111 }

Generated on Thu Jun 2 23:16:59 2005 for FinFlect by  doxygen 1.4.2