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

ffpriv_essive_stem.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_essive_stem.c Implements the essive stem function declared in
00027  * ffpriv_essive_stem.h.
00028  */
00029 
00030 #include "ffpriv_essive_stem.h"
00031 #include "ffutil.h"
00032 #include "ffstring.h"
00033 #include "ffpriv_genitive_stem.h"
00034 
00035 ffint32 ffpriv_essive_stem(ffword* word) {
00036   /*@@v ESSb-01 **/
00037   ffword copy; /*@GENb*/
00038   ffint32 err;
00039 
00040   if ( ffpriv_is_vowel(ffstring_last(&word->data)) ) {
00041     /** TODO: ie */
00042     return /*@NOMb*/ 0; /*@@v ESSb--01 **/
00043   } else {
00044 
00045     ffstring_copy(&word->data, &copy.data);
00046 
00047     copy.metadata = word->metadata;
00048     copy.metadata.cg = 0;
00049     if ( (err = ffpriv_genitive_stem(&copy)) ) {
00050       ffstring_delete(&copy.data);
00051       return err;
00052     }
00053 
00054 
00055     if ( ffstring_tail_equals_ci(&copy.data, 3, "mma") ) {
00056       ffstring_move_and_delete(&copy.data, &word->data);
00057       return /*@GENb*/ ffstring_rfe(&word->data, 2, "pa"); /*@@v ESSb--02 **/
00058     }
00059 
00060     if ( ffstring_last_equals_ci(&word->data,'s') && ffstring_tail_equals_ci(&copy.data, 2, "de") ) {
00061       ffstring_delete(&copy.data);
00062       return /*@NOMb*/ ffstring_rfe(&word->data, 1, "te"); /*@@v ESSb--03 **/
00063     }
00064 
00065     if ( (ffstring_last_equals_ci(&word->data,'s') || ffstring_last_equals_ci(&word->data,'t')) && ffstring_tail_equals_ci(&copy.data, 3, "nne") ) {
00066       ffstring_delete(&copy.data);
00067       return /*@NOMb*/ ffstring_rfe(&word->data, 1, "nte"); /*@@v ESSb--04 **/
00068     }
00069 
00070     ffstring_move_and_delete(&copy.data, &word->data); /* BUGFIX 2005-05-13 */
00071     return /*@GENb*/ 0; /*@@v ESSb--05 **/
00072 
00073   }
00074 }
00075 
00076 /*
00077 
00078         if { [isvokaali [last $word]] } {
00079         
00080 # Vowel change
00081                 set ie [vokaalinvaihtelu $word par]
00082                 if { $ie != ""} {
00083                         regsub t?\[aä\]$ $ie "" ie
00084                         
00085                         if { [regexp ${v}mi$ $word] } {
00086                                 return [general_genitive_stem $word 0 $ops]
00087 }
00088                         
00089                         if { [last $word 3] == "ksi" } {
00090                                 return [general_genitive_stem $word 1 $ops]
00091 }
00092                         
00093                         if { [last $word 3] == "psi" || [last $word 3] == "tsi" } {
00094                                 return [general_genitive_stem $word 0 $ops]
00095 }
00096                         
00097                         if { [isvokaali [last $ie]] } {
00098                                 return $ie
00099 }
00100                         return ${ie}e
00101 }
00102                 
00103                 if { ![is loan $ops] } {
00104 # Relic consonant
00105                         set rel [relic_consonant $word gen]
00106                         if { $rel != "" } {
00107                                 return $rel             
00108 }}
00109                 return $word
00110 } else {
00111 */

Generated on Sun May 15 21:50:47 2005 for FinFlect by  doxygen 1.4.1