Skip to Content
Natural Language Processing with Python
book

Natural Language Processing with Python

by Steven Bird, Ewan Klein, Edward Loper
June 2009
Beginner to intermediate
504 pages
16h 27m
English
O'Reilly Media, Inc.
Content preview from Natural Language Processing with Python

Exercises

  1. ○ Translate the following sentences into propositional logic and verify that they parse with LogicParser. Provide a key that shows how the propositional variables in your translation correspond to expressions of English.

    1. If Angus sings, it is not the case that Bertie sulks.

    2. Cyril runs and barks.

    3. It will snow if it doesn’t rain.

    4. It’s not the case that Irene will be happy if Olive or Tofu comes.

    5. Pat didn’t cough or sneeze.

    6. If you don’t come if I call, I won’t come if you call.

  2. ○ Translate the following sentences into predicate-argument formulas of first-order logic.

    1. Angus likes Cyril and Irene hates Cyril.

    2. Tofu is taller than Bertie.

    3. Bruce loves himself and Pat does too.

    4. Cyril saw Bertie, but Angus didn’t.

    5. Cyril is a four-legged friend.

    6. Tofu and Olive are near each other.

  3. ○ Translate the following sentences into quantified formulas of first-order logic.

    1. Angus likes someone and someone likes Julia.

    2. Angus loves a dog who loves him.

    3. Nobody smiles at Pat.

    4. Somebody coughs and sneezes.

    5. Nobody coughed or sneezed.

    6. Bruce loves somebody other than Bruce.

    7. Nobody other than Matthew loves Pat.

    8. Cyril likes everyone except for Irene.

    9. Exactly one person is asleep.

  4. ○ Translate the following verb phrases using λ-abstracts and quantified formulas of first-order logic.

    1. feed Cyril and give a capuccino to Angus

    2. be given ‘War and Peace’ by Pat

    3. be loved by everyone

    4. be loved or detested by everyone

    5. be loved by everyone and detested by no-one

  5. ○ Consider the following statements:

    >>> lp = nltk.LogicParser() >>> e2 = lp.parse('pat') ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Hands-On Natural Language Processing with Python

Hands-On Natural Language Processing with Python

Rajesh Arumugam, Rajalingappaa Shanmugamani

Publisher Resources

ISBN: 9780596803346Errata Page