or
Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Colour:
Image not available

 
Tell the Publisher!
Id like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Text Processing in Python [Paperback]

David Mertz

RRP: 34.99
Price: 31.11 & FREE Delivery in the UK. Details
You Save: 3.88 (11%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 3 left in stock.
Dispatched from and sold by Amazon. Gift-wrap available.
Want it tomorrow, 11 July? Choose Express delivery at checkout. Details

Book Description

2 Jun 2003 0321112547 978-0321112545 1

Text Processing in Python

describes techniques for manipulation of text using the

Python programming language. At the broadest level, text processing is simply

taking textual information and doing something with it. This might be

restructuring or reformatting it, extracting smaller bits of information from it,

or performing calculations that depend on the text. Text processing is arguably

what most programmers spend most of their time doing. Because Python is

clear, expressive, and object-oriented it is a perfect language for doing text

processing, even better than Perl. As the amount of data everywhere continues

to increase, this is more and more of a challenge for programmers. This book is

not a tutorial on Python. It has two other goals: helping the programmer get

the job done pragmatically and efficiently; and giving the reader an

understanding - both theoretically and conceptually - of why what works works

and what doesn't work doesn't work. Mertz provides practical pointers and tips

that emphasize efficent, flexible, and maintainable approaches to the textprocessing

tasks that working programmers face daily.


Special Offers and Product Promotions

  • Spend 30 and get Norton 360 21.0 - 3 Computers, 1 Year 2014 for 24.99. Here's how (terms and conditions apply)

Product details


More About the Author

Discover books, learn about writers, and more.

Product Description

From the Back Cover

Text Processing in Python is an example-driven, hands-on tutorial that carefully teaches programmers how to accomplish numerous text processing tasks using the Python language. Filled with concrete examples, this book provides efficient and effective solutions to specific text processing problems and practical strategies for dealing with all types of text processing challenges.

Text Processing in Python begins with an introduction to text processing and contains a quick Python tutorial to get you up to speed. It then delves into essential text processing subject areas, including string operations, regular expressions, parsers and state machines, and Internet tools and techniques. Appendixes cover such important topics as data compression and Unicode. A comprehensive index and plentiful cross-referencing offer easy access to available information. In addition, exercises throughout the book provide readers with further opportunity to hone their skills either on their own or in the classroom. A companion Web site (http://gnosis.cx/TPiP) contains source code and examples from the book.

Here is some of what you will find in thie book:

  • When do I use formal parsers to process structured and semi-structured data? Page 257
  • How do I work with full text indexing? Page 199
  • What patterns in text can be expressed using regular expressions? Page 204
  • How do I find a URL or an email address in text? Page 228
  • How do I process a report with a concrete state machine? Page 274
  • How do I parse, create, and manipulate internet formats? Page 345
  • How do I handle lossless and lossy compression? Page 454
  • How do I find codepoints in Unicode? Page 465


0321112547B05022003

About the Author

David Mertz came to writing about programming via the unlikely route of first being a humanities professor. Along the way, he was a senior software developer, and now runs his own development company, Gnosis Software ("We know stuff!"). David writes regular columns and articles for IBM developerWorks, Intel Developer Network, O'Reilly ONLamp, and other publications.



0321112547AB05022003

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Customer Reviews

There are no customer reviews yet on Amazon.co.uk.
5 star
4 star
3 star
2 star
1 star
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.4 out of 5 stars  19 reviews
49 of 51 people found the following review helpful
5.0 out of 5 stars A Truly Educational Book, for those who like to learn 6 July 2003
By Ronald D. Stephens - Published on Amazon.com
Format:Paperback
Text Processing in Python, by David Mertz, 2003, Addison Wesley, 520 pages.
If you have read an introductory book or two about programming, but you are far from being an expert, then you will benefit a lot from reading this book. If you are a competent programmer in any other language, you will benefit from this book. If you are an expert Python programmer, you will also benefit from this book.
For, as you know, there are many good introductory texts about Python. This is not one of them, for this is an advanced book, but not an inaccessible one. David Mertz has a unique style and focus that we have become familiar with from his "Charming Python" series of articles on the IBM Developer Network. Dr. Mertz is more interested in facilitating our learning process than in lecturing us, and rather than fill his pages with impressive examples designed to illustrate his expertise, he gently guides us by offering subtle yet important examples of code and analysis that makes us think for ourselves.
He has a special talent for programming in the functional style, and this is a great introduction to that style of Python programming. Thus, this is also a good guide to using the newer features introduced into Python in the last few revisions, which often facilitate the functional style of programming.
The text includes, in an appendix, a 40 page tutorial covering the basic Python language. This tutorial is, like the book, unique in its approach and is worthwhile even for experienced Pythonistas, as it sheds light on some of the underlying ideas behind the syntax and semantics, and it also illustrates the functional style of programming, which is sometimes quite useful when doing text processing. And, despite its many other virtues, this is a book about text processing.
Chapter 1 covers the Python basics, but with a particular eye towards those features most critical and useful for text processing. Chapter 2 covers the basic string operations as found in the string module and the newer built-in string functions. Chapter three is about Regular Expressions, and, although I am shy about regexes because of their relative complexity, I am very glad to have read this chapter and will no longer be intimidated when regexes are the correct approach to take! Chapter 4 is on Parsers and State machines, which are important for processing nested text, as in everyday HTML, XML and the like. This chapter is not as esoteric as its title may sound to relative newbies (like myself), as it does offer useful ideas and principles for dealing with HTML. How much more useful can a topic be than that? It is true that a deep understanding of this subject may be beyond myself and other relative duffers, but this chapter has much to offer those like me and I am sure much more to offer professionals.
Chapter 5 is on Internet tools and techniques, and this a good example of how text processing touches every important area of computer programming. We manipulate text for email, newsgroups, CGI programs, HTML and many other aspects of net programming. A good summary of XML programming is included, as well as useful synopses of other Python internet modules, from a text processing point of view.
Appendix A is the aforementioned selective and short review of Python basics. Appendix B is a ten page Data Compression primer that is quite educational. Appendix C offers the same good service for Unicode, and Appendix D covers the author's own software, a state machine for adding markup to text, which is backed up by his extensive web site that has a lot of free software to support those doing extensive text processing. Lastly, Appendix E is a Glossary for technical terms from the book. This is very much an educational book, and would be suitable for classroom work at the University level, beyond the introductory programming level; in fact, as part of a curriculum to teach programming using Python at the University level, this would be an excellent text for the second course.
One of the highlights of the book is that each chapter is concluded with a problem and discussion section. These are of the highest quality I have encountered in computer texts. Rather than overwhelming the reader with a large number of problems, the author has obviously given a lifetime of thought in coming up with a few key problems that are meant to stimulate thought, creativity, and ultimately understanding and growth in the reader. I will be coming back to the problems often, as they cannot be absorbed quickly anyway; they require thought. These would be most useful in a classroom environment; but as they are accompanied by excellent discussion material, and backed up by the author's web site, the individual reader will be well served also.
The book is more than the sum of its parts. It will be a most useful reference source for when I am doing various text related tasks for some time to come, and it was also a delightful and educational quick read in the here and now. It also amply illustrates the centrality of text processing in all areas of computer science, and I am confident that the book will be useful and educational for all programmers, whatever their area of expertise.
To sum it all up, this book is educational. It is also beautifully bound and printed, and excellently written. I rate it five stars, my highest rating, and heartily recommend its purchase.
Ron Stephens
41 of 44 people found the following review helpful
5.0 out of 5 stars A beautiful book 3 Sep 2003
By John S. Ryan - Published on Amazon.com
Format:Paperback|Verified Purchase
Yes, I mean it: this is a beautiful book. If your aesthetic sensibilities have been informed, directly or indirectly, by Kernighan and Ritchie's influential book on C, you'll know what I mean.
I've been programming computers in various capacities since I was in my early teens (the mid-1970s) and I've been through a number of languages. Not long ago I discovered Python, and I suspect I won't need to learn any other languages for quite a long time. Guido van Rossum is a wizard.
If you're interested in learning Python, don't start here. If you've got some programming background already, Guido's tutorial (which comes bundled with the Python download) will be enough to get you rolling. I personally recommend all of O'Reilly's books on the subject (_Learning Python_ for the absolute beginner, Mark Lutz's idiosyncratic but highly useful _Programming Python_ for the next level up, the magisterial _Python Cookbook_ for pretty much anybody, and the _Nutshell_ book to be placed permanently next to your keyboard). There are others as well, and after you've gotten started, you'll be a better judge than I am of what will be most useful to you. (But I'd skip the vastly overpriced and not-very-deep _Python Programming Patterns_ unless you can buy it used.)
This one's for later; although it does offer some beginning instruction in Python, it isn't really an introductory book. However, if you do any text processing with Python -- which you almost undoubtedly do if you use Python at all -- then you _do_ want this book even if you don't know it yet.
Most of what you'll want to know is in chapter two, which sets out the basics of string processing in Python. The other, fancier stuff in the later chapters may be handy sometimes, but author David Mertz himself will tell you not to overcomplicate things; if you can do what you need to do using string operations, do so.
Read the rest of it too, though. There's good stuff here on e.g. regular expressions and parsing that you'll find interesting and possibly useful. Just don't rush out and start trying to apply it when it isn't necessary.
Mertz is an excellent teacher. He tends to approach things from a foundation of "functional programming" -- of which I'm not particularly a fan, but he has a healthy sense of its limitations and his comments on the subject are refreshing. (If you're interested in functional programming, get a book on Haskell, which is actually a very cool language. But me, I like imperative languages just fine and I don't have any problem with "side effects" as long as they're deliberate or at least controlled.) At any rate, Mertz won't lock you in to a functional approach, but he will teach you some function-oriented stuff that will be useful to you no matter what your preferred programming style.
And his exposition is well organized and wonderfully lucid. If you're the sort of person who likes books that have a chapter zero, you'll enjoy his style.
Unless you have a strong programming background, then, you probably won't want to start your Python bookshelf with this one. But I recommend making it one of your first five.
22 of 24 people found the following review helpful
4.0 out of 5 stars Round the world tour of string processing for Pythoneers 29 Feb 2004
By John C. Dunbar - Published on Amazon.com
Format:Paperback
This is the only book that really attacks the issue of string processing using Python. Unfortunately it didn't attack the text processing problems that I wanted discussed.
Also, in the area of Regular Expressions the examples didn't directly use the Python library, instead a wrap around function was used for the many examples and that detracted from using the book as a reference book for this purpose.
I found that Python has several different ways to do string processing. Also, some of those ways come up with conflicting results. At the time of this writing the authors of Python are re-organizing and improving this area.
What is truly great about the book is the discussion of state machines, parsers, and functional programming. Although these topics detract from the focus on string processing somewhat this book is perhaps the only popular Python book out there that does these topics justice. I thought they were very well written.
My overall complaint is that this book includes too many things outside of text processing using the core Python language. But other readers may appreciate this aspect more than I did. If you want coverage on handling email specifically, the author covers that. Same with HTML processing and other specialized topics. I just wanted to low down on using the full string processing capabilities of the core Python language -- not necessarily all the specialized libraries.
I found string processing to be messy with Python but found Ruby to be much easier. That is perhaps because Ruby is a newer language and it has some features of Perl built in. Ruby however does not have the extent of libraries available like Python, nor does it have as nice of Windows GUI.
Overall, if you are looking for a book on text processing this is the only book out there, and a big plus with this book is what you will learn on function programming, state machines and parsers.
The author worked hard to produce a book in this specialized area. He has lots of code examples. Highly recommended for Python programmers.
John Dunbar
Sugar Land, TX
31 of 36 people found the following review helpful
5.0 out of 5 stars More author clarification 9 Jun 2004
By Amazon Customer - Published on Amazon.com
Format:Paperback
Added note: The review by phrodod was quite nice, IMO. One little thing: s/he mentions my little re_show() utility that I use in the regex tutorial. While phrodod grants leniency in allowing that it is fine if the utility is not of use beyond the examples... my little wrapper proves better than that even. Specifically, the rather nice Python library PEAK chose to incorporate the exact 3-line utility function (with acknowledgments to me) to help user explore regexen. PEAK, of course, is vastly more interesting than my miniscule and accidental contribution to it :-).
-----
I felt the review from "A reader from Germany" below rather missed the point of my book. Don't buy it if the book is not right for you, most certainly. But I wonder how that reader got such an entirely inaccurate set of expectations about the book.

