Text Processing in Python

個数:

Text Processing in Python

  • 在庫がございません。海外の書籍取次会社を通じて出版社等からお取り寄せいたします。
    通常6~9週間ほどで発送の見込みですが、商品によってはさらに時間がかかることもございます。
    重要ご説明事項
    1. 納期遅延や、ご入手不能となる場合がございます。
    2. 複数冊ご注文の場合、分割発送となる場合がございます。
    3. 美品のご指定は承りかねます。
  • 【入荷遅延について】
    世界情勢の影響により、海外からお取り寄せとなる洋書・洋古書の入荷が、表示している標準的な納期よりも遅延する場合がございます。
    おそれいりますが、あらかじめご了承くださいますようお願い申し上げます。
  • ◆画像の表紙や帯等は実物とは異なる場合があります。
  • ◆ウェブストアでの洋書販売価格は、弊社店舗等での販売価格とは異なります。
    また、洋書販売価格は、ご注文確定時点での日本円価格となります。
    ご注文確定後に、同じ洋書の販売価格が変動しても、それは反映されません。
  • 製本 Paperback:紙装版/ペーパーバック版/ページ数 544 p.
  • 言語 ENG
  • 商品コード 9780321112545
  • DDC分類 005.133

Full Description

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.

Contents

Preface.


What Is Text Processing?



The Philosophy of Text Processing.



What You'll Need to Use This Book.



Conventions Used in This Book.



A Word on Source Code Examples.



External Resources.



1. Python Basics.


Techniques and Patterns.



Utilizing Higher-Order Functions in Text Processing.



Exercise: More on combinatorial functions.



Specializing Python Datatypes.



Base Classes for Datatypes.



Exercise: Filling out the forms (or deciding not to)



Problem: Working with lines from a large file.



Standard Modules.



Working with the Python Interpreter.



Working with the Local Filesystem.



Running External Commands and Accessing OS Features.



Special Data Values and Formats.



Other Modules in the Standard Library.



Serializing and Storing Python Objects.



Platform Specific Operations.



Working with Multi-Media Formats.



Miscellaneous Other Modules.



2. Basic String Operations.


Some Common Tasks.



Problem: Quickly sorting lines on custom criteria.



Problem: Reformatting paragraphs of text.



Problem: Column statistics for delimited or flat-record files.



Problem: Counting characters, words, lines and paragraphs.



Problem: Transmit binary data as ASCII.



Problem: Creating word or letter histograms.



Problem: Reading a file backwards by record, line, or paragraph.



Standard Modules.



Basic String Transformations.



Strings as Files, and Files as Strings.



Converting Between Binary and ASCII.



Cryptography.



Compression.



Unicode.



Solving Problems.



Exercise: Many ways to take out the garbage.



Exercise: Making sure things are what they should be



Exercise: Finding needles in haystacks (full-text indexing).



3. Regular Expressions.


A Regular Expression Tutorial.



Just What is a Regular Expression Anyway?



Matching Patterns In Text: The Basics.



Matching Patterns In Text: Intermediate.



Advanced Regular Expression Extensions.



Some Common Tasks.



Problem: Making a text block flush left.



Problem: Summarizing command-line option documentation.



Problem: Detecting duplicate words.



Problem: Checking for server errors.



Problem: Reading lines with continuation characters



Problem: Identifying URLs and email addresses in texts.



Problem: Pretty printing numbers.



Standard Modules.



Versions and optimizations.



Simple Pattern Matching.



Regular Expression Modules.



4. Parsers and State Machines.


An Introduction to Parsers.



When data becomes deep and texts become stateful.



What is a grammar?



An EBNF grammar for IF/THEN/END structures.



Pencil-and-Paper Parsing.



Exercise: Some variations on the language.



An Introduction to State Machines.



Understanding State Machines.



Text Processing State Machines.



When Not To Use A State Machine.



When to Use a State Machine.



An Abstract State Machine Class.



Processing a Report with a Concrete State Machine.



Subgraphs and State Reuse.



Exercise: Finding other solutions.



Parser Libraries for Python.



Specialized Parsers in the Standard Library.



Low-Level State Machine Parsing.



High-Level EBNF Parsing.



High-Level Programmatic Parsing.



5. Internet Tools and Techniques.


Working With Email and Newsgroups.



Manipulating and Creating Message Texts.



Communicating with Mail Servers.



Message Collections and Message Parts.



World Wide Web Applications.



Common Gateway Interface.



Parsing, Creating, and Manipulating HTML Documents.



Accessing Internet Resources.



Synopses of Other Internet Modules.



Standard Internet-Related Tools.



Third Party Internet-Related Tools.



Understanding XML.



Python Standard Library XML Modules.



Third Party XML-Related Tools



A. A Selective and Impressionistic Short Review of Python.


What Kind of Language is Python?



Namespaces and Bindings.



Assignment and Dereferencing.



Function and Class Definitions.



import Statements.



for Statements.



except Statements.



Datatypes.



Simple Types.



String Interpolation.



Printing.



Container Types.



Compound Types.



Flow Control.



if / then / else Statements.



Boolean Shortcutting.



for / continue / break Statements.



map( ), filter( ), reduce( ), and List Comprehensions.



while / else / continue / break Statements.



Functions, Simple Generators and the yield Statement.



Raising and Catching Exceptions.



Data as Code.



Functional Programming.



Emphasizing Expressions using lambda.



Special List Functions.



List-Application Functions as Flow Control.



Extended Call Syntax and apply( ).



B. A Data Compression Primer.


Introduction.



Lossless and Lossy Compression.



A Data Set Example.



Whitespace Compression.



Run-Length Encoding.



Hu_man Encoding.



Lempel-Ziv Compression.



Solving the Right Problem.



A Custom Text Compressor.



References.



C. Understanding Unicode.


Some Background on Characters.



What is Unicode?



Encodings.



Declarations.



Finding Codepoints.



Resources.



D. A State-Machine for Adding Markup to Text.


E. Glossary.


Index. 0321112547T01302003