我有以下词典规则
gr_noun_suffix(masculine,singular,nominative,10,'ος').
gr_noun_suffix(masculine,singular,nominative,10,'ης').
gr_noun_suffix(masculine,singular,possessive,10,'η').
gr_noun_suffix(masculine,singular,accusative,10,'η').
gr_noun_suffix(masculine,plural,nominative,10,'ες').
gr_noun_suffix(masculine,plural,possessive,10,'ων').
gr_noun_suffix(masculine,plural,accusative,10,'ες').
例如,我需要输入
gr_noun(X,F,Gender,Plurality,Singularity,Case,Code,[σκυλος],[]).
并获得
F = σκυλ(X),
Gender= masculine,
Singularity= singular,
Case= possessive,
Code= 10 .
换句话说,我需要打破单词的最后一个音节,并将其与规则进行比较,以便喜欢适用的内容。
我似乎对如何打断单词的最后一个音节很困惑。
答案 0 :(得分:0)
不要将原子分成字符列表。使用sub_atom/5
查找后缀或将其分隔。
我无法理解所有参数应该是什么,但这对于一个起点应该足够了:
gr_noun(X, F, Gender, Singularity, Case, Code, Noun) :-
gr_noun_suffix(Gender, Singularity, Case, Code, X),
sub_atom(Noun, Before, Len, 0, X),
sub_atom(Noun, 0, Before, Len, F0),
F =.. [F0, X].
有了这个我得到:
?- gr_noun(X, F, Gender, Singularity, Case, Code, σκυλος).
X = ος,
F = σκυλ(ος),
Gender = masculine,
Singularity = singular,
Case = nominative,
Code = 10 ;