3 ms·
One more hack: here's a query which lets you enter a sequence of comma separated terms to stick together MP3s of the closest matching audio recordings for each
by simonw 4y ago
One more hack: here's a query which lets you enter a sequence of comma separated terms to stick together MP3s of the closest matching audio recordings for each one:
https://scotrail.datasette.io/scotrail?sql=with+phrases+as+%28%0D%0A++select%0D%0A++++key%2C+value%0D%0A++from%0D%0A++++json_each%28%27%5B%22%27+%7C%7C+replace%28%3Awords%2C+%27%2C%27%2C+%27%22%2C%22%27%29+%7C%7C+%27%22%5D%27%29%0D%0A%29%2C%0D%0Amatches+as+%28select%0D%0A++phrases.key%2C%0D%0A++phrases.value%2C%0D%0A++%28select+File+from+announcements+where+announcements.Transcription+like+%27%25%27+%7C%7C+trim%28phrases.value%29+%7C%7C+%27%25%27%0D%0A+++limit+1%29+as+File%0D%0Afrom%0D%0A++phrases%0D%0A%29%0D%0Aselect+matches.key%2C+matches.File%2C+announcements.Transcription%2C+announcements.mp3%0D%0Afrom+announcements+join+matches+on+announcements.File+%3D+matches.File%0D%0Aorder+by+key&words=sorry%2C+south%2C+from%2C+dunf%2C+cancelled%2C+due+to%2C+gas https://scotrail.datasette.io/scotrail?sql=with+phrases+as+%...
In that example I enter "sorry, south, from, dunf, cancelled, due to, gas" and it produces audio for "I am sorry to announce that the Southampton Central service from Dunfermline Queen Margaret has been cancelled due to A fire near the railway involving gas cylinders".
- jon_adler 4y agoI hadn’t heard of Datasette until you published this blog entry. I have to say, on watching your intro video, it looks really fantastic. Congratulations on creating such an excellent tool. I look forward to playing with it over the coming days and learning more about it.
- simonw 4y agoI turned this into a canned query: https://scotrail.datasette.io/scotrail/assemble_sentence?terms=i+am+sorry%2C+scotrail%2C+from%2C+bath+spa%2C+is+delayed%2C+due+to%2C+bomb https://scotrail.datasette.io/scotrail/assemble_sentence?ter... And updated the blog entry with a new section about how it works: https://simonwillison.net/2022/Aug/21/scotrail/#assembling-sentences https://simonwillison.net/2022/Aug/21/scotrail/#assembling-s...
- deleted 4y ago[deleted]