CN114548046B - Text processing method and device - Google Patents

Text processing method and device Download PDF

Info

Publication number
CN114548046B
CN114548046B CN202210436844.5A CN202210436844A CN114548046B CN 114548046 B CN114548046 B CN 114548046B CN 202210436844 A CN202210436844 A CN 202210436844A CN 114548046 B CN114548046 B CN 114548046B
Authority
CN
China
Prior art keywords
text
signal
pulse signal
hidden state
processed
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
Application number
CN202210436844.5A
Other languages
Chinese (zh)
Other versions
CN114548046A (en
Inventor
万宇
杨宝嵩
刘大一恒
张海波
陈博兴
谢军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Damo Institute Hangzhou Technology Co Ltd
Original Assignee
Alibaba Damo Institute Hangzhou Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Alibaba Damo Institute Hangzhou Technology Co Ltd filed Critical Alibaba Damo Institute Hangzhou Technology Co Ltd
Priority to CN202210436844.5A priority Critical patent/CN114548046B/en
Publication of CN114548046A publication Critical patent/CN114548046A/en
Application granted granted Critical
Publication of CN114548046B publication Critical patent/CN114548046B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the specification provides a text processing method and a text processing device, wherein the text processing method comprises the following steps: determining a text signal at the current moment and a hidden state signal at the previous moment according to the text matrix; converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal; constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal; and processing the pulse signal to be processed to obtain a target text signal corresponding to the current moment.

Description

Text processing method and device
Technical Field
The embodiment of the specification relates to the technical field of machine learning, in particular to a text processing method and device.
Background
With the development of computer technology, the application of neural networks becomes more and more extensive. The neural network in the prior art includes a large number of linear transformations, which results in high energy consumption and larger computation demand in practical application. And is not beneficial to popularization and use on mobile terminal equipment. For the traditional neural network structure design, a large amount of linear transformation means that a large amount of matrix multiplication operations are needed, and the calling energy consumption of floating-point number multiplication operators is much higher than that of addition, so that a high-performance computer is needed in the application stage to support the operation of the floating-point number multiplication operators, the application cost requirement is high, and the application range limitation is large; there is therefore a need for an effective solution to the above problems.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide two text processing methods. One or more embodiments of the present specification relate to two text processing apparatuses, a computing device, a computer-readable storage medium, and a computer program, so as to solve technical deficiencies in the prior art.
According to a first aspect of embodiments herein, there is provided a text processing method including:
determining a text signal at the current moment and a hidden state signal at the previous moment according to the text matrix;
converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal;
and processing the pulse signal to be processed to obtain a target text signal corresponding to the current moment.
According to a second aspect of embodiments herein, there is provided a text processing apparatus including:
the signal determining module is configured to determine a text signal at the current moment and a hidden state signal at the previous moment according to the text matrix;
the conversion signal module is configured to convert the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
a constructing signal module configured to construct a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal;
and the signal processing module is configured to process the pulse signal to be processed to obtain a target text signal corresponding to the current moment.
According to a third aspect of embodiments herein, there is provided another text processing method including:
acquiring a text matrix corresponding to a text to be processed;
determining a text signal corresponding to the current moment and a hidden state signal at the previous moment according to the text matrix;
converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal, and generating a target text signal corresponding to the current moment according to the pulse signal to be processed;
and under the condition that the text matrix processing is finished, generating a target text corresponding to the text to be processed according to the target text signal corresponding to each moment.
According to a fourth aspect of embodiments herein, there is provided another text processing apparatus including:
the acquisition module is configured to acquire a text matrix corresponding to the text to be processed;
the determining module is configured to determine a text signal corresponding to the current moment and a hidden state signal at the previous moment according to the text matrix;
the conversion module is configured to convert the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
the construction module is configured to construct a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal, and generate a target text signal corresponding to the current moment according to the pulse signal to be processed;
and the generating module is configured to generate a target text corresponding to the text to be processed according to the target text signal corresponding to each moment under the condition that the text matrix processing is completed.
According to a fifth aspect of embodiments herein, there is provided a computing device comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions that when executed by the processor implement the steps of the text processing method described above.
According to a sixth aspect of embodiments herein, there is provided a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the text processing method described above.
According to a seventh aspect of embodiments herein, there is provided a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-described text processing method.
In order to reduce the consumption cost of computing resources, the text processing method provided by the present specification may determine, according to the text matrix, a text signal to be processed at the present time and a hidden state signal at the previous time after the text matrix is obtained; then, a text signal and a hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; the method has the advantages that the text is processed by using the impulse neural network, energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
Drawings
Fig. 1 is a flowchart of a text processing method provided in an embodiment of the present specification;
FIG. 2 is a diagram illustrating pulse conversion in a text processing method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating backpropagation in a method for processing text according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present specification;
FIG. 5 is a flow diagram of another method of text processing provided by one embodiment of the present description;
FIG. 6 is a schematic structural diagram of another text processing apparatus provided in an embodiment of the present specification;
FIG. 7 is a flowchart illustrating a text processing method according to an embodiment of the present disclosure;
fig. 8 is a block diagram of a computing device according to an embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present description. This description may be embodied in many different forms and should not be construed as limited to the embodiments set forth herein, as those skilled in the art will be able to make and use the present disclosure without departing from the spirit and scope of the present disclosure.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first can also be referred to as a second and, similarly, a second can also be referred to as a first without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
First, the noun terms to which one or more embodiments of the present specification relate are explained.
Machine Learning (ML): machine learning is the discipline that studies how to extract knowledge from data.
Deep Learning (DL): deep learning, which is a branch of machine learning. In contrast to traditional machine learning methods, deep learning attempts to acquire, manipulate, and exercise knowledge from a large amount of data using multiple processing layers with the ability to model nonlinear transformation mappings.
Neural Machine Translation (NMT): neural network machine translation, referred to as neural machine translation for short, is the latest generation of machine translation technology. The artificial neural network is used as a main framework of the model, and the neural machine translation method can translate source end information to a target end and realize a cross-language translation task.
BLEU: the most common machine translation quality evaluation method is characterized in that the score is a percentage system, and the higher the score is, the better the effect is.
Transformer: a model framework, the transform model, is a multi-layer model. In the broad sense, the transform Network layer (transform layer) contains two sublayers, which are respectively defined by a self-attention Network (SAN) and a feed-forward Network (FFN) as main frameworks, and combines residual connection (residual normalization) and layer normalization (layer normalization).
Naturalllangugerasureindexing (nlu): natural language understanding, and performing probabilistic modeling on language data by using a deep learning model, so that the model has language knowledge and can be used by other natural language processing tasks.
Pretrainedlanguage model (plm): and pre-training a language model, and performing probability modeling on the language through a large amount of linguistic data and a designed learning task. PLM can be considered as an implementation of NLU. Compared with the traditional method, the PLM can obtain better effect in downstream tasks, such as BERT, by means of the knowledge contained in a large amount of pre-training corpora. In recent years, multilingual PLM has also been able to provide strong support for non-English and cross-language tasks, such as XLM-R.
Spiking Neural Network (SNN): the impulse neural network is a neural network for processing time sequence information. And converting the continuous representation in the space into a time sequence signal through differential modeling so as to enable the model to carry out subsequent processing and processing.
Convolitional Neural Network (CNN): the convolutional neural network has a main structure including a convolution kernel (also called a filter), a pooling layer (pooling), and batch normalization. The convolution kernel is used to process multiple input representations within the corresponding region, and the entire CNN can perform a window sliding operation on all representations to repeat the representation processing work of the convolution kernel to obtain the final output.
Recurrentneuralnetwork (rnn): and the recurrent neural network uses the output of the previous moment as the input of the current moment so as to realize the network architecture for cyclically using the network parameters. Such as Gated Recurrent Units (GRUs).
In the present specification, two text processing methods are provided, and the present specification relates to two text processing apparatuses, a computing device, a computer-readable storage medium, and a computer program, which are described in detail one by one in the following examples.
In practical application, when a natural language understanding task is processed, language understanding is mostly realized on the basis of methods such as a Transformer, a recurrent neural network or knowledge distillation; wherein, based on the language understanding of the Transformer: existing pre-trained language models, such as BERT, are designed based on a Transformer model. Each layer of the network may be split into two sub-modules: self-attention networks (SAN) and feed-forward neural networks (FFN). The SAN receiving input
Figure 815396DEST_PATH_IMAGE001
Query, key and value representations are obtained by linear transformation:
Figure 160926DEST_PATH_IMAGE002
Figure 389913DEST_PATH_IMAGE003
Figure 453684DEST_PATH_IMAGE004
(ii) a Wherein
Figure 59109DEST_PATH_IMAGE005
Are all model parametersNumber, d is the model dimension, l represents the text length; then SAN calculates attention weight, carries out weighted summation on the representation, obtains output which is subjected to linear transformation once again, and adds residual error linkage and layer normalization (layerormanization):
Figure 462409DEST_PATH_IMAGE006
Figure 986931DEST_PATH_IMAGE007
(ii) a Wherein,
Figure 147785DEST_PATH_IMAGE008
. FFN will represent
Figure 681535DEST_PATH_IMAGE009
And (3) performing linear transformation twice, taking ReLU as a nonlinear activation function in the middle, and adding residual linkage and layer normalization to the final output:
Figure 939341DEST_PATH_IMAGE010
(ii) a Although the purpose of natural language understanding can be achieved, a large amount of linear transformation is used in network design, and a large amount of computing resources and energy consumption are needed in actual use, so that the popularization of mobile terminal equipment is not facilitated.
And based on the linguistic understanding of the recurrent neural network: semantic processing and understanding of text is achieved using recurrent neural networks (e.g., GRUs). The gated cyclic unit performs semantic modeling using the same set of parameters, receiving the semantic representations x in sequence over a time series t And hidden state h of last moment t-1 As inputs:
Figure 775710DEST_PATH_IMAGE011
Figure 814073DEST_PATH_IMAGE012
(ii) a Wherein,
Figure 89196DEST_PATH_IMAGE013
;W c and
Figure 139192DEST_PATH_IMAGE014
the model parameters are identified, r and z represent gated representations of the reset gate and the update gate, respectively,
Figure 5517DEST_PATH_IMAGE015
representing a Hadamard operation. The scheme and the Transformer model have similar energy consumption and cannot be applied to the mobile equipment.
The knowledge distillation scheme is to use a small model to learn the output of a large model, and then use the small model in a scene with low energy consumption and few computing resources. Although the energy consumption can be reduced by the scheme, the energy consumption reduction angle is the reduced model scale, and the center of the scheme is not optimized from the angle of an operator. There is therefore a need for an effective solution to the above problems.
In order to reduce the consumption cost of computing resources, the text processing method provided by the present specification may determine, according to the text matrix, a text signal to be processed at the present time and a hidden state signal at the previous time after the text matrix is obtained; then, a text signal and a hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; the text is processed by using the impulse neural network, so that the energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
That is to say, the text processing method provided in this specification completes a natural language processing task based on a pulse neural network, completes a language understanding module in different natural language processing tasks by using SNN, reduces the number of times of operator calls with high energy consumption, and appropriately increases the number of times of operator calls with low energy consumption, thereby achieving balance between model performance and energy consumption reduction, and achieving reduction of energy consumption on the premise of maintaining prediction capability, thereby supporting operation in a mobile device, improving a scene coverage range, and achieving application to a wider service environment.
Fig. 1 is a flowchart illustrating a text processing method according to an embodiment of the present specification, which specifically includes the following steps.
And S102, determining a text signal at the current moment and a hidden state signal at the previous moment according to the text matrix.
Specifically, the text matrix is a matrix corresponding to a text to be processed which needs to be processed in the natural language understanding task; correspondingly, the text to be processed specifically refers to a text that needs to be processed in response to a natural language understanding task, and the natural language understanding task includes, but is not limited to, text translation, topic extraction, text classification, and the like. Correspondingly, the current time is specifically the time when the impulse neural network processes any word unit when processing the text matrix. Correspondingly, the last time specifically refers to the time when another word unit before the word unit is processed. Correspondingly, the text signal specifically refers to a vector expression corresponding to the word unit processed at the current moment; correspondingly, the hidden state signal specifically refers to a vector expression obtained by processing a vector expression corresponding to the word unit at the previous time, and is used for fusing the text signal with the vector expression at the current time to realize the prediction processing operation on the word unit at the current time.
That is to say, when the spiking neural network processes the natural language understanding task, the input at each moment is combined with the hidden state signal at the previous moment, so that the output at the current moment can be superimposed with the signal at the previous moment, and the output at the current moment can be more related to the upper and lower text contents.
Referring to the schematic diagram shown in fig. 2, in the text processing method provided in this embodiment, when the impulse neural network processes a natural language understanding task, the text signal is first transposed into a discrete impulse signal, then the corresponding voltage energy is calculated, when the energy exceeds a set threshold, a sending operation (Fire) is performed, and so on, until the text to be processed is completely processed, the impulse neural network outputs the impulse signal, and then the original representation is restored, so that a result of natural language understanding, such as a translated text, a text theme, a text type, and the like, can be obtained.
The text processing method provided in this embodiment refers to a processing procedure at any time when any text is processed in a natural language understanding task, and for any processing time of the same text in the task, the same or corresponding description contents in this embodiment may be referred to, and are not described in detail herein.
For convenience of description, the present embodiment is described by taking an example of an application of the text processing method in a text translation scenario, and the same or corresponding description contents may be referred to for an application process in other natural language understanding scenarios, which is not described herein in any greater detail.
Based on the above, after the text matrix corresponding to the text to be processed in the text translation task is obtained, the text matrix is translated through the pulse neural network, in the process, the text signal is extracted from the text matrix at each processing moment, and meanwhile, in order to improve the translation accuracy, the hidden state signal at the previous moment is also obtained, so that the translation result at the current moment can be conveniently determined in a subsequent combination manner.
Further, when determining the text signal at the current time, considering that the content included in the text matrix is possibly more, and the text signals corresponding to different word units are sequentially processed at different times, so that the accuracy can be ensured only by sequentially processing according to the set sequence, in this embodiment, the specific implementation manner is as follows:
acquiring a text to be processed, and constructing a text matrix corresponding to the text to be processed; and selecting the text signal corresponding to the current moment in the text matrix according to a preset processing rule.
Specifically, the text to be processed specifically refers to a text that needs to be processed in the natural language understanding task; correspondingly, the preset processing rule specifically refers to a rule for processing each word unit in the text to be processed, and defines the processing sequence and the processing mode of the word unit.
Based on this, after the processed text is obtained, in order to complete the natural language understanding task through the impulse neural network, the text to be processed may be converted into a text matrix that can be recognized by the neural network; and then selecting a signal corresponding to the word unit to be processed corresponding to the current moment in the text matrix according to a preset processing rule to serve as the text signal of the current moment for subsequent natural language understanding processing.
In practical application, the construction of the text matrix can be completed based on a preset dictionary, that is, each word unit in the text to be processed is mapped into a set dictionary, and the text matrix is fused according to the vector expression corresponding to each word unit in the dictionary; then or processing the text to be processed through an encoder to obtain a coding vector as a text matrix; in practical application, the construction of the text matrix may be selected according to practical application scenarios, and the embodiment is not limited herein.
In summary, by selecting the text signal corresponding to the current time according to the preset processing rule, sequential processing can be realized during natural language understanding, so that the processing precision can be effectively improved.
Furthermore, after the text signal corresponding to the current time is determined, considering that the impulse neural network processes each text signal in a cyclic processing manner when processing, the hidden state representation of the previous time is required in the cyclic process, and therefore the hidden state signal of the previous time is also required to be determined; in this embodiment, the specific implementation manner is as follows:
acquiring a pulse signal to be processed corresponding to the last moment; and performing language understanding processing on the pulse signal to be processed corresponding to the previous moment through a hidden state layer to obtain the hidden state signal of the previous moment.
Specifically, the pulse signal to be processed corresponding to the previous time is a pulse signal obtained by fusing a text signal at the previous time and a hidden state signal at the previous time, and the obtained pulse signal to be processed at the previous time is not subjected to language understanding processing; correspondingly, the hidden state layer is specifically a layer for realizing natural language understanding, a corresponding hidden state signal is obtained through a pulse signal processed by the hidden state layer, and a corresponding final state representation can be obtained through processing by an output layer of the pulse neural network.
Based on this, after the text signal corresponding to the current time is determined according to the text matrix, the previous time can be determined at this time, then the pulse signal to be processed which is not subjected to language understanding at the previous time is read, and then the pulse signal to be processed at the previous time is subjected to language understanding processing operation through the hidden state layer, so that the intermediate output at the previous time, namely the hidden state layer at the previous time, can be obtained, and the text signal at the current time can be combined conveniently, and the output at the current time can be predicted.
In practical applications, the hidden state signal at the previous time may also be determined as follows: firstly, determining a hidden state signal at the previous moment and a text signal at the previous moment, then fusing a pulse signal corresponding to the hidden state signal at the previous moment and a pulse signal corresponding to the text signal at the previous moment, and determining the hidden state signal at the previous moment according to the fusion.
In summary, the hidden state signal at the previous time is determined by combining the pulse signal to be processed at the previous time, so that the hidden state signal and the text signal at the current time can be ensured to be continuous signals, and therefore, the target text signal at the current time can be effectively predicted, and the prediction accuracy is improved.
And step S104, converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal.
Specifically, after the text signal at the current time and the hidden state signal at the previous time are determined, further, in order to save the calculation resources and maintain the natural language understanding accuracy, the signals may be converted through a preset pulse conversion function in the impulse neural network, so as to obtain the impulse signals corresponding to the signals, and implement the overhead of reducing the calculation cost through the characteristics of the impulse neural network. The impulse neural network only has a small number of multiplications, energy consumption is lower compared with linear transformation, and the impulse neural network is adaptive to mobile equipment, so that after a text signal and a hidden state signal are obtained, each signal can be processed through an impulse conversion function.
The preset pulse conversion function specifically refers to a function capable of converting a text signal into a pulse signal, that is, the text processing method provided in this embodiment is applied to a pulse neural network, and the pulse neural network is formed by bidirectional SNNs (bidirectionalsnns); correspondingly, the text pulse signal specifically refers to a pulse signal obtained by performing pulse conversion on the text signal; correspondingly, the hidden state pulse signal is specifically a pulse signal obtained by performing pulse conversion on the hidden state signal.
Further, when the text signal is converted by using the pulse conversion function, actually, a variable in the function is used to perform an effective value taking, so that the text signal at each moment can be converted into the pulse signal, in this embodiment, a specific implementation manner is as follows:
determining a pulse signal excitation threshold value according to the preset pulse transfer function; calculating a text signal difference value of the text signal and the pulse signal excitation threshold value, and comparing the text signal difference value with a preset value; determining the text pulse signal corresponding to the text signal according to the comparison result and the preset pulse conversion function;
calculating a hidden state signal difference value of the hidden state signal and the pulse signal excitation threshold value, and comparing the hidden state signal difference value with the preset value; and determining the hidden state pulse signal corresponding to the hidden state signal according to the comparison result and the preset pulse transfer function.
Specifically, the pulse signal excitation threshold is a threshold for measuring whether a pulse exists in the text signal, and whether the pulse exists in the text signal at the current moment can be determined by calculating a difference value between the text signal and the threshold; correspondingly, the text signal difference specifically refers to a difference between a pulse signal excitation threshold and a text signal, namely a text matrix difference; correspondingly, the hidden state signal difference specifically refers to a difference between a pulse signal excitation threshold and a hidden state signal, that is, a hidden state matrix difference.
Based on this, after the text signal and the hidden state signal are obtained, further, at this time, a preset pulse conversion function may be determined first, and then a pulse signal excitation threshold in the preset pulse conversion function is determined; secondly, calculating a text signal difference value between the text signal and a pulse signal excitation threshold value, and determining whether the text signal at the current moment has a pulse according to the text signal difference value, namely comparing the text signal difference value with a preset value; and finally, determining the text pulse signal obtained by the text signal at the current moment after the calculation according to the comparison result and a preset pulse conversion function, wherein the text pulse signal is used for representing the pulse signal at the current moment.
In specific implementation, the determination of the text pulse signal may be determined by the following formula (1):
Figure 468859DEST_PATH_IMAGE016
where t denotes the current time, p t Representing text pulse signals, x t The method comprises the steps of representing a text signal, v representing a pulse signal excitation threshold value, F representing a preset pulse conversion function, and d representing model dimensions, namely values related to all dimensions in a text matrix.
That is, after calculating the text signal difference between the text signal and the pulse signal excitation threshold, comparing the text signal difference with a preset value, if the text signal difference is greater than the preset value, it indicates that there is a pulse at the current moment, then selecting 1 as the sub-text pulse signal corresponding to the text signal at the current moment, and if the text signal difference is less than or equal to the preset value, it indicates that there is no pulse at the current moment, then selecting 0 as the sub-text pulse signal corresponding to the text signal at the current moment; and then updating the text matrix at the current moment by using the sub-text pulse signal to obtain the text pulse signal corresponding to the current moment, namely updating the element value of the text signal corresponding to the current moment in the text matrix by using the sub-text pulse signal, and obtaining the text pulse signal according to the updating result.
Furthermore, the hidden state pulse signal needs to be converted at the same time, that is, a preset pulse conversion function is determined first, and then a pulse signal excitation threshold in the preset pulse conversion function is determined; secondly, calculating a hidden state signal difference value between the hidden state pulse signal and a pulse signal excitation threshold value, and determining whether the hidden state signal at the last moment has a pulse according to the hidden state signal difference value, namely comparing the hidden state signal difference value with a preset value; and finally, determining the hidden state pulse signal obtained by the previous time hidden state signal through the calculation according to the comparison result and a preset pulse transfer function, wherein the hidden state pulse signal is used for representing the previous time pulse signal.
In specific implementation, the determination of the hidden-state pulse signal may be determined by the following formula (2):
Figure 954198DEST_PATH_IMAGE017
wherein t-1 represents the last time, g t-1 Representing a hidden state pulse signal, h t-1 Representing a hidden state signal.
That is, after calculating the text signal difference between the hidden state signal and the pulse signal excitation threshold, the hidden state signal difference and the preset value are subjected to a pin operation, and if the difference is greater than the preset value, which indicates that a pulse exists at the previous moment, 1 is selected as the sub hidden state pulse signal corresponding to the hidden state signal at the previous moment. If the value is less than or equal to the preset value, the pulse does not exist at the previous moment, and 0 is selected as the sub hidden state pulse signal corresponding to the hidden state signal at the previous moment. And then updating the text matrix at the last moment by using the sub hidden state pulse signals to obtain the hidden state pulse signals corresponding to the last moment. The element value of the hidden state signal corresponding to the previous moment in the text matrix is updated through the sub hidden state pulse signal, and the hidden state pulse signal is obtained according to the updating result.
For example, the text to be processed is acquired as "i love China", a text matrix S corresponding to the text to be processed is constructed, and in the text translation processing task, the word unit "love" is determined to correspond to at the current momentText signal x of 2 And a hidden state signal h corresponding to the last time word unit' I 1 At this time, the text signal x is processed by the above formula (1) 2 Converting to obtain text pulse signal
Figure 248913DEST_PATH_IMAGE018
Text pulse signal p corresponding to word unit "love 2 (ii) a Simultaneously, the hidden state signal h is processed by the formula (2) 1 Converting to obtain hidden state pulse signal
Figure 427085DEST_PATH_IMAGE019
I.e. hidden state pulse signal g corresponding to word unit 1 So as to facilitate the subsequent translation processing operation of the text to be processed, i love China.
In summary, the text signal and the hidden state signal are respectively subjected to pulse conversion by using the pulse conversion function, so that the prediction preparation work is completed on the premise of only using a small amount of computing resources, and the purpose of lower energy consumption can be achieved.
And step S106, constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal.
Specifically, after the text pulse signal and the hidden state pulse signal are obtained, according to a processing strategy of the impulse neural network, state combination can be performed on the text pulse signal and the hidden state pulse signal according to the processing strategy, that is, the text pulse signal and the hidden state pulse signal are subjected to signal fusion, so that a pulse signal to be processed is obtained according to a fusion result, and finally the pulse signal to be processed is processed through the impulse neural network, so that an output result at the current moment can be obtained according to the processing result.
The pulse signal to be processed is specifically a pulse signal obtained by fusing a text pulse signal and a hidden state pulse signal, and the calculation of the pulse signal to be processed can be determined by the following formula (3):
Figure 112144DEST_PATH_IMAGE020
wherein h is t Representing the pulse signal to be processed at the current moment, r representing a state decay factor, W g Representing a text matrix.
Following the above example, when the text pulse signal p corresponding to the word unit "love" is obtained 2 And word unit 'I' corresponding hidden state pulse signal g 1 Then, at this time, the text pulse signal p can be processed by the above formula (3) 2 And hidden state pulse signal g 1 Fusing, and obtaining the pulse signal to be processed at the current moment according to the fusion result
Figure 791387DEST_PATH_IMAGE021
(ii) a So as to facilitate the subsequent translation processing operation of the text to be processed, i love China.
In summary, the text pulse signal and the hidden state pulse signal are fused before prediction, so that the pulse signal to be processed corresponding to the current moment can be obtained, the context features are fused, and the prediction accuracy at each moment is improved.
And step S108, processing the pulse signal to be processed to obtain a target text signal corresponding to the current moment.
Specifically, after the pulse signal to be processed is obtained, the pulse signal to be processed at the current time, that is, the hidden state at the current time, is obtained, and the pulse signal to be processed at the current time is processed through the impulse neural network, so that the target text signal at the current time, that is, the target text signal corresponding to the word unit prediction result at the current time, can be obtained. The target text signal specifically refers to a prediction result corresponding to the current moment obtained after the pulse signal to be processed is processed through the impulse neural network.
Further, when processing a pulse signal to be processed, in order to improve accuracy, prediction may be implemented by combining a bidirectional pulse neural network, in this embodiment, the specific implementation manner is as follows:
carrying out forward processing on the pulse signal to be processed to obtain a forward pulse signal, and carrying out backward processing on the pulse signal to be processed to obtain a backward pulse signal; fusing the forward pulse signal and the backward pulse signal to obtain a target pulse signal; and processing the target pulse signal to obtain a target text signal corresponding to the current moment.
Specifically, the forward pulse signal refers to a pulse signal obtained by performing forward processing on a pulse signal to be processed; correspondingly, the backward pulse signal specifically refers to a pulse signal obtained after backward processing is performed on the pulse signal to be processed; the forward processing specifically refers to processing operation on a text signal at the current moment according to a forward sequence of a text to be processed; if the text to be processed is China love, the processing is carried out in sequence according to China- > love- > middle- > country; the backward processing specifically refers to an operation of processing the text signal at the current moment according to the reverse sequence of the text to be processed; if the text to be processed is China love, the processing is carried out according to the sequence of China- > Zhongji- > love- > I. Correspondingly, the target pulse signal specifically refers to a pulse signal obtained by fusing a forward pulse signal and a backward pulse signal; correspondingly, the target text signal specifically refers to a signal obtained by processing the fused pulse signal.
Based on this, after the pulse signal to be processed corresponding to the current moment is obtained, the pulse signal to be processed can be respectively subjected to forward processing and backward processing, and the forward pulse signal and the backward pulse signal can be obtained according to the processing result; secondly, the forward pulse signal and the backward pulse signal can be fused, and a target pulse signal is obtained according to a fusion result; finally, the target pulse signal is processed through an output layer in the pulse neural network, and the target text signal at the current moment can be obtained, namely the forward pulse signal obtained after the processing is combined with the forward and backward pulse neural networks
Figure 547466DEST_PATH_IMAGE022
The backward pulse signal is
Figure 224435DEST_PATH_IMAGE023
Finally, the two are fused and processed by a network to obtain an output result
Figure 459107DEST_PATH_IMAGE024
According to the above example, the pulse signal h to be processed corresponding to the current time is obtained 2 Then, the pulse signal h to be processed may be first treated 2 Respectively carrying out forward processing and backward processing to obtain forward pulse signals according to the processing results
Figure 286249DEST_PATH_IMAGE025
And backward pulse signal
Figure 493239DEST_PATH_IMAGE026
(ii) a Finally, forward pulse signals are paired through BiSNN
Figure 403427DEST_PATH_IMAGE027
And backward pulse signal
Figure 63078DEST_PATH_IMAGE028
The fused pulse signals are processed to obtain a prediction result love corresponding to the word unit love, and by analogy, the translation is sequentially carried out on the text to be processed, I love China, so that the translated text I love China can be obtained.
In summary, by determining the target text signal corresponding to the text signal by combining the forward processing and the backward processing, the natural language understanding can be completed by fully combining the context characteristics, and the language understanding precision can be effectively improved.
In practical application, when natural language processing is performed, the actual result is a result of sequentially processing each word unit in a text to be processed and then integrating the word units, and in this embodiment, the specific implementation manner is as follows:
inputting the text matrix corresponding to the text to be processed into a language understanding model; acquiring a global target text signal corresponding to the text matrix; and inputting the global target text signal to an output unit in the language understanding model for processing to obtain a target text corresponding to the text to be processed.
Specifically, the language understanding model specifically refers to a model corresponding to a natural language understanding task, and includes but is not limited to a translation model, a text classification model, a topic extraction model, and the like; correspondingly, the global target text signal specifically refers to all target text signals after each word unit in the text to be processed is predicted; the corresponding output unit specifically refers to an output layer of the language understanding model; correspondingly, the target text specifically refers to a text obtained after natural language understanding is performed on the text to be processed; for example, in a translation scene, the target text is a translation of the text to be processed; or in a text classification scene, the target text is a type text of the text to be processed; and then, or in a theme extraction scene, the target text is a theme corresponding to the text to be processed.
Based on the above, after the text to be processed is input into the language understanding model, the target text signals corresponding to the text signals are obtained through the language understanding model according to the processing process; after each word unit in the text to be processed is processed, a global target text signal corresponding to the text matrix is obtained. At this time, the global target text signal can be input to an output unit in the language understanding model for processing, and a target text corresponding to the text to be processed is obtained according to the processing result.
Furthermore, considering that the pulse neural network can make the signal form a discretization state, and the gradient calculation cannot be performed in the discretization state, and the back propagation cannot be completed, and in order to improve the predictive capability of the language understanding model, the gradient conversion can be performed on the basis of the discretization state, in this embodiment, the specific implementation manner is as follows:
carrying out gradient processing on the global target text signal to obtain a gradient signal; processing the gradient signal by using a preset back propagation function to obtain model parameter adjusting information; and performing parameter adjustment on the language understanding model according to the model parameter adjustment information to obtain a target language understanding model.
Specifically, the gradient processing specifically refers to performing gradient processing on the global target text signal, and converting the discretized signal into a gradient signal with a gradient state; correspondingly, the preset back propagation function specifically refers to a back propagation function preset according to an actual application scene, and includes but is not limited to rectangle, triangle, sigmoid, and gaussian; correspondingly, the model parameter adjusting information specifically refers to information for adjusting parameters of the language understanding model, and is used for improving the model prediction capability; the corresponding target language understanding model specifically refers to a language understanding model after parameters are called according to a back propagation result.
Based on the above, after the global target text signal is obtained, in order to improve the model prediction capability under the environment, the global target text signal can be subjected to gradient processing to obtain a gradient signal; and finally, performing parameter adjustment on the language understanding model according to the model parameter adjustment information, so as to obtain the target language understanding model.
Wherein, the counter propagation mode of rectangular function is as the following formula (4):
Figure 959490DEST_PATH_IMAGE029
the backpropagation mode of triangular (trigonometric function) is as follows (5):
Figure 755408DEST_PATH_IMAGE030
the back propagation mode of sigmoid (sigmoid function) is as follows equation (6):
Figure 570917DEST_PATH_IMAGE031
the backward propagation mode of gaussian (gaussian function) is as follows:
Figure 655547DEST_PATH_IMAGE032
wherein,
Figure 214705DEST_PATH_IMAGE033
a gradient representing the backward propagation of the current time to the hidden state;
Figure 130708DEST_PATH_IMAGE034
indicating the pulse signal at the current time. N identifies other cases.
Referring to the schematic diagram shown in fig. 3, the propagation diagram of each function is obtained by the four propagation functions. Thereby improving the prediction accuracy of the model.
In order to reduce the consumption cost of computing resources, the text processing method provided by the present specification may determine, according to the text matrix, a text signal to be processed at the present time and a hidden state signal at the previous time after the text matrix is obtained; then, a text signal and a hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; the method has the advantages that the text is processed by using the impulse neural network, energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
Corresponding to the above method embodiment, this specification further provides a text processing apparatus embodiment, and fig. 4 shows a schematic structural diagram of a text processing apparatus provided in an embodiment of this specification. As shown in fig. 4, the apparatus includes:
a signal determining module 402 configured to determine a text signal at a current time and a hidden state signal at a previous time according to the text matrix;
a conversion signal module 404 configured to convert the text signal and the hidden state signal by using a preset pulse conversion function, respectively, to obtain a text pulse signal and a hidden state pulse signal;
a build signal module 406 configured to build a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal;
and the signal processing module 408 is configured to obtain a target text signal corresponding to the current moment by processing the pulse signal to be processed.
In an optional embodiment, the signal conversion module 404 is further configured to:
determining a pulse signal excitation threshold value according to the preset pulse transfer function; calculating a text signal difference value of the text signal and the pulse signal excitation threshold value, and comparing the text signal difference value with a preset value; determining the text pulse signal corresponding to the text signal according to the comparison result and the preset pulse conversion function;
correspondingly, the converting the hidden state signals by using the preset pulse conversion function to obtain the hidden state pulse signals respectively includes: calculating a hidden state signal difference value of the hidden state signal and the pulse signal excitation threshold value, and comparing the hidden state signal difference value with the preset value; and determining the hidden state pulse signal corresponding to the hidden state signal according to the comparison result and the preset pulse transfer function.
In an alternative embodiment, the text pulse signal is determined by the following equation:
Figure 992485DEST_PATH_IMAGE035
where t denotes the current time, p t Representing the text pulse signal, x t Representing a text signal, v representing a pulse signal excitation threshold, F representing a preset pulse conversion function, and d representing a model dimension;
accordingly, the hidden state pulse signal is determined by the following formula:
Figure 423466DEST_PATH_IMAGE036
wherein t-1 represents the last time, g t-1 Representing a hidden state pulse signal, h t-1 Representing a hidden state signal.
In an alternative embodiment, the pulse signal to be processed is determined by the following formula:
Figure 723998DEST_PATH_IMAGE037
wherein h is t Representing the pulse signal to be processed at the current moment, r representing a state decay factor, W g Representing a text matrix.
In an optional embodiment, the determining signal module 402 is further configured to:
acquiring a text to be processed, and constructing a text matrix corresponding to the text to be processed; and selecting the text signal corresponding to the current moment in the text matrix according to a preset processing rule.
In an optional embodiment, the determining signal module 402 is further configured to:
acquiring a pulse signal to be processed corresponding to the last moment; and performing language understanding processing on the pulse signal to be processed corresponding to the previous moment through a hidden state layer to obtain the hidden state signal of the previous moment.
In an optional embodiment, the signal processing module 408 is further configured to:
carrying out forward processing on the pulse signal to be processed to obtain a forward pulse signal, and carrying out backward processing on the pulse signal to be processed to obtain a backward pulse signal; fusing the forward pulse signal and the backward pulse signal to obtain a target pulse signal; and processing the target pulse signal to obtain a target text signal corresponding to the current moment.
In an optional embodiment, the text processing apparatus further includes:
the input module is configured to input the text matrix corresponding to the text to be processed into a language understanding model;
the processing module is configured to acquire a global target text signal corresponding to the text matrix; and inputting the global target text signal to an output unit in the language understanding model for processing to obtain a target text corresponding to the text to be processed.
In an optional embodiment, the text processing apparatus further includes:
the parameter adjusting module is configured to perform gradient processing on the global target text signal to obtain a gradient signal; processing the gradient signal by using a preset back propagation function to obtain model parameter adjusting information; and performing parameter adjustment on the language understanding model according to the model parameter adjustment information to obtain a target language understanding model.
In order to reduce the consumption cost of computing resources, the text processing device provided in this specification may determine, according to a text matrix, a text signal that needs to be processed at a current time and a hidden state signal at a previous time after the text matrix is obtained; then, a text signal and a hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; the method has the advantages that the text is processed by using the impulse neural network, energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
The above is a schematic scheme of a text processing apparatus of the present embodiment. It should be noted that the technical solution of the text processing apparatus and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the text processing apparatus can be referred to the description of the technical solution of the text processing method.
Fig. 5 is a flowchart illustrating another text processing method according to an embodiment of the present disclosure, which specifically includes the following steps.
Step S502, acquiring a text matrix corresponding to a text to be processed;
step S504, determining a text signal corresponding to the current moment and a hidden state signal of the previous moment according to the text matrix;
step S506, respectively converting the text signal and the hidden state signal by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
step S508, constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal, and generating a target text signal corresponding to the current moment according to the pulse signal to be processed;
step S510, in a case that the text matrix processing is completed, generating a target text corresponding to the text to be processed according to the target text signal corresponding to each time.
It should be noted that, for the description contents related to another text processing method provided in this embodiment, reference may be made to the same or corresponding description contents in the foregoing embodiments, and this embodiment is not described in detail herein.
In summary, after the text matrix corresponding to the text to be processed is obtained, the text signal to be processed at the current moment and the hidden state signal at the previous moment are determined according to the text matrix; then, a text signal and a hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; after the text matrix is processed, a target text can be generated according to the target text signal at each moment; the method has the advantages that the text is processed by using the impulse neural network, energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
Corresponding to the above method embodiment, this specification further provides a text processing apparatus embodiment, and fig. 6 shows a schematic structural diagram of another text processing apparatus provided in an embodiment of this specification. As shown in fig. 6, the apparatus includes:
an obtaining module 602 configured to obtain a text matrix corresponding to a text to be processed;
a determining module 604, configured to determine, according to the text matrix, a text signal corresponding to a current time and a hidden state signal at a previous time;
a conversion module 606 configured to convert the text signal and the hidden state signal by using a preset pulse conversion function, respectively, to obtain a text pulse signal and a hidden state pulse signal;
a constructing module 608 configured to construct a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal, and generate a target text signal corresponding to the current time according to the pulse signal to be processed;
the generating module 610 is configured to generate a target text corresponding to the text to be processed according to the target text signal corresponding to each time when the text matrix processing is completed.
In another text processing apparatus provided in this embodiment, after a text matrix corresponding to a text to be processed is obtained, a text signal to be processed at a current time and a hidden state signal at a previous time are determined according to the text matrix; then, the text signal and the hidden state signal are respectively converted by utilizing a preset pulse conversion function, so that a text pulse signal corresponding to the text signal and a hidden state pulse signal corresponding to the hidden state signal can be obtained; at the moment, the text pulse signal and the hidden state pulse signal are fused into a pulse signal to be processed; finally, the pulse signal to be processed is processed, and the target text signal at the current moment can be obtained according to the processing result; after the text matrix is processed, a target text can be generated according to the target text signal at each moment; the method has the advantages that the text is processed by using the impulse neural network, energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in a natural language understanding scene is effectively improved.
The above is a schematic configuration of another text processing apparatus of the present embodiment. It should be noted that the technical solution of the text processing apparatus and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the text processing apparatus can be referred to the description of the technical solution of the text processing method.
The following will further describe the text processing method by taking an application of the text processing method provided in this specification in a topic extraction scenario as an example with reference to fig. 7. Fig. 7 shows a processing procedure flowchart of a text processing method provided in an embodiment of the present specification, which specifically includes the following steps.
Step S702, acquiring a text to be processed, and constructing a text matrix corresponding to the text to be processed.
Step S704, selecting a text signal corresponding to the current time in the text matrix according to a preset processing rule, and determining a hidden state signal at the previous time.
Step S706, determining a pulse signal excitation threshold according to a preset pulse transfer function.
Step S708, calculating a text signal difference between the text signal and the pulse signal excitation threshold, and comparing the text signal difference with a preset value.
Step S710, determining a text pulse signal corresponding to the text signal according to the comparison result and a preset pulse conversion function.
Step S712, calculating a hidden state signal difference between the hidden state signal and the pulse signal excitation threshold, and comparing the hidden state signal difference with a preset value.
Step S714, determining a hidden state pulse signal corresponding to the hidden state signal according to the comparison result and the preset pulse transfer function.
Step S716, constructing a pulse signal to be processed based on the text pulse signal and the hidden state pulse signal.
Step S718, performing forward processing on the pulse signal to be processed to obtain a forward pulse signal, and performing backward processing on the pulse signal to be processed to obtain a backward pulse signal.
And S720, fusing the forward pulse signal and the backward pulse signal to obtain a target pulse signal.
In step S722, the target pulse signal is processed to obtain a target text signal corresponding to the current time.
Step S724, in a case that the text matrix processing is completed, generating a target text corresponding to the text to be processed according to the target text signal corresponding to each time.
In conclusion, the text is processed by using the impulse neural network, so that the energy consumption can be effectively reduced, the operation in the mobile equipment is supported, and the prediction effect in the natural language understanding scene is effectively improved.
FIG. 8 illustrates a block diagram of a computing device 800, according to one embodiment of the present description. The components of the computing device 800 include, but are not limited to, memory 810 and a processor 820. The processor 820 is coupled to the memory 810 via a bus 830, and the database 850 is used to store data.
Computing device 800 also includes access device 840, access device 840 enabling computing device 800 to communicate via one or more networks 860. Examples of such networks include the Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. Access device 840 may include one or more of any type of network interface (e.g., a Network Interface Card (NIC)) whether wired or wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a worldwide interoperability for microwave access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the present description, the above-described components of computing device 800, as well as other components not shown in FIG. 8, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device structure shown in FIG. 8 is for purposes of example only and is not limiting as to the scope of the description. Those skilled in the art may add or replace other components as desired.
Computing device 800 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. Computing device 800 may also be a mobile or stationary server.
Wherein the processor 820 is configured to execute computer-executable instructions that, when executed by the processor, implement the steps of the text processing method described above.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the text processing method.
An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which when executed by a processor implement the steps of the above-mentioned text processing method.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the text processing method, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the text processing method.
An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the text processing method.
The above is an illustrative scheme of a computer program of the present embodiment. It should be noted that the technical solution of the computer program and the technical solution of the text processing method belong to the same concept, and details that are not described in detail in the technical solution of the computer program can be referred to the description of the technical solution of the text processing method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in the form of source code, object code, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts, but those skilled in the art should understand that the present embodiment is not limited by the described acts, because some steps may be performed in other sequences or simultaneously according to the present embodiment. Furthermore, those skilled in the art will appreciate that the embodiments described in this specification are presently preferred and that no acts or modules are required in the implementations of the disclosure.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present specification disclosed above are intended only to aid in the description of the specification. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the embodiments. The specification is limited only by the claims and their full scope and equivalents.

Claims (12)

1. A method of text processing, comprising:
determining a text signal at the current moment and a hidden state signal at the previous moment according to the text matrix, wherein the hidden state signal at the previous moment is a vector expression obtained by processing a vector expression corresponding to a word unit at the previous moment, and is obtained by performing language understanding processing on a pulse signal to be processed corresponding to the previous moment through a hidden state layer;
converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
performing signal fusion on the text pulse signal and the hidden state pulse signal to obtain a pulse signal to be processed;
and processing the pulse signal to be processed to obtain a target text signal corresponding to the current moment.
2. The method of claim 1, wherein converting the text signal with a preset pulse conversion function to obtain a text pulse signal comprises:
determining a pulse signal excitation threshold value according to the preset pulse transfer function;
calculating a text signal difference value of the text signal and the pulse signal excitation threshold value, and comparing the text signal difference value with a preset value;
determining the text pulse signal corresponding to the text signal according to the comparison result and the preset pulse conversion function;
correspondingly, the converting the hidden state signals by using the preset pulse conversion function to obtain the hidden state pulse signals respectively includes:
calculating a hidden state signal difference value of the hidden state signal and the pulse signal excitation threshold value, and comparing the hidden state signal difference value with the preset value;
and determining the hidden state pulse signal corresponding to the hidden state signal according to the comparison result and the preset pulse transfer function.
3. The method of claim 2, the text pulse signal being determined by the formula:
Figure 49629DEST_PATH_IMAGE001
where t denotes the current time, p t Representing the text pulse signal, x t Representing a text signal, v representing a pulse signal excitation threshold, F representing a preset pulse conversion function, and d representing a model dimension;
accordingly, the hidden state pulse signal is determined by the following formula:
Figure 94945DEST_PATH_IMAGE002
wherein t-1 represents the last time, g t-1 Representing a hidden state pulse signal, h t-1 Representing a hidden state signal.
4. The method of claim 3, the pulse signal to be processed being determined by the following formula:
Figure 755734DEST_PATH_IMAGE003
wherein h is t Representing the pulse signal to be processed at the current moment, r representing a state decay factor, W g Representing a text matrix.
5. The method of claim 1, the determining the text signal at the current time from the text matrix, comprising:
acquiring a text to be processed, and constructing a text matrix corresponding to the text to be processed;
and selecting the text signal corresponding to the current moment in the text matrix according to a preset processing rule.
6. The method of claim 1, the determining of the hidden state signal at the previous time comprises:
acquiring a pulse signal to be processed corresponding to the last moment;
and performing language understanding processing on the pulse signal to be processed corresponding to the previous moment through a hidden state layer to obtain the hidden state signal of the previous moment.
7. The method according to claim 1, wherein the obtaining the target text signal corresponding to the current time by processing the pulse signal to be processed comprises:
carrying out forward processing on the pulse signal to be processed to obtain a forward pulse signal, and carrying out backward processing on the pulse signal to be processed to obtain a backward pulse signal;
fusing the forward pulse signal and the backward pulse signal to obtain a target pulse signal;
and processing the target pulse signal to obtain a target text signal corresponding to the current moment.
8. The method according to any one of claims 1-4, wherein before the step of determining the text signal at the current time according to the text matrix and the hidden state signal at the previous time is executed, the method further comprises:
inputting the text matrix corresponding to the text to be processed into a language understanding model;
correspondingly, after the step of obtaining the target text signal corresponding to the current time by processing the pulse signal to be processed is executed, the method further includes:
acquiring a global target text signal corresponding to the text matrix;
and inputting the global target text signal to an output unit in the language understanding model for processing to obtain a target text corresponding to the text to be processed.
9. The method according to claim 8, after the step of obtaining the target text signal corresponding to the current time by processing the pulse signal to be processed is executed, further comprising:
carrying out gradient processing on the global target text signal to obtain a gradient signal;
processing the gradient signal by using a preset back propagation function to obtain model parameter adjusting information;
and performing parameter adjustment on the language understanding model according to the model parameter adjustment information to obtain a target language understanding model.
10. A method of text processing, comprising:
acquiring a text matrix corresponding to a text to be processed;
determining a text signal corresponding to the current moment and a hidden state signal at the previous moment according to the text matrix, wherein the hidden state signal at the previous moment is a vector expression obtained by processing a vector expression corresponding to a word unit at the previous moment, and the hidden state signal is obtained by performing language understanding processing on a pulse signal to be processed corresponding to the previous moment through a hidden state layer;
converting the text signal and the hidden state signal respectively by using a preset pulse conversion function to obtain a text pulse signal and a hidden state pulse signal;
performing signal fusion on the text pulse signal and the hidden state pulse signal to obtain a pulse signal to be processed, and generating a target text signal corresponding to the current moment according to the pulse signal to be processed;
and under the condition that the text matrix processing is finished, generating a target text corresponding to the text to be processed according to the target text signal corresponding to each moment.
11. A computing device, comprising:
a memory and a processor;
the memory is for storing computer-executable instructions, and the processor is for executing the computer-executable instructions, which when executed by the processor, implement the steps of the method of any one of claims 1 to 9 or 10.
12. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, perform the steps of the method of any one of claims 1 to 9 or 10.
CN202210436844.5A 2022-04-25 2022-04-25 Text processing method and device Active CN114548046B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210436844.5A CN114548046B (en) 2022-04-25 2022-04-25 Text processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210436844.5A CN114548046B (en) 2022-04-25 2022-04-25 Text processing method and device

Publications (2)

Publication Number Publication Date
CN114548046A CN114548046A (en) 2022-05-27
CN114548046B true CN114548046B (en) 2022-09-27

Family

ID=81666747

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210436844.5A Active CN114548046B (en) 2022-04-25 2022-04-25 Text processing method and device

Country Status (1)

Country Link
CN (1) CN114548046B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502983B (en) * 2016-10-17 2019-05-10 清华大学 The event driven collapse Gibbs sampling method of implicit Di Li Cray model
CN108519890B (en) * 2018-04-08 2021-07-20 武汉大学 Robust code abstract generation method based on self-attention mechanism
US11195085B2 (en) * 2019-03-21 2021-12-07 International Business Machines Corporation Spiking synaptic elements for spiking neural networks
CN110059324B (en) * 2019-04-26 2022-12-13 广州大学 Neural network machine translation method and device based on dependency information supervision
US11087086B2 (en) * 2019-07-12 2021-08-10 Adp, Llc Named-entity recognition through sequence of classification using a deep learning neural network
KR20210146002A (en) * 2020-05-26 2021-12-03 한국전자통신연구원 Method and apparatus for training multi-layer spiking neural network
CN114254106A (en) * 2020-09-25 2022-03-29 北京灵汐科技有限公司 Text classification method, device, equipment and storage medium
CN113779277A (en) * 2021-01-22 2021-12-10 北京沃东天骏信息技术有限公司 Method and device for generating text
CN113204944B (en) * 2021-06-02 2024-06-11 云知声智能科技股份有限公司 Text generation method, device, equipment and storage medium
CN113313240B (en) * 2021-08-02 2021-10-15 成都时识科技有限公司 Computing device and electronic device
CN114091659A (en) * 2021-11-24 2022-02-25 西安电子科技大学 Ultralow-delay pulse neural network based on space-time information and learning method

Also Published As

Publication number Publication date
CN114548046A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN109977428B (en) Answer obtaining method and device
CN109858044B (en) Language processing method and device, and training method and device of language processing system
CN111222347B (en) Sentence translation model training method and device and sentence translation method and device
CN110427625B (en) Sentence completion method, apparatus, medium, and dialogue processing system
CN112487182A (en) Training method of text processing model, and text processing method and device
CN109710953B (en) Translation method and device, computing equipment, storage medium and chip
WO2020155619A1 (en) Method and apparatus for chatting with machine with sentiment, computer device and storage medium
WO2022156561A1 (en) Method and device for natural language processing
CN111144124B (en) Training method of machine learning model, intention recognition method, and related device and equipment
CN111931518A (en) Translation model training method and device
JP7417679B2 (en) Information extraction methods, devices, electronic devices and storage media
US11475225B2 (en) Method, system, electronic device and storage medium for clarification question generation
CN111738020A (en) Translation model training method and device
WO2024114186A1 (en) Intent recognition method and related device
CN113011184A (en) Training method and device for language representation model
CN114723047B (en) Task model training method, device and system
CN116737895A (en) Data processing method and related equipment
CN113868451B (en) Cross-modal conversation method and device for social network based on up-down Wen Jilian perception
CN114548046B (en) Text processing method and device
CN113536800A (en) Word vector representation method and device
CN114997395A (en) Training method of text generation model, method for generating text and respective devices
CN110188367B (en) Data processing method and device
CN113792537A (en) Action generation method and device
CN113282821A (en) Intelligent application prediction method, device and system based on high-dimensional session data fusion
US20240137042A1 (en) Coding apparatuses, and data processing methods and apparatueses

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