我如何在 Prolog 中制作一个程序来识别用户输入的名词的性别、复数和大小写?

How can i make a program in Prolog that recognizes the gender, plurality and case of a noun which the user inputs?

我有以下词典规则

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 .

换句话说,我需要打破单词的最后一个音节,并与规则进行比较,以便喜欢适用的内容。

我好像卡在了如何打断单词的最后一个音节上。

不要将原子拆分成字符列表。使用 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 ;