For example, s/he wrote:

> This book is not for people that are new to programming.

However, if you buy the book from Amazon (here), the very first thing you see in the Editorial Reviews section is:

> Written for experienced programmers...

So it seems odd for the above reader to be negatively surprised by the target audience. If s/he bought it at a brick-and-morter store, the back cover pretty much says the same thing.

Moreover, the reader mentioned also seems not to understand the meaning of the title:

> The title of the book is very much missleading too.
> If you think that the book has anything to do with
> text processing in the sense of linguistics, you are
> mistaken.

I'm not sure how anyone would think that the phrase "text processing" is supposed to mean "computational linguistics." There are a couple overlaps between the fields. And you probably need a bit of text processing to extract useful corpora for computational linguistics. But the ordinary meaning of the words makes it clear that these are quite different areas of specialty. Actually, I just wrote an IBM developerWorks article introducing the Natural Language Toolkit (for Python). Anyone who is interested in computational linguistics and Python should take a look at that library.

I wonder if the "from Germany" description of the reader indicates the s/he translated the English title slightly wrongly. I can kinda imagine that across languages the field distinction could get lost.

And finally:

> ...really mad to find out that the book is available online too.

This one rather upsets me. I provide a service for readers--both those who pay for the printed copy and those who read it online for free (or make a voluntary donation online). The reader is *mad* that I give away something for free that I was under no obligation to (and even wrestled slightly with my publisher to make sure I could do so)!? If s/he doesn't want the free copy, I don't see how s/he's forced to download it!
10 of 10 people found the following review helpful
5.0 out of 5 stars Great Advanced Python Book 9 May 2004
By Phillip David - Published on Amazon.com
Format:Paperback
This book covers many of the details of processing text files to extract and/or generate more textual information from them. The author covers quite a number of advanced techniques, starting with an introduction to functional programming paradigms in the first few pages.
Nothing in this book is truly new, but the author finds many ways of applying the things advanced Pythonistas already know to domains that they might otherwise not consider.
This book is very dense, so don't expect to read it and get it in a weekend. And certainly, don't pick this up as a first programming in Python book. If you're just learning to program, consider "Learning Python" by Lutz or "How to Think Like a Computer Scientist" (free web book -- search Google for it). If you already know programming, but need to learn Python, consider the Quick Python Book (old, but great) or "Dive into Python" (another free web book) for learning those.
When the time comes that you want to write a small language of your own for your users (or when you need to support an existing small language), this book will be invaluable for telling you how to do this using Python.
If you don't understand functional programming, but think you might like to learn it, use this book to teach you that.
If you want to understand the regular expression library, use this book for that as well. However, the RE library examples do wrap the output in a special macro that's only likely to be useful for the purposes of the book. Understand that you're not likely to use the macro, and you'll be fine.
The tremendous breadth and depth of this book makes me recommend it highly. But even if you're advanced, don't expect it to be light reading.
Enjoy.
Were these reviews helpful?   Let us know

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   


Look for similar items by category


Feedback