application grammars
play

APPLICATION GRAMMARS CHRISTINA UNGER (MERCURY.AI) EXAMPLE: NATURAL - PowerPoint PPT Presentation

APPLICATION GRAMMARS CHRISTINA UNGER (MERCURY.AI) EXAMPLE: NATURAL LANGUAGE INTERFACES NLI applications are intermediaries between users and data. They need to speak the language of the user the language of the data Their job is to


  1. APPLICATION GRAMMARS CHRISTINA UNGER (MERCURY.AI)

  2. EXAMPLE: NATURAL LANGUAGE INTERFACES

  3. NLI applications are intermediaries between users and data. They need to speak ● the language of the user ● the language of the data Their job is to translate between both.

  4. NLI applications are intermediaries between users and data. They need to speak u s u a l l y e a s y ( s t r u c t u r e d a n d ● the language of the user ● the language of the data m a c h i n e - r e a d a b l e ) Their job is to translate between both.

  5. NLI applications are intermediaries between users and data. They need to speak m u c h h a r d e r ● the language of the user ( n a t u r a l l a n g u a g e ) ● the language of the data Their job is to translate between both.

  6. NLI applications are intermediaries between users and data. They need to speak ● the language of the user ● the language of the data Their job is to translate between both.

  7. Abstract syntax describing the domain Concrete syntax Concrete syntax Concrete syntax (SQL/SPARQL/...) (English) (Latvian) RGL (Eng) RGL (Lav)

  8. Application grammars are top-level grammars, the RGL is a library. The Resource Grammar Library was developed to take care of "low-level" linguistic rules such as inflection, agreement, and word order. This enables the authors of application grammars to focus on the semantics when designing the abstract syntax. https://www.grammaticalframework.org/lib/doc/translation.html

  9. THE RGL AS TOP-LEVEL GRAMMAR FOR MACHINE TRANSLATION: TOMORROW

  10. MAIN PROBLEM: The RGL is low-level syntax-oriented. It lacks a level of abstraction , e.g. to facilitate aligning natural language with data. ● Semantic distinctions are assumed to be defined in application grammars. The RGL defines the ● combinatorics of elements, but doesn't specify which elements can really go together. ● RGL parsing creates spurious syntactic ambiguities .

  11. HANDS-ON: BUILDING AN APPLICATION GRAMMAR

  12. STEP 1: SCOPE

  13. STEP 1: SCOPE I’m hungry!

  14. STEP 1: SCOPE I want an Italian pizza!

  15. STEP 1: SCOPE I have chili and papayas. What can I cook with this?

  16. STEP 1: SCOPE Fast and healthy would be good.

  17. STEP 1: SCOPE Do you have something vegetarian instead?

  18. STEP 1: SCOPE No way, I hate garlic!

  19. STEP 1: SCOPE Any fancy desserts for a date?

  20. STEP 1: SCOPE Does this have peanuts? She’s allergic to peanuts...

  21. STEP 1: SCOPE Grouping examples Recipe Search Recipe INFO User Preferences I’m hungry. Does this contain peanuts? I hate garlic. Any burger recipes? For how many people is this? I’m vegetarian. Fast and healthy please. What do I need? I’m allergic to peanuts. What can I do with papayas? How many carbs does it have? I like cheese. I’m still hungry. Is this vegetarian? I try to eat low-carb.

  22. Version 1 Writing application grammars is inherently domain-driven : All important choices depend on the scope and requirements of the application. https://gist.github.com/cunger/1e5d9e404c6979fc45cdf366b52562e1

  23. Version 1 + good level of abstraction - doesn’t generalize across domains observation: verbalization structures are usually the same across similar domains, it’s mostly the lexical items that differ

  24. Version 2 (ontological heaven) abstract Search = { cat Kind; Term Kind; Entity Kind; Attribute Kind; Relation Kind Kind; Search; SearchFilter; + functions for composition

  25. Version 2 (ontological heaven) abstract SearchForRecipes = Search ** { fun Ingredient, Recipe : Kind; pizza, burger, dessert : Term Recipe; tomato, cheese, peanut : Term Ingredient; spaghetti_bolognese, pizza_hawaii : Entity Recipe; vegetarian, fast, easy, healthy : Attribute Recipe; with : Relation Ingredient Recipe; without : Relation Ingredient Recipe; }

  26. Version 2 (ontological heaven) abstract SearchForCars = Search ** { fun Car, Equipment : Kind; porsche_cayenne : Entity Car; convertible, suv : Term Car; child_seat, air_conditioning : Term Equipment; fast, cheap : Attribute Car; with : Relation Equipment Car; without : Relation Equipment Car; }

  27. Version 2 (ontological heaven) abstract SearchForMusic = Search ** { fun Song, Album, Artist : Kind; freddy_mercury : Entity Artist; made_in_heaven : Entity Album; bicycle_race : Entity Song; relaxed, fast, heavy : Attribute Song; song_by : Relation Song Artist; album_by : Relation Album Artist; contains : Relation Song Album; }

  28. Yet Another Query Language (YAQL) svn checkout svn://molto-project.eu/wp4/YAQL

  29. Version 2 (ontological heaven) + generalizes across domains + thus easy to re-use grammar parts + tailored towards alignment with data - strong semantic orientation leads to a cat/lincat mismatch

  30. Version 2 (ontological heaven) abstract Search = { cat Kind; Term Kind; Entity Kind; Attribute Kind; Relation Kind Kind; Search; SearchFilter;

  31. Version 2 (ontological heaven) abstract Search = { cat Kind; Term Kind; -- CN Entity Kind; -- NP Attribute Kind; -- AP, Adv, RCl Relation Kind Kind; -- V2, N2, A2 Search; SearchFilter;

  32. Version 2 (ontological heaven) abstract Search = { cat Kind; Term Kind; -- CN Entity Kind; -- NP Attribute Kind; -- { ap : AP, adv : Adv, rcl : RCl } Relation Kind Kind; -- { v2 : V2, n2 : N2, a2 : A2 } Search; SearchFilter;

  33. Version 2 (ontological heaven) English

  34. Version 2 (ontological heaven) English German (or pick your favourite morphologically rich language)

  35. Version 2 (ontological heaven) English German (or pick your favourite morphologically rich language)

  36. Version 2 (ontological heaven) abstract Search = { cat Kind; Term Kind; -- CN Entity Kind; -- NP Attribute Kind; -- { ap : AP, adv : Adv, rcl : RCl } Relation Kind Kind; -- { v2 : V2, n2 : N2, a2 : A2 } Search; SearchFilter;

  37. Version 2 (ontological heaven) abstract Search = { cat Attribute_AP Kind; -- AP Attribute_Adv Kind; -- Adv Attribute_RCl Kind; -- RCl Relation_V2 Kind Kind; -- V2 Relation_N2 Kind Kind; -- N2 Relation_A2 Kind Kind; -- A2

  38. Version 2 (ontological heaven) abstract Search = { + flat , no explosion cat - duplication of composition rules Attribute_AP Kind; -- AP (imagine you have several *_AP Attribute_Adv Kind; -- Adv and *_CN categories and want to Attribute_RCl Kind; -- RCl have AP-CN-modification) Relation_V2 Kind Kind; -- V2 Relation_N2 Kind Kind; -- N2 Relation_A2 Kind Kind; -- A2

  39. Version 3 (Syntax-Oriented) abstract Search = { cat Noun; -- CN NounPhrase; -- NP AdjectivePhrase; -- AP VerbPhrase; -- VP Adverb; -- Adv Clause; -- Cl

  40. Version 3 (Syntax-Oriented) abstract Search = { + perfect correspondence between cats and lincats cat Noun; -- CN NounPhrase; -- NP AdjectivePhrase; -- AP VerbPhrase; -- VP Adverb; -- Adv Clause; -- Cl

  41. Version 3 (Syntax-Oriented) abstract Search = { + perfect correspondence between cats and lincats cat - plain duplication of the API Noun; -- CN - and where did the semantics go?? NounPhrase; -- NP (syntax-orientation is not bad, but it's also not enough) AdjectivePhrase; -- AP VerbPhrase; -- VP Adverb; -- Adv Clause; -- Cl

  42. Version 4

  43. abstract RecipeSearch = { cat IngredientMassNoun; IngredientCountNoun; NounPhrase; NounPhrase_Neg; NounPhrase_NPI; NounPhrase_PPI; ...

  44. abstract RecipeSearch = { > flat cat > syntax-oriented IngredientMassNoun; > grammatic and semantic distinctions IngredientCountNoun; as needed NounPhrase; NounPhrase_Neg; NounPhrase_NPI; NounPhrase_PPI; ...

  45. abstract RecipeSearch = { > flat cat > syntax-oriented IngredientMassNoun; > grammatic and semantic distinctions IngredientCountNoun; as needed NounPhrase; > modular NounPhrase_Neg; NounPhrase_NPI; NounPhrase_PPI; ...

  46. Numbers.gf Dates.gf Core.gf phrase and clause layer (re-usable across languages and domains) Domain.gf Dialog.gf lexical items and constructrions

  47. Numbers.gf Dates.gf Core.gf phrase and clause layer (re-usable across languages and domains) UserStory1.gf Dialog.gf UserStory2.gf

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend