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

drawing png Chinese incorrectly encoded #67

Open
caiyongji opened this issue Aug 13, 2018 · 1 comment
Open

drawing png Chinese incorrectly encoded #67

caiyongji opened this issue Aug 13, 2018 · 1 comment

Comments

@caiyongji
Copy link

also tried to load List

		List<String> texts = new ArrayList<>();
		BufferedReader br = new BufferedReader(new FileReader("c:\\c\\temp.txt"));
		String line = null;
		while((line = br.readLine())!=null){
			texts.add(line);
//			System.out.println(new String(line.getBytes(), "UTF-8"));
		}
		br.close();
		final FrequencyAnalyzer frequencyAnalyzer = new FrequencyAnalyzer();
		frequencyAnalyzer.setWordFrequenciesToReturn(600);
		frequencyAnalyzer.setMinWordLength(2);
		frequencyAnalyzer.setWordTokenizer(new ChineseWordTokenizer());
		
		final List<WordFrequency> wordFrequencies = frequencyAnalyzer.load(texts);
		final Dimension dimension = new Dimension(600, 600);
		final WordCloud wordCloud = new WordCloud(dimension, CollisionMode.PIXEL_PERFECT);
		wordCloud.setPadding(2);
		wordCloud.setBackground(new CircleBackground(300));
		wordCloud.setColorPalette(new ColorPalette(new Color(0xD5CFFA), new Color(0xBBB1FA), new Color(0x9A8CF5), new Color(0x806EF5)));
		wordCloud.setFontScalar(new SqrtFontScalar(12, 45));
		wordCloud.build(wordFrequencies);
		wordCloud.writeToFile("c:\\c\\temp.png");
@kennycason
Copy link
Owner

Can you upload a picture of the resulting image? I can't tell the problem from only this code. Also, if possible, post temp.txt as well. Thanks

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

2 participants