Statistical word Frequency

Source: Internet
Author: User

This test is not completed, the beginning will not read and write files, after learning the file can be normal read and write, I write a statistical file of the frequency of the letter

Statistics uppercase, lowercase letter frequency The way I used it.

/* Lowercase Letter */
SYSTEM.OUT.PRINTLN ("There are lowercase letters in the halibote.txt:");
for (Char ch= ' a ';ch< ' z '; ch++)
{
count=0;//counter
for (int i=0;i<chs.length;i++)
{
if (ch==chs[i]) count++;
}
if (count!=0)
{
System.out.println (ch+ "has" +count+ ");
}
}
/* Capital Letter */
System.out.println ("Halibote.txt in capital letters:");
for (char ch= ' A ';ch< ' Z '; ch++)
{
count=0;
for (int i=0;i<chs.length;i++)
{
if (ch==chs[i]) count++;
}
if (count!=0)
{
System.out.println (ch+ "has" +count+ ");
}
}

In code to express, but the most critical is not to transfer, from the TXT document converted to char type, loaded to read only the first word, not to the back of the statistics, the problem is here.

Go ahead and write again tomorrow.

Statistical word Frequency

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.