jonadsimon / entendrepreneur-web

web app for generating funny portmanteaus and rhymes
http://www.punchlinedesign.net
186 stars 15 forks source link

Get all subgrapheme/subphoneme probabilities in one SQL call #11

Closed jonadsimon closed 5 years ago

jonadsimon commented 5 years ago

Assuming that most word pairs have min(word_len) = 5, there are ~5x2x2 = 20 db called per word pair

Could drop this to 2 calls (one to GraphemeProbs, one to PhonemeProbs) by querying before the loop starts, and caching the results. Expect this to yield substantial speedup overall, 2-4x of total time

jonadsimon commented 5 years ago

https://github.com/jonadsimon/entendrepreneur-web/commit/79a8cd2ed3fbe2a7a8d94acff42e867a3ff9869d