Tuesday, July 13, 2010

Why'd it have to be snakes?

Trivia note: I've finally decided to learn Python for text-handling purposes. It was that or Perl, which is more of a slob's language (and thus better suited to me, probably), but I'm still going to try Python, courtesy in part of Text Processing in Python, available here.

The point is to automate some linguistic tasks, including translation and reverse-engineering lexicons. I usually just put together a quick, single-use program for a given purpose, but I'm thinking about producing some long, flexible, multiple-use programs, so I might as well get serious.

It's the indentation that gets me. Granted, it's more obvious than spotting a } lurking somewhere in the code, but it means that the Python Zen soundbite "Flat is better than nested" merely justifies a necessity: Python probably can't handle much nesting without the indentation getting out of hand. That may be a bad thing: Life nests a lot, which means God doesn't use Python. I sometimes think he's more the Perl type too. This would be a very different world without nesting, and in any case, no matter what the Pythons claim, the world is not flat.

But I guess that's why you job everything out to modules.

Anyway, I'll see what it's like in practice. I may try writing a concordance program (it would output where a given word occurred in a group of text files and incidentally list their complete vocabulary); that should be a good opener. Or perhaps a parser--I'll need one of those anyway.

I'll report back on how it's going. Just remember that any incoherent complaints about snakes won't be delirium tremens.

No comments:

Powered by WebRing.