Import the QQ pinyin dictionary to sogou pinyin

Source: Internet
Author: User

I used sogou pinyin before, but once my dictionary data was lost inexplicably, I found that my dictionary cannot be exported as plain text, so I gave up sogou's use of QQ pinyin. Yesterday I saw a cloud Input Method launched by sogou pinyin. It was really a very creative one. I decided to return to sogou pinyin because of sogou's creativity.

To return to the sogou Pinyin input method, the dictionary problem is very serious. By default, the QQ Pinyin input method cannot be imported into the sogou Pinyin input method, and the QQ Pinyin input method can be exported directly, the following prompt is displayed when importing the sogou Pinyin input method:

So I had to write a small program to convert the dictionary format of QQ Pinyin and then import it.

I analyzed the formats of the QQ pinyin dictionary and the sogou pinyin dictionary. The differences are as follows:

The QQ pinyin dictionary provides the number of word frequencies, but the sogou dictionary does not.

There are no single quotation marks before the Pinyin of QQ pinyin, but the sogou dictionary must be available.

Therefore, you only need to write a small piece of code to implement the above conversion. The Code is as follows: StreamReader sr = new StreamReader (this. textBox1.Text, Encoding. Default );

String newPath = Path. GetDirectoryName (textBox1.Text) + "\ Sougou PY.txt ";
StreamWriter sw = new StreamWriter (newPath, false, Encoding. Default );
While (sr. Peek ()> 0)
{
String str = sr. ReadLine ();
Var py = str. Split ('');
If (py. Count ()> 2)
{
String newPy = "'" + py [0] + "" + py [1];
Sw. WriteLine (newPy );
// RichTextBox1.AppendText (newPy + "\ r \ n ");
}
}
Sr. Close ();
Sw. Close ();
MessageBox. Show ("OK ");

In this way, you can convert the dictionary and save it as the Sougou PY.txt file.

Next, you can import the local text dictionary in the sogou input method. The imported results are as follows:

The code and program are attached to facilitate your use in the same situation (the executable file is in the bin/Debug directory.. net Framework 2.0 support. If it cannot run, install it. net):/Files/studyzy/QQPY2SGPY1.1.zip

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.