Text processing method, device, electronic device and storage medium

By performing keyword extraction and denoising on the text, and using the attention weight matrix of the AI ​​model, the problem of users having difficulty understanding the cause of the prediction results is solved, thereby improving the accuracy and reliability of diagnostic results in medical scenarios.

CN118246558BActive Publication Date: 2024-09-03SINGULARITY INTELLIGENCE (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410686082.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-09-03
Estimated Expiration
2044-05-30

AI Technical Summary

Technical Problem

In the application of AI models, it is difficult for users to understand the reasons for the prediction results, especially in medical scenarios, where doctors need to understand the reasons behind the diagnosis results to ensure accuracy.

Method used

By performing keyword extraction and denoising on the text to be processed, the trained AI model is used to obtain the prediction results and attention weight matrix, determine whether there are abnormalities in the text, and input the processed text into the AI ​​model to obtain the final prediction results and keywords, and then visualize the keywords to trace the causes of the prediction results.

Benefits of technology

It improves the user experience, enhances the ability to understand prediction results, and ensures the accuracy of prediction results. Especially in medical text processing, it can correct input errors and improve the reliability of diagnostic results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118246558B
    Figure CN118246558B
Patent Text Reader

Abstract

The present invention provides a text processing method, device, electronic device and storage medium, which relate to the field of text processing. The method comprises: firstly denoising the text to be processed, then inputting the denoised text into a trained AI model to obtain corresponding prediction results and intermediate processing data, and then obtaining keywords of the text based on the intermediate processing data, so as to know the reasons for the prediction results, play a tracing role, and improve user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text processing, and in particular to a text processing method, electronic equipment and storage medium. Background Art

[0002] Currently, AI models such as deep learning models have been widely used in various fields. The trained AI model can directly give the corresponding prediction results based on the input information entered by the user. The AI ​​model is more like a black box in terms of its working mechanism. Usually, it is not very clear why the model gives such a prediction result. However, in some application scenarios, it is necessary to know the reason for the prediction result. For example, in actual medical scenarios, when the model gives a specific diagnosis result based on the medical text, the doctor will have a strong desire to know "why". Summary of the invention

[0003] In view of the above technical problems, the technical solution adopted by the present invention is:

[0004] According to a first aspect of the present invention, a text processing method is provided, the method comprising the following steps:

[0005] S200, based on the reference keyword set corresponding to the initial text to be processed, obtaining the keyword set of the initial text to be processed as the first keyword set KWI1 of the initial text={KWI1 1 , KWI1 2 , ..., KWI1 t , ..., KWI1 d};KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 t The initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content.

[0006] S210, based on the trained AI model, obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH jCorresponding to the j-th character in the prediction result, i ranges from 1 to m, where m is the number of characters in the initial text, and j ranges from 1 to n, where n is the number of characters in the prediction result.

[0007] S220, based on R0, obtain the keyword set of the initial text as the second keyword set KWI2 of the initial text = {KWI2 1 , KWI2 2 , ..., KWI2 k , ..., KWI2 Q}, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2.

[0008] S230, based on KWI1 and KWI2, determine whether the initial text has any abnormality. If there is any abnormality, perform corresponding processing operations on the initial text to obtain a corresponding target text; if there is no abnormality, use the initial text as the target text.

[0009] S240, based on the trained AI model, obtain the prediction result and the corresponding attention weight matrix R corresponding to the target text, and based on R, obtain the keywords corresponding to the target text.

[0010] S250, if the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, output prompt information indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and visualize the keywords corresponding to the target text.

[0011] If the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, output a prompt message indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text

[0012] According to a second aspect of the present invention, there is provided a text processing device, the device comprising:

[0013] The first acquisition module is used to acquire the keyword set of the initial text to be processed based on the reference keyword set corresponding to the initial text to be processed, as the first keyword set KWI1 of the initial text={KWI1 1 , KWI1 2 , ..., KWI1 t , ..., KWI1 d};KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 tThe initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content.

[0014] The second acquisition module is used to obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text based on the trained AI model; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH j Corresponding to the j-th character in the prediction result, i ranges from 1 to m, where m is the number of characters in the initial text, and j ranges from 1 to n, where n is the number of characters in the prediction result.

[0015] The third acquisition module is used to acquire the keyword set of the initial text based on R0 as the second keyword set KWI2 of the initial text={KWI2 1 , KWI2 2 , ..., KWI2 k , ..., KWI2 Q}, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2.

[0016] The target text acquisition module is used to judge whether there is an abnormality in the initial text based on KWI1 and KWI2. If there is an abnormality, the corresponding processing operation is performed on the initial text to obtain the corresponding target text; if there is no abnormality, the initial text is used as the target text.

[0017] The fourth acquisition module is used to obtain the prediction result and the corresponding attention weight matrix R corresponding to the target text based on the trained AI model, and based on R, obtain the keywords corresponding to the target text.

[0018] The output module is used to output prompt information indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and to visually display the keywords corresponding to the target text.

[0019] According to a third aspect of the present invention, there is provided an electronic device comprising a processor and a memory; the processor is used to execute the steps of the method described in the first aspect of the present invention by calling a program or instruction stored in the memory.

[0020] According to a fourth aspect of the present invention, there is provided a non-transitory computer-readable storage medium storing a program or instructions, wherein the program or instructions enable a computer to execute the steps of the method described in the first aspect of the present invention.

[0021] The present invention has at least the following beneficial effects:

[0022] The text processing method provided by the embodiment of the present invention first denoises the text to be processed, then inputs the denoised text into the trained AI model to obtain corresponding prediction results and intermediate processing data, and then obtains the keywords of the text based on the intermediate processing data, so as to know the reasons for the prediction results, play a tracing role, and improve the user experience.

[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 A flowchart of a text processing method provided by an embodiment of the present invention;

[0026] Figure 2 Schematic diagram of the attention weight matrix in an embodiment of the present invention. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0029] It should be noted that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0030] The embodiment of the present invention provides a text processing method, such as Figure 1 As shown, the method may include the following steps:

[0031] S200, based on the reference keyword set corresponding to the initial text to be processed, obtaining the keyword set of the initial text to be processed as the first keyword set KWI1 of the initial text={KWI1 1 , KWI1 2 , ..., KWI1 t , ..., KWI1 d};KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 t The number of keywords in .

[0032] In an embodiment of the present invention, the initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content. In a specific application embodiment of the present invention, the initial text may be a medical text, for example, the text content may include symptoms and corresponding examinations and tests, and the text description may be a diagnosis result.

[0033] In an embodiment of the present invention, a reference keyword set may be pre-stored in a database and may be obtained through prior experience. Specifically, M sample texts are obtained, and the texts with the same text description in the M sample texts are taken as the same type of texts. For each same type of text, the keywords of the same type of text are obtained, such as keywords such as symptoms, examinations and tests, and the keywords corresponding to the same type of text are obtained. For example, the keywords corresponding to a cold are: runny nose, cough, fever, sore throat, routine blood test, increased lymphocyte percentage, etc. It is known to those skilled in the art that the keyword acquisition method for each same type of text may be an existing method.

[0034] In the embodiment of the present invention, KWI1 can be obtained by the following steps:

[0035] S201, based on the text description corresponding to the initial text, obtain a reference keyword set RKW corresponding to the initial text = {RKW 1 , RKW 2 , ..., RKW s , ..., RKW q}; Among them, RKW s is the sth keyword in RKW, the value of s ranges from 1 to q, and q is the number of keywords in RKW.

[0036] In the embodiment of the present invention, each reference keyword set has a corresponding text description, so that the corresponding reference keyword set can be obtained by querying the database through the text description corresponding to the initial text.

[0037] S202, based on RKW, obtain a keyword set CRKW corresponding to the initial text and RKW={CRKW 1 ,CRKW 2 , ..., CRKW t , ..., CRKW d};CRKW t is the tth keyword in CRKW, the value of t ranges from 1 to d, and d is the value of CRKW. t The number of keywords in CRKW t The similarity between the keyword and the corresponding keyword in RKW is greater than the set similarity threshold.

