Skip to content

extend grammar to handle lastbook_nomatch, usermodel_match, usermodel_nomatch #3

Open
@arne-cl

Description

@arne-cl

There are a few message blocks that pypolibox currently can't turn into an HLDS structure, since there is/are no corresponding rules/vocabulary in the OpenCCG grammar fragment we're using.

Have a look at lexicalize_messageblocks.py:

def lexicalize_lastbook_nomatch(lastbook_nomatch_message_block):
    r"""
    Im Gegensatz zum ersten / vorhergehenden / anderen Buch ____
    """
    raise NotImplementedError, "The grammar fragment can't handle lastbook non-matches, yet."

def lexicalize_usermodel_match(usermodel_match_message_block):
    r"""erfüllt Anforderungen / entspricht ihren Wünschen"""
    raise NotImplementedError, "The grammar fragment can't handle usermodel matches, yet."

def lexicalize_usermodel_nomatch(usermodel_nomatch_message_block):
    r"""erfüllt (leider) Anforderungen nicht / entspricht nicht ihren
    Wünschen"""
    raise NotImplementedError, "The grammar fragment can't handle usermodel non-matches, yet."

As an example, let's ask pypolibox for a book about parsing:

pypolibox --keywords parsing

[...]

The id message block can be realized as follows:

„ Computational_Linguistics._An_Introduction. “ von Ralph Grishman ist im Jahr 1986 erschienen .
Ralph Grishmans „ Computational_Linguistics._An_Introduction. “ beinhaltet keine Code-Beispiele .
das Buch richtet sich an Anfänger .
Ralph Grishmans „ Computational_Linguistics._An_Introduction. “ beinhaltet Übungen .
das Buch von Ralph Grishman umfasst 193 Seiten .

The grammar fragment can't handle usermodel matches, yet.
The message block contains these messages:
[ *msgType*           = 'usermodel_match'                                          ]
[ *reference_authors* = (frozenset(['Ralph Grishman']), 'neutral')                 ]
[ *reference_title*   = ('Computational Linguistics. An Introduction.', 'neutral') ]
[ keywords            = (frozenset(['parsing']), 'positive')                       ] 

In this case, pypolibox will generate the ID message block for a matching book, but cannot express the usermodel_match message block (something like "das Buch behandelt das Thema Parsing und entspricht damit ihren Wünschen").

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions