Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings. The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of one application scenario of a method for generating information in accordance with some embodiments of the present disclosure.
In an application scenario as in fig. 1, the execution subject may be a server (e.g., server 101 shown in fig. 1). First, the server 101 may sequentially acquire the first input information 102 and the second input information 103 through a wired connection manner or a wireless connection manner. For example, the first input information 102 may be "morning number". The second input information 103 may be "good". Then, the server 10 may analyze the first input information 102 and the second input information 103 to determine whether the first input information 102 needs error correction. For example, in the above example, the first input information 102 specifies that error correction is required, and the error correction information 105 is generated based on the first input information 102 and the second input information 103. For example, the above-described error correction information 105 may be "good morning".
The execution main body may be hardware or software. When the execution main body is hardware, the execution main body can be implemented as a distributed cluster consisting of a plurality of servers or terminal devices, and can also be implemented as a single server or a single terminal device. When the execution body is embodied as software, it may be implemented as a plurality of software or software modules for providing distributed services, for example, or as a single software or software module. But also a thread or process. And is not particularly limited herein.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method for generating information in accordance with the present disclosure is shown. The method for generating information comprises the following steps:
step 201, acquiring the first input information and the second input information in sequence.
In some embodiments, an execution subject of the method for generating information (e.g., the server 101 shown in fig. 1) may sequentially acquire the first input information and the second input information by a wired connection manner or a wireless connection manner. The first input information and the second input information may be locally stored information or information downloaded from a network. For example, the first input information and the second input information may be two pieces of information transmitted by the same user continuously, or two pieces of information transmitted by two users communicating with each other continuously. For example, the first input information and the second input information may be two consecutive pieces of information sent by the user a, which may be "morning number" and "good". Or user a may send user b "will go to a meeting in the afternoon today", and user b replies "do a meeting? ".
It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
Step 202, analyzing the first input information and the second input information to determine whether the first input information needs error correction.
In some embodiments, the executing entity may analyze the first input information and the second input information obtained in step 201 to determine whether the first input information needs error correction. As an example, first, the execution main body may perform word segmentation processing on the first input information to obtain at least one word. Then, the second input information is input into a Pointer network (Pointer Networks), and the obtained at least one word is sequentially input into the Pointer network according to the sequence of appearance in the first input information, so that at least one probability value can be obtained. Then, the executing entity may compare the obtained at least one probability value with a preset threshold value respectively. And finally, when the probability value reaches the preset threshold value, determining that the first input information needs to be corrected. The preset threshold may be preset.
In some optional implementations of some embodiments, it is determined that error correction is required for the first input information in response to the second input information including predefined characters. The predefined characters may be predetermined chinese or english symbols, such as "", "- >", etc. As an example, the second input information described above may be "meeting- > meeting".
In some optional implementation manners of some embodiments, the second input information is subjected to regular matching according to a predefined regular expression, and whether the second input information is consistent with the predefined regular expression is determined; in response to determining that the first input information matches, it is determined that error correction is required. As an example, the predefined regular expression may be preset. Regular expressions are a logical formula for operating on character strings (including common characters (e.g., letters between a and z) and special characters (called meta characters)), and a "regular character string" is formed by using specific characters defined in advance and a combination of the specific characters, and is used for expressing a filtering logic for the character string. A regular expression is a text pattern that describes one or more strings of characters to be matched when searching for text.
Step 203, in response to determining that error correction is required, generating error correction information according to the first input information and the second input information.
In some embodiments, in response to determining that error correction is required, the execution body may generate error correction information based on the first input information and the second input information. As an example, when the first input information is "morning number", the second input information is "good", and the error correction information may be "morning good". When the first input information is "today's afternoon meeting", and the second input information is "meeting- > meeting", the execution main body may replace "meeting" in the first input information with "meeting" in the second input information, so that the obtained error correction information may be "today's afternoon meeting".
In some optional implementations of some embodiments, the method further comprises: an input terminal for transmitting the error correction information to the first input information; for example, the above error correction information may be "good morning". The input terminal can be an electronic device such as a mobile phone and a computer. Detecting a user confirmation operation for the error correction information displayed on the input terminal; as an example, the execution body may control the error correction information to be displayed on the input terminal in a form of a prompt box. The user confirmation operation may be a click operation for a control for triggering confirmation information on the prompt box. And sending the error correction information to a receiving terminal of the first input information in response to the detection of the user confirmation operation. The receiving terminal can be an electronic device such as a mobile phone and a computer.
According to the method for generating information disclosed by some embodiments of the present disclosure, by determining whether the second input information includes predefined characters or performing regular matching on the second input information according to a predefined regular expression, whether the first input information needs error correction can be determined more accurately, so that the accuracy of determining whether the first input information needs error correction is improved.
With continued reference to fig. 3, a flow 300 of further embodiments of methods for generating information according to the present disclosure is shown. The method for generating information comprises the following steps:
step 301, sequentially acquiring first input information and second input information.
In some embodiments, the specific implementation of step 301 and the technical effect brought by the implementation may refer to step 201 in those embodiments corresponding to fig. 2, and are not described herein again.
Step 302, inputting the first input information and the second input information into a machine learning model to obtain an error correction value.
In some embodiments, an executing entity (e.g., the server 101 in fig. 1) of the method for presenting information may input the first input information and the second input information into a machine learning model, resulting in an error correction value, wherein the machine learning model is trained by a training sample set.
As an example, the machine learning model may be derived by performing the following training steps based on a set of training samples. Performing the following training steps based on the set of training samples: respectively inputting the sample information pairs of at least one training sample in the training sample set into an initial machine learning model to obtain error correction values corresponding to each sample information pair in the at least one training sample; comparing each sample information pair in the at least one training sample with a corresponding sample error correction value; determining the prediction accuracy of the initial machine learning model according to the comparison result; determining whether the prediction accuracy is greater than a preset accuracy threshold; in response to determining that the accuracy is greater than the preset accuracy threshold, taking the initial machine learning model as a trained machine learning model; and adjusting parameters of the initial machine learning model in response to the determination that the accuracy is not greater than the preset accuracy threshold, forming a training sample set by using unused training samples, using the adjusted initial machine learning model as the initial machine learning model, and executing the training step again.
It will be appreciated that after the above training, the machine learning model can be used to characterize the correspondence between the sample information pairs and the error correction values. The above-mentioned machine learning model may be a convolutional neural network model.
In some optional implementations of some embodiments, the training sample set includes a sample information pair and an error correction value of the sample information pair, and the machine learning model is trained with the sample information pair as an input and the error correction value of the sample information pair as an expected output.
Step 303, determining whether the first input information needs error correction based on the comparison result between the error correction value and a preset threshold.
In some embodiments, the executing entity may compare the error correction value obtained in step 302 with a preset threshold, and determine whether the first input information needs error correction according to the comparison result. The preset threshold may be preset. And when the error correction value reaches a preset threshold value, determining that the first input information needs error correction.
Step 304, in response to determining that error correction is required, generating error correction information based on the first input information and the second input information.
In some embodiments, the specific implementation of step 304 and the technical effect brought by the implementation may refer to step 203 in those embodiments corresponding to fig. 2, which are not described herein again.
As can be seen from the above example, the error correction value is obtained by inputting the acquired first input information and second input information to a machine learning model trained in advance. Then, based on the comparison result of the error correction value and the preset threshold, it is determined whether the first input information needs error correction. The speed of determining whether the first input information needs error correction can be increased.
With further reference to fig. 4, as an implementation of the above-described method for the above-described figures, the present disclosure provides some embodiments of an apparatus for generating information, which correspond to those of the method embodiments described above for fig. 2, and which may be applied in particular in various electronic devices.
As shown in fig. 4, an apparatus 400 for generating information of some embodiments includes: an acquisition unit 401, a determination unit 402, and a generation unit 403. Wherein, the obtaining unit 401 is configured to obtain the first input information and the second input information in sequence; a determining unit 402 configured to analyze the first input information and the second input information and determine whether the first input information needs error correction; a generating unit 403 configured to generate error correction information from the first input information and the second input information in response to determining that error correction is required.
In some embodiments, the determining unit 402 in the apparatus 400 for generating information comprises: a deriving subunit configured to input the first input information and the second input information into a machine learning model, and derive an error correction value, wherein the machine learning model is trained by a training sample set; and a determining subunit configured to determine whether the first input information needs error correction based on a comparison result of the error correction value and a preset threshold.
In some embodiments, the training sample set in the deriving subunit in the determining unit 402 in the apparatus for generating information 400 includes a pair of sample information and error correction values of the pair of sample information, and the machine learning model is trained with the pair of sample information as input and the error correction values of the pair of sample information as desired output.
In some embodiments, the determining unit 402 of the apparatus for generating information 400 is further configured to: and determining that the first input information requires error correction in response to the second input information comprising predefined characters.
In some embodiments, the determining unit 402 of the apparatus for generating information 400 is further configured to: performing regular matching on the second input information according to a predefined regular expression to determine whether the second input information is consistent with the predefined regular expression; in response to determining that the first input information matches, it is determined that error correction is required.
In some embodiments, the means for generating information 400 is further configured to: an input terminal for transmitting the error correction information to the first input information; detecting a user confirmation operation for the error correction information displayed on the input terminal; and sending the error correction information to a receiving terminal of the first input information in response to the detection of the user confirmation operation.
The apparatus for generating information disclosed in some embodiments of the present disclosure may determine whether the first input information needs error correction more accurately by determining whether the second input information includes predefined characters or by performing regular matching on the second input information according to a predefined regular expression.
Referring now to fig. 5, a schematic diagram of an electronic device (e.g., the server of fig. 1) 500 suitable for use in implementing some embodiments of the present disclosure is shown. The terminal device in some embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The terminal device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the use range of the embodiments of the present disclosure.
As shown in fig. 5, electronic device 500 may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the electronic apparatus 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; a storage device 508 including, for example, a memory card; and a communication device 509. The communication means 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device 500 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 5 may represent one device or may represent multiple devices as desired.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program, when executed by the processing device 501, performs the above-described functions defined in the methods of some embodiments of the present disclosure.
It should be noted that the computer readable medium described above in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: sequentially acquiring first input information and second input information; analyzing the first input information and the second input information to determine whether the first input information needs error correction; in response to determining that error correction is required, error correction information is generated based on the first input information and the second input information.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by software, and may also be implemented by hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a determination unit, and a generation unit. Here, the names of the units do not constitute a limitation of the units themselves in some cases, and for example, the acquisition unit may also be described as a "unit that sequentially acquires the first input information and the second input information".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In accordance with one or more embodiments of the present disclosure, there is provided a method for generating information, including: sequentially acquiring first input information and second input information; analyzing the first input information and the second input information to determine whether the first input information needs error correction; in response to determining that error correction is required, error correction information is generated based on the first input information and the second input information.
According to one or more embodiments of the present disclosure, the analyzing the first input information and the second input information to determine whether the first input information needs error correction includes: inputting the first input information and the second input information into a machine learning model to obtain an error correction value, wherein the machine learning model is trained through a training sample set; determining whether the first input information needs error correction based on a comparison result of the error correction value and a preset threshold value
According to one or more embodiments of the present disclosure, the training sample set includes a pair of sample information and an error correction value of the pair of sample information, and the machine learning model is trained with the pair of sample information as an input and the error correction value of the pair of sample information as a desired output.
According to one or more embodiments of the present disclosure, the analyzing the first input information and the second input information to determine whether the first input information needs error correction includes: and determining that the first input information requires error correction in response to the second input information comprising predefined characters.
According to one or more embodiments of the present disclosure, the analyzing the first input information and the second input information to determine whether the first input information needs error correction includes: performing regular matching on the second input information according to a predefined regular expression to determine whether the second input information is consistent with the predefined regular expression; in response to determining that the first input information matches, it is determined that error correction is required.
According to one or more embodiments of the present disclosure, the method further includes: an input terminal for transmitting the error correction information to the first input information; detecting a user confirmation operation for the error correction information displayed on the input terminal; and sending the error correction information to a receiving terminal of the first input information in response to the detection of the user confirmation operation.
In accordance with one or more embodiments of the present disclosure, there is provided an apparatus for generating information, including: an acquisition unit configured to sequentially acquire first input information and second input information; a determining unit configured to analyze the first input information and the second input information and determine whether the first input information needs error correction; and a generating unit configured to generate error correction information based on the first input information and the second input information in response to determining that error correction is required.
According to one or more embodiments of the present disclosure, the determining unit includes: a deriving subunit configured to input the first input information and the second input information into a machine learning model, and derive an error correction value, wherein the machine learning model is trained by a training sample set; and a determining subunit configured to determine whether the first input information needs error correction based on a comparison result of the error correction value and a preset threshold.
According to one or more embodiments of the present disclosure, the training sample set in the obtaining subunit in the determining unit includes a sample information pair and an error correction value of the sample information pair, and the machine learning model is trained with the sample information pair as an input and the error correction value of the sample information pair as an expected output.
According to one or more embodiments of the present disclosure, the determining unit is further configured to: and determining that the first input information requires error correction in response to the second input information comprising predefined characters.
According to one or more embodiments of the present disclosure, the determining unit is further configured to: performing regular matching on the second input information according to a predefined regular expression to determine whether the second input information is consistent with the predefined regular expression; in response to determining that the first input information matches, it is determined that error correction is required.
In accordance with one or more embodiments of the present disclosure, the means for generating information is further configured to: an input terminal for transmitting the error correction information to the first input information; detecting a user confirmation operation for the error correction information displayed on the input terminal; and sending the error correction information to a receiving terminal of the first input information in response to the detection of the user confirmation operation.
According to one or more embodiments of the present disclosure, there is provided an electronic device including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as described in any of the embodiments above.
According to one or more embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the method as described in any of the embodiments above.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.