kovi-plugin-ciyi 0.1.1

Kovi 的词意(猜词游戏)插件。
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use kovi::serde_json;
use once_cell::sync::Lazy;
use std::collections::HashSet;

const ALL_WORDS_JSON: &str = include_str!("../res/all_words.json");
const QUESTION_WORDS_JSON: &str = include_str!("../res/question_words.json");

pub static ALL_WORDS: Lazy<HashSet<String>> = Lazy::new(|| {
    let words: Vec<String> =
        serde_json::from_str(ALL_WORDS_JSON).expect("Failed to parse all_words.json");
    words.into_iter().collect()
});

pub static QUESTION_WORDS: Lazy<Vec<String>> = Lazy::new(|| {
    serde_json::from_str(QUESTION_WORDS_JSON).expect("Failed to parse question_words.json")
});