Chinese character pinyin Database

Source: Internet
Author: User
Therefore, you must first filter the txt files, leaving only simplified Chinese characters and pinyin. The Code is as follows (WinDev language, French version) MonBufferestunBufferMonBufferfChargeTexte (C: usersstagiaire571_topnotesbd_donnecedit.txt) MaCha? Neestunecha? NeUNICODEMaCha? NeMonBuffernI

Therefore, you must first filter the txt files, leaving only simplified Chinese characters and pinyin. The Code is as follows (WinDev language, French version) MonBuffer est un Buffer MonBuffer = fChargeTexte (C: \ Users \ stagiaire57 \ Desktop \ Notes \ BD_donne \ cedit.txt) MaCha? Ne est une cha? Ne UNICODE MaCha? Ne = MonBuffer nI



Therefore, you must first filter the txt files, leaving only simplified Chinese characters and pinyin. The Code is as follows (WinDev language, French version)

MonBuffer est un Buffer
MonBuffer = fChargeTexte ("C: \ Users \ stagiaire57 \ Desktop \ Notes \ BD_donne \ cedit.txt ")
MaCha? Ne est une cha? Ne UNICODE
MaCha? Ne = MonBuffer
NIDFichier est int = fOuvre ("C: \ Users \ stagiaire57 \ Desktop \ Notes \ BD_donne \ cedittestSimplifie.txt", foLectureEcriture)
I est un int = 1
TANTQUE ExtraitLigne (MaCha? Ne, I) <> EOT // <> is not equal to, that is, the execution will continue as long as the boundary payment is not equal. Once the boundary payment is equal, the execution will stop.
Unechaine est une cha? Ne = ExtraitLigne (MaCha? Ne, I)
// SUneNouvelleChaine1 est une cha? Ne = ExtraitCha? Ne (unechaine, 1, "", DepuisD é)
SUneNouvelleChaine2 est une cha? Ne = ExtraitCha? Ne (unechaine, 2, "", DepuisD é)
SUneNouvelleChaine3 est une cha? Ne = ExtraitCha? Ne (unechaine, 2, ["[", "]", "and"])
SUneNouvelleChaine4 est une cha? Ne = sUneNouvelleChaine2 + TAB + sUneNouvelleChaine3
FEcritLigne (nIDFichier, sUneNouvelleChaine4)
I ++
FIN

It can be seen that WinDev is very convenient. several lines of code solves the problem of writing a page of code in other languages. The processed txt file is as follows:


Now we can clearly see that although the pinyin in the original txt file has a tone, it is represented in arrays and is not actually displayed on letters, below is the novelty of my program. I added the tone to the corresponding letter and then put the data in the database. The Code is as follows:

PROCEDURE DetecterETchanger (UnPinyin): cha? Ne UNICODE
SChaineTest est une cha? Ne UNICODE = Milieu (UnPinyin, Taille (UnPinyin), 1)


SLettreAremplace est une cha? Ne UNICODE = ""
SLettreRemplace est une cha? Ne UNICODE = ""


NTrouve est un entier = 0


SI ChercherVoyelle (UnPinyin, "a") = Vrai ALORS
NTrouve = 1
SLettreAremplace = ""
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "á"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "à"
CAS "5"
SLettreRemplace = ""
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN

SI nTrouve = 0 _ ET _ ChercherVoyelle (UnPinyin, "o") = Vrai ALORS
NTrouve = 1
SLettreAremplace = "o"
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "ó"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "regular"
CAS "5"
SLettreRemplace = "o"
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN


SI nTrouve = 0 _ ET _ ChercherVoyelle (UnPinyin, "e") = Vrai ALORS
NTrouve = 1
SLettreAremplace = "e"
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "é"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "è"
CAS "5"
SLettreRemplace = "e"
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN


SI nTrouve = 0 _ ET _ ChercherVoyelle (UnPinyin, "I") = Vrai ALORS
NTrouve = 1
SLettreAremplace = "I"
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "í"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "regular"
CAS "5"
SLettreRemplace = "I"
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN


SI nTrouve = 0 _ ET _ ChercherVoyelle (UnPinyin, "u") = Vrai ALORS
NTrouve = 1
SLettreAremplace = "u"
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "ú"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "regular"
CAS "5"
SLettreRemplace = "u"
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN

SI nTrouve = 0 _ ET _ ChercherVoyelle (UnPinyin, "v") = Vrai ALORS
NTrouve = 1
SLettreAremplace = "u :"
SELON sChaineTest
CAS "1"
SLettreRemplace = "regular"
CAS "2"
SLettreRemplace = "regular"
CAS "3"
SLettreRemplace = "regular"
CAS "4"
SLettreRemplace = "regular"
CAS "5"
SLettreRemplace = "U"
AUTRE CAS
RENVOYER UnPinyin
FIN
FIN

SI nTrouve = 0 ALORS
RENVOYER UnPinyin
FIN
SUnPinyinRemplace est une cha? Ne UNICODE = Remplace (UnPinyin, sLettreAremplace, sLettreRemplace)
RENVOYER Milieu (sUnPinyinRemplace, 1, Taille (sUnPinyinRemplace)-1)

PROCEDURE ChangerPinyinAccent ()
MonBuffer est un Buffer
MonBuffer = fChargeTexte ("C: \ Users \ stagiaire57 \ Desktop \ PinyinTest.txt ")
MaCha? Ne est une cha? Ne UNICODE
MaCha? Ne = MonBuffer
HOuvre (ChangerPinyin1)
I est un int = 1

TANTQUE ExtraitLigne (MaCha? Ne, I) <> EOT
PinyinFinale est une cha? Ne UNICODE = ""
Unechaine est une cha? Ne = ExtraitLigne (MaCha? Ne, I)
ChangerPinyin1.Hanzi = ExtraitCha? Ne (unechaine, 1, TAB)
PinyinInitiale est une cha? Ne UNICODE = ExtraitCha? Ne (unechaine, 2, TAB)

Numbre est un entier = 1
BOUCLE
UnPinyin est une cha? Ne UNICODE = ExtraitCha? Ne (PinyinInitiale, numbre, "", DepuisD é)
Numbre ++
SI UnPinyin = eot alors sortio
PinyinFinale + = DetecterETchanger (UnPinyin)
SI ExtraitCha? Ne (PinyinInitiale, numbre, "", DepuisD é but) <> eot alors PinyinFinale ++ = ""
FIN

ChangerPinyin1.Pinyin = PinyinFinale

HAjoute (ChangerPinyin1)
I ++
FIN

PROCEDURE ChercherVoyelle (UnPinyin, lettre): bool é en
I est un entier = 1
LonguerUnPinyin est un entier = Taille (UnPinyin)

SI lettre = "v" ALORS
BOUCLE
ChaineInstant est une cha? Ne UNICODE = Milieu (UnPinyin, I, 1)
SI chaineInstant = "u" ET Milieu (UnPinyin, I + 1,1) = ":" ALORS
RENVOYER Vrai
FIN
SI I = longuerUnPinyin ALORS
RENVOYER Faux
FIN
I ++
FIN
FIN

SI lettre = "u" ALORS
BOUCLE
ChaineInstant est une cha? Ne UNICODE = Milieu (UnPinyin, I, 1)
SI chaineInstant = lettre ET Milieu (UnPinyin, I + 1, 1) <> ":" ALORS
RENVOYER Vrai
FIN
SI I = longuerUnPinyin ALORS
RENVOYER Faux
FIN
I ++
FIN
FIN

BOUCLE
ChaineInstant est une cha? Ne UNICODE = Milieu (UnPinyin, I, 1)
SI chaineInstant = lettre ALORS
RENVOYER Vrai
FIN
SI I = longuerUnPinyin ALORS
RENVOYER Faux
FIN
I ++
FIN

The final database is as follows:



Well, all the database programs are like this. We can see that WinDev is really a very convenient language. Its database is HyperSQL, but this language can also write data to other databases.

I hope the article will help you.

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.