[0038] In the embodiment of the present invention, RKW can be obtained by a keyword matching method or a semantic matching method, or by calculating the similarity after vectorizing the initial text and CRKW. In the embodiment of the present invention, the similarity can be cosine similarity. The similarity threshold can be set as an empirical value. Obviously, KWI1=CRKW.

[0039] S210, based on the trained AI model, obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH jCorresponding to the jth character in the prediction result, the value of i is 1 to m, m is the number of characters in the initial text, and the value of j is 1 to n, n is the number of characters in the prediction result. In an embodiment of the present invention, the AI ​​model may be a deep learning model for text matching, for example, an RE2 model. In an embodiment of the present invention, the trained AI model may be trained using corresponding training data, and in an illustrative embodiment of the present invention, the training data may be medical text. It is known to those skilled in the art that the specific training method of the AI ​​model may be an existing method.

[0040] In an embodiment of the present invention, the method for obtaining the attention weight matrix corresponding to the text may be a prior art, for example, it may be derived from the corresponding processing device through a data export interface. The horizontal position identifier and the vertical position identifier in the matrix may be represented by numbers, each of which represents the position of the corresponding character in the corresponding text. For example, if the vertical position identifier is 3, it represents the third character in the text content in the initial text.

[0041] In the embodiment of the present invention, the characters may include Chinese characters, letters, punctuation marks, etc.

[0042] In an exemplary embodiment, R0 may be Figure 2 In the embodiment of the present invention, the weight of each column in the matrix is ​​a normalized weight, that is, ∑ m i=1 d ij =1.

[0043] Furthermore, in the embodiment of the present invention, different weights in the matrix may be displayed using different colors, and the specific display method may be the prior art.

[0044] S220, based on R0, obtain the keyword set of the initial text as the second keyword set KWI2 of the initial text = {KWI2 1 , KWI2 2 , ..., KWI2 k , ..., KWI2 Q}, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2.

[0045] Furthermore, KWI2 can be obtained through the following steps:

[0046] S2201, set j=1.

[0047] S2202, if j≤n, set i=1 and execute S2203, if j>n, execute S2207.

[0048] S2203, if i≤m, execute S2204, otherwise, execute S2206.

[0049] S2204, for d ij , if d ij ≥W0, d ij Corresponding vertical position mark LV i Add the current j-th candidate keyword set KWC j , execute S2205, otherwise, directly execute S2205, where KWC j The initial value of is empty, and W0 is the preset weight threshold.

[0050] In an exemplary embodiment of the present invention, W0 may be an empirical value. In another exemplary embodiment, W0=(1 / m)×k, where k is a preset coefficient, k>1. Preferably, k≥2.

[0051] S2205, set i=i+1, and execute S2203.

[0052] S2206, set j=j+1, and execute S2202.

[0053] S2207, obtain keyword intersection KWI = (KWC 1 ∩KWC 2 ∩……∩KWC j ∩……∩KWC n );Execute S2208.

