Dan Haub
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: NLP, 298, grammatical framework, natural language processing, copyright haub and kurz --- # More on Rule Based NLP Despite the rise of statistical models in NLP, rule based grammars still have various use cases. In this lecture, we explore a bit more about how these systems are used. ## The big "Why?" As we've seen, rule based systems are complicated and difficult to develop. Just adding the ability to inflect adjectives in Spanish presented many challenges to overcome, and that's just a small part of only a single natural language. So why are rule based systems and grammars still being studied? They excel in reliability for domain specific tasks. ## Domain Specificity Say you wanted to cook something special, but the recipe was in a different language and you can't find one in your own. Google Translate may be able to help! So, you copy and paste the recipe into that handy service and out pops a recipe you can understand... but none of it makes any sense. This [YouTube](https://www.youtube.com/watch?v=_d5Km1U_IYY&ab_channel=Imbrandonfarris) trend perfectly shows how far General NLP systems like Google Translate have to go before they can really handle any task. In reality, there are only so many cooking techniques and possible ingredients, most of which will have direct translations in many other languages. This is an example of a "domain" in NLP. Broadly, domains are segments of a language that have little internal ambiguity and definable boundaries for what can be considered in or out of the domain. For example, turkey in a cooking domain will always be the bird, while in an international affairs domain it will always be the country. There is no ambiguity for the word Turkey when constrained to either of those domains. However if the topic of the domain is unrelated to either meaning of turkey, the word would be considered outside that domain. Let's take a second to think about our cooking domain. **What kinds of ideas, vocabulary, etc. would belong to that domain, and where would the boundary logically be?** ## Reliability If a domain is well defined, a system that implements that domain will always outperform statistical models on the same tasks. Given enough time and resources, it would be well within the realm of possibility to write a recipe translator in GF so that whatever recipe you write is guaranteed to be understandable in any target language. Consider the sentence "Bake turkey at 375F for 3 hours" Parsing this out, we can see that the action `bake` has three "parameters" associated with it: what is being baked, what temperature it's being baked at, and how long it's being baked. As such, our abstract syntax tree could look something like `bake ( food (turkey), temperature (375F), duration (3 hours))` As we saw last week, this can very easily be translated into any number of languages as long as you define linearization rules for all of these words. ## In the real world A quick search for "rule based NLP" on Google Scholar yields quite a few results, most of which are descriptions of certain scientific domains where rule based systems are used for various purposes. In 2022 alone, there are papers describing uses such as [information extracton](https://en.wikipedia.org/wiki/Information_extraction), [part-of-speech tagging](https://en.wikipedia.org/wiki/Part-of-speech_tagging#:~:text=In%20corpus%20linguistics%2C%20part%2Dof,its%20definition%20and%20its%20context.), [named entity recognition](https://en.wikipedia.org/wiki/Named-entity_recognition), and other forms of linguistical analysis. Each of these topics could be a course unto itself and are fantastic options for final projects, so feel free to explore at your leisure :) ## CNLs Perhaps the purest form of rule base NLP comes in the form of Controlled Natural Languages (CNLs), that attempt to pare down real world languages into simpler forms that are directly parsable by a computer. There many CNLs out ther with varying degrees of human readability, machine readability, what can be expressed, etc. A fairly comprehensive review of CNLs from 2013 is available [here](https://direct.mit.edu/coli/article/40/1/121/1455/A-Survey-and-Classification-of-Controlled-Natural). Because there are so many, there's not enough time to discuss all of them, but two that are particularly interesting are "CLEF Query Language" and "Attempto Controlled English". ### CLEF Query Language Databases are hugely important in modern software, so easy querying and managing through a readable interface is vital. This isn't much of an issue for developers, as we can easily learn SQL, MongoDB, Neo4j, etc. But there are many cases in which non-specialists need flexible access to databases. This is where a language like CLEF QL comes in. Proposed in [Hallett et.al 2007](https://www.researchgate.net/publication/42794580_Composing_Questions_through_Conceptual_Authoring), CLEF QL provides a natural language interface that is translated directly into SQL. The system outline looks something like this: ![](https://i.imgur.com/bvWxMKp.png) An example query would is "How many of the explorers who climbed Kilimanjaro but not Everest between 1960 and 1995 did so more than three times during that period?" If you're familiar with SQL, you may realize that a query like this would be fairly complex, well beyond someone who has no experience in programming. ### Attempto Controlled English Whereas some CNLs are meant to access data, others are ment to be the data itself. Such is the case for Attempto Controlled English (ACE). It was first proposed in [Fuchs et.al 1996](https://arxiv.org/pdf/cmp-lg/9603003.pdf) by researchers at the university of Zurich as a language in which to easily store domain specific data in a format that is both human readable and machine parsable. The research team at Zurich has developed a few very cool tools that make use of the capabilities of ACE. One of which is a wiki service that runs automatic logic checks on its corpus to make sure every statement is logically consistent. They have also implemented a large subset of [ACE using GF](https://github.com/Attempto/ACE-in-GF), see eg [ACE.gf](https://github.com/Attempto/ACE-in-GF/blob/master/grammars/ace/ACE.gf) for a concrete example of part of the grammar. Using both the ACE wiki technology and the capabilities of GF, they expanded the wiki to automatically translate pages into various languages! ACE is defined such that no ambiguity exists even when the same sentence written in normal English could have multiple interpretations. For example, in the sentence "**A customer inserts a card that is valid and opens an account.**" it isn't clear if the customer or the card opens the account. But in ACE, the parser will assume the main subject of the sentence carries on to each predicate, so the customer is understood to open the account. To write a similar sentence while making sure the card is understood to open the account, you would say "**A customer inserts a card that is valid and that opens an account.**" For more information on ACE, check out their [homepage](http://attempto.ifi.uzh.ch/site/)! ## Homework Do some self exploration in the world of rule based NLP and report back to the slack channel. A starting point could be [Google Scholar](https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=rule+based+nlp&btnG=).[^citedby] Of particular interest are projects that have a git repository with code that can be run. When you've found something worth sharing, write a short paragraph on what you found and post it in the class Slack. Just make sure to provide links to the resources you use to get your information! You have free reign over all things Rule Based. You could share a cool use for Rule Based systems, talk about a domain that you find interesting, look deeper into any of the CNLs from Kuhn's [survey paper](https://direct.mit.edu/coli/article/40/1/121/1455/A-Survey-and-Classification-of-Controlled-Natural), or anything else you can find! *If you come across something particularly interesting, it could lead you to a topic for the final project!* Please make sure to send your message to the slack before 10:00 AM on Tuesday 2/22 so there is time to read everyone's responses by next class! [^citedby]: If you find a paper that interests you, you can find later work citing this paper by clicking on "cited by". Earlier work is cited in the paper itself. This way it is easy to search back and forward in time and to map out the landscape of topic fairly quickly.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully