Method, device, equipment and storage medium for constructing language model and speech recognition
By constructing a combination of entity-like language model and main language model, the target language model is generated, which solves the problems of data sparseness and complicated processing in named entity recognition, improves the recognition accuracy and simplifies data processing.
Patent Information
- Application Number
- CN202111588177.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-12-23
AI Technical Summary
Existing technologies have problems with data sparsity and complicated processing in named entity recognition. It is difficult to effectively identify named entities missing in training data, and it is difficult to update the weights of 2-gram or 3-gram models using weight-raising methods.
By obtaining the entity-like language model, replacing the specified named entities in the training corpus with named entity categories, building a main language model, and combining it with the entity-like language model to generate a target language model to identify the specified named entity category.
It solves the problem of sparse training data, avoids data processing pressure, and allows the adjustment of named entity weights, improving the accuracy of named entity recognition.
Smart Images

Figure CN114282540B
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech recognition technology, and in particular to a method for constructing a language model, a method for speech recognition, a device for constructing a language model, a device for speech recognition, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Named Entities Recognition (NER) is a basic task in Natural Language Processing (NLP). Its purpose is to identify the names of people, places, organizations, or named entities classified according to specific needs in the input text. NER technology is widely used in information extraction, information retrieval, intelligent question answering, machine translation and other fields.
[0003] In the related art, a language model (LM) generated based on named entity modeling can be used for named entity recognition. For the modeling of named entities, the following two methods are proposed in the related art:
[0004] 1. Increase relevant corpus. Collect or create corpus containing a certain named entity, expand the training data, and thus achieve the purpose of increasing the probability of named entity recognition. However, the disadvantages of this method are: 1) large workload and complicated processing; 2) the importance of the named entity depends entirely on the collected or created data, and cannot be controlled in a targeted manner; 3) the sparseness problem of each named entity in the data is not solved.
[0005] 2. Targeted weighting. In the trained language model, increase the weight of a named entity to increase the probability of named entity recognition. However, the disadvantage of this method is that the weighting is only for the 1-gram model, and it is difficult to update the 2-gram or 3-gram, as well as the back-off factor. Summary of the invention
[0006] The present application provides a segment routing policy delivery method, device, equipment, storage medium and program product to solve the problem of difficulty in balancing delivery efficiency and packet loss caused by controller failure when delivering segment routing policies in the prior art.
[0007] In a first aspect, an embodiment of the present application provides a method for constructing a language model, the method comprising:
[0008] Acquire a class entity language model, wherein the class entity language model includes a plurality of specified named entities belonging to the same named entity category;
[0009] Replacing the designated named entity in the training corpus with the named entity category to obtain a new training corpus;
[0010] Using the new training corpus to build a main language model;
[0011] The class entity language model is combined with the main language model to construct a target language model.
[0012] In a second aspect, an embodiment of the present application further provides a method for speech recognition, the method comprising:
[0013] Convert the speech signal to be recognized into a text sequence;
[0014] The text sequence is input into the target language model described in the first aspect, and a recognition result output by the target language model is obtained.
[0015] In a third aspect, an embodiment of the present application further provides a device for constructing a language model, the device comprising:
[0016] A quasi-entity language model acquisition module, used to acquire a quasi-entity language model, wherein the quasi-entity language model includes a plurality of specified named entities belonging to the same named entity category;
[0017] A corpus replacement module, used to replace the specified named entity in the training corpus with the named entity category to obtain a new training corpus;
[0018] A main language model training module, used to construct a main language model using the new training corpus;
[0019] The language model combining module is used to combine the class entity language model with the main language model to construct a target language model.
[0020] In a fourth aspect, an embodiment of the present application further provides a speech recognition device, the device comprising:
[0021] A text sequence conversion module, used for converting the speech signal to be recognized into a text sequence;
[0022] The text recognition module is used to input the text sequence into the target language model described in the first aspect and obtain the recognition result output by the target language model.
[0023] In a fifth aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising:
[0024] one or more processors;
[0025] a storage device for storing one or more programs,
[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the method of the first aspect or the second aspect mentioned above.
[0027] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method of the first aspect or the second aspect mentioned above.
[0028] In a seventh aspect, an embodiment of the present application further provides a computer program product, wherein the computer program product comprises computer executable instructions, and wherein the computer executable instructions are used to implement the method of the first aspect or the second aspect when executed.
[0029] The technical solution provided by this application has the following beneficial effects:
[0030] In this embodiment, a language model can be constructed for a specified named entity category. First, a class entity language model including multiple specified named entities belonging to the same named entity category is obtained. Then, according to the specified named entity and the named entity category in the class entity language model, the specified named entity in the training corpus is replaced with the named entity category to obtain a new training corpus. In this way, the main language model constructed using the new training corpus is a language model for the above-mentioned named entity category. Then, the main language model is combined with the class entity language model to obtain a target language model that associates the named entity category with the specified named entity under the category. In this way, even if only a part of the specified named entities exists in the training corpus, the specified named entities that do not exist in the training corpus can be identified based on the named entity category and all the specified named entities contained in the category, thereby effectively solving the problem of sparse training data. In addition, this embodiment does not need to expand the training corpus to avoid data processing pressure caused by too many named entities. At the same time, the weights of each specified named entity can be adjusted through the class entity language model to better control the weights of each specified named entity. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flowchart of a method embodiment of building a language model provided in Embodiment 1 of the present application;
[0032] Figure 2 This is a schematic diagram of a quasi-entity WFST network model provided in Example 1 of the present application;
[0033] Figure 3 This is a schematic diagram of a main WFST network model provided in Example 1 of the present application;
[0034] Figure 4It is a WFST network model obtained by combining a class entity WFST network model with a main WFST network model provided in the first embodiment of the present application;
[0035] Figure 5 This is a flow chart of a method embodiment of speech recognition provided in Embodiment 2 of the present application;
[0036] Figure 6 It is a structural block diagram of an embodiment of a device for building a language model provided in Embodiment 3 of the present application;
[0037] Figure 7 It is a structural block diagram of a speech recognition device embodiment provided in Embodiment 4 of the present application;
[0038] Figure 8 It is a structural schematic diagram of an electronic device provided in Example 5 of the present application. DETAILED DESCRIPTION
[0039] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for ease of description, only the parts related to the present application, rather than all structures, are shown in the accompanying drawings.
[0040] Embodiment 1
[0041] Figure 1 This is a flowchart of a method embodiment of building a language model provided in Embodiment 1 of the present application. This embodiment may include the following steps:
[0042] Step 110 : obtaining a class entity language model, wherein the class entity language model includes a plurality of specified named entities belonging to the same named entity category.
[0043] The class entity language model is a language model used to describe multiple specified named entities belonging to the same named entity category. The named entity category and the multiple specified named entities in the named entity category may vary according to different business requirements, which is not limited in this embodiment.
[0044] In an exemplary application scenario, such as a game live broadcast scenario, it is a challenging problem to let the speech recognition engine recognize the team name and the player name. For example, in the field of MOBA (Multiplayer Online Battle Arena), the two words 'Scout' and 'Meiko' have certain similar properties in syntax and semantics, such as representing the player name. Considering this similarity of words, a "player name (player)" category can be set, which includes at least two named entities, 'Scout' and 'Meiko'. In this way, even if 'feel a bit pity for Scout' may not appear in the training data, because 'feel a bit pity for Meiko' has appeared in the training data, and 'Scout' and 'Meiko' belong to the same named entity category, the former can be given a higher probability.
[0045] In one implementation, the entity-like language model may be a user-configured model. Exemplarily, the entity-like language model may be an entity-like FA (Finite Automata) network model, wherein FA is composed of a finite set of states and state transitions, each of which has at least one label. In one example, FA also carries a weight each time it transitions to a state. A user may create an entity-like FA network model by inputting an instruction to create FA.
[0046] In a further example, the entity-like FA network model may include a WFST (Weighted Finite-State Transducers) network model, which has both an output label and a weight at each state transition. In the WFST network model, multiple arcs pointing from the start state to the end state may be included, and the output label of each arc corresponds to a specified named entity in the current named entity category. For example, for the above-mentioned game live broadcast scenario, its WFST network model can be as follows: Figure 2 As shown. Figure 2 In , three arcs are listed from the starting state 0 to the ending state 1. Each arc corresponds to a specified named entity in the current category. Each arc includes an input label, an output label, and a weight. The input label and the output label are used to represent a specific specified named entity. For example, in Figure 2 In the example, “_meiko:_meiko / 0.69315” indicates that the input label and output label of the arc are both “_meiko”, which is used to represent the named entity 'Meiko', and the weight is “0.69315”.
[0047] In one implementation, in the WFST network model, the weight of each arc may be related to the number of specified named entities in the current named entity category. For example, the weight of each arc may be determined using the following formula:
[0048]
[0049] Where Pr(w|c) is the weight, which means that for a given named entity category c (such as a player name category), the probability of estimating a specified named entity w (such as a specific player name) in c; P c is the number of named entities in named entity category c; e is the natural base; α and β are adjustable empirical values.
[0050] In other implementations, the weight of each arc may also be a weight input by a user, which is not limited in this embodiment.
[0051] Step 120: Replace the designated named entity in the training corpus with the named entity category to obtain new training corpus.
[0052] The training corpus refers to a natural language expression fragment containing one or more specified named entities, such as an article or a paragraph. Named entities refer to entities with specific meanings or strong referentiality in the text, which can include names of people, places, organizations, dates, times, proper nouns, etc.
[0053] In this step, it can be determined whether each training corpus in the corpus contains the specified named entity in the above step 110. If so, the specified named entity in the training corpus is replaced with its corresponding named entity category. The training corpus obtained after the replacement is the new training corpus, thereby obtaining a new corpus.
[0054] In order to facilitate the identification of named entity categories, in one example, a special token can be used to identify the named entity category according to the actual application scenario or prior knowledge. For example, the named entity category can be identified as an entity category expressed in the form of "#nonterm:***".
[0055] For example, for Figure 2 Given two named entities 'Meiko' and 'Scout', we can replace 'Meiko' and 'Scout' in the training corpus with the named entity category 'player' to which they belong, using '#nonterm:player'. For another example, assuming that the named entity is the team name 'edg', we can replace 'edg' in the training corpus with the named entity category 'team' to which it belongs, using '#nonterm:team'.
[0056] Step 130: construct a main language model using the new training corpus.
[0057] In this step, a new corpus may be used to train the main language model. Exemplarily, the main language model may be an N-gram model. In implementation, a general N-gram model training method may be used to train the N-gram model based on the new corpus, and this embodiment does not limit the N-gram model training method.
[0058] Step 140: Combine the class entity language model with the main language model to construct a target language model.
[0059] In this embodiment, the entity-like language model configured by the user is combined with the main language model to generate a target language model for speech recognition.
[0060] In one embodiment, when the main language model is an N-gram model and the quasi-entity language model is an quasi-entity FA network model, the N-gram model needs to be first converted into a main FA network model, and then OpenFST can be used to combine the main FA network model with the quasi-entity FA network model to finally generate a target language model.
[0061] In practice, the N-gram model usually exists in the ARPA file format. During implementation, the general arpa2fst algorithm may be used to convert the N-gram language model into a main FA network model, which may be a WFST network model.
[0062] After obtaining the main FA network model, the main FA network model can be combined with the entity-like FA network model by using OpenFST. In one embodiment, if the main FA network model and the entity-like FA network model are both WFST, the above-mentioned step of combining the main FA network model with the entity-like FA network model to construct the target language model can further include the following steps:
[0063] Step S1, identifying an arc whose output label is the named entity category from the main FA network model as a target arc, and obtaining a state pointed to by the target arc in the main FA network model as a backward access state.
[0064] Step S2: redirecting the target arc to the initial state of the entity-like FA network model, and replacing the output label in the target arc with a first designated label.
[0065] Step S3, adding an arc pointing to the backward access state in each end state of the entity-like FA network model, and setting the input label and output label of the arc to the second designated label.
[0066] Step S4, determining the target language model based on the finally obtained FA network model.
[0067] For example, assuming the main FA network model is Figure 3 As shown, the entity-like FA network model is as follows Figure 2 As shown, Figure 2 The entity-like FA network model is inserted into Figure 3 In the main FA network model, we can get Figure 4 The final FA network model. The combination process is as follows: Figure 2 The named entity category of the FA network model is "#nonterm:player", then in Figure 3 In the example, the arc A where "#nonterm:player" is located is used as the target arc. Then the state "2" pointed to by the target arc is used as the backward access state. Next, the target arc A is redirected to Figure 2 In the starting state "0" of the WFST of the class entity, the output label (i.e. "#nonterm:player") in the target arc is replaced with the first specified label. If the option epsilon_on_replace is set to true, the input label also needs to be replaced with the first specified label. For example, the first specified label can be an "epsilon" label, such as Figure 4 As shown. The weight on the target arc remains unchanged. In addition, after redirecting the target arc to the starting state "0" of the class entity WFST, the starting state is changed to an intermediate state, and the state identifier also needs to change from "0" to the next state of the state that issues the target arc, as shown in Figure 4 As shown, the state of the target arc is state "1". When the target arc is redirected to the starting state "0" of the class entity WFST, the "0" needs to be changed to state "2", and the subsequent state identifiers are changed in the same way.
[0068] After the start state of the quasi-entity WFST is connected to the main WFST, for the end state of the quasi-entity WFST, an arc pointing to the above backward access state can be added from the end state, and the input label and output label of the added arc are set to the second specified label. Exemplarily, the second specified label can also be an "epsilon" label. For example, in Figure 4 In the example, when the starting state of the class entity WFST is connected to the main WFST, its ending state becomes an intermediate state, and the state identifier changes from the original "1" to "3". Then an arc is added from state 3 to point to the backward access state 4. In this arc, both the input label and the output label are "epsilon", and the arc weight is 0.
[0069] It should be noted that in the above example, the entity-like FA network model has one end state. If the entity-like FA network model has more than one end state, each end state needs to add an arc pointing to the backward access state.
[0070] This embodiment does not limit the expression form of the target language model, and its expression form can be determined according to actual business needs. The FA network model obtained by the final combination can be directly used as the target language model, or the FA network model obtained by the final combination can be converted into an N-gram model and the N-gram model can be used as the target language model.
[0071] In one embodiment, there may be multiple entity-like FA network models embedded in the main FA network model, and each entity-like FA network model has a corresponding named entity category, such as a team category (team), a player name category (player), etc. Then the step of constructing the target language model in step 140 may include the following steps:
[0072] A quasi-entity FA network model is randomly selected from the multiple quasi-entity FA network models and inserted into the main FA network model to generate a first intermediate FA network model; the next quasi-entity FA network model is selected and inserted into the first intermediate FA network model to generate a second intermediate FA network model, and so on, until all quasi-entity FA network models are embedded in the main FA network model.
[0073] For example, assuming that there are three entity-like FA network models a, b, and c, and assuming that the main FA network model is M, first randomly select a class-entity FA network model from the three class-entity FA network models a, b, and c, assuming it is b, and then embed b into M according to the method of steps S1 to S3 to obtain the first intermediate FA network model M′. Then randomly select a class-entity FA network model from a and c, assuming it is a, and then embed a into M′ according to the method of steps S1 to S3 to obtain the second intermediate FA network model M″. Finally, embed c into M″ according to the method of steps S1 to S3 to obtain the third intermediate FA network model M″′ as the final FA network model.
[0074] In practice, for the finally obtained FA network model, in order to ensure the efficiency of beam search, a weight pushing may be performed on the FA network model.
[0075] In one embodiment, after the target language model is obtained, the embodiment may further include the following steps:
[0076] The target language model is sent to a downstream program so that the downstream program can perform speech recognition according to the target language model.
[0077] Since the target language model contains a class entity language model, the downstream program can give a higher probability to named entities of the same category based on multiple named entities in the class entity language model when performing speech recognition based on the target language model, thereby improving the accuracy of speech recognition.
[0078] In this embodiment, a language model can be constructed for a specified named entity category. First, a class entity language model including multiple specified named entities belonging to the same named entity category is obtained. Then, according to the specified named entity and the named entity category in the class entity language model, the specified named entity in the training corpus is replaced with the named entity category to obtain a new training corpus. In this way, the main language model constructed using the new training corpus is a language model for the above-mentioned named entity category. Then, the main language model is combined with the class entity language model to obtain a target language model that associates the named entity category with the specified named entity under the category. In this way, even if only a part of the specified named entities exists in the training corpus, the specified named entities that do not exist in the training corpus can be identified based on the named entity category and all the specified named entities contained in the category, thereby effectively solving the problem of sparse training data. In addition, this embodiment does not need to expand the training corpus to avoid data processing pressure caused by too many named entities. At the same time, the weights of each specified named entity can be adjusted through the class entity language model to better control the weights of each specified named entity.
[0079] Embodiment 2
[0080] Figure 5 This is a flow chart of a method embodiment of speech recognition provided in Embodiment 2 of the present application. This embodiment may include the following steps:
[0081] Step 510: convert the speech signal to be recognized into a text sequence.
[0082] Step 520: input the text sequence into a target language model, and obtain a recognition result output by the target language model.
[0083] This embodiment uses the target language model constructed in the first embodiment to recognize text sequences, which can effectively improve the recognition accuracy of named entities. In one example, when the target language model of this embodiment and the common language model are used to recognize the team name and player name of a MOBA game, the target language model of this embodiment improves the recognition performance in terms of both WER (Word Error Rate) and CER (Character Error Rate).
[0084] Embodiment 3
[0085] Figure 6 The structural block diagram of an embodiment of a device for building a language model provided in Embodiment 3 of the present application may include the following modules:
[0086] The entity-like language model acquisition module 610 is used to acquire the entity-like language model, wherein the entity-like language model includes a plurality of specified named entities belonging to the same named entity category;
[0087] A corpus replacement module 620, configured to replace the specified named entity in the training corpus with the named entity category to obtain a new training corpus;
[0088] A main language model training module 630, configured to construct a main language model using the new training corpus;
[0089] The language model combining module 640 is used to combine the class entity language model with the main language model to construct a target language model.
[0090] In one embodiment, the main language model is an N-gram model, and the entity-like language model is an entity-like finite automaton FA network model;
[0091] The language model combining module 640 may include the following submodules:
[0092] A language model conversion submodule, used to convert the main language model into a main FA network model;
[0093] The FA network model combining submodule is used to combine the class entity FA network model with the main FA network model based on the named entity category to construct a target language model.
[0094] In one embodiment, the FA network model combination submodule is specifically used for:
[0095] Identifying an arc whose output label is the named entity category from the main FA network model as a target arc, and obtaining a state pointed to by the target arc in the main FA network model as a backward access state;
[0096] redirecting the target arc to the starting state of the entity-like FA network model, and replacing the output label in the target arc with a first specified label;
[0097] Adding an arc pointing to the backward access state in each end state of the entity-like FA network model, and setting the input label and output label of the arc to the second designated label;
[0098] The target language model is determined based on the final FA network model.
[0099] In one embodiment, the FA network model combination submodule is also used for:
[0100] The FA network model finally obtained is used as the target language model;
[0101] or,
[0102] The N-gram model converted from the final FA network model is used as the target language model.
[0103] In one embodiment, there are multiple entity-like FA network models, wherein each entity-like FA network model has corresponding category information;
[0104] The FA network model combined with the submodule is also used for:
[0105] Randomly select a quasi-entity FA network model from the plurality of quasi-entity FA network models and insert it into the main FA network model to generate a first intermediate FA network model;
[0106] The next entity FA network model is selected and inserted into the first intermediate FA network model to generate a second intermediate FA network model, and so on, until all entity-like FA network models are embedded in the main FA network model.
[0107] In one embodiment, the entity-like FA network model includes multiple arcs pointing from a starting state to an ending state, the output label of each arc corresponds to a specified named entity in the named entity category, and the weight of each arc is related to the number of specified named entities in the entity-like language model.
[0108] In one embodiment, the device may further include the following modules:
[0109] The target language model sending module is used to send the target language model to the downstream program so that the downstream program can perform speech recognition according to the target language model.
[0110] A device for constructing a language model provided in an embodiment of the present application can execute a method for constructing a language model in the first embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method.
[0111] Embodiment 4
[0112] Figure 7 The structural block diagram of a speech recognition device embodiment provided in the fourth embodiment of the present application may include the following modules:
[0113] A text sequence conversion module 710, used to convert the speech signal to be recognized into a text sequence;
[0114] The text recognition module 720 is used to input the text sequence into the target language model described in the first embodiment and obtain the recognition result output by the target language model.
[0115] A speech recognition device provided in an embodiment of the present application can execute a speech recognition method in embodiment 2 of the present application, and has functional modules and beneficial effects corresponding to the execution method.
[0116] Embodiment 5
[0117] Figure 8 A schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present application is shown in FIG. Figure 8 As shown, the electronic device includes a processor 810, a memory 820, an input device 830 and an output device 840; the number of the processor 810 in the electronic device can be one or more. Figure 8 A processor 810 is taken as an example; the processor 810, the memory 820, the input device 830 and the output device 840 in the electronic device can be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0118] The memory 820, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the above-mentioned embodiment 1 or embodiment 2 in the embodiments of the present application. The processor 810 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 820, that is, implements the method mentioned in the above-mentioned method embodiment 1 or embodiment 2.
[0119] The memory 820 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 820 may further include a memory remotely arranged relative to the processor 810, and these remote memories may be connected to the device / terminal / server via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0120] The input device 830 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 840 may include a display device such as a display screen.
[0121] Embodiment 6
[0122] Embodiment 6 of the present application also provides a storage medium containing computer executable instructions, and when the computer executable instructions are executed by a computer processor, they are used to execute the method of the above-mentioned method embodiment 1 or embodiment 2.
[0123] Of course, the storage medium containing computer executable instructions provided in the embodiments of the present application is not limited to the operations of the method described above, but can also execute related operations in the method provided in any embodiment of the present application.
[0124] Embodiment 7
[0125] Embodiment 7 of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to execute the method of the above-mentioned method embodiment 1 or embodiment 2 when executed by a computer processor.
[0126] Of course, the computer program product provided by the embodiment of the present application, whose computer executable instructions are not limited to the method operations described above, can also execute related operations in the method provided by any embodiment of the present application.
[0127] Through the above description of the implementation method, the technicians in the relevant field can clearly understand that the present application can be implemented with the help of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for an electronic device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0128] It is worth noting that in the embodiment of the above-mentioned device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
[0129] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for constructing a language model, characterized in that: The method comprises: Acquire a class entity language model, wherein the class entity language model includes a plurality of specified named entities belonging to the same named entity category; Replacing the designated named entity in the training corpus with the named entity category to obtain a new training corpus; Using the new training corpus to build a main language model; Combining the class entity language model with the main language model to construct a target language model; Wherein, the main language model is an N-gram model, and the entity-like language model is an entity-like finite automaton FA network model; The step of combining the entity-like language model with the main language model to construct a target language model includes: Converting the main language model into a main FA network model; Based on the named entity category, combining the class entity FA network model with the main FA network model to construct a target language model; The method of combining the class entity FA network model with the main FA network model based on the named entity category to construct a target language model includes: Identifying an arc whose output label is the named entity category from the main FA network model as a target arc, and obtaining a state pointed to by the target arc in the main FA network model as a backward access state; redirecting the target arc to the starting state of the entity-like FA network model, and replacing the output label in the target arc with a first specified label; Adding an arc pointing to the backward access state in each end state of the entity-like FA network model, and setting the input label and output label of the arc to the second designated label; The target language model is determined based on the final FA network model.
2. The method according to claim 1, characterized in that The determining of the target language model based on the finally obtained FA network model includes: The FA network model finally obtained is used as the target language model; or, The N-gram model converted from the final FA network model is used as the target language model.
3. The method according to any one of claims 1 to 2, characterized in that: There are multiple entity-like FA network models, wherein each entity-like FA network model has corresponding category information; The step of combining the entity-like FA network model with the main FA network model to construct a target language model includes: Randomly select a quasi-entity FA network model from the plurality of quasi-entity FA network models and insert it into the main FA network model to generate a first intermediate FA network model; The next entity FA network model is selected and inserted into the first intermediate FA network model to generate a second intermediate FA network model, and so on, until all entity-like FA network models are embedded in the main FA network model.
4. The method according to any one of claims 1 to 2, characterized in that: The entity-like FA network model includes multiple arcs pointing from a starting state to an ending state, the output label of each arc corresponds to a specified named entity in the named entity category, and the weight of each arc is related to the number of specified named entities in the entity-like language model.
5. The method according to claim 1, characterized in that The method further comprises: The target language model is sent to a downstream program so that the downstream program can perform speech recognition according to the target language model.
6. A method for speech recognition, characterized in that: The method comprises: Convert the speech signal to be recognized into a text sequence; The text sequence is input into the target language model according to any one of claims 1 to 5, and a recognition result output by the target language model is obtained.
7. A device for constructing a language model, characterized in that: The device comprises: A quasi-entity language model acquisition module, used to acquire a quasi-entity language model, wherein the quasi-entity language model includes a plurality of specified named entities belonging to the same named entity category; A corpus replacement module, used to replace the specified named entity in the training corpus with the named entity category to obtain a new training corpus; A main language model training module, used to construct a main language model using the new training corpus; A language model combining module, used to combine the class entity language model with the main language model to construct a target language model; Wherein, the main language model is an N-gram model, and the entity-like language model is an entity-like finite automaton FA network model; The language model combining module includes: A language model conversion submodule, used to convert the main language model into a main FA network model; A FA network model combining submodule, used to combine the class entity FA network model with the main FA network model based on the named entity category to construct a target language model; The FA network model combined with the submodule is specifically used for: Identifying an arc whose output label is the named entity category from the main FA network model as a target arc, and obtaining a state pointed to by the target arc in the main FA network model as a backward access state; redirecting the target arc to the starting state of the entity-like FA network model, and replacing the output label in the target arc with a first specified label; Adding an arc pointing to the backward access state in each end state of the entity-like FA network model, and setting the input label and output label of the arc to the second designated label; The target language model is determined based on the final FA network model.
8. A speech recognition device, characterized in that: The device comprises: A text sequence conversion module, used for converting the speech signal to be recognized into a text sequence; A text recognition module is used to input the text sequence into the target language model according to any one of claims 1 to 5, and obtain a recognition result output by the target language model.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
11. A computer program product, comprising computer executable instructions, wherein the computer executable instructions are used to implement the method according to any one of claims 1 to 6 when executed.
