質問: join(lines, " ").toLowerCase(); String[] tokens =splitTokens (allText, ",.?!:;[]-\"'"); for (String s : tokens) { // Is the word in the HashMap? if (words.containsKey (s)) { // Increase the count words.put(s, words.get (s)+1); } else { // Add word to the HashMap words.put(s, 1); } } for (String val : words.keySet ()) { print(val + ""); println(words.get (val)); } **実行結果** ![イメージ説明](https://teratail-v2.storage.googleapis.com/uploads/contributed_images/247057ca2714468cc349a71c4cc220d5.jpeg) **使用した文章**(sample.txtの中身) Jared Kushner may have a harder time doing his job now that he s lost access to top secret information, becoming the most high profile victim in a White House security clearance scandal. According to Politico, Kushner and all other White House aides operating at a high level interim security clearance? Top Secret/SCI ? were informed Friday that their clearance would be downgraded. ### 補足情報(FW/ツールのバージョンなど) Processingを使用しています。
回答: `splitTokens(value)`としたときはスペース・タブ・\r・\n・\fで分割しますが、 `splitTokens(value, delim)`としたときはdelimのみで分割します。 なので`",.?!:;[]-\"'"`の中にスペースも入れてください(必要ならタブ等も) splitTokens() \ Language (API) \ Processing 3+