Text processing method, device, electronic device and storage medium
By dividing the product introduction text, determining the central sentence and merging it randomly, the problem of low quality of product summary generation under small sample categories is solved, and high-quality summary generation for categories with small data volume is achieved.
Patent Information
- Application Number
- CN202110139483.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-01
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-02-01
AI Technical Summary
In the field of text processing, categories with small amounts of data cannot generate high-quality product summary, resulting in uneven data distribution and long tail phenomenon.
By obtaining the introduction text of the product, dividing it into multiple parts, determining the central sentence of each part, and sampling it according to the random variables P~E(λ), the sample sentences are obtained and generated input text is generated for generating the product summary.
Through random sampling and merging technology, a variety of input texts are generated, which solves the problem of low quality of product summary generation under small sample categories, and achieves high-quality summary generation for categories with small data volumes.
Smart Images

Figure CN113761175B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of text processing, and more specifically, to a text processing method, device, electronic device and storage medium. Background Art
[0002] In practical applications, for different product categories, data has serious imbalanced distribution and long tail phenomena. Some categories, such as common electrical appliances, tops, skirts, etc., have tens of thousands of data, while some categories, such as some clothing accessories, ties, hems, buttons, etc., have less than 100 data. Generally, the categories with less data are called small sample categories.
[0003] In the process of implementing the concept of the present disclosure, the inventors found that there are a large number of categories with relatively small amounts of data, and it is impossible to generate high-quality product summaries for these categories without data enhancement processing. Summary of the invention
[0004] In view of this, the present disclosure provides a text processing method, device, electronic device and storage medium that can generate a variety of commodity input texts.
[0005] One aspect of the present disclosure provides a text processing method, comprising:
[0006] Obtaining an introduction text of a product, wherein the introduction text includes a plurality of sentences;
[0007] Dividing the introductory text into a plurality of parts, and determining a central sentence of each of the plurality of parts;
[0008] In each of the parts, sampling is performed according to random variables P to E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution;
[0009] The sample sentences corresponding to each part are merged to obtain input text, and the input text is used to generate the summary of the product.
[0010] According to an embodiment of the present disclosure, determining the central sentence of each of the multiple parts includes:
[0011] In each of the parts, any sentence in the part is randomly obtained as the corresponding central sentence.
[0012] According to an embodiment of the present disclosure, determining the central sentence of each of the multiple parts includes:
[0013] Calculate the similarity between the sentences in each part.
[0014] In each of the parts, the sum of the similarities between each sentence and other sentences is calculated to obtain the total similarity of each sentence in each part;
[0015] In each of the parts, the sentence with the highest total similarity is selected as the corresponding central sentence.
[0016] According to an embodiment of the present disclosure, dividing the introduction text into multiple parts includes:
[0017] At least part of the plurality of sentences is segmented into the plurality of parts by using a clustering algorithm.
[0018] According to an embodiment of the present disclosure, it also includes:
[0019] Obtaining multiple summaries of the product based on the input text;
[0020] Constructing a plurality of training samples according to the plurality of summaries, each of the training samples comprising two different summaries, one of the two different summaries being used as an input of a preset summary generation model, and the other being used as an output of the summary generation model;
[0021] The summary generation model is trained using the multiple training samples to obtain a trained summary generation model, wherein the trained summary generation model is used to generate a summary of the product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product.
[0022] According to an embodiment of the present disclosure, it also includes:
[0023] Any one of the multiple summaries of the product is input into the trained summary generation model to generate a summary of the product that is the same as or different from the multiple summaries of the product.
[0024] According to an embodiment of the present disclosure, the summary generation model is a sequence-to-sequence model based on RNN, CNN or Transformer.
[0025] Another aspect of the present disclosure provides a text processing device, comprising:
[0026] An acquisition module, used to acquire an introduction text of a product, wherein the introduction text includes a plurality of sentences;
[0027] A division module, used for dividing the introduction text into multiple parts;
[0028] A determination module, used for determining the central sentence of each part;
[0029] A sampling module, used for sampling in each part according to random variables P to E(λ) to obtain sampled sentences corresponding to each part, wherein λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution;
[0030] The merging module is used to merge the sample sentences corresponding to each part to obtain input text, and the input text is used to generate the summary of the product.
[0031] According to an embodiment of the present disclosure, the text processing device further includes:
[0032] A generating module, used for generating a plurality of summaries of the product based on the input text;
[0033] A construction module, configured to construct a plurality of training samples according to the plurality of summaries, each of the training samples comprising two different summaries, one of the two different summaries being used as an input of a preset summary generation model, and the other being used as an output of the summary generation model;
[0034] A training module is used to train the summary generation model using the multiple training samples to obtain a trained summary generation model, wherein the trained summary generation model is used to generate a summary of the product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product.
[0035] Another aspect of the present disclosure provides an electronic device, comprising:
[0036] one or more processors;
[0037] a memory for storing one or more programs,
[0038] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0039] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0040] According to an embodiment of the present disclosure, the introduction text of the product is obtained, the introduction text is divided into multiple parts, and the central sentence of each of the multiple parts is determined. In each part, sampling is performed according to random variables P~E(λ) to obtain a sampled sentence corresponding to each part, and the sampled sentences corresponding to each part are merged to obtain the input text. Since each sampled sentence constituting the input text is randomly selected and sampled according to random variables P~E(λ), a variety of input texts can be generated for the product while ensuring that the sentence closer to the central sentence has a greater probability of being selected as a sampled sentence, thereby expanding the input text of the product. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0042] Figure 1 An exemplary system architecture to which a text processing method according to an embodiment of the present disclosure can be applied is schematically shown;
[0043] Figure 2 A flowchart of a text processing method according to an embodiment of the present disclosure is schematically shown;
[0044] Figure 3A A flowchart for determining a central sentence according to an embodiment of the present disclosure is schematically shown;
[0045] Figure 3B A flowchart for determining a central sentence according to an embodiment of the present disclosure is schematically shown;
[0046] Figure 4 A flowchart of a text processing method according to an embodiment of the present disclosure is schematically shown;
[0047] Figure 5 A block diagram schematically shows a text processing device according to an embodiment of the present disclosure;
[0048] Figure 6 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0049] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0050] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0051] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0052] In the case of using expressions such as "at least one of A, B, and C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B, or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0053] The embodiment of the present disclosure provides a text processing method. The method includes obtaining an introduction text of a product, dividing the introduction text into multiple parts, each of the multiple parts includes at least one sentence, determining the central sentence of each part, using a random variable method, randomly sampling a sentence in each part to obtain a sampled sentence corresponding to each part, merging the sampled sentences corresponding to each part to obtain an input text, and the input text is used to generate a summary of the product.
[0054] Figure 1 The exemplary system architecture 100 to which the text processing method according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0055] like Figure 1As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0056] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0057] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0058] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0059] It should be noted that the text processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the text processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The text processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the text processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Alternatively, the text processing method provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, or 103, or can also be executed by other terminal devices different from the terminal devices 101, 102, or 103. Accordingly, the text processing device provided in the embodiment of the present disclosure can also be set in the terminal devices 101, 102, or 103, or can be set in other terminal devices different from the terminal devices 101, 102, or 103.
[0060] For example, the introduction text of the product may be originally stored in any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto), or stored in an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally execute the text processing method provided by the embodiment of the present disclosure, or send the introduction text of the product to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the introduction text of the product may execute the text processing method provided by the embodiment of the present disclosure.
[0061] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0062] Figure 2 The flowchart of the text processing method according to the embodiment of the present disclosure is schematically shown.
[0063] like Figure 2 As shown, the method includes operations S201 to S205.
[0064] In operation S201, an introduction text of a product is obtained, where the introduction text includes a plurality of sentences.
[0065] In operation S202, the introduction text is divided into a plurality of parts.
[0066] In operation S203, a central sentence of each of the plurality of parts is determined.
[0067] In operation S204, in each part, sampling is performed according to random variables P~E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i by distance from the central sentence of the part, and E(·) represents exponential distribution.
[0068] In operation S205, the sample sentences corresponding to each part are merged to obtain an input text, and the input text is used to generate a summary of the product.
[0069] In the present disclosure, the product may be a product under a small sample category, and the introduction text of the product may be taken from the details page of the product, and the details page of the product may display the introduction product information in the form of pictures, text, video, audio, etc. Using text extraction technology, the product information displayed in various forms such as pictures, text, video, audio, etc. on the details page of the product is extracted to obtain the full introduction text of the product. Furthermore, when the number of words in the full amount of the product text is less than a certain threshold, the full amount of the introduction text is the introduction text of the product. When the number of words in the full amount of the introduction text is not less than a certain threshold, a compression algorithm can be sampled to compress the full amount of the introduction text to form the introduction text of the product. The present disclosure does not limit the specific value of the threshold, and those skilled in the art can set it according to actual conditions. Similarly, the present disclosure does not limit the number of multiple parts, which can be 10, 20, 50, etc. The number of sentences in each part can be the same or different, and the present disclosure does not limit this.
[0070] In the present disclosure, the introduction text is divided into multiple parts, which can be divided arbitrarily, or a clustering algorithm is used to divide at least some of the multiple sentences in the introduction text into multiple parts. The clustering algorithm can be K-Means clustering, K-Medoids, Clara, Clarans, etc. The present disclosure does not limit the type of the clustering algorithm.
[0071] In the present disclosure, in each part, sampling is performed according to random variables P~E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution. Using random sampling that obeys exponential distribution, the randomness of sampling sentences in each part is guaranteed, and the probability that sentences closer to the central sentence are selected as sampled sentences is greater.
[0072] According to the present disclosure, the introduction text of the product is obtained, the introduction text is divided into multiple parts, and the central sentence of each of the multiple parts is determined. In each part, sampling is performed according to random variables P~E(λ) to obtain a sampled sentence corresponding to each part, and the sampled sentences corresponding to each part are merged to obtain an input text. Since each sampled sentence constituting the input text is randomly selected and sampled according to random variables P~E(λ), a variety of input texts can be generated for the product while ensuring that the sentence closer to the central sentence has a greater probability of being selected as a sampled sentence.
[0073] Figure 3A and 3B The flowchart of determining a central sentence according to an embodiment of the present disclosure is schematically shown.
[0074] like Figure 3AAs shown, operation S203 includes:
[0075] S301a, in each part, randomly obtain any sentence in the part as the corresponding central sentence. That is, the central sentence of each part is not limited to any sentence in each part.
[0076] like Figure 3B As shown, operation S203 includes:
[0077] S301b, calculating the similarity between each sentence included in each part.
[0078] S302b, in each part, calculate the sum of the similarities between each sentence and other sentences, and obtain the total similarity of each sentence in each part.
[0079] S303b, in each part, select the sentence with the highest total similarity as the corresponding central sentence.
[0080] For example, one part includes sentences M1, M2, and M3. The similarities S12, S13, and S23 between sentences M1, M2, and M3 are calculated. The total similarity of sentence M1 is S12+S13, the total similarity of sentence M2 is S12+S23, and the total similarity of sentence M3 is S13+S23. Then compare which value is the largest among S12+S13, S12+S23, and S13+S23. Assuming that the largest value is S12+S13, sentence M1 is taken as the central sentence in this part.
[0081] Figure 4 The flowchart of the text processing method according to the embodiment of the present disclosure is schematically shown.
[0082] like Figure 4 As shown, the method includes:
[0083] In operation S401 , a plurality of summaries of commodities are obtained based on input text.
[0084] In operation S402, a plurality of training samples are constructed according to the plurality of summaries.
[0085] In operation S403, a summary generation model is trained using a plurality of training samples to obtain a trained summary generation model.
[0086] Each training sample includes two different summaries, one of which is used as the input of the preset summary generation model, and the other is used as the output of the summary generation model. For example, for an input text, the product summaries are y1, y2, y3, and the training samples can be (y1, y2), (y2, y1), (y2, y3), (y3, y2), (y1, y3), (y3, y1), etc.
[0087] The trained summary generation model is used to generate a summary of a product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product. For example, for an input text, the product summaries are y1, y2, y3, and the trained summary generation model can be used to generate more yi, such as y1, y2, y3, ..., y m .
[0088] In the present disclosure, any one of the multiple summaries of a product is input into the trained summary generation model to generate a summary of the product that is the same as or different from the multiple summaries of the product.
[0089] In the present disclosure, the summary generation model is a sequence-to-sequence model based on a recurrent neural network (RNN), a convolutional neural network (CNN) or a Transformer.
[0090] In the present disclosure, the multiple summaries of the product can be manually written based on the input text, or can be obtained by using multiple existing summary models to input the input text into multiple summary models respectively to obtain multiple summaries of the product.
[0091] Figure 5 The block diagram of a text processing device according to an embodiment of the present disclosure is schematically shown.
[0092] like Figure 5 As shown, the text processing device 500 includes an acquisition module 510 , a division module 520 , a determination module 530 , a sampling module 540 and a merging module 550 .
[0093] An acquisition module 510 is used to acquire an introduction text of a product, where the introduction text includes a plurality of sentences;
[0094] A division module 520 is used to divide the introduction text into multiple parts;
[0095] A determination module 530, for determining a central sentence of each part;
[0096] A sampling module 540 is used to perform sampling in each part according to random variables P to E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution;
[0097] The merging module 550 is used to merge the sample sentences corresponding to each part to obtain an input text, and the input text is used to generate a summary of the product.
[0098] In one embodiment of the present disclosure, the determination module 530 is specifically configured to randomly obtain any sentence in each part as the corresponding central sentence.
[0099] In one embodiment of the present disclosure, the determination module 530 includes:
[0100] The similarity calculation submodule is used to calculate the similarity between the sentences in each part.
[0101] A sum calculation module is used to calculate the sum of similarities between each sentence and other sentences in each part, so as to obtain the total similarity of each sentence in each part;
[0102] The submodule is selected to select the sentence with the highest total similarity as the corresponding central sentence in each part.
[0103] In one embodiment of the present disclosure, the segmentation module 520 is specifically configured to segment at least part of the plurality of sentences into a plurality of parts by using a clustering algorithm.
[0104] In one embodiment of the present disclosure, the text processing device 500 further includes:
[0105] A generation module, used for generating multiple summaries of products based on input text;
[0106] A construction module, configured to construct a plurality of training samples according to the plurality of summaries, each training sample comprising two different summaries, one of the two different summaries being used as an input of a preset summary generation model, and the other being used as an output of the summary generation model;
[0107] The training module is used to train the summary generation model using the multiple training samples to obtain a trained summary generation model, and the trained summary generation model is used to generate a summary of the product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product.
[0108] In one embodiment of the present disclosure, the text processing device 500 further includes:
[0109] The input module is used to input any one of the multiple summaries of the product into the trained summary generation model to generate a summary of the product that is the same as or different from the multiple summaries of the product.
[0110] In one of the embodiments of the present disclosure, the summary generation model is a sequence-to-sequence model based on RNN, CNN or Transformer.
[0111] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0112] For example, any multiple of the acquisition module 510, the division module 520, the determination module 530, the sampling module 540, and the merging module 550 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the acquisition module 510, the division module 520, the determination module 530, the sampling module 540, and the merging module 550 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 510 , the division module 520 , the determination module 530 , the sampling module 540 and the merging module 550 may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be performed.
[0113] It should be noted that the text processing device part in the embodiment of the present disclosure corresponds to the text processing method part in the embodiment of the present disclosure. The description of the text processing device part specifically refers to the text processing method part, which will not be repeated here.
[0114] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0115] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0116] In RAM 603, various programs and data required for the operation of system 600 are stored. Processor 601, ROM 602 and RAM 603 are connected to each other through bus 604. Processor 601 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. Processor 601 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0117] According to an embodiment of the present disclosure, the system 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The system 600 may further include one or more of the following components connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0118] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0119] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0120] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0121] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or the RAM 603 described above and / or one or more memories other than the ROM 602 and the RAM 603 .
[0122] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0123] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0124] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A text processing method, comprising: Obtaining an introduction text of a product, wherein the introduction text includes a plurality of sentences; Dividing the introductory text into a plurality of parts, and determining a central sentence of each of the plurality of parts; In each of the parts, sampling is performed according to random variables P to E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution; The sample sentences corresponding to each part are merged to obtain input text, and the input text is used to generate the summary of the product.
2. The method according to claim 1, wherein determining the central sentence of each of the plurality of parts comprises: In each of the parts, any sentence in the part is randomly obtained as the corresponding central sentence.
3. The method according to claim 1, wherein determining the central sentence of each of the plurality of parts comprises: Calculate the similarity between the sentences in each part. In each of the parts, the sum of the similarities between each sentence and other sentences is calculated to obtain the total similarity of each sentence in each part; In each of the parts, the sentence with the highest total similarity is selected as the corresponding central sentence.
4. The method according to claim 1, wherein dividing the introduction text into a plurality of parts comprises: At least part of the plurality of sentences is segmented into the plurality of parts by using a clustering algorithm.
5. The method according to any one of claims 1 to 4, further comprising: Obtaining multiple summaries of the product based on the input text; Constructing a plurality of training samples according to the plurality of summaries, each of the training samples comprising two different summaries, one of the two different summaries being used as an input of a preset summary generation model, and the other being used as an output of the summary generation model; The summary generation model is trained using the multiple training samples to obtain a trained summary generation model, wherein the trained summary generation model is used to generate a summary of the product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product.
6. The method according to claim 5, further comprising: Any one of the multiple summaries of the product is input into the trained summary generation model to generate a summary of the product that is the same as or different from the multiple summaries of the product.
7. According to the method of claim 5, the summary generation model is a sequence-to-sequence model based on RNN, CNN or Transformer.
8. A text processing device, comprising: An acquisition module, used to acquire an introduction text of a product, wherein the introduction text includes a plurality of sentences; A division module, used for dividing the introduction text into multiple parts; A determination module, used for determining a central sentence of each of the plurality of parts; A sampling module, used for sampling in each part according to random variables P to E(λ) to obtain sampled sentences corresponding to each part, where λ=1 / the number of sentences in the part to be sampled, P represents the probability of taking a sentence ranked as i in distance from the central sentence of the part, and E(·) represents exponential distribution; The merging module is used to merge the sample sentences corresponding to each part to obtain input text, and the input text is used to generate the summary of the product.
9. The apparatus according to claim 8, further comprising: A generating module, used for generating a plurality of summaries of the product based on the input text; A construction module, configured to construct a plurality of training samples according to the plurality of summaries, each of the training samples comprising two different summaries, one of the two different summaries being used as an input of a preset summary generation model, and the other being used as an output of the summary generation model; A training module is used to train the summary generation model using the multiple training samples to obtain a trained summary generation model, wherein the trained summary generation model is used to generate a summary of the product that is the same as or different from the multiple summaries of the product based on any one of the multiple summaries of the product.
10. An electronic device, comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
11. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Text abstract extraction method and device, computer equipment and storage medium
CN110750637A
Text processing method, device and equipment and storage medium
CN111858907A