Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ограничения предикатов не действуют при интерпретации #67

Open
abaula opened this issue Sep 26, 2019 · 0 comments

Comments

@abaula
Copy link

abaula commented Sep 26, 2019

FPerson = fact(
    'Person',
    ['first', 'last']
)
GName = gram('Name')
GSurn = gram('Surn')

RLastName = and_(GSurn, is_single()).interpretation(
    FPerson.last.inflected()
)
RFirstName = and_(GName, is_single()).interpretation(
    FPerson.first.inflected()
)

RPerson = rule(or_(
    RFirstName, RLastName
    #RLastName, RFirstName
    )).interpretation(
    FPerson
)

show_matches(RPerson, ["Иванов", "Иван"])

имеем:

Person(first='иванов',
last=None)
Person(first='иван',
last=None)

если взглянуть на морфер, то видно, что "Иванов" не имеет единственного числа для gram('Name'), тем не менее правило RFirstName срабатывает.

list(tokenizer("Иванов Иван"))

[MorphToken('Иванов',
[0, 6),
'RU',
[Form('иванов', Grams(NOUN,Sgtm,Surn,anim,masc,nomn,sing)),
Form('иванов', Grams(ADJF,Poss,masc,nomn,sing)),
Form('иванов', Grams(ADJF,Poss,accs,inan,masc,sing)),
Form('иван', Grams(NOUN,Name,anim,gent,masc,plur)),
Form('иван', Grams(NOUN,Name,accs,anim,masc,plur))]),
MorphToken('Иван',
[7, 11),
'RU',
[Form('иван', Grams(NOUN,Name,anim,masc,nomn,sing))])]

@kuk kuk changed the title is_single() не работает Ограничения предикатов не действуют при интерпретации May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant