Skip to content
Snippets Groups Projects
Commit 55f41811 authored by Alexis Nasr's avatar Alexis Nasr
Browse files

added a function that checks if a l_rule can apply

parent 53a616c9
Branches
No related tags found
No related merge requests found
......@@ -5,6 +5,28 @@
#include "util.h"
int l_rule_is_applicable(char *form, char *l_rule)
{
int i,j;
int sep_index;
int lemma_suffix_length;
int form_suffix_length;
int form_length = strlen(form);
int l_rule_length = strlen(l_rule);
for(sep_index=1; sep_index < l_rule_length; sep_index++)
if(l_rule[sep_index] == '@')
break;
lemma_suffix_length = l_rule_length - 1 - sep_index;
form_suffix_length = sep_index - 1;
for(j=0, i=form_length - form_suffix_length; j < sep_index; i++, j++)
if((l_rule[j] != '*') && (l_rule[j] != form[i]))
return 0;
return 1;
}
char *apply_l_rule(char *form, char *l_rule)
{
int i,j;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment