package cz.vutbr.feec.utko.xonder02.lda;


public class Main {
    public static void main(String[] args) {
        Dictionary dictionary = new Dictionary();

        Corpus corpus = Corpus.generate(new String[][]{
                {"a", "b", "c"},
                {"d", "e", "f"},
                {"g", "h", "ch"},

                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
                {"g", "h", "ch"},
        }, dictionary, false);


        try {
            Lda main = new Lda(corpus, 3, 50, 0.001, 1);

            main.getTopic(0).printPairs(dictionary, 10);
            main.getTopic(1).printPairs(dictionary, 10);
            main.getTopic(2).printPairs(dictionary, 10);

            Document document = Document.generate(new String[]{
                    "a", "b", "c", "jajds"
            }, dictionary, true);

            System.out.print("Topic ID: ");
            System.out.println(main.findTopic(document, 0.01).get(0).getTopic().getTopicId());

            document = Document.generate(new String[]{
                    "a"
            }, dictionary, true);

            System.out.print("Topic ID: ");
            System.out.println(main.findBestTopic(document).getTopicId());

            document = Document.generate(new String[]{
                    "a", "h", "g", "a",
            }, dictionary, true);

            System.out.print("Topic ID: ");
            System.out.println(main.findBestTopic(document).getTopicId());

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
