<commit_before>extern crate opencorpora;

use opencorpora::Dict;

fn main() {
    use std::fs::File;
    let file = File::open("dict/dict.xml").unwrap();
    match Dict::read_from_xml(&file) {
        Ok(dict) => {
            println!("Version: {}", dict.version);
            println!("Revision: {}", dict.revision);
            println!("Grammemes count: {}", dict.grammemes.len());
            println!("Restrictions count: {}", dict.restrictions.len());
            println!("Lemmata count: {}", dict.lemmata.len());
            let mut forms_count = 0;
            let mut max_forms_in_lemma = 0;
            let mut max_grammemes_in_form = 0;
            for lemma in &dict.lemmata {
                let forms = lemma.forms.len();
                forms_count += forms;
                if max_forms_in_lemma < forms {
                    max_forms_in_lemma = forms;
                }

                let lemma_grammemes = lemma.grammemes.len();
                for form in &lemma.forms {
                    let form_grammemes = form.grammemes.len();
                    let total_grammemes = lemma_grammemes + form_grammemes;
                    if max_grammemes_in_form < total_grammemes {
                        max_grammemes_in_form = total_grammemes;
                    }
                }
            }
            println!("All forms count: {}", forms_count);
            println!("Max forms in a lemma: {}", max_forms_in_lemma);
            println!("Max grammemes in a form: {}", max_grammemes_in_form);
            println!("Link types count: {}", dict.link_kinds.len());
            println!("Links count: {}", dict.links.len());
        },<commit_msg>Исправлен путь к словарю в примере 'examples/stats.rs'.<commit_after>extern crate opencorpora;

use opencorpora::Dict;

fn main() {
    use std::fs::File;
    let file = File::open("dict/test_dict.xml").unwrap();
    match Dict::read_from_xml(&file) {
        Ok(dict) => {
            println!("Version: {}", dict.version);
            println!("Revision: {}", dict.revision);
            println!("Grammemes count: {}", dict.grammemes.len());
            println!("Restrictions count: {}", dict.restrictions.len());
            println!("Lemmata count: {}", dict.lemmata.len());
            let mut forms_count = 0;
            let mut max_forms_in_lemma = 0;
            let mut max_grammemes_in_form = 0;
            for lemma in &dict.lemmata {
                let forms = lemma.forms.len();
                forms_count += forms;
                if max_forms_in_lemma < forms {
                    max_forms_in_lemma = forms;
                }

                let lemma_grammemes = lemma.grammemes.len();
                for form in &lemma.forms {
                    let form_grammemes = form.grammemes.len();
                    let total_grammemes = lemma_grammemes + form_grammemes;
                    if max_grammemes_in_form < total_grammemes {
                        max_grammemes_in_form = total_grammemes;
                    }
                }
            }
            println!("All forms count: {}", forms_count);
            println!("Max forms in a lemma: {}", max_forms_in_lemma);
            println!("Max grammemes in a form: {}", max_grammemes_in_form);
            println!("Link types count: {}", dict.link_kinds.len());
            println!("Links count: {}", dict.links.len());
        }
{'fraction_non_alphanumeric': 0.1256637168141593, 'fraction_numerical': 0.0017699115044247787, 'mean_word_length': 1.7932454695222406, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2593656', 'n_tokens_mistral': 1016, 'n_tokens_neox': 981, 'n_words': 198}