Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traditional Chinese words always displayed in Simplified Chinese version in word cloud frequencies and image #112

Open
peyser81 opened this issue Mar 3, 2023 · 0 comments

Comments

@peyser81
Copy link

peyser81 commented Mar 3, 2023

Hi, I have traditional Chinese words as input and the generated word frequencies and image always show the simplified version of the words. This is my sample code and the image

            final FrequencyAnalyzer frequencyAnalyzer = new FrequencyAnalyzer();
            frequencyAnalyzer.setWordFrequenciesToReturn(100);
            frequencyAnalyzer.setMinWordLength(2);
            frequencyAnalyzer.setStopWords(loadStopWords());
            frequencyAnalyzer.setWordTokenizer(new ChineseWordTokenizer());

            List<String> texts = new ArrayList<>();
            texts.add("畫畫"); //Traditional Chinese, 画画 is the simplified version
            texts.add("笨蛋");
            texts.add("purpose");
            final List<WordFrequency> wordFrequencies = frequencyAnalyzer.load(texts);
            final List<WordFrequency> wordFrequenciesNeg = frequencyAnalyzer.load(new ArrayList<>());
            freq = wordFrequencies;
            freqNeg = wordFrequenciesNeg;
            long t = System.currentTimeMillis();

            // Layered Word Cloud from two images/two word sets
            Dimension dimension = new Dimension(600, 386);
            LayeredWordCloud layeredWordCloud = new LayeredWordCloud(2, dimension, CollisionMode.PIXEL_PERFECT);
            layeredWordCloud.setAngleGenerator(0, new AngleGenerator(0));
            layeredWordCloud.setAngleGenerator(1, new AngleGenerator(0));

            layeredWordCloud.setPadding(0, 2);
            layeredWordCloud.setPadding(1, 2);

            layeredWordCloud.setKumoFont(0, new KumoFont("Noto Sans TC", FontWeight.PLAIN));
            layeredWordCloud.setKumoFont(1, new KumoFont("Noto Sans TC", FontWeight.PLAIN));

            String backgroundPath = context.getRealPath("/res/wordcloud/backgrounds/");
            layeredWordCloud.setBackground(0, new PixelBoundryBackground(backgroundPath + "cloud_bg.bmp"));
            layeredWordCloud.setBackground(1, new PixelBoundryBackground(backgroundPath + "cloud_fg.bmp"));

            layeredWordCloud.setBackgroundColor(Color.WHITE);

            layeredWordCloud.setColorPalette(0,
                    new ColorPalette(new Color(0xAF1B14), new Color(0xE0251C), new Color(0xF2473F),
                            new Color(0xFB7771), new Color(0xF9ADA9), new Color(0xF9ADA9), new Color(0xF9ADA9),
                            new Color(0xF9ADA9), new Color(0xF9ADA9), new Color(0xF9ADA9)));
            layeredWordCloud.setColorPalette(1,
                    new ColorPalette(new Color(0x336708), new Color(0x428609), new Color(0x58AE0F),
                            new Color(0x72D51F), new Color(0xA0CE7A), new Color(0xA0CE7A), new Color(0xA0CE7A),
                            new Color(0xA0CE7A), new Color(0xA0CE7A), new Color(0xA0CE7A)));

            layeredWordCloud.setFontScalar(0, new LinearFontScalar(12, 60));
            layeredWordCloud.setFontScalar(1, new LinearFontScalar(14, 80));

1677815320785

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant