1 / 4

Parsing a Name

Parsing a Name. Homework 1. Cases to Consider. Rest Last Last, Rest Rest Last, Suffix Last, Rest, Suffix Others??? Question : how do we tell the computer to recognize and distinguish each case from the others?. Distinguishing the Four Cases. Case. Distinguishing Characteristic.

latoya
Download Presentation

Parsing a Name

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Parsing a Name Homework 1

  2. Cases to Consider • Rest Last • Last, Rest • Rest Last, Suffix • Last, Rest, Suffix • Others??? • Question: how do we tell the computer to recognize and distinguish each case from the others?

  3. Distinguishing the Four Cases Case Distinguishing Characteristic No Comma present First Comma before First Space First Space before First Comma First Comma ≠ Last Comma • Rest Last • Last, Rest • Rest Last, Suffix • Last, Rest, Suffix • Note that one must remove extraneous white space before the strategy above works correctly • Remove leading and trailing whitespace • Replace multiple consecutive whitespace characters with single space • Remove any whitespace immediately before a comma

  4. Distinguishing the Four Cases Case Distinguishing Characteristic No Comma present First Comma before First Space First Space before First Comma First Comma ≠ Last Comma • Rest Last • Last, Rest • Rest Last, Suffix • Last, Rest, Suffix After handling the suffix in the last two cases and then removing it along with its preceding comma and space, we are left with the first two cases

More Related