Skip to content

Instantly share code, notes, and snippets.

@kscz
kscz / Common Voice Sentences.md
Last active January 1, 2018 22:01
This is a set of sentences for the Mozilla Common Voice project. All sentences are released under a "CC0" license as defined [here](https://creativecommons.org/share-your-work/public-domain/cc0/)

Some goals for these sentences:

  • Capture unusual phonemes (measure/pleasure)
  • Words which have multiple, valid pronounciations in different areas, but divorced from the overall accent (milk/malk, aluminium/al-oo-mini-um, roof/ruff, aunt/ant, vase/"vah-ze", room/"rum")
  • Frequently used but challenging contractions (could/wouldn't've (frequently misspelled as "couldn't of"))
  • Names
  • Tricky speech patterns like "cats survive" where the double
@kscz
kscz / example_easy.json
Created December 4, 2017 03:25
Issue with modeling in serde
{
"origin_server_ts": 1512357670852,
"sender": "@kit:example.com",
"event_id": "$15123576704435ruveN:example.com",
"unsigned": {
"age": 12377
},
"content": {
"body": "previous message redacted as a test",
"msgtype": "m.text"
fn main() {
let x = String::from("Hello");
foo(&x); // Give away an immutable reference of x to foo
println!("{} from the other side.", x);
}
fn foo(bar: &String) -> () {
println!("{} world!", bar);
}
fn main() {
println!("Hello darkness my old {}", pick_one(true, "friend", "frenemy"));
println!("I've come to {} with you again.", pick_one(false, "dance", "talk"));
println!("Because a {} softly creeping", pick_one(false, "gremlin", "vision"));
println!("Left its {} while I was {}.", pick_one(true, "seeds", "cell phone"), pick_one(false, "also creeping", "sleeping"));
}
fn pick_one<'a>(this_or_that: bool, this: &'a str, that: &'a str) -> &'a str {
if this_or_that {
this
fn main() {
println!("Hello darkness my old {}", pick_one(true, "friend", "frenemy"));
println!("I've come to {} with you again.", pick_one(false, "dance", "talk"));
println!("Because a {} softly creeping", pick_one(false, "gremlin", "vision"));
println!("Left its {} while I was {}.", pick_one(true, "seeds", "cell phone"), pick_one(false, "also creeping", "sleeping"));
}
// ERROR: rust doesn't know which lifetime to pick! This or that?
fn pick_one(this_or_that: bool, this: &str, that: &str) -> &str {
if this_or_that {
fn main() {
println!("\"Yo Gandalf, how do we look?\", asked Frodo.");
println!("\"{}\" he replied", reference_eternal());
}
fn reference_eternal() -> &'static str {
&"Fly, you fools!"
}
fn main() {
println!("\"Yo Gandalf, how do we look?\", asked Frodo.");
println!("\"{}\" he replied", reference_eternal());
}
// ERROR: rust can't figure out where the lifetime should come from!
fn reference_eternal() -> &str {
&"Fly, you fools!"
}
struct Neato {
burrito: String
}
impl Neato {
pub fn new(ingredients: &str) -> Neato {
Neato { burrito: String::from(ingredients) }
}
// I put explicit lifetimes here, but rust would have guessed this normally
fn main() {
let x = String::from("Mysterious first letter!");
let ref_x = first_letter(&x);
println!("{}ystery solved!", ref_x);
}
fn first_letter<'a>(input: &'a str) -> &'a str {
&input[0..1]
}
fn main() {
let x = String::from("What is love?");
let y = String::from("Baby don't hurt me,");
let ref_y = print_first_return_second(&x, &y);
print!("{}", y);
print!("{}", ref_y);
println!(" no more!");
}
fn print_first_return_second<'a, 'b>(print_me: &'a str, return_me: &'b str) -> &'a str {