monochromium 0.2.0

A fast, local-first CLI note-taking app for developers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Build out tiny ML model to do text -> title
pub fn make_title(text: String) -> String {
    let words: Vec<&str> = text.split_whitespace().take(5).collect();

    words.join(" ")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_make_title_truncates_at_five_words() {
        let title = make_title("one two three four five six seven".to_string());
        assert_eq!(title, "one two three four five");
    }
}