That's actually why Nantucket ignores meter for now - cmudict's stress patterns are really inaccurate and unsatisfying. espeak is an interesting idea!
One thought I want to explore in a later version is using cmudict's stress patterns for polysyllabic words, but ignoring any stress/meter rules for monosyllabic words. I suspect that'll do pretty well, and it'll be interesting to test it out.
That sounds like a good heuristic. Monosyllabic words don't seem entirely free when it comes to assigning accent, but more free overall. Polysyllabic words seem relatively stable, except for some oddities where you can take poetic license, like putting the accent on the last syllable of "cursed" ("cursèd").
For an example of where it seems weird w/ monosyllabic words, compare, "I WENT to the STORE to BUY some BREAD", which has a sort of poetic rhythm, with "I went TO the STORE to BUY some BREAD" which seems weird, even in a poem. An offhand analysis is that stressing the main verb and then running "to the" together into one unstressed syllable is more natural than making the main verb unstressed and stressing the preposition. Perhaps buried in the code of some text-to-speech engine are heuristics that cover some of these cases? But perhaps they can just be ignored at first, and patched up later in cases where results are too strange.
Anyway, this is just miscellaneous thoughts about future enhancements; the current Nantucket is cool to try out.
http://wry.me/sonnetron/ computes meter using cmudict. It worked fine there, I think, though the word salad it's running over is easier -- when phrases make actual sense you sometimes get a verb mispronounced as a noun, and so on.
The logic is simple: reject a word if it has both stressed and unstressed syllables, with a stressed one falling on an unstressed beat in the meter. Pass anything else.
Very neat project, BTW. I've been wanting a good solution to the unknown-word problem. Here's a post on my blank-verse detector before: http://darius.livejournal.com/48525.html