CN112347267B - Text processing method, device, computer equipment and storage medium - Google Patents
Text processing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112347267B CN112347267B CN202011232583.2A CN202011232583A CN112347267B CN 112347267 B CN112347267 B CN 112347267B CN 202011232583 A CN202011232583 A CN 202011232583A CN 112347267 B CN112347267 B CN 112347267B
- Authority
- CN
- China
- Prior art keywords
- text
- characters
- vector
- information
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 36
- 238000003860 storage Methods 0.000 title claims abstract description 15
- 239000013598 vector Substances 0.000 claims abstract description 493
- 238000000034 method Methods 0.000 claims abstract description 58
- 238000012545 processing Methods 0.000 claims abstract description 33
- 238000013528 artificial neural network Methods 0.000 claims description 77
- 238000012549 training Methods 0.000 claims description 20
- 238000000605 extraction Methods 0.000 claims description 18
- 230000007246 mechanism Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 8
- 238000010606 normalization Methods 0.000 claims description 6
- 238000004891 communication Methods 0.000 description 9
- 230000008569 process Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000012512 characterization method Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000008451 emotion Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 230000005484 gravity Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- AYNSTGCNKVUQIL-UHFFFAOYSA-N C(CCCCCCCCCCC)C=1C=CC(=C(C=1)C1=NC(=CC(=C1)N(CCN(C)C)C)C1=C(C=CC(=C1)CCCCCCCCCCCC)OC)OC Chemical compound C(CCCCCCCCCCC)C=1C=CC(=C(C=1)C1=NC(=CC(=C1)N(CCN(C)C)C)C1=C(C=CC(=C1)CCCCCCCCCCCC)OC)OC AYNSTGCNKVUQIL-UHFFFAOYSA-N 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/194—Calculation of difference between files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Molecular Biology (AREA)
- Mathematical Physics (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Databases & Information Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
The disclosure provides a text processing method, a text processing device, a computer device and a storage medium, wherein the method comprises the following steps: determining first importance degree information corresponding to each first character in the first text based on the acquired first text, and determining second importance degree information corresponding to each second character in the second text based on the acquired second text; determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors respectively corresponding to the plurality of first characters; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors corresponding to the plurality of second characters respectively; similarity information between the first text and the second text is determined based on the first target vector and the second target vector. The method reduces the influence of the characters with smaller semantic contribution to the text on the text characteristics, and improves the accuracy of the similarity result.
Description
Technical Field
The present disclosure relates to the field of natural language processing technologies, and in particular, to a text processing method, a text processing device, a computer device, and a storage medium.
Background
At present, similarity calculation between sentences is used for measuring similarity between different sentences, and is widely applied to the fields of information retrieval, customer service reply and the like. For example, when customer service replies automatically, by calculating the similarity between the user question information sent by the user and a plurality of preset question information contained in a pre-constructed standard question-answering library, a preset question sentence with highest similarity can be determined in the standard question-answering library, and a answer sentence corresponding to the preset question sentence is pushed to the user as automatic reply information.
The current way of determining the similarity between different sentences has the problem of lower accuracy.
Disclosure of Invention
The embodiment of the disclosure at least provides a text processing method, a text processing device, computer equipment and a storage medium.
In a first aspect, an embodiment of the present disclosure provides a text processing method, including:
determining first importance degree information corresponding to each first character in the first text based on the acquired first text, and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
Determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors corresponding to the first characters respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors respectively corresponding to the plurality of second characters;
similarity information between the first text and the second text is determined based on the first target vector and the second target vector.
In an optional embodiment, the determining, based on the first importance degree information and the first word vectors corresponding to the first characters, a first target vector characterizing first text semantic information includes:
and carrying out weighted summation on the first word vectors corresponding to the plurality of first characters respectively by using the first importance degree information to obtain the first target vector.
In an alternative embodiment, the determining similarity information between the first text and the second text based on the first target vector and the second target vector includes:
determining a vector distance between the first target vector and the second target vector;
And obtaining similarity information between the first text and the second text based on the vector distance.
In an alternative embodiment, the vector distance between the first target vector and the second target vector includes at least one of:
Euclidean distance, manhattan distance, chebyshev distance, minkowski distance, mahalanobis distance, angle cosine, and Hamming distance.
In an optional implementation manner, the determining, based on the acquired first text, first importance degree information corresponding to each first character in the first text includes:
Acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text respectively;
Processing the first feature sentence vector and first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vectors respectively;
and obtaining first importance degree information corresponding to the plurality of first characters based on the first relativity information between the plurality of first characters and the first feature sentence vector respectively.
In an optional implementation manner, the obtaining the first feature sentence vector of the first text and the first feature word vector corresponding to the plurality of first characters in the first text respectively includes:
acquiring a first text; wherein the first text includes a plurality of first characters;
Determining a first sentence vector corresponding to the first text based on the first text, and determining first word vectors corresponding to a plurality of first characters respectively based on the plurality of first characters in the first text;
And carrying out joint feature extraction on the first sentence vector and the first word vectors corresponding to the first characters respectively to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to the first characters in the first text.
In an optional implementation manner, the extracting the joint feature of the first sentence vector and the first word vectors corresponding to the first characters respectively includes:
And carrying out joint feature extraction on the first sentence vector and the first word vector corresponding to each of the plurality of first characters by utilizing a pre-trained neural network to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to each of the plurality of first characters in the first text.
In an optional implementation manner, the processing, by using an attention mechanism, the first feature sentence vector and first feature word vectors corresponding to the plurality of first characters respectively to obtain first relevance information between the plurality of first characters and the first feature sentence vector respectively includes:
For each first character in the plurality of first characters, determining a first feature word vector corresponding to each first character and a first distance between the first feature sentence vector and the first feature word vector;
And determining first relevance information between each first character and the first feature sentence vector based on the first distance.
In an alternative embodiment, the training the neural network includes:
Acquiring a sample text;
Obtaining sample correlation degree information between characters in the sample text and sample sentence vectors of the sample text respectively by using a neural network to be trained;
Determining the loss of the neural network to be trained based on the sample correlation information, and training the neural network to be trained based on the loss;
and obtaining the neural network through multiple rounds of training of the neural network to be trained.
In an alternative embodiment, the sample text includes: a first sample text and a second sample text;
the losses include at least one of a first loss, a second loss, and a third loss;
In the case that the loss includes the first loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
Determining a first loss based on first sample correlation information corresponding to the first sample text;
In the case that the loss includes the second loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
determining a second loss based on second sample correlation information corresponding to the second sample text;
in the case that the loss includes the third loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
sample similarity information between the first sample text and the second sample text is determined based on the first sample relevance information and the second sample relevance information, and a third penalty is determined based on the sample similarity information.
In an optional implementation manner, the obtaining, based on the first relevance information between the plurality of first characters and the first feature sentence vectors, first importance degree information corresponding to the plurality of first characters respectively includes:
and carrying out normalization processing on the first relevance information between the plurality of first characters and the first feature sentence vector respectively to obtain first importance degree information corresponding to the plurality of first characters respectively.
In an optional implementation manner, the obtaining, based on the first relevance information between the plurality of first characters and the first feature sentence vectors, first importance degree information corresponding to the plurality of first characters respectively includes:
determining a first target sentence vector representing the first text semantic based on first relativity information between the plurality of first characters and the first feature sentence vector respectively and first word vectors corresponding to the plurality of first characters respectively;
and determining first importance degree information corresponding to the first characters respectively based on the first target sentence vector and the first word vectors corresponding to the first characters respectively.
In a second aspect, an embodiment of the present disclosure further provides a text processing apparatus, including:
The first determining module is used for determining first importance degree information corresponding to each first character in the first text based on the acquired first text and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
The second determining module is used for determining a first target vector representing the first text semantic information based on the first importance degree information and first word vectors corresponding to the first characters respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors respectively corresponding to the plurality of second characters;
And a third determining module, configured to determine similarity information between the first text and the second text based on the first target vector and the second target vector.
In an optional implementation manner, the second determining module is configured to, when determining, based on the first importance degree information and first word vectors corresponding to the plurality of first characters, a first target vector representing first text semantic information:
and carrying out weighted summation on the first word vectors corresponding to the plurality of first characters respectively by using the first importance degree information to obtain the first target vector.
In an alternative embodiment, the third determining module is configured to, when determining similarity information between the first text and the second text based on the first target vector and the second target vector:
determining a vector distance between the first target vector and the second target vector;
And obtaining similarity information between the first text and the second text based on the vector distance.
In an alternative embodiment, the vector distance between the first target vector and the second target vector includes at least one of:
Euclidean distance, manhattan distance, chebyshev distance, minkowski distance, mahalanobis distance, angle cosine, and Hamming distance.
In an optional implementation manner, when determining, based on the acquired first text, first importance degree information corresponding to each first character in the first text, the first determining module is configured to:
Acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text respectively;
Processing the first feature sentence vector and first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vectors respectively;
and obtaining first importance degree information corresponding to the plurality of first characters based on the first relativity information between the plurality of first characters and the first feature sentence vector respectively.
In an optional implementation manner, the first determining module is configured to, when acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text, respectively:
acquiring a first text; wherein the first text includes a plurality of first characters;
Determining a first sentence vector corresponding to the first text based on the first text, and determining first word vectors corresponding to a plurality of first characters respectively based on the plurality of first characters in the first text;
And carrying out joint feature extraction on the first sentence vector and the first word vectors corresponding to the first characters respectively to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to the first characters in the first text.
In an optional implementation manner, the first determining module is configured to, when performing joint feature extraction on the first sentence vector and first word vectors corresponding to the plurality of first characters respectively:
And carrying out joint feature extraction on the first sentence vector and the first word vector corresponding to each of the plurality of first characters by utilizing a pre-trained neural network to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to each of the plurality of first characters in the first text.
In an optional implementation manner, the first determining module processes the first feature sentence vector and the first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relevance information between the first characters and the first feature sentence vector respectively, where the first relevance information includes:
For each first character in the plurality of first characters, determining a first feature word vector corresponding to each first character and a first distance between the first feature sentence vector and the first feature word vector;
And determining first relevance information between each first character and the first feature sentence vector based on the first distance.
In an alternative embodiment, the first determining module, when training the neural network, is configured to:
Acquiring a sample text;
Obtaining sample correlation degree information between characters in the sample text and sample sentence vectors of the sample text respectively by using a neural network to be trained;
Determining the loss of the neural network to be trained based on the sample correlation information, and training the neural network to be trained based on the loss;
and obtaining the neural network through multiple rounds of training of the neural network to be trained.
In an alternative embodiment, the sample text includes: a first sample text and a second sample text;
the losses include at least one of a first loss, a second loss, and a third loss;
In the case where the loss includes the first loss, the first determining module is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
Determining a first loss based on first sample correlation information corresponding to the first sample text;
in the case where the loss includes the second loss, the first determining module is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
determining a second loss based on second sample correlation information corresponding to the second sample text;
in the case where the loss includes the third loss, the first determining module is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
sample similarity information between the first sample text and the second sample text is determined based on the first sample relevance information and the second sample relevance information, and a third penalty is determined based on the sample similarity information.
In an optional implementation manner, the first determining module is configured to, when obtaining first importance degree information corresponding to the plurality of first characters based on first relevance degree information between the plurality of first characters and the first feature sentence vector, respectively:
and carrying out normalization processing on the first relevance information between the plurality of first characters and the first feature sentence vector respectively to obtain first importance degree information corresponding to the plurality of first characters respectively.
In an optional implementation manner, the first determining module is configured to, when obtaining first importance degree information corresponding to the plurality of first characters based on first relevance degree information between the plurality of first characters and the first feature sentence vector, respectively:
determining a first target sentence vector representing the first text semantic based on first relativity information between the plurality of first characters and the first feature sentence vector respectively and first word vectors corresponding to the plurality of first characters respectively;
and determining first importance degree information corresponding to the first characters respectively based on the first target sentence vector and the first word vectors corresponding to the first characters respectively.
In a third aspect, an optional implementation manner of the disclosure further provides a computer device, a processor, and a memory, where the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory, where the machine-readable instructions, when executed by the processor, perform the steps in the first aspect, or any possible implementation manner of the first aspect, when executed by the processor.
In a fourth aspect, an alternative implementation of the present disclosure further provides a computer readable storage medium having stored thereon a computer program which when executed performs the steps of the first aspect, or any of the possible implementation manners of the first aspect.
The description of the effects of the above text processing apparatus, computer device, and computer-readable storage medium is referred to the description of the above text processing method, and is not repeated here.
According to the embodiment of the disclosure, first importance degree information corresponding to each first character in a first text is utilized to determine a first target vector representing first text semantic information, second importance degree information corresponding to each second character in a second text is utilized to determine a second target vector representing second text semantic information, and similarity information between the first text and the second text is determined based on the first target vector and the second target vector; according to the method, the semantics of the first text and the second text are extracted, and the similarity information between the first text and the second text is determined based on the semantic extraction result, so that the influence of characters with smaller semantic contribution to the text on text characteristics is reduced, and the accuracy of a similarity result is improved.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the embodiments are briefly described below, which are incorporated in and constitute a part of the specification, these drawings showing embodiments consistent with the present disclosure and together with the description serve to illustrate the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of its scope, for the person of ordinary skill in the art may admit to other equally relevant drawings without inventive effort.
FIG. 1 illustrates a flow chart of a text processing method provided by an embodiment of the present disclosure;
FIG. 2 is a flowchart of a specific method for determining first importance degree information corresponding to each first character in a first text based on the obtained first text according to an embodiment of the present disclosure;
Fig. 3 is a flowchart of a specific method for obtaining a first feature sentence vector of a first text and first feature word vectors corresponding to a plurality of first characters in the first text according to an embodiment of the disclosure;
FIG. 4 illustrates a flow chart of a method of training a neural network provided by an embodiment of the present disclosure;
FIG. 5 is a flowchart of a specific method for determining first sample relevance information between first sample characters in a first sample text and first sample sentence vectors of the first sample text, respectively, according to an embodiment of the present disclosure;
FIG. 6 is a flowchart of a specific method for determining first relevance information between a plurality of first characters in a first text and a first feature sentence vector, respectively, according to an embodiment of the present disclosure;
FIG. 7 illustrates a flowchart of one particular method of determining a first target sentence vector that characterizes first text semantics provided by embodiments of the present disclosure;
FIG. 8 is a flowchart illustrating a specific method for determining first importance level information corresponding to a plurality of first characters based on a first target sentence vector and word vectors corresponding to the plurality of first characters, respectively, according to an embodiment of the present disclosure;
FIG. 9 shows a schematic diagram of a text processing device provided by an embodiment of the present disclosure;
Fig. 10 is a schematic diagram of a computer device structure according to an embodiment of the disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the disclosed embodiments generally described and illustrated herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
According to research, when determining the similarity between different texts, two branches in a neural network with a double-tower structure are generally utilized to extract the characteristic data of the different texts respectively, and the similarity between the different texts is determined based on the similarity between the characteristic data of the different texts. However, in practical application, because the contribution degrees of different characters in the text to the text semantics are different, when the similarity between the different texts is determined by the current processing mode, the character with the smaller contribution degree can interfere the feature data of the text, so that the feature data not only comprises the real semantic features of the text, but also comprises the features of other characters with smaller sharing degree in the text; the interference can cause feature data extracted for the text, so that the semantics of the text cannot be accurately represented, and therefore, when the similarity between different texts is determined based on the feature data obtained in the mode, the problem of low accuracy exists.
Based on the above research, the disclosure provides a text processing method, which extracts the semantics of a first text and a second text, and determines similarity information between the first text and the second text based on the extraction result of the semantics, thereby reducing the influence of characters with smaller semantic contribution to the text on text characteristics and improving the accuracy of the similarity result.
The present invention is directed to a method for manufacturing a semiconductor device, and a semiconductor device manufactured by the method.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
For the sake of understanding the present embodiment, first, a detailed description will be given of a text processing method disclosed in an embodiment of the present disclosure, where an execution subject of the text processing method provided in the embodiment of the present disclosure is generally a computer device having a certain computing capability, where the computer device includes, for example: the terminal device or server or other processing device may be a User Equipment (UE), mobile device, user terminal, cellular phone, cordless phone, personal digital assistant (Personal DIGITAL ASSISTANT, PDA), handheld device, computing device, vehicle mounted device, wearable device, etc. In some possible implementations, the text processing method may be implemented by way of a processor invoking computer readable instructions stored in a memory.
The text processing method provided by the embodiment of the present disclosure is described below.
Referring to fig. 1, a flowchart of a text processing method according to an embodiment of the disclosure is shown, where the method includes steps S101 to S103, where:
S101: determining first importance degree information corresponding to each first character in the first text based on the acquired first text, and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
S102: determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors respectively corresponding to the plurality of first characters; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors corresponding to the plurality of second characters respectively;
s103: similarity information between the first text and the second text is determined based on the first target vector and the second target vector.
According to the embodiment of the disclosure, first importance degree information corresponding to each first character in a first text is utilized to determine a first target vector representing first text semantic information, second importance degree information corresponding to each second character in a second text is utilized to determine a second target vector representing second text semantic information, and similarity information between the first text and the second text is determined based on the first target vector and the second target vector; according to the method, the semantics of the first text and the second text are extracted, and the similarity information between the first text and the second text is determined based on the semantic extraction result, so that the influence of characters with smaller semantic contribution to the text on text characteristics is reduced, and the accuracy of a similarity result is improved.
The following describes the above-mentioned steps S101 to S103 in detail.
For S101, the first importance degree information of the first text is similar to the second importance degree information of the second text, and the embodiment of the disclosure uses the first text as an example to determine the first importance degree information corresponding to each first character in the first text based on the acquired first text.
Referring to fig. 2, an embodiment of the present disclosure provides a method for determining first importance degree information corresponding to each first character in a first text based on the acquired first text, including:
s201: and acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to the plurality of first characters in the first text respectively.
The first text is, for example, a sentence, and the sentence may include one or more clauses; in the case that the first text includes multiple clauses, the multiple clauses include, for example, clauses that are obtained by performing intent segmentation on a segment of sentence by punctuation marks such as commas and stop signs and include fewer first characters, and each clause may include one or more first characters. In addition, the first text may be divided not by punctuation marks in the first text but by the expressed meaning of the first character in the first text.
Alternatively, the first text may be considered as a complete sentence without dividing it into separate sentences.
Specifically, when the text processing method provided by the embodiment of the present disclosure is applied to different scenes, the first text is also differentiated. For example, in the case where the text processing method is applied to information retrieval, a retrieval sentence input by a user may be used as a first text, for example, "what is a weighted sum operation? "what is the weighted sum operation" the question of this input is then? "as first text; when the text processing method is applied to customer service reply, dialogue information input by a user can be used as a first text, for example, when the user communicates with the customer service for a network course, communication information of 'hello, is of course today' is sent to the customer service, and the communication information of 'hello, is of course today' at this moment is used as the first text. Wherein, for the first text "hello, there is a lesson today" two clauses "hello" divided by comma, and "there is a lesson today".
In some possible embodiments, to increase accuracy, the first text may also include a symbol, such as "? "; or may also convert the symbols in the first text into corresponding words, e.g.,? "convert to" does "; or may also pay attention to questions, negatives, etc. to determine the user's true meaning. For example, "is there a class today? "whether there is a lesson today", "a lesson-present bar today" and "whether there is a lesson today" can be expressed by "the lesson-present bar today" and will not be described in detail.
In addition, emotion analysis can be performed on the first text, and the analysis result is used as a final first text, for example, emotion of the user is judged according to information input by the user, such as anger, and after the emotion state of the user is determined, the information input by the user is supplemented to obtain the final first text. For example, "without any reminder, I do not know at all whether there is a lesson today, resulting in I missing lessons, how you are responsible for-! "the user can judge" the user is angry, and the user misses the lesson because the user is not reminded, "and the like, and the method is not limited.
In one possible embodiment, the first text is not limited to a language, and may include chinese, english, japanese, korean, or other languages, for example, and may be a combination of languages. For example, the first text may include "How to update my information".
In a possible implementation manner, the first text may also be text information obtained by parsing audio and video information, picture information, and the like, which will not be described in detail.
Referring to fig. 3, an embodiment of the present disclosure provides a specific method for obtaining a first feature sentence vector of a first text and first feature word vectors corresponding to a plurality of first characters in the first text, where the specific method includes:
s301: acquiring a first text; wherein the first text includes a plurality of first characters.
For example, in the case of applying the text processing method to information retrieval, a retrieval sentence input by a user in a retrieval box may be obtained; under the condition that the text processing method is applied to customer service reply, the communication information sent by the user in the dialog box can be directly extracted, or the communication information sent by the user can be extracted from a database for storing the communication information of the user. The specific acquisition method can be determined according to actual situations, and is not described herein.
At this time, the acquired first text includes a plurality of first characters. For example, in the case where the first text contains "hello, is there a lesson today", two clauses "hello", and "is there a lesson today" contained in the first text may be determined; and a plurality of first characters "you", "good", "present", "day", "have", "class", and "do".
S302: based on the first text, a first sentence vector corresponding to the first text is determined, and based on a plurality of first characters in the first text, a first word vector corresponding to each of the plurality of first characters is determined.
When determining the first sentence vector corresponding to the first text and the first word vector corresponding to the plurality of first characters in the first text, for example, vector encoding may be performed on the first text and the first word vector corresponding to the plurality of first characters in the first text to determine the first sentence vector and the plurality of first word vectors, where the dimensions of the obtained first sentence vector and the plurality of first word vectors are the same. Wherein the vector encoding comprises at least one of: one-Hot Encoding (One-Hot Encoding), tag Encoding (Label Encoder, LE).
For example, in the case where the first text contains "hello, is lesson today," two clauses "hello" contained in the sample text and the first sentence vector corresponding to "lesson today" may be determined using vector encoding, and may be represented as CLS 1 and CLS 2, for example. At this time, for the first sentence vector CLS 1 corresponding to the clause "hello", the first character corresponding to CLS 1 includes: "you", "good", the first word vector corresponding to the first character may be represented, for example, as E 1、E2; for the first sentence vector CLS 2 corresponding to the phrase "lesson today", the first character corresponding to CLS 2 includes: the first word vector corresponding to the first character may be represented as E 3、E4、……、E7, for example.
In addition, "hello, there is a lesson today" can be directly used as the same clause, namely as a complete first character string, "hello, there is a lesson today". At this time, the first sentence vector of the clause may be expressed as: CLS 3, the first character corresponding to the clause includes: the first word vector corresponding to the first character may be represented as E 1、E2、……、E7, for example, "hello," present, "" daily, "" present, "" lesson, "and" moldy.
At this time, unstructured and non-computable text data can be converted into structured and computable vector data, which facilitates further computing processing of the first text.
S303: and carrying out joint feature extraction on the first sentence vector and the first word vectors corresponding to the first characters respectively to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to the first characters in the first text.
When extracting the joint feature of the first sentence vector and the first word vector corresponding to the plurality of first characters, for example, the following manner may be adopted: and carrying out joint feature extraction on the first sentence vector and the first word vector corresponding to each of the plurality of first characters by utilizing a pre-trained neural network to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to each of the plurality of first characters in the first text.
The neural network may include, for example, at least one of: a language-aware depth bi-directional transformer (Deep Bidirectional Transformers for Language Understanding, BERT), a global vector model (Global Vectors for Word Representation, gloVe), a Word vector generation model (Word to vector, word2 vec).
When the first sentence vector and the first word vectors corresponding to the plurality of first characters are subjected to joint feature extraction, the obtained first feature sentence vector is influenced by the first sentence vectors and the first word vectors corresponding to all the first characters, and not only contains the integral features of the first text, but also contains the first character features of all the first characters; similarly, the obtained first feature word vector is influenced by the first word vector corresponding to the first feature word vector and the first sentence vector corresponding to other first characters, so that the obtained first feature word vector also comprises the features of other first characters and the integral features of the first text besides the features corresponding to the first characters, and thus, the association among different first characters, the first characters and the first text is established.
And then, processing the first feature word vector based on the first feature sentence vector and the first feature word vector corresponding to the first characters respectively through an attention mechanism, so that when first correlation information between the first characters and the first feature sentence vector is obtained, the obtained first correlation information has higher accuracy, and further, the first importance degree information corresponding to each first character obtained based on the first correlation information also has higher accuracy.
Referring to fig. 4, an embodiment of the disclosure further provides a method for training a neural network, including:
S401: acquiring a sample text;
S402: obtaining sample correlation degree information between characters in a sample text and sample sentence vectors of the sample text respectively by using a neural network to be trained;
s403: determining the loss of the neural network to be trained based on the sample correlation information, and training the neural network to be trained based on the loss;
s404: and obtaining the neural network through multiple rounds of training of the neural network to be trained.
In an implementation, the acquired sample text includes: the first sample herein, or includes: a first sample text and a second sample text.
For the case that the sample text includes the first sample text, the first sample text may include text information collected in a network, such as comment information under online class learning software; or may include stored historical communication information for the user. The specific method for obtaining the first sample may be determined according to actual needs, which is not described herein.
At this time, under the condition that the number of characters contained in the first sample text is smaller than the preset number, all characters in the text can be used as important characters for representing the semantics of the sample text because of the too small number of characters in the text, and at this time, the first sample text and the second sample text can be directly subjected to text processing to determine sample similarity information between the first sample text and the second sample text. The preset number is, for example, 2, 3, or 4. The setting can be specifically performed according to actual needs.
In the case that the number of characters contained in the first sample text is greater than or equal to the preset number, for example, the first sample text includes "ask for questions, how to renew fees", two clauses "ask for questions", and "how to renew fees" contained in the first sample text can be determined; and a plurality of first sample characters "please", "ask", "how", "continue", and "fee".
In the case of determining the first sample, referring to fig. 5, an embodiment of the present disclosure provides a specific method for determining first sample correlation information between first sample characters in the first sample text and first sample sentence vectors of the first sample text, respectively, including:
S501: based on the first sample text and the plurality of first sample characters in the first sample text, a first sample sentence vector corresponding to the first sample text and a first sample word vector corresponding to the first characters in the first sample text can be determined by vector coding.
For example, in the case where the first sample includes "please ask, how to renew," the two clauses "please ask", and the first sample sentence vector corresponding to "how to renew" included in the first sample may be determined by using vector encoding, and may be represented as cls 1, and cls 2; and a plurality of first sample words "please", "ask", "how", "follow", and "fee" included in the first sample text correspond to the first sample word vector, which may be represented as e 1、e2、……、e6, for example.
S502: based on a first sample sentence vector corresponding to the first sample text and first sample word vectors corresponding to at least two first sample characters respectively, determining a first sample feature sentence vector corresponding to the first sample sentence vector and a first sample feature word vector corresponding to the first sample characters respectively by utilizing a neural network to be trained.
For example, in the case that the first sample includes "please ask for a fee", based on the first sample sentence vector cls 1 and the cls 2 and the first sample word vector e 1、e2、……、e6, the first sample sentence vector and the first sample word vector are extracted in a parallel processing manner by using the neural network to be trained, so as to determine a first sample feature sentence vector corresponding to the first sample sentence vector, which may be expressed as cls 1'、cls2'; and a first sample feature word vector to which the first sample characters respectively correspond, may be represented as o 1、o2、……、o6, for example.
In the case of determining a first sample feature sentence vector and a plurality of first sample feature word vectors by using the neural network to be trained, any one of the first sample feature sentence vectors and the first sample feature word vectors is obtained by integrating all of the first sample sentence vectors and the first sample word vectors in the first sample text, that is, any one of the first sample feature sentence vectors and the first sample feature word vectors contains all of the clauses in the first sample text and the features of the first sample characters. Taking the first sample feature word vector o 1 as an example, when the neural network to be trained is used to determine the first sample feature word vector o 1 corresponding to the first sample word vector e 1, the neural network simultaneously synthesizes all the vector features of the remaining first sample sentence vectors cls 1、cls2 and the first sample word vector e 2、e3、……、e6.
At this time, since any one of the obtained first sample feature sentence vector and the first sample feature word vector contains all the clauses in the sample text and the features of the first sample character, the influence of the context semantic association degree and the sentence length in the sentence can be reduced.
S503: and processing the first sample feature word vectors corresponding to the at least two first sample characters respectively through an attention mechanism to obtain first sample relativity information between the at least two first sample characters and the first sample feature sentence vectors.
In one possible implementation, a concentration model (Attention) may be used to process sample word vectors corresponding to at least two first sample characters, respectively, and determine sample first correlation information between the at least two first sample characters and the first feature sentence vector, respectively. Wherein the at least two first characters may be obtained, for example, by a ranking method, the ranking method comprising, for example, a document pair ranking method (PAIRWISE RANK, PR).
At this point, the first sample may be represented, for example, as s 1, and the relative importance between the two first sample characters determined in sample text s 1 may be predetermined, i.e., for the two first sample characters determined, one of the first sample characters may be determined to be more important than the other first sample character. The two first sample characters determined may be denoted as ti 1 + and tj 1 -, respectively, where ti 1 + and tj 1 -represent two different first sample characters, "+" represents a higher importance level and "-" represents a lower importance level.
At this time, the first sample correlation information obtained by processing the first sample feature word vector by the attention mechanism may be represented by a 1(s1,ti1 +) and a 1(s1,tj1 -, for example.
In the case of determining the first sample correlation degree information, the first loss may be determined based on the first sample correlation degree information, including: the first penalty is determined based on first sample relevance information corresponding to the first sample text.
In one possible embodiment, the first loss may be determined, for example, using the following equation (1):
L1(s1,ti1+,tj1-)=exp(a1(s1,ti1+))/(exp(a1(s1,ti1+))+exp(a1(s1,tj1-))) (1)
Wherein L 1(s1,ti1+,tj1 -) represents a first loss. Under the condition that the neural network is used for determining that the ti 1 + is higher than tj 1 -in importance degree, the obtained L 1(s1,ti1+,tj1 -) is a positive value, for example, and the judgment of the neural network on the importance of the first character is correct; in the case that the neural network is used for determining that the t 1 + is lower than the tj 1 -in importance degree, the obtained L 1(s1,ti1+,tj1 -) is a negative value, for example, and the judgment error of the neural network on the importance of the first character is represented.
Under the condition of determining the first loss, the neural network to be trained can be adjusted and optimized according to the first loss, and the direction of adjustment and optimization is adjusted to obtain more loss L 1(s1,ti1+,tj1 -), which represents that the importance of the first character is correctly judged, of the first sample, namely the neural network obtains more results that the importance of the first character and/or the second character is correctly judged.
At this time, the neural network may also be trained for multiple rounds using the plurality of first samples to obtain the neural network. The specific process of the multi-round training is not described in detail herein.
For the case that the sample text includes the first sample text and the second sample text, the second sample is obtained in a similar manner to the manner of obtaining the first sample text, which is not described herein. Similarly, a specific method for determining the second sample correlation information based on the second sample text is similar to a method for determining the first sample correlation information based on the first sample text in the case that the sample text includes the first sample text, and will not be described herein.
In one possible implementation, the first penalty may be determined based on the first sample correlation information; and/or determining a second penalty based on the second sample correlation information; and/or determining sample similarity information between the first sample text and the second sample text based on the first sample relevance information and the second sample relevance information, and determining a third penalty based on the sample similarity information. At this time, the loss of the neural network to be trained includes at least one of a first loss, a second loss, and a third loss.
Wherein the second loss may be represented, for example, as L 2(s2,ti2+,tj2 -). The manner of determining the second loss is similar to the manner of determining the first loss L 1(s1,ti1+,tj1 -) described above, and will not be described in detail herein.
When the third loss is determined, the third loss may be determined based on sample similarity information determined from the first sample correlation information and the second sample correlation information, and a difference between preset similarity information between the predetermined first sample text and the predetermined second sample text, which may be represented as L 3, for example.
In one possible implementation, the first sample vector may be determined based on the first sample correlation information and the first sample word vector. For example, the first sample vector may be weighted using the first sample correlation degree information to determine the first sample vector. Likewise, a second sample vector may be determined based on the second sample correlation information and the second sample word vector.
In the case of determining the first sample vector and the second sample vector, the sample similarity information REL of the first sample vector and the second sample vector may be determined by using the neural network, and may be represented as rel=0.8 in the form of a numerical value, for example, and may be represented as rel=0.9 in the form of a numerical value, for example, at this time, the third loss L 3 may be determined according to the following equation (2):
L3=|rel-REL| (2)
at this time, the neural network may be trained based on at least one of the first loss, the second loss, and the third loss.
In one possible implementation manner, the neural network to be trained may be adjusted and optimized according to the determined loss of the neural network to be trained, and in the case that the loss includes at least one of the first loss and the second loss, the direction of adjustment and optimization is adjusted to obtain more loss L 1(s1,ti1+,tj1 -) representing that the importance of the first sample character is correctly judged and/or loss L 2(s2,ti2+,tj2 -) representing that the importance of the second sample character is correctly judged, that is, the neural network obtains more results that the importance of the first character and/or the second character is correctly judged; in the case that the loss includes the third loss, the direction of model training is the direction in which the obtained third loss is smaller, that is, the direction in which the sample similarity information determined by using the neural network is closer to the preset similarity information.
At this time, the neural network may be trained for multiple rounds by using the plurality of first sample texts and the plurality of second sample texts, so as to obtain the neural network. The specific process of the multi-round training is not described in detail herein.
For the case where the sample text includes the second sample text, similar to the case where the sample text includes the first sample text, the description thereof will be omitted.
In the case of a neural network, the first text may be processed using the neural network.
For example, in the case that the first text includes "the lesson exists today", the first sentence vector CLS 2 and the first word vector E 3、E4、……、E7 corresponding to the neural network may be used to perform joint feature extraction, so as to obtain a first feature sentence vector corresponding to the first text, which may be represented as CLS 2', and a first feature word vector corresponding to each of a plurality of first characters in the first text, for example, may be represented as O 3、O4、……、O7. The method of extracting the joint features is similar to the method of extracting the joint features of the sample sentence vector and the sample word vector in S303, and is not described herein.
After training the above process to obtain the neural network, after obtaining the first text, firstly converting the first text into a first sentence vector and a first word vector, and then inputting the first sentence vector and the first word vector of the first text into the neural network to obtain a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text.
The method for determining the first importance degree information in S201 further includes:
S202: and processing the first feature sentence vector and the first feature word vector corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vector.
After the first feature sentence vector corresponding to the first text and the first feature word vector corresponding to the plurality of first characters in the first text are obtained through S201, the first feature sentence vector and the first feature word vector corresponding to the plurality of first characters respectively can be processed through a attention mechanism, so as to obtain first relativity information between the plurality of first characters and the first feature sentence vector respectively.
Referring to fig. 6, the embodiment of the disclosure further provides a specific method for determining first relevance information between a plurality of first characters in a first text and first feature sentence vectors, including:
S601: for each first character of the plurality of first characters, a first distance between a first feature word vector corresponding to each first character and a first feature sentence vector is determined.
Wherein the first feature word vector corresponding to each first character and the first distance between the first feature sentence vector comprise at least one of the following: euclidean distance, mahalanobis distance, hamming distance, and manhattan distance. In the case of determining the first distance between the first feature word vector corresponding to each first character and the first feature sentence vector, a corresponding first distance calculating method may be determined, which is not described herein.
S602: first relevance information between each first character and the first feature sentence vector is determined based on the first distance.
In a specific implementation, taking the example of obtaining the first feature word vector corresponding to each first character and the euclidean distance between the first feature sentence vector, when the euclidean distance between any first character and the first feature sentence vector is larger, the correlation degree between the first character and the first feature sentence vector is characterized to be lower; and when the Euclidean distance between any first character and the first feature sentence vector is smaller, the correlation degree between the first character and the first feature sentence vector is higher.
In one possible implementation manner, for example, the first relevance information between each first character and the first feature sentence vector may be determined based on a relative magnitude relation of the euclidean distance between the first feature word vector and the first feature sentence vector corresponding to each first character, and for example, the maximum first distance among the euclidean distances between the first feature word vector and the first feature sentence vector corresponding to each first character may be determined as a metric, and the proportional relation between the euclidean distance between the first feature word vector and the first feature sentence vector corresponding to each first character and the metric may be determined as the first relevance information between each first character and the first feature sentence vector.
For example, in the case where the first text includes "hello, and there is a lesson today," the first relevance information between each first character and the first feature sentence vector in the obtained first text may be represented as R 1、R2、……、R7, for example.
The method for determining the first importance degree information in S202 further includes:
S203: and obtaining first importance degree information corresponding to the first characters based on the first relativity information between the first characters and the first feature sentence vector.
In the case of determining the first relevance information between each first character and the first feature sentence vector in the first text, first importance degree information corresponding to each of the plurality of first characters may be obtained based on the first relevance information, where the first importance degree information may be represented as λ i, for example, where the value of i is determined by the number of first characters, that is, each first character corresponds to the first importance degree information λ i.
Illustratively, in the case where the first text contains "hello, there is a lesson today," the first importance degree information corresponding to each of the first characters in the first text includes λ 1、λ2、……、λ7, respectively.
The first importance level information may include, for example, a value representing an importance level, for example, 0.1 and 0.4, wherein 0.1 represents a lower importance level than 0.4 and 0.4 represents a lower importance level than 0.1; or a number of levels characterizing the importance level, e.g. 1,2, 3.
In the case that the first importance degree information includes the number of levels representing the importance level, the meaning of the number of levels may also be set, and in the case that the number of levels of the importance level includes 1, 2, and 3, for example, it may be set that the number of levels is larger to represent that the importance degree is higher, that is, when the first importance degree information is 3, the importance degree is higher; or the characterization importance degree with larger number of stages can be set to be lower, namely, the characterization importance degree is lower when the first importance degree information is 3.
In another embodiment, the value of the correlation degree may be directly determined as the first importance degree information.
In another embodiment, a plurality of correlation intervals may be predetermined, where each correlation interval corresponds to a importance level value; when the correlation between a certain first feature word vector and a first feature sentence vector falls into a certain similarity interval, determining an importance degree value corresponding to the correlation interval as first importance degree information of the first feature word vector.
In determining the first degree of importance information based on the first degree of relatedness information between the plurality of first characters and the first feature sentence vector, for example, at least one of the following (b 1) and (b 2) may be employed, but is not limited to:
(b1) : and carrying out normalization processing on the first relativity information between the plurality of first characters and the first feature sentence vector respectively to obtain first importance degree information corresponding to the plurality of first characters respectively.
In one possible implementation manner, for example, a normalization function (Softmax) may be used to normalize the first relevance information between the plurality of first characters and the first feature sentence vector, so as to obtain first importance degree information of the plurality of first characters. At this time, the obtained first importance degree information of the plurality of first characters includes a plurality of numerical values corresponding to the first characters, respectively.
For example, in the case of "hello, and there is a lesson today" of the first text, the obtained first importance degree information corresponding to the plurality of first characters "hello", "present", "day", "present", "lesson", and "lesson" respectively may be represented as λ1=0.05、λ2=0.05、λ3=0.2、λ4=0.2、λ5=0.2、λ6=0.2、λ7=0.1,, for example, representing that the most important words in the first text are "today" and "lesson".
(B2) : determining a first target sentence vector representing first text semantics based on first relativity information between the plurality of first characters and the first feature sentence vector respectively and word vectors corresponding to the plurality of first characters respectively; and determining first importance degree information corresponding to the first characters respectively based on the first target sentence vector and the word vectors corresponding to the first characters respectively.
Referring to fig. 7, an embodiment of the present disclosure provides a specific method for determining a first target sentence vector representing a first text semantic, including:
S701: for each first character of the plurality of first characters, a first midword vector corresponding to each first character is determined based on first relevance information between each first character and the first feature sentence vector.
In one possible implementation manner, in a case where the obtained first relevance information between each first character and the first feature sentence vector in the first text includes R 1、R2、……、R7 and the word vectors corresponding to the plurality of first characters respectively include E 1、E2、……、E7, the word vector corresponding to the first character may be weighted by using the first relevance information between each first character and the first feature sentence vector in the first text, to obtain a first intermediate word vector corresponding to each first character, which may be denoted as C 1、C2、……、C7, for example. The first intermediate word vector C i, i e [1,7] corresponding to any first character may be obtained, for example, by using the following formula (3):
Ci=RiEi (3)
S702: and summing the first intermediate word vectors corresponding to the first characters respectively to obtain a first target sentence vector.
In the case of determining the first intermediate word vectors to which the plurality of first characters respectively correspond, the first intermediate word vectors to which the plurality of first characters respectively correspond may be summed to obtain a first target sentence vector that characterizes the first text semantic, which may be represented as CLS aim, for example.
Illustratively, in the case of characterizing the first target sentence vector with the matrix vector, the first text contains "hello, and the corresponding first target sentence vector when there is a lesson today may be expressed as, for example, the following formula (4):
CLSaim=[C1,C2,…,C7] (4)
in the case of determining the first target sentence vector, first importance degree information corresponding to each of the plurality of first characters may be determined.
Referring to fig. 8, an embodiment of the present disclosure provides a specific method for determining first importance degree information corresponding to a plurality of first characters based on a first target sentence vector and word vectors corresponding to the plurality of first characters, respectively, including:
s801: for each first character in the plurality of first characters, splicing a word vector corresponding to each first character and a first target sentence vector to obtain a third target vector corresponding to each first character;
S802: and obtaining first importance degree information corresponding to the plurality of first characters respectively by utilizing a probability model based on third target vectors corresponding to the plurality of first characters respectively.
In the case of determining the first target sentence vector, the word vector corresponding to each first character and the first target sentence vector may be spliced to obtain a third target vector corresponding to each first character, which may be expressed asAnd representing a third target vector corresponding to the ith first character.
In the case of determining corresponding first importance degree information for third object vectors corresponding to the plurality of first characters, respectively, using a probability model, the probability model includes at least one of: conditional random field models (Conditional Random Field, CRF), maximum entropy models (Maximum Entropy Markov Model, MEMM), markov Models (MM). At this time, the result output by the probability model may include importance levels 1,2, 3, for example.
For example, when the preset importance level value is higher and the importance is higher, when the first text includes "hello, there is a lesson today", the obtained first importance degree information corresponding to the plurality of first characters "you", "hello", "present", "on day", "there", "lesson", and "lesson" may be represented as λ 1=1、λ2=1、λ3=3、λ4=3、λ5=3、λ6=3、λ7 =2, and the more important words in the first text are represented as "today" and "lesson".
For S102, the first target vector and the second target vector are obtained in a similar manner, and the embodiment of the disclosure will be described by taking determining the first target vector based on the first importance degree information and the first word vectors corresponding to the plurality of first characters, respectively, as an example.
Wherein the first target vector may be represented as, for exampleFirst target vector/>The number of elements in (a) is equal to the number of elements of the first word vector. At this time, since the corresponding first importance degree information is referred to when the first target vector is determined based on the first word vector, the words of higher importance degree are assigned with higher specific gravity, and words of lower importance degree are assigned with lower specific gravity, so that the feature of the vocabulary of higher importance has a higher duty ratio in the first target vector.
When the first word vectors corresponding to the plurality of first characters are weighted and summed by using the first importance degree information to obtain the first target vector, for example, at least one of the following (c 1) and (c 2) may be used but not limited to:
(c1) : when the obtained first importance degree information of the plurality of first characters includes a plurality of numerical values corresponding to the first characters, the first importance degree information corresponding to the plurality of first characters may be used as an importance weight value to perform weighted summation on the first word vectors corresponding to the plurality of first characters, so as to obtain a first target vector. Wherein the first target vector Any element/>For example, the following formula (5) can be used:
(c2) : when the obtained first importance degree information of the plurality of first characters includes a plurality of importance level values corresponding to the first characters, for example, a preset weight value corresponding to the importance level value may be used to perform weighted summation on first word vectors corresponding to the plurality of first characters, so as to obtain a first target vector.
In one possible embodiment, a corresponding preset weight value may be determined for each importance level value. At this time, the corresponding preset weight value determined by the importance level value corresponding to each first character may be represented as λ i', for example.
For example, in the case that the importance level value includes 1,2, and 3, the preset weight values corresponding to the importance level values are, for example, 0.1, 0.5, and 0.8. For example, when the value of importance is 1, the corresponding preset weight value is 0.1.
At this time, the corresponding preset weight value λ i' may be determined based on the importance level value corresponding to each first character, and the first target vector may be obtained by performing weighted summation based on the first word vector corresponding to each first character. Wherein the first target vectorAny element/>For example, the following formula (6) can be used:
The method for determining the second target vector based on the second importance degree information and the second word vectors corresponding to the plurality of second characters respectively is similar to the method for determining the first target vector in S102, and will not be described herein.
For S103, the similarity information may include, for example, a value representing the degree of similarity, for example, 0.1 and 0.9, where 0.1 represents a lower similarity than 0.9 and 0.9 represents a higher similarity than 0.1; or include a series of levels characterizing the similarity levels, including I, II, III, for example.
In the case that the similarity information includes the number of levels representing the similarity level, the meaning of the number of levels may be set, and in the case that the number of levels of the similarity level includes I, II, III, for example, the number of levels may be set to be larger, that is, when the similarity information is III, the degree of representing the similarity is higher; or the number of the stages is smaller, that is, the degree of the characterization similarity is higher when the similarity information is I.
In determining the similarity information between the first text and the second text, for example, the following manner may be adopted: determining a vector distance between the first target vector and the second target vector; and obtaining similarity information between the first text and the second text based on the vector distance.
Wherein, in determining the vector distance between the first target vector and the second target vector, the vector distance comprises at least one of the following: euclidean distance, manhattan distance, chebyshev distance, minkowski distance, mahalanobis distance, angle cosine, and Hamming distance. In the case of determining the vector distance, a calculation method of the corresponding vector distance may be determined, which will not be described herein.
In the case of determining the first target vector and the second target vector, similarity information between the first text and the second text may be obtained.
In one possible implementation, the value of the resulting vector distance may be determined directly as similarity information; or a plurality of similarity intervals can be predetermined, and each similarity interval corresponds to a similarity degree value; when the vector distance between the first target vector and the second target vector falls into a certain similarity interval, determining a similarity degree value corresponding to the interval as similarity information between the first text and the second text.
Taking a customer service reply scene as an example, in the case that a user sends text information including "hello, is in class today", the first text is "hello, is in class today". The predetermined standard question-answering library may include a plurality of preset question information, for example, including "whether a course exists today" and "whether a renewal is required for the course now". At this time, when the preset question information "whether or not there is a course today" is used as the second text to perform text processing in the case where the similarity information includes a numerical value representing the degree of similarity, the obtained similarity information between the first text and the second text is, for example, 0.8; when the preset question information "whether the present course needs to be renewed" is used as the second text to perform text processing, the obtained similarity information between the first text and the second text is, for example, 0.2, that is, the second text "whether the present course is present" and the first text "hello", and the similarity degree of the present course is higher than that of the second text "whether the present course needs to be renewed" and the first text. At this time, the "present course today" may be used as the preset question information with the highest similarity to the first text, and the preset answer corresponding to the preset question information "present course today" may be pushed to the user as the best matching automatic reply information.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiments of the present disclosure further provide a text processing device corresponding to the text processing method, and since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to that of the text processing method in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 9, a schematic diagram of a text processing apparatus according to an embodiment of the disclosure is provided, where the apparatus includes: a first determination module 91, a second determination module 92, a third determination module 93; wherein,
A first determining module 91, configured to determine, based on the obtained first text, first importance degree information corresponding to each first character in the first text, and determine, based on the obtained second text, second importance degree information corresponding to each second character in the second text;
A second determining module 92, configured to determine a first target vector representing first text semantic information based on the first importance degree information and first word vectors corresponding to the plurality of first characters, respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors respectively corresponding to the plurality of second characters;
A third determining module 93, configured to determine similarity information between the first text and the second text based on the first target vector and the second target vector.
In an alternative embodiment, the second determining module 92 is configured to, when determining the first target vector representing the first text semantic information based on the first importance level information and the first word vectors corresponding to the plurality of first characters, respectively:
and carrying out weighted summation on the first word vectors corresponding to the plurality of first characters respectively by using the first importance degree information to obtain the first target vector.
In an alternative embodiment, the third determining module 93 is configured to, when determining the similarity information between the first text and the second text based on the first target vector and the second target vector:
determining a vector distance between the first target vector and the second target vector;
And obtaining similarity information between the first text and the second text based on the vector distance.
In an alternative embodiment, the vector distance between the first target vector and the second target vector includes at least one of:
Euclidean distance, manhattan distance, chebyshev distance, minkowski distance, mahalanobis distance, angle cosine, and Hamming distance.
In an alternative embodiment, the first determining module 91 is configured to, when determining, based on the obtained first text, first importance degree information corresponding to each first character in the first text, respectively:
Acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text respectively;
Processing the first feature sentence vector and first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vectors respectively;
and obtaining first importance degree information corresponding to the plurality of first characters based on the first relativity information between the plurality of first characters and the first feature sentence vector respectively.
In an alternative embodiment, the first determining module 91 is configured to, when acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text, respectively:
acquiring a first text; wherein the first text includes a plurality of first characters;
Determining a first sentence vector corresponding to the first text based on the first text, and determining first word vectors corresponding to a plurality of first characters respectively based on the plurality of first characters in the first text;
And carrying out joint feature extraction on the first sentence vector and the first word vectors corresponding to the first characters respectively to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to the first characters in the first text.
In an alternative embodiment, the first determining module 91 is configured to, when performing joint feature extraction on the first sentence vector and first word vectors corresponding to the plurality of first characters respectively:
And carrying out joint feature extraction on the first sentence vector and the first word vector corresponding to each of the plurality of first characters by utilizing a pre-trained neural network to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to each of the plurality of first characters in the first text.
In an alternative embodiment, the first determining module 91 processes the first feature sentence vector and the first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relevance information between the first characters and the first feature sentence vectors respectively, where the first relevance information includes:
For each first character in the plurality of first characters, determining a first feature word vector corresponding to each first character and a first distance between the first feature sentence vector and the first feature word vector;
And determining first relevance information between each first character and the first feature sentence vector based on the first distance.
In an alternative embodiment, the first determining module 91 is configured to, when training the neural network:
Acquiring a sample text;
Obtaining sample correlation degree information between characters in the sample text and sample sentence vectors of the sample text respectively by using a neural network to be trained;
Determining the loss of the neural network to be trained based on the sample correlation information, and training the neural network to be trained based on the loss;
and obtaining the neural network through multiple rounds of training of the neural network to be trained.
In an alternative embodiment, the sample text includes: a first sample text and a second sample text;
the losses include at least one of a first loss, a second loss, and a third loss;
In the case that the loss includes the first loss, the first determining module 91 is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
Determining a first loss based on first sample correlation information corresponding to the first sample text;
In the case that the loss includes the second loss, the first determining module 91 is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
determining a second loss based on second sample correlation information corresponding to the second sample text;
In the case that the loss includes the third loss, the first determining module 91 is configured to, when determining the loss of the neural network to be trained based on the sample correlation information:
sample similarity information between the first sample text and the second sample text is determined based on the first sample relevance information and the second sample relevance information, and a third penalty is determined based on the sample similarity information.
In an alternative embodiment, the first determining module 91 is configured to, when obtaining the first importance degree information corresponding to the first characters based on the first relevance information between the first characters and the first feature sentence vectors, respectively:
and carrying out normalization processing on the first relevance information between the plurality of first characters and the first feature sentence vector respectively to obtain first importance degree information corresponding to the plurality of first characters respectively.
In an alternative embodiment, the first determining module 91 is configured to, when obtaining the first importance degree information corresponding to the first characters based on the first relevance information between the first characters and the first feature sentence vectors, respectively:
determining a first target sentence vector representing the first text semantic based on first relativity information between the plurality of first characters and the first feature sentence vector respectively and first word vectors corresponding to the plurality of first characters respectively;
and determining first importance degree information corresponding to the first characters respectively based on the first target sentence vector and the first word vectors corresponding to the first characters respectively.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
The embodiment of the disclosure further provides a computer device, as shown in fig. 10, which is a schematic structural diagram of the computer device provided by the embodiment of the disclosure, including:
A processor 10 and a memory 20; the memory 20 stores machine readable instructions executable by the processor 10, the processor 10 being configured to execute the machine readable instructions stored in the memory 20, the machine readable instructions when executed by the processor 10, the processor 10 performing the steps of:
determining first importance degree information corresponding to each first character in the first text based on the acquired first text, and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
Determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors corresponding to the first characters respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors respectively corresponding to the plurality of second characters;
similarity information between the first text and the second text is determined based on the first target vector and the second target vector.
The memory 20 includes a memory 2021 and an external memory 2022; the memory 2021 is also referred to as an internal memory, and is used to temporarily store operation data in the processor 10 and data exchanged with the external memory 2022 such as a hard disk, and the processor 10 exchanges data with the external memory 2022 via the memory 2021.
The specific execution process of the above instruction may refer to the steps of the text processing method described in the embodiments of the present disclosure, which is not described herein.
The disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the text processing method described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
Embodiments of the present disclosure further provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to perform steps of a text processing method described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims (14)
1. A text processing method, comprising:
determining first importance degree information corresponding to each first character in the first text based on the acquired first text, and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors corresponding to the first characters respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors corresponding to the plurality of second characters respectively;
determining similarity information between the first text and the second text based on the first target vector and the second target vector;
The method for determining the first importance degree information corresponding to each first character in the first text based on the acquired first text comprises the following steps: acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text respectively; processing the first feature sentence vector and first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vectors respectively; and obtaining first importance degree information corresponding to the plurality of first characters based on the first relativity information between the plurality of first characters and the first feature sentence vector respectively.
2. The text processing method according to claim 1, wherein the determining a first target vector representing first text semantic information based on the first importance degree information and first word vectors corresponding to the plurality of first characters, respectively, includes:
and carrying out weighted summation on the first word vectors corresponding to the plurality of first characters respectively by using the first importance degree information to obtain the first target vector.
3. The text processing method according to claim 1, wherein the determining similarity information between the first text and the second text based on the first target vector and the second target vector includes:
determining a vector distance between the first target vector and the second target vector;
And obtaining similarity information between the first text and the second text based on the vector distance.
4. A text processing method according to claim 3, wherein the vector distance between the first target vector and the second target vector comprises at least one of:
Euclidean distance, manhattan distance, chebyshev distance, minkowski distance, mahalanobis distance, angle cosine, and Hamming distance.
5. The method of claim 1, wherein the obtaining the first feature sentence vector of the first text and the first feature word vector corresponding to the plurality of first characters in the first text respectively includes:
acquiring a first text; wherein the first text includes a plurality of first characters;
Determining a first sentence vector corresponding to the first text based on the first text, and determining first word vectors corresponding to a plurality of first characters respectively based on the plurality of first characters in the first text;
And carrying out joint feature extraction on the first sentence vector and the first word vectors corresponding to the first characters respectively to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to the first characters in the first text.
6. The text processing method according to claim 5, wherein the performing joint feature extraction on the first sentence vector and the first word vectors corresponding to the plurality of first characters respectively includes:
And carrying out joint feature extraction on the first sentence vector and the first word vector corresponding to each of the plurality of first characters by utilizing a pre-trained neural network to obtain a first feature sentence vector corresponding to the first text and a first feature word vector corresponding to each of the plurality of first characters in the first text.
7. The text processing method according to claim 1, wherein the processing the first feature sentence vector and the first feature word vectors corresponding to the plurality of first characters by the attention mechanism to obtain first relevance information between the plurality of first characters and the first feature sentence vector respectively includes:
For each first character in the plurality of first characters, determining a first feature word vector corresponding to each first character and a first distance between the first feature sentence vector and the first feature word vector;
And determining first relevance information between each first character and the first feature sentence vector based on the first distance.
8. The text processing method of claim 6, wherein training the neural network comprises:
Acquiring a sample text;
Obtaining sample correlation degree information between characters in the sample text and sample sentence vectors of the sample text respectively by using a neural network to be trained;
Determining the loss of the neural network to be trained based on the sample correlation information, and training the neural network to be trained based on the loss;
and obtaining the neural network through multiple rounds of training of the neural network to be trained.
9. The text processing method of claim 8, wherein the sample text comprises: a first sample text and a second sample text;
the losses include at least one of a first loss, a second loss, and a third loss;
In the case that the loss includes the first loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
Determining a first loss based on first sample correlation information corresponding to the first sample text;
In the case that the loss includes the second loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
determining a second loss based on second sample correlation information corresponding to the second sample text;
in the case that the loss includes the third loss, the determining, based on the sample correlation information, a loss of the neural network to be trained includes:
sample similarity information between the first sample text and the second sample text is determined based on the first sample relevance information and the second sample relevance information, and a third penalty is determined based on the sample similarity information.
10. The text processing method according to claim 1, wherein the obtaining the first importance degree information corresponding to the plurality of first characters based on the first relevance degree information between the plurality of first characters and the first feature sentence vector, respectively, includes:
and carrying out normalization processing on the first relevance information between the plurality of first characters and the first feature sentence vector respectively to obtain first importance degree information corresponding to the plurality of first characters respectively.
11. The text processing method according to claim 1, wherein the obtaining the first importance degree information corresponding to the plurality of first characters based on the first relevance degree information between the plurality of first characters and the first feature sentence vector, respectively, includes:
determining a first target sentence vector representing the first text semantic based on first relativity information between the plurality of first characters and the first feature sentence vector respectively and first word vectors corresponding to the plurality of first characters respectively;
and determining first importance degree information corresponding to the first characters respectively based on the first target sentence vector and the first word vectors corresponding to the first characters respectively.
12. A text processing apparatus, comprising:
The first determining module is used for determining first importance degree information corresponding to each first character in the first text based on the acquired first text and determining second importance degree information corresponding to each second character in the second text based on the acquired second text;
the second determining module is used for determining a first target vector representing the first text semantic information based on the first importance degree information and first word vectors corresponding to the first characters respectively; and determining a second target vector representing second text semantic information based on the second importance degree information and a plurality of second word vectors corresponding to the plurality of second characters respectively;
a third determining module, configured to determine similarity information between the first text and the second text based on the first target vector and the second target vector;
The first determining module is used for determining first importance degree information corresponding to each first character in the first text respectively based on the acquired first text: acquiring a first feature sentence vector of the first text and first feature word vectors corresponding to a plurality of first characters in the first text respectively; processing the first feature sentence vector and first feature word vectors corresponding to the first characters respectively through an attention mechanism to obtain first relativity information between the first characters and the first feature sentence vectors respectively; and obtaining first importance degree information corresponding to the plurality of first characters based on the first relativity information between the plurality of first characters and the first feature sentence vector respectively.
13. A computer device, comprising: a processor, a memory storing machine readable instructions executable by the processor for executing machine readable instructions stored in the memory, which when executed by the processor, perform the steps of the text processing method of any of claims 1 to 11.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a computer device, performs the steps of the text processing method according to any one of claims 1 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011232583.2A CN112347267B (en) | 2020-11-06 | 2020-11-06 | Text processing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011232583.2A CN112347267B (en) | 2020-11-06 | 2020-11-06 | Text processing method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112347267A CN112347267A (en) | 2021-02-09 |
CN112347267B true CN112347267B (en) | 2024-05-10 |
Family
ID=74428490
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011232583.2A Active CN112347267B (en) | 2020-11-06 | 2020-11-06 | Text processing method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112347267B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113420118A (en) * | 2021-06-24 | 2021-09-21 | 联仁健康医疗大数据科技股份有限公司 | Data correlation analysis method and device, electronic terminal and storage medium |
CN114970551A (en) * | 2022-07-27 | 2022-08-30 | 阿里巴巴达摩院(杭州)科技有限公司 | Text processing method and device and electronic equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108509410A (en) * | 2017-02-27 | 2018-09-07 | 广东神马搜索科技有限公司 | Text semantic similarity calculating method, device and user terminal |
CN108829818A (en) * | 2018-06-12 | 2018-11-16 | 中国科学院计算技术研究所 | A kind of file classification method |
CN110825845A (en) * | 2019-10-23 | 2020-02-21 | 中南大学 | Hierarchical text classification method based on character and self-attention mechanism and Chinese text classification method |
CN111611355A (en) * | 2019-02-25 | 2020-09-01 | 北京嘀嘀无限科技发展有限公司 | Dialog reply method, device, server and storage medium |
US10824922B1 (en) * | 2018-12-12 | 2020-11-03 | Amazon Technologies, Inc. | Similarity detection system |
-
2020
- 2020-11-06 CN CN202011232583.2A patent/CN112347267B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108509410A (en) * | 2017-02-27 | 2018-09-07 | 广东神马搜索科技有限公司 | Text semantic similarity calculating method, device and user terminal |
CN108829818A (en) * | 2018-06-12 | 2018-11-16 | 中国科学院计算技术研究所 | A kind of file classification method |
US10824922B1 (en) * | 2018-12-12 | 2020-11-03 | Amazon Technologies, Inc. | Similarity detection system |
CN111611355A (en) * | 2019-02-25 | 2020-09-01 | 北京嘀嘀无限科技发展有限公司 | Dialog reply method, device, server and storage medium |
CN110825845A (en) * | 2019-10-23 | 2020-02-21 | 中南大学 | Hierarchical text classification method based on character and self-attention mechanism and Chinese text classification method |
Also Published As
Publication number | Publication date |
---|---|
CN112347267A (en) | 2021-02-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110134971B (en) | Method and device for machine translation and computer readable storage medium | |
CN110781663B (en) | Training method and device of text analysis model, text analysis method and device | |
US11010554B2 (en) | Method and device for identifying specific text information | |
CN110737763A (en) | Chinese intelligent question-answering system and method integrating knowledge map and deep learning | |
CN108763535B (en) | Information acquisition method and device | |
CN109740158B (en) | Text semantic parsing method and device | |
JP7139626B2 (en) | Phrase generation relationship estimation model learning device, phrase generation device, method, and program | |
CN114580382A (en) | Text error correction method and device | |
CN112347267B (en) | Text processing method, device, computer equipment and storage medium | |
CN111241237A (en) | Intelligent question and answer data processing method and device based on operation and maintenance service | |
CN109977203B (en) | Sentence similarity determining method and device, electronic equipment and readable storage medium | |
CN111859940B (en) | Keyword extraction method and device, electronic equipment and storage medium | |
CN110162596B (en) | Training method and device for natural language processing, automatic question answering method and device | |
CN113705313A (en) | Text recognition method, device, equipment and medium | |
CN115238143A (en) | Query statement generation method and device, model training method, equipment and medium | |
CN113449514A (en) | Text error correction method and device suitable for specific vertical field | |
Voleti et al. | Investigating the effects of word substitution errors on sentence embeddings | |
CN113723116A (en) | Text translation method and related device, electronic equipment and storage medium | |
CN117332112A (en) | Multimodal retrieval model training, multimodal retrieval method, electronic device, and storage medium | |
CN110659392B (en) | Retrieval method and device, and storage medium | |
CN114861673A (en) | Semantic analysis method, device and equipment | |
CN113095065B (en) | Chinese character vector learning method and device | |
CN115510232A (en) | Text sentence classification method and classification device, electronic equipment and storage medium | |
CN116975288A (en) | Text processing method and text processing model training method | |
KR20230171234A (en) | Method for Providing Question-and-Answer Service Based on User Participation And Apparatus Therefor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |