Chomsky Normal Form - Converting A Grammar To Chomsky Normal Form

Converting A Grammar To Chomsky Normal Form

  1. Introduce
    Introduce a new start variable, and a new rule where is the previous start variable.
  2. Eliminate all rules
    rules are rules of the form where and where is the CFG's variable alphabet.
    Remove every rule with on its right hand side (RHS). For each rule with in its RHS, add a set of new rules consisting of the different possible combinations of replaced or not replaced with . If a rule has as a singleton on its RHS, add a new rule unless has already been removed through this process. For example, examine the following grammar :
    has one rule. When the is removed, we get the following:
    Notice that we have to account for all possibilities of and so we actually end up adding 3 rules.
  3. Eliminate all unit rules
    After all the rules have been removed, you can begin removing unit rules, or rules whose RHS contains one variable and no terminals (which is inconsistent with CNF).
    To remove
    add rule unless this is a unit rule which has already been removed.
  4. Clean up remaining rules that are not in Chomsky normal form.
    Replace with where are new variables.
    If, replace in above rules with some new variable and add rule .

Read more about this topic:  Chomsky Normal Form

Famous quotes containing the words converting a, converting, grammar, chomsky, normal and/or form:

    “Sigh no more, ladies, sigh no more,
    Men were deceivers ever,
    One foot in sea and one on shore,
    To one thing constant never:
    Then sigh not so, but let them go,
    And be you blithe and bonny,
    Converting all your sounds of woe
    Into Hey nonny, nonny.”
    —William Shakespeare (1564–1616)

    “A way of certifying experience, taking photographs is also a way of refusing it—by limiting experience to a search for the photogenic, by converting experience into an image, a souvenir. Travel becomes a strategy for accumulating photographs.”
    —Susan Sontag (b. 1933)

    “The new grammar of race is constructed in a way that George Orwell would have appreciated, because its rules make some ideas impossible to express—unless, of course, one wants to be called a racist.”
    —Stephen Carter (b. 1954)

    “Language is a process of free creation; its laws and principles are fixed, but the manner in which the principles of generation are used is free and infinitely varied. Even the interpretation and use of words involves a process of free creation.”
    —Noam Chomsky (b. 1928)

    “You know that fiction, prose rather, is possibly the roughest trade of all in writing. You do not have the reference, the old important reference. You have the sheet of blank paper, the pencil, and the obligation to invent truer than things can be true. You have to take what is not palpable and make it completely palpable and also have it seem normal and so that it can become a part of experience of the person who reads it.”
    —Ernest Hemingway (1899–1961)

    “In America every woman has her set of girl-friends; some are cousins, the rest are gained at school. These form a permanent committee who sit on each other’s affairs, who “come out” together, marry and divorce together, and who end as those groups of bustling, heartless well-informed club-women who govern society. Against them the Couple of Ehepaar is helpless and Man in their eyes but a biological interlude.”
    —Cyril Connolly (1903–1974)