Re: New Word Generator
From: | Benct Philip Jonsson <conlang@...> |
Date: | Friday, September 28, 2007, 12:51 |
David J. Peterson skrev:
> <http://bprhad.wz.cz/awkwords/index.php>
>
> All online, and works with unicode. Works fine with Safari
> on Mac OS X 10.4.10. I've found it to be pretty handy, so
> I thought I'd pass it along.
A great generator, and very similar in its external to one I
wrote in perl but never put online :-)
I'd like to know how the nested parentheses thing works...
The only two things I really miss are
* to have a check so that the same word isn't generated more
than once.
I stored the generated words as keys in a hash
while(keys(%hash_with_words_as_keys) <= $number_of_words){
$word = &generate_word;
$hash_with_words_as_keys{ $word } = 1
unless $hash_with_words_as_keys{ $word };
}
* to have a list of forbidden combinations.
E.g. my conlang Kijeb doesn't allow any of the combinations
in the list
yi/iy/wu/uw/nm/ñn/ñm/ñy/nn/ss/tt/td/rr/yy/ww/yr/kwr/gwr
which may arise from the simple settings
V:a/i/u/ya/yu
C:p/t/k/kw/b/d/g/gw/f/s/x/m/n/ñ/r/w/y
F:s/t/n/r
r:((s)C(r))V(F)(CV(F))
n:100
nle
Rather than making a complicated pattern to avoid such a
short list of exceptions it would be better to simply list
them and test the output against the list as a regex
alternation. In perl simply add a test
unless( $word =~
m{(yi|iy|wu|uw|nm|ñn|ñm|ñy|nn|ss|tt|td|rr|yy|ww|yr|kwr|gwr)})
around the line putting the word into the hash.
/BP 8^)>
--
Benct Philip Jonsson -- melroch atte melroch dotte se
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No man forgets his original trade: the rights of
nations and of kings sink into questions of grammar,
if grammarians discuss them.
-Dr. Samuel Johnson (1707 - 1784)