[0054] For example, the text subscripts of “brain” in the medical text diagnosis are [23, 24, 24, 324, 324, 456, 457, 458, 459], and the text subscripts of “tumor” in the medical text diagnosis are [23, 24, 24, 456, 457, 550, 551, 552], then the intersection of the subscripts is [[23, 24, 24, 456, 457].

[0055] S2208, obtain KWI2 based on KWI.

[0056] Further, S2208 may specifically include:

[0057] S1, set variable r=1.

[0058] S2, if r≤p, execute S3, otherwise, execute S5; p is the number of longitudinal position identifiers in KWI.

[0059] S3, for the rth longitudinal position marker L in KWI r , if L r ≠(L r-1 +1) and L r ≠(Lr+1 -1), indicating that the identifier is an isolated 3, that is, the corresponding character is an isolated character, and add L r to the current set LS of abnormal position identifiers, and execute S4; otherwise, execute S4; the initial value of LS is empty.

[0060] S4, set r = r + 1, and execute S2.

[0061] S5, use the characters corresponding to the vertical position identifiers in KWI except those in LS as the first intermediate keyword, and use the continuous segments corresponding to the vertical position identifiers in LS as the second intermediate keyword; execute S6; the continuous segment is formed by the string in the initial text that contains the character corresponding to the corresponding vertical position identifier and is between two adjacent punctuation marks. For example, for the vertical position identifier 4, its corresponding continuous segment is the string in the initial text content that contains the 4th character of the text and is between two adjacent punctuation marks. Specifically, for example, for the text "A,..., poliomyelitis,..., B", if the character corresponding to a certain vertical position identifier in LS is "儿", then the corresponding continuous segment is "poliomyelitis".

[0062] S6, obtain the union of the first intermediate keyword and the second intermediate keyword as KWI2, that is, as the keyword corresponding to the initial text.

[0063] S230, based on KWI1 and KWI2, judge whether there is an abnormality in the initial text. If there is an abnormality, perform the corresponding processing operation on the initial text to obtain the corresponding target text; if there is no abnormality, use the initial text as the target text.

[0064] Further, S230 may specifically include:

[0065] S2301, set t = 1.

[0066] S2302, if t ≤ d, execute S2303, otherwise, execute S2308.

[0067] S2303, set k = 1.

[0068] S2304, if k ≤ Q, execute S2305, otherwise, execute S2307.

[0069] S2305, if the intersection I t of the set LVS1 of vertical position identifiers corresponding to KWI1 t and the set LVS2 of vertical position identifiers corresponding to KWI2 k is empty, execute S2306; if I k is empty, execute S2306; if I tk is empty, execute S2306; if I tkNot empty, but I tk Not equal to LVS1 t , determine KWI1 in the initial text t There is an abnormality and KWI1 t Add the initial text to the current exception description set corresponding to the initial text and execute S2306, otherwise, directly execute S2306; the initial value of the current exception description set corresponding to the initial text is empty.

[0070] In the embodiment of the present invention, LVS1 t Can be made by KWI1 t The vertical position marks corresponding to all characters in LVS2 are formed. k Can be provided by KWI2 k The vertical position marks corresponding to all characters in the text are formed. In theory, for the keyword KWI1 in the text t , the corresponding LVS1 t The corresponding weights should all be greater than the preset weight threshold W0. tk Not empty, but I tk Not equal to LVS1 t , explaining LVS1 in the initial text t The corresponding weight contains a vertical position marker that is less than W0, for example, LVS1 t is {1,2,3,4,5}. In theory, the initial text corresponds to LVS1 t The weights of all characters should be greater than W0. If LVS2 k is {1, 2, 4, 5}, then we can infer that the keyword KWI1 t There may be noise, which causes the weight of the position that should be large to be small, and denoising is needed.

[0071] S2306, set k=k+1, and execute S2304.

[0072] S2307, set t=t+1, and execute S2302.

[0073] S2308, if the current exception description set is not empty, modify the text content of the initial text, that is, modify the abnormal keywords, and use the modified initial text as the target text; if the current exception description set is empty, use the initial text as the target text.

[0074] In actual medical scenarios, doctors basically input medical texts into computers by hand, which inevitably leads to errors. For example, "CT examination" is mistakenly typed as "CAT examination", which will cause the prediction results to be inaccurate. Through S230, such errors can be found, thereby making the prediction results more accurate.

[0075] S240, based on the trained AI model, obtain the prediction result and the corresponding attention weight matrix R corresponding to the target text, and based on R, obtain the keywords corresponding to the target text.

[0076] In an embodiment of the present invention, the prediction result of the target text is obtained by inputting the text content included in the target text into the trained AI model, and the attention weight matrix R is the intermediate data of the trained AI model, and the element d in the uth row and vth column of the attention weight matrix R is uv Indicates the u-th vertical position marker LV u For the vth horizontal position mark LH v The attention weights, where LV u Corresponding to the uth character in the initial text, LH v Corresponding to the vth character in the prediction result, u takes a value from 1 to m, where m is the number of characters in the initial text, and v takes a value from 1 to n, where n is the number of characters in the prediction result of the target text.

[0077] Furthermore, the keywords of the target text can be obtained based on the following steps:

[0078] S10, set v=1.

[0079] S11, if v≤n, set u=1 and execute S12; if v>n, execute S12.

[0080] S12, if u≤m, execute S13, otherwise, execute S15.

[0081] S13, for d uv , if d uv ≥W0, d uv Corresponding vertical position mark LV u Add the current vth candidate keyword set KWC v , execute S14, otherwise, directly execute S14, where KWC v The initial value of is empty.

[0082] S14, set u=u+1, and execute S12.

[0083] S15, set v=v+1, and execute S11.

[0084] S16, obtain the keyword intersection KWI = (KWC 1 ∩KWC 2 ∩……∩KWC v ∩……∩KWC n ); execute S17.

[0085] S17. Obtain the keywords of the target text based on the KWI.

[0086] Further, S17 may specifically include:

[0087] S1701. Set the variable r = 1.

[0088] S1702. If r ≤ p, execute S1703; otherwise, execute S1705; p is the number of vertical position identifiers in the KWI.

[0089] S1703. For the r-th vertical position identifier L in the KWI r , if L r ≠ (L r-1 +1) and L r ≠ (L r+1 -1), it indicates that this identifier is an isolated identifier, that is, the corresponding character is an isolated character. Add L r to the current set LS of abnormal position identifiers, and execute S1704; otherwise, execute S1704; the initial value of LS is empty.

[0090] S1704. Set r = r + 1 and execute S1702.

[0091] S1705. Use the characters corresponding to the vertical position identifiers in the KWI except those in LS as the first intermediate keyword, and use the continuous segments corresponding to the vertical position identifiers in LS as the second intermediate keyword; execute S1706.

[0092] In the embodiments of the present invention, the continuous segment is formed by a string in the target text that contains the character corresponding to the corresponding vertical position identifier and is located between two adjacent punctuation marks. For example, for the vertical position identifier 4, its corresponding continuous segment is the string in the corresponding text content that contains the 4th character of the text and is located between two adjacent punctuation marks. Specifically, for example, for the text "A,..., poliomyelitis,..., B", if the character corresponding to a certain vertical position identifier in LS is "儿", then the corresponding continuous segment is "小儿麻痹症".

[0093] S1706. Obtain the union of the first intermediate keyword and the second intermediate keyword as the keyword corresponding to the target text.

[0094] S250. If the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, output a prompt message indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and visually display the keyword corresponding to the target text.

[0095] In the embodiments of the present invention, any method for visually displaying the keywords corresponding to the target text belongs to the protection scope of the present invention. For example, the keywords are highlighted in a set color. In actual application scenarios, such as medical application scenarios, doctors can know the reasons for the prediction results based on the prediction results and the obtained keywords. On the other hand, when the diagnosis results and the prediction results are inconsistent, there may be errors in the diagnosis results. The medical text can be adaptively modified according to the obtained keywords, so that the medical text can be made more accurate.

[0096] Based on the same inventive concept, an embodiment of the present invention provides a text keyword acquisition device, the device comprising:

[0097] The first acquisition module is used to acquire the keyword set of the initial text to be processed based on the preset reference keyword set corresponding to the initial text to be processed, as the first keyword set KWI1 of the initial text={KWI1 1 , KWI1 2 , ..., KWI1 t , ..., KWI1 d};KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 t The initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content.

[0098] The second acquisition module is used to obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text based on the trained AI model; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH j Corresponding to the j-th character in the prediction result, i ranges from 1 to m, where m is the number of characters in the initial text, and j ranges from 1 to n, where n is the number of characters in the prediction result.

[0099] The third acquisition module is used to acquire the keyword set of the initial text based on R0 as the second keyword set KWI2 of the initial text={KWI2 1 , KWI2 2 , ..., KWI2k , ..., KWI2 Q}, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2.

[0100] The target text acquisition module is used to judge whether there is an abnormality in the initial text based on KWI1 and KWI2. If there is an abnormality, the corresponding processing operation is performed on the initial text to obtain the corresponding target text; if there is no abnormality, the initial text is used as the target text.

[0101] The fourth acquisition module is used to obtain the prediction result and the corresponding attention weight matrix R corresponding to the target text based on the trained AI model, and based on R, obtain the keywords corresponding to the target text.

[0102] The output module is used to output prompt information indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and to visually display the keywords corresponding to the target text.

[0103] The device can be used to perform Figure 1 Therefore, for the functions that can be realized by each functional module of the device, please refer to Figure 1 The description of the illustrated embodiment is not repeated in detail.

[0104] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the embodiment of the present invention.

[0105] The embodiment of the present invention further provides a non-transitory computer-readable storage medium storing computer-executable instructions, wherein the computer instructions are used to execute the method described in the embodiment of the present invention.

[0106] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.

[0107] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A text processing method, characterized in that: The method comprises the following steps: S200, based on the reference keyword set corresponding to the initial text to be processed, obtaining the keyword set of the initial text to be processed as the first keyword set KWI1 of the initial text = {KWI11, KWI12, ..., KWI1 t , ..., KWI1 d };KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 t The initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content; S210, based on the trained AI model, obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH j Corresponding to the jth character in the prediction result, i ranges from 1 to m, where m is the number of characters in the original text, and j ranges from 1 to n, where n is the number of characters in the prediction result; S220, based on R0, obtain the keyword set of the initial text as the second keyword set KWI2 of the initial text = {KWI21, KWI22, ..., KWI2 k , ..., KWI2 Q }, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2; S230, based on KWI1 and KWI2, judging whether the initial text has an abnormality, if there is an abnormality, performing a corresponding processing operation on the initial text to obtain a corresponding target text; if there is no abnormality, taking the initial text as the target text; S240, based on the trained AI model, obtaining a prediction result and a corresponding attention weight matrix R corresponding to the target text, and based on R, obtaining a keyword corresponding to the target text; S250, if the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, outputting prompt information indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and visually displaying the keywords corresponding to the target text; Among them, KWI2 is obtained through the following steps: S2201, set j=1; S2202, if j≤n, set i=1 and execute S2203; if j>n, execute S2207; S2203, if i≤m, execute S2204, otherwise, execute S2206; S2204, for d ij , if d ij ≥W0, d ij Corresponding vertical position mark LV i Add the current j-th candidate keyword set KWC j , execute S2205, otherwise, directly execute S2205, where KWC j The initial value of is empty, W0 is the preset weight threshold; W0=(1 / m)×k, k is the preset coefficient, k>1; S2205, set i=i+1, and execute S2203; S2206, set j=j+1, and execute S2202; S2207, obtain the keyword intersection KWI = (KWC1∩KWC2∩……∩KWC j ∩……∩KWC n );Execute S2208; S2208, obtaining KWI2 based on KWI; S2208 specifically includes: S1, set variable r=1; S2, if r≤p, execute S3, otherwise, execute S5; p is the number of longitudinal position identifiers in KWI; S3, for the rth longitudinal position marker L in KWI r , if L r ≠(L r-1 +1) and L r ≠(L r+1 -1), L r Add to the current abnormal location identification set LS and execute S4; otherwise, execute S4; the initial value of LS is empty; S4, set r=r+1, execute S2; S5, using characters corresponding to the vertical position identifiers in KWI other than the vertical position identifier in LS as the first middle keyword, and using the continuous segment corresponding to the vertical position identifier in LS as the second middle keyword; executing S6; the continuous segment is formed by a character string in the target text that contains characters corresponding to the corresponding vertical position identifier and is located between two adjacent punctuation marks; S6, obtaining a union of the first intermediate keyword and the second intermediate keyword as KWI2.

2. The method according to claim 1, characterized in that S230 specifically includes: S2301, set t=1; S2302, if t≤d, execute S2303, otherwise, execute S2308; S2303, set k=1; S2304, if k≤Q, execute S2305, otherwise, execute S2307; S2305, if KWI1 t Corresponding vertical position identification set LVS1 t With KWI2 k Corresponding vertical position identification set LVS2 k The intersection of tk is empty, execute S2306; if I tk Not empty, but I tk Not equal to LVS1 t , determine KWI1 in the initial text t There is an abnormality and KWI1 t Add the current exception description set corresponding to the initial text and execute S2306; otherwise, directly execute S2306; the initial value of the current exception description set corresponding to the initial text is empty; S2306, set k=k+1, and execute S2304; S2307, set t=t+1, and execute S2302; S2308, if the current exception description set is not empty, modify the text content of the initial text and use the modified initial text as the target text; if the current exception description set is empty, use the initial text as the target text.

3. The method according to claim 1, characterized in that The initial text is a medical text.

4. A text processing device, characterized in that: The device comprises: The first acquisition module is used to acquire the keyword set of the initial text to be processed based on the reference keyword set corresponding to the initial text to be processed, as the first keyword set KWI1 of the initial text = {KWI11, KWI12, ..., KWI1 t , ..., KWI1 d };KWI1 t is the tth keyword in KWI1, the value of t ranges from 1 to d, and d is the value of KWI1 t The initial text to be processed includes text content and text description, and the text description is a description obtained based on the text content; The second acquisition module is used to obtain the prediction result and the corresponding attention weight matrix R0 corresponding to the initial text based on the trained AI model; wherein the prediction result is obtained by inputting the text content included in the initial text into the trained AI model, the attention weight matrix R0 is the intermediate data of the trained AI model, and the element d in the i-th row and j-th column of the attention weight matrix R0 is ij Indicates the i-th vertical position marker LV i For the jth horizontal position marker LH j The attention weights, where LV i Corresponding to the i-th character in the initial text, LH j Corresponding to the jth character in the prediction result, i ranges from 1 to m, where m is the number of characters in the original text, and j ranges from 1 to n, where n is the number of characters in the prediction result; The third acquisition module is used to acquire the keyword set of the initial text based on R0 as the second keyword set KWI2 of the initial text = {KWI21, KWI22, ..., KWI2 k , ..., KWI2 Q }, KWI2 k is the kth keyword in KWI2, k ranges from 1 to Q, and Q is the number of keywords in KWI2; A target text acquisition module is used to determine whether the initial text has an abnormality based on KWI1 and KWI2. If an abnormality exists, a corresponding processing operation is performed on the initial text to obtain a corresponding target text; if no abnormality exists, the initial text is used as the target text; A fourth acquisition module is used to acquire the prediction result and the corresponding attention weight matrix R corresponding to the target text based on the trained AI model, and acquire the keywords corresponding to the target text based on R; An output module is used for outputting a prompt message indicating that the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text when the prediction result corresponding to the target text is inconsistent with the text description corresponding to the target text, and visually displaying the keywords corresponding to the target text; Among them, KWI2 is obtained through the following steps: S2201, set j=1; S2202, if j≤n, set i=1 and execute S2203; if j>n, execute S2207; S2203, if i≤m, execute S2204, otherwise, execute S2206; S2204, for d ij , if d ij ≥W0, d ij Corresponding vertical position mark LV i Add the current j-th candidate keyword set KWC j , execute S2205, otherwise, directly execute S2205, where KWC j The initial value of is empty, W0 is the preset weight threshold; W0=(1 / m)×k, k is the preset coefficient, k>1; S2205, set i=i+1, and execute S2203; S2206, set j=j+1, and execute S2202; S2207, obtain the keyword intersection KWI = (KWC1∩KWC2∩……∩KWC j ∩……∩KWC n );Execute S2208; S2208, obtaining KWI2 based on KWI; S2208 specifically includes: S1, set variable r=1; S2, if r≤p, execute S3, otherwise, execute S5; p is the number of longitudinal position identifiers in KWI; S3, for the rth longitudinal position marker L in KWI r , if L r ≠(L r-1 +1) and L r ≠(L r+1 -1), L r Add to the current abnormal location identification set LS and execute S4; otherwise, execute S4; the initial value of LS is empty; S4, set r=r+1, execute S2; S5, using characters corresponding to the vertical position identifiers in KWI other than the vertical position identifier in LS as the first middle keyword, and using the continuous segment corresponding to the vertical position identifier in LS as the second middle keyword; executing S6; the continuous segment is formed by a character string in the target text that contains characters corresponding to the corresponding vertical position identifier and is located between two adjacent punctuation marks; S6, obtaining a union of the first intermediate keyword and the second intermediate keyword as KWI2.

5. An electronic device, characterized in that: including a processor and a memory; The processor is used to execute the steps of the method according to any one of claims 1 to 3 by calling the program or instruction stored in the memory.

6. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium is used to store a program or instruction, and the program or instruction enables a computer to execute the steps of the method according to any one of claims 1 to 3.