Home Page Icon
Home Page
Table of Contents for
Part 4: Appendices
Close
Part 4: Appendices
by Rob Miller
Text Processing with Ruby
Text Processing with Ruby
For the Best Reading Experience...
Table of Contents
Early praise for Text Processing with Rub y
Acknowledgments
Introduction
About This Book
Online Resources
Pa rt 1 Extract: Acquiring Text
Chapter 1: Reading from Files
Opening a File
Reading from a File
Treating Files as Streams
Reading Fixed-Width Files
Wrapping Up
Chapter 2: Processing Standard Input
Redirecting Input from Other Processes
Example: Extracting URLs
Concurrency and Buffering
Wrapping Up
Chapter 3: Shell One-Liners
Arguments to the Ruby Interpreter
Prepending and Appending Code
Example: Parsing Log Files
Wrapping Up
Chapter 4: Flexible Filters with ARGF
Reading from ARGF as a Stream
Modifying Files
Manipulating ARGV
Wrapping Up
Chapter 5: Delimited Data
Parsing a TSV
Delimited Data and the Command Line
The CSV Format
Wrapping Up
Chapter 6: Scraping HTML
The Right Tool for the Job: Nokogiri
Searching the Document
Working with Elements
Exploring a Page
Example: Reading a League Table
Wrapping Up
Chapter 7: Encodings
A Brief Introduction to Character Encodings
Ruby’s Support for Character Encodings
Detecting Encodings
Wrapping Up
Part 2: Transform: Modifying and Manipulating Text
Chapter 8: Regular Expressions Basics
A Gentle Introduction
Pattern Syntax
Regular Expressions in Ruby
Wrapping Up
Chapter 9: Extraction and Substitution with Regular Expressions
Matching Against Patterns
Global Match Variables
Extracting Multiple Matches
Transforming Text
Wrapping Up
Chapter 10: Writing Parsers
Simple Parsers with StringScanner
Example: Parsing a Config File
Rule-Based Parsers
Example: Parsing RTF Files
Wrapping Up
Chapter 11: Natural Language Processing
What Is Natural Language Processing?
Example: Extracting Keywords from Articles
Example: Fuzzy Searching
Wrapping Up
Part 3: Load: Writing Text
Chapter 12: Standard Output and Standard Error
Simple Output
Formatting Output with printf
Redirecting Standard Output
Wrapping Up
Chapter 13: Writing to Other Processes and to Files
Writing to Other Processes
Writing to Files
Temporary Files
Wrapping Up
Chapter 14: Serialization and Structure: JSON, XML, CSV
JSON
XML
CSV
Wrapping Up
Chapter 15: Templating Output with ERB
Writing Templates
Example: Generating a Purchase Ledger
Evaluating Templates
Passing Data to Templates
Controlling Presentation with Decorators
Wrapping Up
Part 4: Appendices
Appendix 1: A Shell Primer
Running Commands
Controlling Output
Exit Statuses and Flow Control
Appendix 2: Useful Shell Commands
You May Be Interested I n…
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Wrapping Up
Next
Next Chapter
Appendix 1: A Shell Primer
Part 4
Appendices
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset