Chinese pronunciation verification method based on edit distance

文档序号:988121 发布日期:2020-11-06 浏览:5次 中文

阅读说明:本技术 一种基于编辑距离的中文发音校验方法 (Chinese pronunciation verification method based on edit distance ) 是由 钱春霖 于 2020-07-31 设计创作,主要内容包括:本发明涉及一种基于编辑距离的中文发音校验方法,采用全新策略设计,针对来自待验证中文发音词的待验证中文文本,获得预设拼音规则下所对应的待验证标准拼音格式,以及其拓展的标准拼音格式,并基于元音、辅音的二维向量表示,以及标准拼音格式的表示方法,获得待验证中文文本及其拓展标准拼音格式分别所对应的数学表示,并选取待验证中文文本及其拓展标准拼音分别和预设目标标准拼音之间的最小编辑距离,作为待验证中文发发音词和目标真实词之间的编辑距离,最后结合预设距离阈值,实现待验证中文发音词相较目标真实词相似度结果的验证,能够有效解决中文场景中信息校验的准确性,保证智能语音对话的稳定性。(The invention relates to a Chinese pronunciation checking method based on editing distance, which adopts a brand-new strategy design, obtains a standard pinyin format to be verified under a preset pinyin rule aiming at a Chinese text to be verified of a Chinese pronunciation word to be verified, an expanded standard pinyin format thereof, obtains mathematical expressions corresponding to the Chinese text to be verified and the expanded standard pinyin format thereof respectively based on two-dimensional vector expression of vowels and consonants and a standard pinyin format expression method, selects a minimum editing distance between the Chinese text to be verified and the expanded standard pinyin thereof respectively and a preset target standard pinyin as an editing distance between the Chinese pronunciation word to be verified and a target real word, and finally realizes the verification of the similarity result of the Chinese pronunciation word to be verified and the target real word by combining with a preset distance threshold value, thereby effectively solving the accuracy of information checking in a Chinese scene, the stability of intelligent voice conversation is guaranteed.)

1. A Chinese pronunciation verification method based on edit distance is used for realizing similarity verification of a Chinese pronunciation word to be verified compared with a target real word, and is characterized by comprising the following steps:

step A, obtaining a Chinese text to be verified corresponding to the Chinese pronunciation word to be verified, and then entering step B;

b, judging whether the length of the character string corresponding to the Chinese text to be verified is equal to the length of the character string corresponding to the Chinese text to be verified, if so, entering the step C; otherwise, judging that the verification of the Chinese pronunciation word to be verified is failed compared with the target real word;

step C, obtaining a standard pinyin format to be verified corresponding to the Chinese text to be verified according to a preset pinyin rule, and then entering step D;

d, calculating and obtaining an editing distance between the standard pinyin format to be verified and a preset target standard pinyin format corresponding to the target real word, namely the editing distance between the Chinese pronunciation word to be verified and the target real word based on the mathematical expression of the standard pinyin format, wherein the shorter the editing distance between the two is, the higher the similarity between the two is, and then entering the step E;

and E, judging whether the editing distance between the Chinese pronunciation word to be verified and the target real word is smaller than a preset distance threshold value, if so, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is passed, and otherwise, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is not passed.

2. The method for verifying pronunciation of chinese characters based on edit distance as claimed in claim 1, wherein: in the step C, based on the single Chinese character consisting of consonant, vowel and tone, the standard Pinyin format corresponding to the single Chinese character is represented, and then the standard Pinyin format to be verified corresponding to the Chinese text to be verified is obtained; wherein:

if the tone of the Chinese character is light sound, numbers except 1, 2, 3 and 4 are preset to represent the tone corresponding to the Chinese character;

if the pinyin of the Chinese character has no consonant, replacing the consonant corresponding to the Chinese character by the empty character string;

if the Chinese character is a polyphone character, the standard Pinyin format corresponding to each pronunciation of the Chinese character is applied to jointly represent the standard Pinyin format corresponding to the Chinese character.

3. The method for verifying pronunciation of Chinese language based on edit distance as claimed in claim 1 or 2, wherein: in the step C, after the standard pinyin format to be verified corresponding to the Chinese text to be verified is obtained, various standard pinyin expansion formats corresponding to the standard pinyin format to be verified are further obtained according to various vowel expansion forms, various consonant expansion forms and various complete pinyin expansion forms in a preset pinyin expansion table, and then the various standard pinyin expansion formats and the standard pinyin format to be verified are jointly used as the standard pinyin format to be verified corresponding to the Chinese text to be verified, and then the step D is carried out;

and D, calculating and obtaining the editing distance between each standard pinyin format to be verified and the preset target standard pinyin format corresponding to the target real word, and selecting the minimum editing distance as the editing distance between the Chinese pronunciation word to be verified and the target real word.

4. The method for verifying pronunciation of Chinese language based on edit distance as claimed in claim 3, wherein: in step a, a Chinese short sentence text corresponding to the Chinese pronunciation short sentence to be verified is obtained first, and then a slot lifting operation is performed on the Chinese short sentence text to obtain a Chinese keyword in the Chinese short sentence text, namely the Chinese text to be verified corresponding to the Chinese pronunciation word to be verified.

5. The method for verifying pronunciation of Chinese language based on edit distance as claimed in claim 3, wherein: the Chinese pronunciation words to be verified are obtained from the Chinese text to be verified, and the Chinese short sentence texts to be verified are obtained from the Chinese pronunciation short sentences by the speech recognition ASR system.

Technical Field

The invention relates to a Chinese pronunciation verification method based on editing distance, and belongs to the technical field of intelligent voice conversation.

Background

The intelligent voice conversation system is also called an intelligent conversation Agent or an intelligent chatting system. The system is a system for realizing language interaction with human beings by an artificial intelligence technology based on voice recognition, natural language processing and voice synthesis technology. The intelligent voice conversation system is mainly divided into a task-oriented conversation system and a non-task-oriented conversation system from the application scene, wherein the typical task-oriented conversation system comprises an intelligent voice assistant and a smart phone outbound system, and the typical non-task-oriented system comprises an intelligent sound box, a chat robot and the like.

The man-machine interaction link of the traditional intelligent voice dialogue system mainly comprises three stages of voice recognition, semantic understanding and voice synthesis. The voice recognition is to convert the voice spoken by the user into corresponding characters; semantic understanding is to extract the intention of a user from information such as text-level conversation context and the like expressed by the user and generate a text of a material response; the voice synthesis means that the responded text is converted into voice and played to the user. The speech recognition and speech synthesis technology has strong universality, namely, the type of the intelligent speech dialogue system and the difference of the application field, even the configuration of the interactive dialogue template can not cause great influence on the effect.

In an intelligent voice dialog system, a common application scenario of semantic understanding is to verify whether certain key information in the user's speech conforms to an expected value. Such as a person name check, a company name check, a card number check, etc. However, in the speech system of telephone transmission, ASR has a certain error in recognizing the user's spoken words and converting them into words, especially in phrases without special meaning. For example, if the user says "my name is zhang san feng", and the text data converted by the ASR system may be "my name is zhang shan fen", if it is determined whether the user says the same by only determining whether the text or pinyin is the same, there is a high possibility that the verification accuracy is extremely low. It is proposed in the art to determine this by the similarity of the pronunciation of the text to the expected text. At present, the algorithm aiming at Chinese similarity relates to pinyin, tone, radical structure and the like of Chinese characters. However, in the intelligent dialogue system, the text data is obtained by recognition of the ASR system, and the structure of the characters does not have referential property. In the algorithm for the similarity of pinyin, the most common way than the traditional method is the Edit Distance (Edit Distance or Levenshtein Distance), which considers three editing operations, Insertion (Insertion), Deletion (Deletion) and replacement (Substitution), and takes the minimum number of editing operations required for converting one character string into another character string as the similarity of the two character strings, but the Edit Distance only represents the difference on pinyin texts, and if Chinese characters are converted into pinyin (numbers represent the tones of the pinyin), the algorithm for the Edit Distance cannot well represent the similarity of Chinese pronunciation. For example: the distance between the Pinyin of the pang4, the Pinyin of the stick 4 and the Pinyin of the Wang4 are the same, but obviously, the Pinyin of the pang4 and the Pinyin of the bang4 are more similar, but the pronunciations of the pang4 and the Pinyin of the bang4 are greatly different, so that the similarity of the Pinyin editing distance is used as the similarity of the Chinese pronunciations, and the Pinyin editing distance has certain limitation.

Disclosure of Invention

The invention aims to solve the technical problem of providing a Chinese pronunciation verification method based on editing distance, which adopts a brand-new strategy design, can effectively solve the accuracy of information verification in a Chinese scene, and ensures the stability of intelligent voice conversation.

The invention adopts the following technical scheme for solving the technical problems: the invention designs a Chinese pronunciation verification method based on edit distance, which is used for verifying the similarity of Chinese pronunciation words to be verified compared with target real words, and comprises the following steps:

step A, obtaining a Chinese text to be verified corresponding to the Chinese pronunciation word to be verified, and then entering step B;

b, judging whether the length of the character string corresponding to the Chinese text to be verified is equal to the length of the character string corresponding to the Chinese text to be verified, if so, entering the step C; otherwise, judging that the verification of the Chinese pronunciation word to be verified is failed compared with the target real word;

step C, obtaining a standard pinyin format to be verified corresponding to the Chinese text to be verified according to a preset pinyin rule, and then entering step D;

d, calculating and obtaining an editing distance between the standard pinyin format to be verified and a preset target standard pinyin format corresponding to the target real word, namely the editing distance between the Chinese pronunciation word to be verified and the target real word based on the mathematical expression of the standard pinyin format, wherein the shorter the editing distance between the two is, the higher the similarity between the two is, and then entering the step E;

and E, judging whether the editing distance between the Chinese pronunciation word to be verified and the target real word is smaller than a preset distance threshold value, if so, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is passed, and otherwise, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is not passed.

As a preferred technical scheme of the invention: in the step C, based on the single Chinese character consisting of consonant, vowel and tone, the standard Pinyin format corresponding to the single Chinese character is represented, and then the standard Pinyin format to be verified corresponding to the Chinese text to be verified is obtained; wherein:

if the tone of the Chinese character is light sound, numbers except 1, 2, 3 and 4 are preset to represent the tone corresponding to the Chinese character;

if the pinyin of the Chinese character has no consonant, replacing the consonant corresponding to the Chinese character by the empty character string;

if the Chinese character is a polyphone character, the standard Pinyin format corresponding to each pronunciation of the Chinese character is applied to jointly represent the standard Pinyin format corresponding to the Chinese character.

As a preferred technical scheme of the invention: in the step C, after the standard pinyin format to be verified corresponding to the Chinese text to be verified is obtained, various standard pinyin expansion formats corresponding to the standard pinyin format to be verified are further obtained according to various vowel expansion forms, various consonant expansion forms and various complete pinyin expansion forms in a preset pinyin expansion table, and then the various standard pinyin expansion formats and the standard pinyin format to be verified are jointly used as the standard pinyin format to be verified corresponding to the Chinese text to be verified, and then the step D is carried out;

and D, calculating and obtaining the editing distance between each standard pinyin format to be verified and the preset target standard pinyin format corresponding to the target real word, and selecting the minimum editing distance as the editing distance between the Chinese pronunciation word to be verified and the target real word.

As a preferred technical scheme of the invention: in step a, a Chinese short sentence text corresponding to the Chinese pronunciation short sentence to be verified is obtained first, and then a slot lifting operation is performed on the Chinese short sentence text to obtain a Chinese keyword in the Chinese short sentence text, namely the Chinese text to be verified corresponding to the Chinese pronunciation word to be verified.

As a preferred technical scheme of the invention: the Chinese pronunciation words to be verified are obtained from the Chinese text to be verified, and the Chinese short sentence texts to be verified are obtained from the Chinese pronunciation short sentences by the speech recognition ASR system.

Compared with the prior art, the Chinese pronunciation verification method based on the edit distance has the following technical effects:

the invention designs a Chinese pronunciation checking method based on editing distance, which adopts a brand-new strategy design, obtains a standard pinyin format to be verified under a preset pinyin rule aiming at a Chinese text to be verified of a Chinese pronunciation word to be verified, an expanded standard pinyin format thereof, obtains mathematical representations respectively corresponding to the Chinese text to be verified and the expanded standard pinyin format thereof based on two-dimensional vector representation of vowels and consonants and a representation method of the standard pinyin format, selects a minimum editing distance between the Chinese text to be verified and the expanded standard pinyin thereof and a preset target standard pinyin as an editing distance between the Chinese pronunciation word to be verified and a target real word, finally combines a preset distance threshold value to realize the verification of the similarity result of the Chinese pronunciation word to be verified and the target real word, and can effectively solve the accuracy of information checking in a Chinese scene, the stability of intelligent voice conversation is guaranteed.

Drawings

FIG. 1 is a flow chart of the method for verifying Chinese pronunciation based on edit distance according to the present invention;

FIG. 2 is a schematic diagram of an application module of the method for verifying Chinese pronunciation based on edit distance according to the present invention.

Detailed Description

The following description will explain embodiments of the present invention in further detail with reference to the accompanying drawings.

The invention designs a Chinese pronunciation verification method based on edit distance, which is used for realizing similarity verification of a Chinese pronunciation word to be verified compared with a target real word aiming at the Chinese pronunciation word to be verified, wherein in practical application, the Chinese pronunciation word to be verified comes from a Chinese pronunciation short sentence to be verified, and the following steps A to E are specifically executed as shown in figure 1.

Step A, firstly, a speech recognition ASR system is applied to recognize the Chinese pronunciation short sentence to be verified, the Chinese short sentence text corresponding to the Chinese pronunciation short sentence to be verified is obtained, then, a slot lifting operation is carried out on the Chinese short sentence text, the Chinese key words in the Chinese short sentence text, namely the Chinese text to be verified corresponding to the Chinese pronunciation word to be verified, are obtained, and then, the step B is carried out.

B, judging whether the length of the character string corresponding to the Chinese text to be verified is equal to the length of the character string corresponding to the Chinese text to be verified, if so, entering the step C; otherwise, the verification of the Chinese pronunciation word to be verified is judged to fail compared with the target real word.

And step C, according to the following preset three pinyin rules, based on the composition format of consonants, vowels and tones of a single Chinese character, representing the standard pinyin format corresponding to the single Chinese character, further obtaining the standard pinyin format to be verified corresponding to the Chinese text to be verified, and then entering the step D, wherein in practical application, for example, the pinyin format corresponding to the 'upper' common Chinese is 'shang 4'.

Rule one, if the tone of the chinese character is soft, a preset number other than 1, 2, 3, and 4 is applied to represent the tone corresponding to the chinese character, for example, the pinyin of the chinese 'east' is'd ong 1x i 5'.

If there is no consonant in the pinyin of the chinese character, the null character string is used to replace the consonant corresponding to the chinese character, for example, the pinyin of the chinese character 'o' may be represented as 'a 1'.

And if the Chinese character is a polyphone character, applying a standard pinyin format corresponding to each pronunciation of the Chinese character to jointly represent the standard pinyin format corresponding to the Chinese character, such as ' line ', the pinyin records are [ ' x in 2, ' hand 2 ' ], and when such a word participates in a phrase, such as ' bank ', the pinyin format of the phrase is [ ' y in 2 hand 2 ', ' y in 2x in 2 ' ].

And C, based on the design of the step C, obtaining a standard pinyin format to be verified corresponding to the Chinese text to be verified, wherein the standard pinyin format corresponding to the 'ascending' is 'sh ang 4sh eng 1', for example.

And D, calculating to obtain mathematical expressions corresponding to the standard pinyin format to be verified and the preset target standard pinyin format corresponding to the target real word based on the mathematical expressions of the quasi-pinyin format of the Chinese text, calculating to obtain the editing distance between the standard pinyin format to be verified and the preset target standard pinyin format corresponding to the target real word, namely the editing distance between the Chinese pronunciation word to be verified and the target real word, wherein the shorter the editing distance between the standard pinyin format to be verified and the target real word, the higher the similarity between the standard pinyin format to be verified and the target real word, and entering the step E.

Regarding the mathematical representation of the standard pinyin format herein, for example, the mathematical representation of the standard pinyin format for "fat" itself is: [[(7.0,4.0),(40,4.0),2],[(1.0,1.5),(1.0,1.5),4]].

The steps C to D are based on the situation that the obtained chinese text to be verified corresponds to a standard pinyin format to be verified, but in the actual application, there are polyphonic characters in the chinese scene, and the situation that the flat-tongue sound and the warped-tongue sound are not distinguished in part of the area, the front nasal sound and the rear nasal sound, 'n' and 'l' are not distinguished, which are not in accordance with the pronunciation standard of mandarin. In order to solve the problem, the invention further provides a pinyin expansion form of the Chinese, wherein the pinyin expansion form is mainly used for solving the problem of recognition errors caused by inconsistent pronunciation of Chinese area and pronunciation of Mandarin, and in the specific design execution, a pinyin expansion table needs to be established firstly, as shown in the following table 1.

Figure BDA0002612077580000051

TABLE 1

The pinyin expansion table is only used as confusing voice common in Chinese pinyin, and the expansion word list can be adjusted according to the characteristics of the area where the client is located in the actual intelligent dialog scene.

To better describe the application of the pinyin expansion table, such as the chinese character "zhanghui", it is first converted to the true chinese pinyin format: "zhang 1 h ui 4", according to the expansion vocabulary, 'zh' and 'z' can be expanded, 'ang' and 'an' can be expanded, 'hui' and 'fei', so that the final expanded pinyin can be obtained as follows:

expanding pinyin Spy 1: 'zh ang 1 h ui 4'

Expanding pinyin Spy 2: 'z ang 1 h ui 4'

Expanding pinyin Spy 3: 'zh ang 1 f ei 4'

Expanding pinyin Spy 4: 'z ang 1 f ei 4'

Expanding pinyin Spy 5: 'zh an 1 h ui 4'

Expanding pinyin Spy 6: 'z an 1 h ui 4'

Expanding pinyin Spy 7: 'zh an 1 f ei 4'

Expanding pinyin Spy 8: 'z an 1 f ei 4'

Based on the thought about the Chinese pinyin expansion form, aiming at the practical application of the step C, after obtaining the standard pinyin format to be verified corresponding to the Chinese text to be verified, according to each vowel expansion form, each consonant expansion form and each complete pinyin expansion form in a preset pinyin expansion table, further obtaining various standard pinyin expansion formats corresponding to the standard pinyin format to be verified, further taking the various standard pinyin expansion formats and the standard pinyin format to be verified as the standard pinyin formats to be verified corresponding to the Chinese text to be verified, and then entering the step D.

And D, calculating and obtaining the editing distance between each standard pinyin format to be verified and the preset target standard pinyin format corresponding to the target real word based on the mathematical expression of the standard pinyin format to be verified in the practical application based on the step C about the extension expansion of the Chinese pinyin expansion form, selecting the minimum editing distance as the editing distance between the Chinese pronunciation word to be verified and the target real word, and entering the step E.

And E, judging whether the editing distance between the Chinese pronunciation word to be verified and the target real word is smaller than a preset distance threshold value, if so, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is passed, and otherwise, judging that the similarity verification of the Chinese pronunciation word to be verified and the target real word is not passed.

In practical applications, the setting of the preset distance threshold in step E is obtained based on experimental data. In the above algorithm for calculating similarity, it can be known that as the number of chinese characters increases, the final similarity value is also improved accordingly. Therefore, the invention provides that the Chinese pronunciation words to be verified with different lengths are judged by adopting independent threshold values.

The threshold setting is based on a large amount of data to be counted and is manually judged, so that the threshold corresponding to the length of the character string is obtained. The data mainly comprises four parts, namely a Chinese keyword obtained through a groove lifting function, a corresponding target real word in a database, pronunciation similarity between the Chinese keyword and the target real word, and artificial judgment of whether the target real word and the target real word meet pronunciation similarity. As shown in table 2 below, the sample data is explained by using the real character length of 3 as a sample, and the similarity in the table is calculated after pinyin expansion according to table 1.

Slot key word Real data Pronunciation similarity (similarity) Pronunciation similarity manual judgment result
Zhang Feng Zhangsanfeng tea 0.07936507936507936 True
Zhang Hui Ming Zhang fei Ming 0 True
King wisdom Root of Wangzhui 0.0004761904761904761 True
Coffee health Wang health care 0.6349206349206349 False
... ... ... ...

TABLE 2

Assuming that the data has n data groups, all data groups with the pronunciation similarity artificial judgment result of True are taken, and the similarity threshold value with the maximum pronunciation similarity (similarity) meeting the character length of 3 is taken.

The Chinese pronunciation verification method based on the edit distance is applied to practice, and an Ai robot system is called A and a user is B in combination with the method shown in figure 2.

Firstly, when the intelligent voice conversation system enters a certain round of conversation, when A inquires B: "ask what your name is for security".

At this time, B answers A by voice, that is, "My name is Zhang Hui"

At this time, the ASR system will convert the answer of B into Chinese text, i.e. "My name Zhang Hui"

Because the current scene is a name verification scene, the system calls a keyword slot lifting function, performs keyword slot lifting on the converted text, obtains Chinese keywords 'zhanghui', namely the Chinese text to be verified, and obtains the target real word of the user B from the database as 'zhanghui'.

And if the obtained character string length of the Chinese text to be verified is not consistent with the character string length of the target real word, directly taking the Chinese text to be verified as a verification failure, and carrying out a corresponding conversation process. And if the length of the Chinese text to be verified is the same as that of the target real word, continuing to check the similarity of the next step.

The Ai system will now enter the analysis flow. The analysis process mainly comprises the following steps:

generating various standard pinyin expansion formats of the Chinese text to be verified, and taking the various standard pinyin expansion formats and the standard pinyin format to be verified of the Chinese text to be verified as the standard pinyin formats to be verified corresponding to the Chinese text to be verified;

generating standard phonetic format of target real word "zhanghui" and converting it into phonetic code

And calculating the similarity of each standard pinyin format to be verified corresponding to the Chinese text to be verified and the standard pinyin format of the target real word one by one.

And acquiring the minimum similarity in the process as the pronunciation similarity of the Chinese text to be verified and the target real word.

And entering a corresponding flow of intelligent conversation by judging the final pronunciation similarity and the size according with the length threshold of the current keyword.

The invention designs a Chinese pronunciation verification method based on edit distance, which adopts a brand-new strategy design, obtains a standard pinyin format to be verified under a preset pinyin rule and an expanded standard pinyin format aiming at a Chinese text to be verified from a Chinese pronunciation word to be verified, obtains mathematical expressions corresponding to the Chinese text to be verified and the expanded standard pinyin format respectively based on vowel and consonant two-dimensional vector expression and a standard pinyin format expression method, selects a minimum edit distance between the Chinese text to be verified and the expanded standard pinyin respectively and a preset target standard pinyin as an edit distance between the Chinese pronunciation word to be verified and a target real word, finally combines a preset distance threshold value to realize the verification of the similarity result of the Chinese pronunciation word to be verified and the target real word, and can effectively solve the accuracy of information verification in a Chinese scene, the stability of intelligent voice conversation is guaranteed.

The embodiments of the present invention have been described in detail with reference to the drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于短语结构树的相似题目识别方法和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!