Wednesday, January 5, 2011

FYP Post 2: Sentence Segmentation

Yesterday I was saying I couldn't do the sentence segmentation. Well, here's the code for it. Right now I am able to break a passage into individual sentences.

>>> text = "The average compact point-and-shoot camera has a 4x or 5x zoom lens in it. Anyone who's ever tried with one of these cameras to get in closer to a player on the field at a sporting event or snap off a shot of a bird without scaring it away knows that such a short range doesn't cut it. The obvious solution is to get something with a longer zoom, but that means a larger camera, too, that might no longer fit in your pocket. Or could it? With more megapixels waning as a marketable feature, increased optical zooms and/or wide-angle lenses are supplanting that spec on compact cameras. If all you want is to get in a little tighter on the action, the 14-megapixel Sony Cyber-shot DSC-W370's 7x optical zoom or 12-megapixel Panasonic Lumix DMC-ZR3's 8x zoom lens should satisfy. Those who are really tired of their short zooms will probably want to step up to a 10x zoom lens like those on the Casio Exilim EX-FH100 and Sony Cyber-shot DSC-H55. They can be a little uncomfortable for smaller pockets, but can definitely fit in a jacket pocket or bag. Reaching a little farther beyond those is the Panasonic DMC-ZS5, which packs a wide-angle lens with a 12x zoom range into what's still a fairly compact body and the 14x Canon PowerShot SX210 IS. There are a couple things to keep in mind about these cameras. Longer lenses, as well as wider ones, typically cause a bit of distortion, which some models correct for when processing photos. Plus, because the lens glass isn't always top quality, the images from these cameras can be soft. Also, generally speaking, the longer the lens, the slower the camera's performance. We've learned not to expect really fast start-up and shot-to-shot times on models with a 10x zoom or greater."
>>> sents = sent_tokenizer.tokenize(text)
>>> import pprint
>>> pprint.pprint(sents)
['The average compact point-and-shoot camera has a 4x or 5x zoom lens in it.',
"Anyone who's ever tried with one of these cameras to get in closer to a player on the field at a sporting event or snap off a shot of a bird without scaring it away knows that such a short range doesn't cut it.",
'The obvious solution is to get something with a longer zoom, but that means a larger camera, too, that might no longer fit in your pocket.',
'Or could it?',
'With more megapixels waning as a marketable feature, increased optical zooms and/or wide-angle lenses are supplanting that spec on compact cameras.',
"If all you want is to get in a little tighter on the action, the 14-megapixel Sony Cyber-shot DSC-W370's 7x optical zoom or 12-megapixel Panasonic Lumix DMC-ZR3's 8x zoom lens should satisfy.",
'Those who are really tired of their short zooms will probably want to step up to a 10x zoom lens like those on the Casio Exilim EX-FH100 and Sony Cyber-shot DSC-H55.',
'They can be a little uncomfortable for smaller pockets, but can definitely fit in a jacket pocket or bag.',
"Reaching a little farther beyond those is the Panasonic DMC-ZS5, which packs a wide-angle lens with a 12x zoom range into what's still a fairly compact body and the 14x Canon PowerShot SX210 IS.",
'There are a couple things to keep in mind about these cameras.',
'Longer lenses, as well as wider ones, typically cause a bit of distortion, which some models correct for when processing photos.',
"Plus, because the lens glass isn't always top quality, the images from these cameras can be soft.",
"Also, generally speaking, the longer the lens, the slower the camera's performance.",
"We've learned not to expect really fast start-up and shot-to-shot times on models with a 10x zoom or greater."]
>>>

No comments:

Post a Comment