dhowe / RiTaV1

RiTa: the generative language toolkit
http://rednoise.org/rita
GNU General Public License v3.0
354 stars 78 forks source link

Error when testing 'Analysis' and 'RandomRhymes' examples with no lexicon #459

Closed cqx931 closed 7 years ago

cqx931 commented 7 years ago

No warning message about lexicon

Analysis image

RandomRhymes The page just doesn't load and there is no error message, no response. (it get stuck in the while loop)

Also, currently we don't have a unique warning message for no lexicon. The warning message I got with rita.js when I test in RiLexicon-tests.html is "A minimal Lexicon is currently in use. For word features outside the lexicon, use a larger version of RiTa."

dhowe commented 7 years ago

That warning is fine, but we can't have the error...

cqx931 commented 7 years ago

In the PR above, I have modified the example code for both 'Analysis' and 'RandomRhymes' (p5 and dom), so that no error message is showing when rita.js is used.

Warning message: When lex size is 0, what need a warning message are functions that have a for loop iterating through the whole lexicon data set to return something back.(randomWord(), rhymes(), _getRawPhones()...etc.) So I changed all this.data.length in those for loops to this.size() and add a warning message in lex.size(), if the lexicon size is zero.

Please let me know if there is any concern about this method.

dhowe commented 7 years ago

sounds right