Corpus selection method and device, electronic equipment and storage medium
By generating a grid to be processed and matching the spatial state grid of the metacellular automaton, relevant word segments are assigned, and a corpus related to the corpus to be processed is directly constructed. This solves the problem of low corpus generation efficiency in the existing technology and achieves the effect of rapidly expanding the corpus.
Patent Information
- Application Number
- CN202410784735.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-06-17
AI Technical Summary
Existing technologies are inefficient at generating corpora and cannot effectively utilize generative models built from neural networks to rapidly expand the corpus.
By generating a grid to be processed, the spatial state grid of the metacellular automaton is matched with the grid to be processed, relevant word segments are assigned, a corpus to be proofread related to the corpus to be processed is constructed, and the target corpus is selected from it, saving the training time of the neural network and directly generating the corpus related to the corpus to be processed.
It improves the speed of corpus generation and generalization efficiency, ensures that the generated corpus is relevant to the corpus to be processed, and avoids the time consumption of neural network training.
Smart Images

Figure CN118839698B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of information technology, and more particularly, to a corpus selection method and device, an electronic device, and a computer readable storage medium. BACKGROUND
[0002] In the field of human-computer interaction technology, the command language sent by the user to the electronic device is different due to different speaking styles and habits of the user. Therefore, in order to enable the electronic device to fully understand the user's command, it is necessary to prepare enough corpus.
[0003] At present, a generation model constructed by a neural network can be used to generate corpus, thereby achieving the purpose of selecting enough corpus for the electronic device. However, the efficiency of generating corpus by using this method is low. SUMMARY
[0004] The present application provides a corpus selection method and device, an electronic device, and a computer readable storage medium to improve the above-mentioned defects.
[0005] In a first aspect, an embodiment of the present application provides a corpus selection method, which comprises:
[0006] According to the plurality of segmented words after segmenting the to-be-processed corpus and a preset rule, a to-be-processed grid is generated. A unit grid with a target value in the to-be-processed grid corresponds to a segmented word;
[0007] In the process of changing the spatial state grid of the meta-cellular automaton according to the preset rule, a first spatial state grid matched with the to-be-processed grid is determined from the changed spatial state grid;
[0008] Each unit grid with a target value in the first spatial state grid is assigned a corresponding related segmented word. The related segmented word is a segmented word related to the segmented word;
[0009] According to the related segmented words assigned to the unit grids with target values in each target grid intercepted from the first spatial state grid, the to-be-corrected corpus corresponding to each target grid is determined;
[0010] The target corpus corresponding to the to-be-processed corpus is selected from each to-be-corrected corpus.
[0011] In a second aspect, an embodiment of the present application further provides a corpus selection device, which comprises:
[0012] The generation module is configured to generate a to-be-processed grid according to the plurality of segmented words after segmenting the to-be-processed corpus and a preset rule. A unit grid with a target value in the to-be-processed grid corresponds to a segmented word;
[0013] The first determining module is configured to determine a first space state grid matched with the to-be-processed grid from the changed space state grid during a change process of the space state grid of the meta-cellular automaton according to a preset rule;
[0014] The distribution module is configured to assign each cell grid with a target value in the first space state grid with a corresponding related word piece; the related word piece is a word piece related to the word piece;
[0015] The second determining module is configured to determine, according to the related word pieces assigned to the cell grids with the target value in each target grid intercepted from the first space state grid, a target corpus corresponding to each target grid respectively;
[0016] The selecting module is configured to select a target corpus corresponding to the to-be-processed corpus from the target corpora.
[0017] In a third aspect, an embodiment of the present application further provides an electronic device, which comprises: one or more processors; a memory; and one or more application programs stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to execute the method described above.
[0018] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores program code executable by a processor, and the program code, when executed by the processor, causes the processor to execute the method described above.
[0019] The application provides a corpus selection method and device, electronic equipment and computer readable storage medium. In the application, a plurality of segmented words obtained by segmenting a to-be-processed corpus and a preset rule are used to generate a to-be-processed grid. Then, a first spatial state grid matched with the to-be-processed grid is determined from a spatial state grid of a metacell automaton changing over time. Then, each cell grid with a target value in the first spatial state grid is assigned a corresponding relevant segmented word. Then, the relevant segmented words assigned to the cell grids with the target value in each target grid intercepted from the first spatial state grid are used to determine a to-be-proofread corpus corresponding to each target grid. Then, a target corpus corresponding to the to-be-processed corpus is selected from the to-be-proofread corpora, and the selected target corpus is used as a corpus generated based on the to-be-processed corpus. Since the metacell automaton changes according to the preset rule, and the to-be-processed grid is generated according to the preset rule, the first spatial state grid determined at this time is related to the to-be-processed corpus, so that the to-be-proofread corpus constructed based on the target grid selected from the first spatial state grid is also related to the to-be-processed corpus, and it is ensured that the target corpus is also a to-be-proofread corpus related to the to-be-processed corpus, thereby achieving the purpose of expanding the corpus based on the to-be-processed corpus, and the corpus is generated based on a neural network construction model, the time for training the neural network model is saved, and the corpus generation speed is greatly improved, thereby improving the corpus generation efficiency and corpus generalization efficiency.
[0020] Other features and advantages of the embodiments of the present application will be described in the following description, and some will become apparent from the description, or will be learned from the practice of the embodiments of the present application. The purposes and other advantages of the embodiments of the present application can be achieved and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0022] Figure 1 A flowchart of a corpus selection method according to an embodiment of the present application is shown.
[0023] Figure 2 A schematic diagram of a to-be-processed grid in an embodiment of the present application is shown.
[0024] Figure 3 A flowchart of step S105 of the corresponding embodiment is shown. Figure 1 A flowchart of step S105 of the corresponding embodiment is shown.
[0025] Figure 4A schematic diagram of a corpus selection process in an embodiment of the present application is shown.
[0026] Figure 5 A schematic diagram of a phrase splitting module processing process in an embodiment of the present application is shown.
[0027] Figure 6 A schematic diagram of a cellular automaton processing module processing process in an embodiment of the present application is shown.
[0028] Figure 7 A structural block diagram of a corpus selection device according to an embodiment of the present application is shown.
[0029] Figure 8 A structural block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0031] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0032] Please refer to Figure 1 , Figure 1 A corpus selection method flowchart according to an embodiment of the present application is shown, for an electronic device, the method comprising:
[0033] S101, generating a to-be-processed grid according to a plurality of segmented words after segmentation of a to-be-processed corpus and a preset rule.
[0034] Among them, the unit grid with a target value in the to-be-processed grid corresponds to a segmented word.
[0035] In the present application, the electronic device can be a vehicle, a mobile terminal, a server, and the like. The to-be-processed corpus can refer to any one semantic complete sentence. For example, in the field of vehicle-machine interaction technology, the to-be-processed corpus can be a text instruction (or a text instruction after a voice instruction is texted) for any function of a vehicle. For another example, in the field of document management, the to-be-processed corpus can be any one sentence in an electronic document. For another example, in the field of information search technology, the to-be-processed corpus can be any one search sentence input by a user.
[0036] After the to-be-processed corpus is obtained, the to-be-processed corpus can be divided into words to obtain a plurality of segmented words, wherein the division rule can be to divide the to-be-processed corpus into words according to the "subject-predicate-object-determinative-attribute-complement". For example, the to-be-processed corpus is "open the vehicle window", according to the part-of-speech determination of "open" as the predicate and "vehicle window" as the object, the to-be-processed corpus "open the vehicle window" is divided into two segmented words "open" and "vehicle window".
[0037] In the present application, an initial grid of a target size can be set, and then a to-be-processed grid can be generated according to a preset rule and segmented words divided from the to-be-processed corpus, wherein a unit grid in the to-be-processed grid corresponding to a target value corresponds to one segmented word, and the unit grid refers to the smallest unit constituting the grid. The target size can be set based on requirements, for example, the target size can be 3*3 or 5*5, and the target value can be 1. In the target grid, the value of the unit grid not corresponding to the segmented word can be 0, or the unit grid not corresponding to the segmented word can also be empty.
[0038] The preset rule includes that the parity of the sum of the values of the grids around the center unit grid in the grid of the target size is the same as the parity of the value of the center unit grid, and when the sum of the values of the grids around the center unit grid is odd, the value of the center unit grid is the target value. Based on the preset rule, if the generated target grid can meet the preset rule, the size of the initial grid used to generate the target grid should not be less than 3*3. Since when the size of the initial grid is less than 3*3, that is, there is no longer a center unit grid or there will be no unit grid around the center unit grid, for example, when the size of the initial grid is 2*2, there is no center unit grid, and the four grids are all edge unit grids.
[0039] For example, in the case where the target size is 3*3 and the target value is 1, the number of segmented words after division of different to-be-processed corpora is different, and the to-be-processed grids obtained are as shown in Figure 2 Figure 2 a in the formula (1) is the to-be-processed grid corresponding to the two divided words, and the unit grid with a value of 1 corresponds to one of the two divided words. It can be understood that, based on the foregoing preset rule, the grid with a value of 1 around the central grid unit can also be located in any one of the other three grid units adjacent to the central grid unit; in Figure 2 b in the formula (2) is the to-be-processed grid corresponding to the four divided words, and the unit grid with a value of 1 corresponds to one of the four divided words.
[0040] It can be understood that the target value corresponding to the plurality of divided words after the division of the to-be-processed corpus is not fixed, for example, in the case where the target size is 3*3, the target value is 1, and the divided words after the division of the to-be-processed corpus are two, the to-be-processed grid is as shown in a in the formula (3). Figure 2 The central grid unit with a target value can correspond to any one of the two divided words.
[0041] S102, in the process of changing the spatial state grid of the meta-cellular automaton according to the preset rule, determining a first spatial state grid matched with the to-be-processed grid from the changed spatial state grid.
[0042] The spatial state grid of the meta-cellular automaton can be set according to requirements, the size of the state initialization spatial state grid is greater than the foregoing target size, and the values of each unit grid in the state initialization spatial state grid can all be 0. For example, the state initialization spatial state grid is a 200*200 grid.
[0043] Then, the values of any one or more unit grids in the state initialization spatial state grid can be randomly changed, and the spatial state grid of the meta-cellular automaton is controlled to change based on the changed values according to the foregoing preset rule. Each change conforms to the foregoing preset rule. For example, the state initialization spatial state grid is a 200*200 grid, and the values of each unit grid are 0. Then, the value of the most central unit grid (the most central unit grid is actually four, and any one unit grid can be selected) is changed to 1. Then, the meta-cellular automaton controls the change of the spatial state grid according to the preset.
[0044] In the process of changing the spatial state grid of the meta-cellular automaton according to the preset rule, after each change time, a spatial state grid is obtained, and the spatial state grid is matched with the to-be-processed grid to determine a spatial state grid matched with the to-be-processed grid as the first spatial state grid.
[0045] As an implementation, the space state grid including the grid to be processed can be selected as the first space state grid. That is, after a certain change time, the space state grid after the change time has the same region as the grid to be processed, and the space state grid is taken as the first space state grid.
[0046] As an implementation, S102 can include: determining a second space state grid including the grid to be processed from the changed space state grid during the change of the space state grid of the meta-cellular automaton according to the preset rule; and obtaining a space state grid after the occurrence time of the second space state grid as the first space state grid.
[0047] That is, after a certain change time, the space state grid after the change time has the same region as the grid to be processed, and the space state grid is taken as the second space state grid, and then a space state grid after the occurrence time of the second space state grid is obtained as the first space state grid. For example, a space state grid obtained after the first change of the second space state grid is obtained as the first space state grid, and for example, two space state grids obtained after the first and third changes of the second space state grid are both taken as the first space state grid.
[0048] Based on the foregoing, when the space state grid includes the same region as the grid to be processed, the corpus represented by the region is the basic corpus corresponding to the processed corpus, and therefore, the first space state grid determined by the space state grid including the same region as the grid to be processed is evolved from the region corresponding to the basic corpus, and is necessarily a space state grid related to the processed corpus, and therefore, the subsequent corpus construction process is performed based on the first space state grid, and the constructed corrected corpus is also a corpus related to the processed corpus.
[0049] S103, assigning a corresponding related word to each cell grid with a target value in the first space state grid.
[0050] The related word is a word related to the word. Generally, the processed corpus includes a subject word, the subject word is a word indicating a target scene subject in the processed corpus, and the target scene subject is a scene subject to which the processed corpus is directed. The synonyms or words of the same part of speech of the words other than the subject word in the multiple words can be taken as the related words corresponding to the multiple words.
[0051] The scene subject can be a key object in the scene, and the target scene subject is the scene subject to which the to-be-processed corpus is directed. For example, the to-be-processed corpus is directed to a car window control scene in car-machine interaction, the key object is a car window, and the target scene subject is the car window. For another example, the to-be-processed corpus is directed to an entertainment news scene, the key object is an entertainment object, and the target scene subject is the name of the entertainment object. Generally, the division words that are subjects or objects in the to-be-processed corpus can be obtained as subject words indicating the target scene subject in the to-be-processed corpus.
[0052] In a specific application, for a division word other than a predicate, a synonym of the division word can be obtained as a related division word; and for a division word other than a predicate, a word with the same part of speech and similar or opposite meaning as the division word can be obtained as a related division word.
[0053] After the related division words are determined, if the number of the related division words does not exceed the number of the cell grids with the target value in the first spatial state grid, a related division word is randomly assigned to each cell grid with the target value, so that each related division word is assigned to a cell grid with the target value, and different cell grids are assigned different related division words, and the remaining cell grids with the target value can not be assigned related division words; if the number of the related division words exceeds the number of the cell grids with the target value in the first spatial state grid, each cell grid with the target value is randomly assigned a related division word, so that each cell grid with the target value is assigned a related division word, and different cell grids are assigned different related division words, and the remaining related division words can not be processed.
[0054] S104, determining the to-be-corrected corpus corresponding to each target grid according to the related division words assigned to the cell grids with the target value in each target grid intercepted from the first spatial state grid.
[0055] The target grid can be intercepted from the first spatial state grid.
[0056] In this application, one grid with the same size as the to-be-processed grid can be intercepted from the first spatial state grid as a target grid each time, and multiple target grids can be intercepted by multiple times of interception, and the target grids intercepted each time are different.
[0057] To fully utilize the first spatial state grid, the intercepted target grids can traverse each grid in the first spatial state grid. Each grid with the same size as the to-be-processed grid after the first spatial state grid is divided directly according to the size of the to-be-processed grid can be used as a target grid, or a sliding window with the size of the to-be-processed grid can be constructed, and the first spatial state grid can be traversed according to a set step, and each grid traversed each time can be used as a target grid.
[0058] For example, the size of the to-be-processed game piece is 3*3, and the size of the first space state grid is 200*200. The first space state grid can be divided into 66*66 target grids according to the size of 3*3. For another example, the size of the to-be-processed game piece is 3*3, and the size of the first space state grid is 200*200. Based on the sliding window of 3*3, the step is set to 1 for traversal. At this time, 198*198 target grids are obtained by traversal.
[0059] It is worth mentioning that in the case where the selected first space state grid is multiple, each first space state grid can be intercepted according to the foregoing manner to obtain at least one target grid to obtain multiple target grids.
[0060] For each target grid, the related words allocated to the unit grid with the target value in the target grid can be determined, and then the related words allocated to the unit grid with the target value in the target grid are combined to obtain a combined result as the to-be-corrected expectation corresponding to the target grid.
[0061] Generally, the unit grid with the target value in the target grid is multiple, and the related words allocated to the unit grid with the target value in the target grid are also multiple. The multiple related words can be randomly combined to obtain multiple combination results, and each combination result can be used as a to-be-corrected expectation corresponding to a target grid. For example, the unit grid with the target value in the target grid is 4, and the related words allocated to the 4 unit grids are 4. The combination result of the 4 related words can be up to 4*3*2*1=24. The 24 combination results can be used as to-be-corrected expectations, that is, 24 to-be-corrected expectations are obtained.
[0062] All target grids are traversed to obtain all to-be-corrected expectations. It can be understood that since the to-be-corrected expectation is obtained by combining related words, the to-be-corrected expectation can not be a complete sentence, and can include multiple predicates or multiple subjects.
[0063] S105, selecting a target corpus corresponding to the to-be-processed corpus from each to-be-corrected corpus.
[0064] In this embodiment, after obtaining the to-be-corrected expectation, the sentence similarity of the to-be-corrected corpus and the to-be-processed corpus can be calculated, and the first number of to-be-corrected expectations is selected as the target corpus according to the sentence similarity from high to low, or the to-be-corrected expectation whose sentence similarity reaches the sentence similarity threshold is selected as the target corpus. The first number and the sentence similarity threshold can be set based on demand, and the present application is not limited.
[0065] In the present application, the edit distance, the Jaccard coefficient, the TF coefficient, the TFIDF coefficient, etc. between the to-be-processed corpus and the target corpus can be calculated as the sentence similarity between the to-be-processed corpus and the target corpus.
[0066] In some embodiments, after S105, the method can further include: if the target corpus does not exist in the corpus, adding the target corpus to the corpus to update the corpus. The corpus can be a database pre-stored in the electronic device and storing a certain number of corpora. If it is determined that the corpus does not contain the target corpus, the target corpus is added to the corpus, the purpose of the corpus is achieved, and the generalization degree of the corpus is improved.
[0067] In the present embodiment, according to the plurality of segmented words of the to-be-processed corpus and the preset rule, the to-be-processed grid is generated; then the first spatial state grid matching the to-be-processed grid is determined from the spatial state grid of the metacell automaton changing over time; then each cell grid with a target value in the first spatial state grid is assigned a corresponding related segmented word; and according to the related segmented words assigned to the cell grids with target values in each target grid intercepted in the first spatial state grid, the respective target corpus corresponding to each target grid is determined; then the target corpus corresponding to the to-be-processed corpus is selected from each target corpus to be proofread, and the selected target corpus is used as the corpus generated based on the to-be-processed corpus. Since the metacell automaton changes according to the preset rule, and the to-be-processed grid is generated according to the preset rule, at this time, the determined first spatial state grid is related to the to-be-processed corpus, so that the to-be-proofread corpus constructed according to the target grid selected from the first spatial state grid is also related to the to-be-processed corpus, ensuring that the target corpus is also a related corpus of the to-be-processed corpus. Thus, the purpose of expanding the corpus based on the to-be-processed corpus is achieved, and a generation model based on a neural network is not needed to generate the corpus, saving the time for training the neural network model and greatly improving the corpus generation speed, thereby improving the corpus generation efficiency and the corpus generalization efficiency.
[0068] In an embodiment, as shown in FIG. 10, S105 can include: Figure 3
[0069] S201, obtaining a first word order and a first word meaning correlation value corresponding to the to-be-processed corpus.
[0070] The first word order is used to indicate the word order arrangement between the word types to which the plurality of segmented words belong, and the first word meaning correlation value is used to indicate the correlation degree between the plurality of segmented words and the subject word. The subject word is a segmented word indicating the target scene subject in the to-be-processed corpus, and the target scene subject is the scene subject to which the to-be-processed corpus is directed. The first word meaning correlation value can include a correlation degree corresponding to each segmented word.
[0071] After the division of the to-be-processed corpus, a plurality of segmented words are obtained. According to the positions of the segmented words in the to-be-processed corpus, an arrangement order between the parts-of-speech to which the plurality of segmented words belong is determined as the part-of-speech arrangement order. For example, the to-be-processed corpus is “open the window”, and the segmented words after division are “open” and “window”. The part-of-speech of “open” is predicate, and the part-of-speech of “window” is object. At this time, the first part-of-speech order is “predicate before object”.
[0072] Generally, the association degree of the plurality of segmented words with the subject word can be indicated by a numerical value. The greater the numerical value corresponding to a segmented word, the higher the association degree of the segmented word with the subject word. The smaller the numerical value corresponding to a segmented word, the lower the association degree of the segmented word with the subject word. The association degree of the subject word with itself is the largest, and the association degrees of other segmented words with the subject word are less than the association degree of the subject word with itself. For example, when the association degree of the subject word with itself is 1, the association degrees of the subject word with other segmented words do not exceed 1.
[0073] It is worth mentioning that when the association degree of the subject word with itself is 1, the first word meaning association value can include the association degree corresponding to each other segmented word, and the association degree of the subject word can not be included in the first word meaning association value. Since the association degree of the subject word with itself is 1 by default, the association degree of the subject word is directly determined to be 1 when processing.
[0074] In this embodiment, the association degrees between segmented words can be determined according to the reasonableness of the collocation between different segmented words. For example, it is reasonable to open the window, so the association degree of “open” and “window” can be larger. For another example, it is unreasonable to drive the window, so the association degree of “drive” and “window” can be lower.
[0075] After determining the association degrees corresponding to the plurality of segmented words after division of the to-be-processed corpus, the association degrees corresponding to the plurality of segmented words can be summarized to obtain the first word meaning association value.
[0076] S202, obtaining a second part-of-speech order and a second word meaning association value corresponding to the to-be-corrected corpus.
[0077] As known from the foregoing embodiments, the to-be-corrected corpus is obtained by combining related segmented words. Therefore, the second part-of-speech order is used to indicate the part-of-speech arrangement order between the parts-of-speech to which the plurality of related segmented words in the to-be-corrected corpus belong, and the second word meaning association value is used to indicate the association degrees of the plurality of related segmented words in the to-be-corrected corpus with the subject word. For example, the second word meaning association value can include the association degrees of the plurality of related segmented words in the to-be-corrected corpus with the subject word.
[0078] It can be understood that each to-be-corrected corpus corresponds to one second part-of-speech order and one second word meaning association value.
[0079] The second word order and the second word meaning correlation value are determined in a similar manner as the first word order and the first word meaning correlation value, and will not be described again.
[0080] S203, according to the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value, selecting a target corpus corresponding to each to-be-corrected corpus from each to-be-corrected corpus.
[0081] After obtaining the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value, the target corpus can be selected according to the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value.
[0082] As an implementation manner, for each to-be-corrected corpus, the matching degree of the to-be-corrected corpus and the to-be-processed corpus can be determined according to the first word order, the first word meaning correlation value, the second word order corresponding to the to-be-corrected corpus, and the second word meaning correlation value, and then, the second number of to-be-corrected corpora are selected as target corpora in descending order of matching degree, or the to-be-corrected corpora whose matching degree reaches a matching degree threshold are selected as target corpora. The first number and the matching degree threshold can be set based on requirements, and the present application is not limited.
[0083] For example, the correlation values of each word in the first word meaning correlation value can be averaged or weighted summed, to obtain a first operation result, the correlation values of each relevant word in the second word meaning correlation value corresponding to the to-be-corrected corpus can be averaged or weighted summed, to obtain a second operation result, and the fluency can be determined according to the difference between the second word order and the first word order corresponding to the to-be-corrected corpus, and then the first operation result, the second operation result, and the fluency are weighted summed or averaged, to obtain the matching degree.
[0084] Optionally, the closer the second word order is to the first word order, the higher the fluency is, and the less similar the second word order is to the first word order, the lower the fluency is. When the second word order is the same as the first word order, the fluency is the highest. Generally, when the second word order is different from the first word order, the closer the word order at the corresponding position in the second word order is to the first word order, the higher the fluency is. For example, the first word order is predicate before object, and the second word order is predicate before subject, at this time, it is determined that the fluency is high, and for another example, the first word order is predicate before object, and the second word order is predicate after predicate, at this time, it is determined that the fluency is low.
[0085] As a further implementation, S203 can include: determining a word similarity of the to-be-proofread corpus according to the first word sense association value and a second word sense association value corresponding to the to-be-proofread corpus; determining a fluency of each to-be-proofread corpus according to the first word order and a second word order corresponding to the to-be-proofread corpus; and selecting a target corpus from each to-be-proofread corpus, which has a word similarity reaching a similarity threshold and a fluency reaching a fluency threshold. The similarity threshold and the fluency threshold can be set based on requirements, for example, the similarity threshold is 0.75 and the fluency threshold is 0.8.
[0086] The association values of each segmented word in the first word sense association value can be averaged or weighted summed, etc., to obtain a first operation result, and the association values of each relevant segmented word in the second word sense association value corresponding to the to-be-proofread corpus can be averaged or weighted summed, etc., to obtain a second operation result. Then, the first operation result and the second operation result can be averaged or weighted summed, etc., to obtain the word similarity. All the to-be-proofread corpora can be traversed to obtain the word similarity of all the to-be-proofread corpora. Meanwhile, the fluency of each to-be-proofread corpus can be determined according to the difference between the second word order corresponding to the to-be-proofread corpus and the first word order. Then, the to-be-proofread corpus having a word similarity reaching a similarity threshold and a fluency reaching a fluency threshold can be selected from each to-be-proofread corpus as a target corpus.
[0087] In some implementations, after obtaining the word similarity of all the to-be-proofread corpora, the to-be-proofread corpus having a word similarity reaching a similarity threshold can be selected as a first intermediate corpus. Then, the fluency can be determined according to the difference between the second word order corresponding to the first intermediate corpus and the first word order (since the first intermediate corpus is selected to-be-proofread corpus, it also has a second word order), and the first intermediate corpus having a fluency reaching a fluency threshold can be selected as a target corpus.
[0088] In another implementation, after obtaining the fluency of all the to-be-proofread corpora, the to-be-proofread corpus having a fluency reaching a fluency threshold can be selected as a second intermediate corpus. Then, the word similarity can be determined according to the difference between the second word sense association value corresponding to the second intermediate corpus and the first word sense association value (since the second intermediate corpus is selected to-be-proofread corpus, it also has a second word order), and the second intermediate corpus having a word similarity reaching a similarity threshold can be selected as a target corpus.
[0089] Of course, the to-be-proofread corpus satisfying both the conditions of the to-be-proofread corpus having a word similarity reaching a similarity threshold and a fluency reaching a fluency threshold can also be directly determined as a target corpus.
[0090] In this embodiment, according to the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value, the correlation degree between the to-be-corrected corpus and the to-be-processed corpus and the rationality of the to-be-corrected corpus can be accurately determined, so that the target corpus selected according to the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value is more reasonable and more relevant to the to-be-processed corpus, and the accuracy of selecting the target corpus is improved.
[0091] In order to more accurately understand the method of the present application, the corpus selection method of the present application is explained in conjunction with an example, in which the corpus is a voice instruction for vehicle-machine interaction, that is, the electronic device is a vehicle.
[0092] As shown in Figure 4 , when the vehicle is used for the first time, the vehicle determines whether to start the corpus updating function (the corpus updating function is a vehicle function for implementing the corpus selection scheme of the present application), if yes, the corpus updating function is disabled (and after being disabled, the user can manually start the function in the future), if no, the voice instruction input by the user is obtained.
[0093] Then, the voice instruction is filtered according to the filtering rule to obtain the filtered to-be-processed voice instruction, wherein the filtering rule can include filtering voice instructions including specific tone and voice instructions including dialect, wherein the specific tone can include anger and sadness, etc.
[0094] After that, the to-be-processed voice instruction is converted into text information to obtain the to-be-processed corpus, the to-be-processed corpus is processed by a word group splitting module, and then the processing result of the word group splitting module is processed by a meta-cellular automaton processing module to realize the updating of the corpus of the corpus library.
[0095] The processing process of the word group splitting module is as shown in Figure 5 The word group splitting module divides the to-be-processed corpus into words to obtain a plurality of segmented words, and determines the first word meaning correlation value and the first word order corresponding to the to-be-processed corpus.
[0096] Then, the processing result of the word group splitting module is processed by the meta-cellular automaton processing module, and the processing process of the meta-cellular automaton processing module is as shown in FIG. 6.
[0097] According to the segmented words of the to-be-processed corpus, a to-be-processed grid is constructed through a word distribution submodule in the meta-cellular automaton processing module, and a second spatial state grid is determined for the to-be-processed grid as a basic corpus. Through a corpus inversion submodule, evolution is performed based on the basic corpus to obtain a first spatial state grid. Then, through a corpus prediction submodule, a target grid is intercepted from the first spatial state grid, and relevant segmented words assigned to the target value unit grids in the target grid are used to construct a to-be-corrected corpus. Subsequently, through a corpus analysis submodule, the word similarity and fluency corresponding to the to-be-corrected corpus are determined to filter target corpus through the word similarity and fluency corresponding to the to-be-corrected corpus. Finally, through a corpus correction submodule, it is determined whether the target corpus is stored in the corpus library of the vehicle. If not, the target corpus is added to the corpus library. If so, the target corpus is deleted.
[0098] It can be understood that after the first spatial state grid is determined, one target grid can be selected each time, and then subsequent steps are selected based on the to-be-corrected corpus generated by the target grid to determine whether the selected to-be-processed corpus is the target corpus. If the to-be-processed corpus is not the target corpus, a new to-be-processed corpus is selected from the to-be-corrected corpus determined in the target grid, and the process is repeated. If the to-be-processed corpus is the target corpus, it is determined whether to add it to the corpus library. After determining whether to add it to the corpus library (adding to the corpus library or not adding to the corpus library and deleting the target corpus), a new to-be-processed corpus is selected from the to-be-corrected corpus determined in the target grid, and the process is repeated. When all to-be-processed corpora in the target grid are traversed, a target grid can be intercepted from the first spatial state grid again, and the foregoing process is repeated until all target grids are traversed. In other words, each time only one to-be-corrected corpus can be determined as the target corpus and whether to add it to the corpus library.
[0099] In this example, the corpus update function will eventually be applied in the human-computer interaction of the vehicle, and therefore, this corpus generalization process can be integrated into the car machine background (server in communication connection with the vehicle) for online corpus update. If the car machine can normally recognize, understand and execute voice commands other than the existing corpus library, the car machine background can perform the foregoing processing on the text information processed from the voice command text to obtain the target corpus, and add the target corpus to the corpus library.
[0100] It can be understood that when this corpus update function is integrated into the car machine background, the privacy of the driver and passengers is taken into account. Therefore, the car owner is informed of the existence of this function when the car owner first uses the vehicle, and the car owner decides whether to turn on this function. In addition, this function needs to be integrated as an independent function, and the car owner still has the right to turn off this corpus update function in the settings. Once this corpus update function is turned off, the collection of corpus is stopped, and the corpus update function can be manually turned on during the use of the vehicle.
[0101] It is worth mentioning that when the corpus generalization process is integrated into the car machine background, considering the experience of the driver and the passenger, when the car owner chooses to turn on this function, the car machine background will calculate the corpus contribution of the driver and the passenger in the corpus library. When the corpus contribution of the driver and the passenger exceeds 50% of the total corpus in the corpus library, the subsequent voice commands of the driver and the passenger will be preferentially searched in the car machine background for the corpus content contributed by the driver and the passenger.
[0102] Referring to the drawings Figure 7 , Figure 7 A structural block diagram of a corpus selection device according to an embodiment of the present application is shown. The device 1200 comprises:
[0103] The generating module 1210 is configured to generate a to-be-processed grid according to the plurality of segmented words after segmentation of the to-be-processed corpus and a preset rule; and a unit grid with a target value in the to-be-processed grid corresponds to a segmented word.
[0104] The first determining module 1220 is configured to determine a first spatial state grid matched with the to-be-processed grid from the changing spatial state grids of the meta-cellular automaton in the process of changing the spatial state grids according to the preset rule.
[0105] The assigning module 1230 is configured to assign a corresponding relevant segmented word to each unit grid with a target value in the first spatial state grid; and the relevant segmented word is a segmented word related to the segmented word.
[0106] The second determining module 1240 is configured to determine a respective to-be-proofread corpus corresponding to each target grid according to the relevant segmented words assigned to the unit grids with target values in the intercepted target grids in the first spatial state grid.
[0107] The selecting module 1250 is configured to select a target corpus corresponding to the to-be-processed corpus from the to-be-proofread corpora.
[0108] Optionally, the first determining module 1220 is further configured to determine a second spatial state grid including the to-be-processed grid from the changing spatial state grids of the meta-cellular automaton in the process of changing the spatial state grids according to the preset rule; and obtain a spatial state grid with an occurrence time located after the occurrence time of the second spatial state grid as the first spatial state grid.
[0109] Optionally, the second determining module 1240 is further configured to, for each target grid, combine the relevant segmented words assigned to the unit grids with target values in the target grid to obtain a to-be-proofread corpus corresponding to a target grid region.
[0110] Optionally, the selecting module 1250 is further configured to obtain a first word order and a first word meaning correlation value corresponding to the to-be-processed corpus, the first word order being used to indicate a word order arrangement between the word classes to which the multiple segmented words belong, and the first word meaning correlation value being used to indicate a correlation degree between the multiple segmented words and the subject word, the subject word being a segmented word in the to-be-processed corpus that indicates a target scenario subject, the target scenario subject being a scenario subject to which the to-be-processed corpus is directed; obtain a second word order and a second word meaning correlation value corresponding to the to-be-corrected corpus, the second word order being used to indicate a word order arrangement between the word classes to which the multiple related segmented words in the to-be-corrected corpus belong, and the second word meaning correlation value being used to indicate a correlation degree between the multiple related segmented words in the to-be-corrected corpus and the subject word; and select, from the multiple to-be-corrected corpora, a target corpus corresponding to the to-be-processed corpus according to the first word order, the first word meaning correlation value, the second word order corresponding to each to-be-corrected corpus, and the second word meaning correlation value corresponding to each to-be-corrected corpus.
[0111] Optionally, the selecting module 1250 is further configured to determine a word similarity corresponding to the to-be-corrected corpus according to the first word meaning correlation value and the second word meaning correlation value corresponding to the to-be-corrected corpus, determine a fluency degree of each to-be-corrected corpus according to the first word order and the second word order corresponding to the to-be-corrected corpus, and select, from the multiple to-be-corrected corpora, a target corpus whose word similarity reaches a similarity threshold value and whose fluency degree reaches a fluency threshold value.
[0112] Optionally, the selecting module 1250 is further configured to add the target corpus to the corpus library to update the corpus library if the target corpus does not exist in the corpus library.
[0113] Please refer to Figure 8 , which shows a structural block diagram of an electronic device 900 provided by an embodiment of the present application. The electronic device 900 can be a vehicle, a mobile terminal, a server, and part of a module for implementing the corpus selecting method of the embodiment of the present application, etc. The electronic device 900 in the present application can include one or more of the following components: a processor 910, a memory 920, and one or more application programs, wherein the one or more application programs can be stored in the memory 920 and configured to be executed by the one or more processors 910, and the one or more programs are configured to perform the method as described in the foregoing method embodiment.
[0114] The processor 910 can include one or more processing cores. The processor 910 connects various parts within the entire electronic device 900 by various interfaces and lines, performs various functions of the electronic device 900 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 920, and calling data stored in the memory 920. Alternatively, the processor 910 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), a programmable logic array (PLA). The processor 910 can integrate a combination of one or several of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes an operating system, a user interface, and an application program; the GPU is responsible for rendering and drawing of content to be displayed; and the modem is used for processing wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 910, but can be implemented by a separate communication chip.
[0115] The memory 920 can include a random access memory (RAM) and can also include a read-only memory (ROM). The memory 920 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 920 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing each of the methods described below, etc. The data storage area can also store data created by the electronic device 900 in use (such as a phone book, audio and video data, chat record data, etc.).
[0116] In several embodiments provided in the present application, the coupling between the modules can be electrical, mechanical or other forms of coupling.
[0117] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can exist physically independently, or two or more modules can be integrated into one module. The above-mentioned integrated module can be realized in the form of hardware or in the form of a software functional module.
[0118] In another aspect, the present application also provides a computer readable storage medium, which stores program codes, and the program codes can be invoked by a processor to execute the method described in the above method embodiments.
[0119] The computer readable storage medium can be an electronic storage such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer readable storage medium comprises a non-transitory computer readable storage medium. The computer readable storage medium has a storage space for program codes to execute any of the method steps described above. The program codes can be read from or written to one or more computer program products. The program codes can be compressed in a suitable form, for example.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit the same; even though the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A corpus selection method, characterized by, The method comprises: generating a to-be-processed grid according to a plurality of segmented words obtained after segmenting a to-be-processed corpus and a preset rule; a unit grid with a target value in the to-be-processed grid corresponds to a segmented word; wherein the preset rule comprises that the parity of the sum of the values of the grids around a center unit grid in a grid with a target size is the same as the parity of the value of the center unit grid, and the value of the center unit grid is a target value when the sum of the values of the grids around the center unit grid is odd; determining a second spatial state grid comprising the to-be-processed grid from the changing spatial state grid in the changing process of the spatial state grid of the cellular automaton according to the preset rule; obtaining a spatial state grid appearing at a moment later than the appearing moment of the second spatial state grid as a first spatial state grid; allocating a corresponding relevant segmented word to each unit grid with a target value in the first spatial state grid; the relevant segmented word is a segmented word related to the segmented word; combining the relevant segmented words allocated to the unit grids with target values in each target grid intercepted in the first spatial state grid to obtain a target corpus corresponding to the target grid. selecting a target corpus corresponding to the to-be-processed corpus from the target corpora.
2. The method of claim 1, wherein, The selecting a target corpus corresponding to the to-be-processed corpus from the target corpora comprises: obtaining a first part-of-speech order and a first word meaning correlation value corresponding to the to-be-processed corpus; the first part-of-speech order is used to indicate the part-of-speech arrangement order between the parts of speech to which the plurality of segmented words belong, and the first word meaning correlation value is used to indicate the correlation degree between the plurality of segmented words and a subject word; the subject word is a segmented word indicating a target scene subject in the to-be-processed corpus, and the target scene subject is a scene subject to which the to-be-processed corpus is directed; obtaining a second part-of-speech order and a second word meaning correlation value corresponding to the target corpus; the second part-of-speech order is used to indicate the part-of-speech arrangement order between the parts of speech to which the plurality of relevant segmented words in the target corpus belong, and the second word meaning correlation value is used to indicate the correlation degree between the plurality of relevant segmented words in the target corpus and the subject word; selecting a target corpus corresponding to the to-be-processed corpus from the target corpora according to the first part-of-speech order, the first word meaning correlation value, the second part-of-speech order and the second word meaning correlation value corresponding to each target corpus.
3. The method of claim 2, wherein, The selecting a target corpus corresponding to the to-be-processed corpus from the target corpora according to the first part-of-speech order, the first word meaning correlation value, the second part-of-speech order and the second word meaning correlation value corresponding to each target corpus comprises: determining a word similarity corresponding to the target corpus according to the first word meaning correlation value and the second word meaning correlation value corresponding to the target corpus; determining the fluency of each target corpus according to the first part-of-speech order and the second part-of-speech order corresponding to the target corpus; selecting a target corpus with a word similarity reaching a similarity threshold value and a fluency reaching a fluency threshold value from the target corpora.
4. The method of claim 1, wherein, After selecting the target corpus corresponding to the to-be-processed corpus from each of the to-be-corrected corpora, the method further includes: If the target corpus does not exist in the corpus library, the target corpus is added to the corpus library to update the corpus library.
5. A corpus selection device, characterized by, The device includes: A generation module configured to generate a to-be-processed grid according to a plurality of segmented words after segmentation of the to-be-processed corpus and a preset rule; a unit grid with a target value in the to-be-processed grid corresponds to one of the segmented words; wherein the preset rule includes that parity of a sum of values of grids around a center unit grid with a target size is the same as parity of a value of the center unit grid, and the value of the center unit grid is a target value when the sum of the values of the grids around the center unit grid is odd; A first determination module configured to determine a second space state grid including the to-be-processed grid from a changing space state grid in a changing process of a space state grid of a cellular automaton; and acquire a space state grid at an occurrence time after the occurrence time of the second space state grid as a first space state grid; An allocation module configured to allocate a corresponding relevant segmented word to each unit grid with a target value in the first space state grid; the relevant segmented word is a segmented word related to the segmented word; A second determination module configured to combine the relevant segmented words allocated to unit grids with target values in each target grid intercepted in the first space state grid to obtain to-be-corrected corpus corresponding to the target grid; A selection module configured to select a target corpus corresponding to the to-be-processed corpus from each of the to-be-corrected corpora.
6. An electronic device, comprising: One or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to perform the method of any one of claims 1-4. The computer-readable storage medium stores processor-executable program code, and the program code is executed by the processor to make the processor perform the method of any one of claims 1-4.
7. A computer readable storage medium characterized in that,
Citation Information
Patent Citations
Corpus analysis method and device, electronic equipment and storage medium
CN112183089A
Word segmentation method and device, electronic equipment and readable storage medium
CN114692630A