Text detection methods, devices, equipment and computer-readable storage media
By using a trained detection model to perform consistency checks on product descriptions, titles, and attributes, the problem of inconsistent information generated by the generation model was solved. This enabled refined detection of inconsistency types and intervals, improving detection accuracy and platform credibility.
Patent Information
- Application Number
- CN202210952230.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-08-09
AI Technical Summary
Existing generative models tend to generate sentences or words that do not match the source product information when generating product copy, resulting in limited detection effectiveness, an inability to finely distinguish inconsistency types, and a decline in the practicality of real-world applications.
By using a trained detection model to perform consistency checks on the text to be detected, the title, and attributes, multi-task detection can be achieved, which can finely distinguish inconsistency types and inconsistency ranges, thereby improving detection accuracy.
It enables rapid and accurate detection of product descriptions, avoiding misleading users and enhancing the platform's reputation.
Smart Images

Figure CN117688929B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and to, but is not limited to, a text detection method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] In today's era of rapid development in computer and internet technology, online shopping has become an indispensable part of people's lives. While browsing e-commerce websites, users often face an overload of information. To save time and energy, accurately presenting product features in the product descriptions on e-commerce websites is crucial, helping users directly understand the products they are browsing.
[0003] Product copywriting generation can be abstracted as a text summarization task, taking product information as input and descriptive text for the product as output. Product copywriting generation is well-suited to generative summarization methods. Extractive summarization extracts key information from the input and integrates it, while generative summarization encodes the input and generates each word and sentence using a decoder. Existing generative models tend to generate sentences or words that do not accurately reflect the original product information, significantly impacting their practicality in real-world scenarios. Summary of the Invention
[0004] In view of this, embodiments of this application provide a text detection method, apparatus, device, and computer-readable storage medium.
[0005] The technical solution of this application embodiment is implemented as follows:
[0006] This application provides a text detection method, the method comprising:
[0007] The receiving terminal sends a request message for text detection, the request message carrying the title, attributes and text to be detected of the object to be detected;
[0008] A trained detection model is obtained, which is used to detect the consistency information between the text to be detected and the title and attributes. The consistency information includes consistency and inconsistency types.
[0009] The title, attributes, and text to be detected are input into the trained detection model for processing to obtain the detection results.
[0010] A response message carrying the detection result is sent to the terminal so that the terminal processes the text to be detected based on the detection result.
[0011] This application provides a text detection device, the device comprising:
[0012] The receiving module is used to receive a request message sent by the terminal for text detection, wherein the request message carries the title, attributes and text to be detected of the object to be detected;
[0013] The acquisition module is used to acquire a trained detection model, which is used to detect the consistency information between the text to be detected and the title and attributes. The consistency information includes consistency and inconsistency types.
[0014] The processing module is used to input the title, attributes, and text to be detected into the trained detection model for processing to obtain the detection result;
[0015] The sending module is used to send a response message carrying the detection result to the terminal, so that the terminal can process the text to be detected based on the detection result.
[0016] This application provides a document detection device, including:
[0017] Processor; and
[0018] Memory for storing computer programs that can run on the processor;
[0019] The computer program, when executed by the processor, implements the steps of the above-mentioned text detection method.
[0020] This application provides a computer-readable storage medium storing computer-executable instructions configured to perform the steps of the above-described document detection method.
[0021] The text detection method of this application embodiment includes: receiving a request message sent by a terminal for text detection, the request message carrying the title, attributes, and text to be detected of an object to be detected; obtaining a trained detection model, the trained detection model being used to detect the consistency information between the text to be detected and the title and attributes, the consistency information including consistency and inconsistency type; inputting the title, attributes, and text to be detected into the trained detection model for processing to obtain a detection result; and sending a response message carrying the detection result to the terminal, so that the terminal processes the text to be detected based on the detection result. The text detection method provided by this application embodiment determines the consistency of the text to be detected based on the title and attributes of the object to be detected, and determines the inconsistency type when the text to be detected is inconsistent with the title and attributes, realizing multi-task detection of text, enabling refined detection of inconsistency types, and improving the accuracy of text inconsistency detection. Furthermore, the text detection method provided by this application embodiment can quickly and accurately detect inconsistent text, avoiding the publication of misleading text and enhancing platform credibility. Attached Figure Description
[0022] In the accompanying drawings (which are not necessarily drawn to scale), similar reference numerals may describe similar parts in different views. The drawings illustrate, by way of example and not limitation, the various embodiments discussed herein.
[0023] Figure 1 This is a schematic diagram of the network architecture of the text detection system provided in the embodiments of this application;
[0024] Figure 2 This is a schematic diagram illustrating an implementation process of the text detection method provided in an embodiment of this application;
[0025] Figure 3 A schematic diagram illustrating another implementation process of the text detection method provided in this application embodiment;
[0026] Figure 4 This is a schematic diagram illustrating another implementation process of the text detection method provided in the embodiments of this application;
[0027] Figure 5 A schematic diagram illustrating one implementation process for obtaining a second training dataset in the text detection method provided in this application embodiment;
[0028] Figure 6 A flowchart illustrating the product description inconsistency detection method provided in this application embodiment;
[0029] Figure 7 A schematic diagram of the framework of the multi-task joint learning model for product document inconsistency detection provided in this application embodiment;
[0030] Figure 8 This is a schematic diagram of the structure of the product description inconsistency detection system provided in the embodiments of this application;
[0031] Figure 9 A schematic diagram of the composition structure of the document detection device provided in the embodiments of this application;
[0032] Figure 10 This is a schematic diagram of the composition structure of a document detection device provided in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0034] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0035] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0037] Before providing a more detailed description of the embodiments of this application, in order to better understand the embodiments of this application, we will first explain the copywriting detection methods in related technologies and their shortcomings in conjunction with the application scenario of product copywriting in e-commerce websites.
[0038] Accurately presenting product features in product descriptions on e-commerce websites is crucial, as it helps users directly understand the products they browse. The essence of product description generation can be abstracted as a text summarization task, taking product information as input and descriptive text as output. Text summarization tasks can be divided into extractive summarization and generative summarization. As the names suggest, extractive summarization extracts important information from the input content and integrates this information, while generative summarization encodes the input content and generates each word and sentence through a decoder. Clearly, generative summarization is more suitable for product description generation. Existing generative models tend to generate sentences or words that do not conform to the factual information of the source product, which greatly affects the practicality of generative models in real-world scenarios. Related technologies use detection models to check the consistency between the generated product descriptions and the source product information, avoiding misleading users with inconsistent product descriptions. However, the text detection task in related technologies is equivalent to a binary classification task, only able to detect whether the product description is consistent with the source product information, lacking the distinction between inconsistency types, and unable to detect which part of the product description is inconsistent with the source product information, resulting in limited detection effectiveness.
[0039] Based on the above problems, this application provides a text detection method that compares product content with generated text content, distinguishes inconsistent content in a fine-grained manner, performs multi-classification of inconsistent information, and thus detects detailed inconsistent information in a refined way; furthermore, it predicts logical inconsistency intervals, which can effectively utilize product information to detect generated text more effectively and improve the text detection effect.
[0040] Based on the deficiencies of the aforementioned text detection solutions in related technologies, the method provided in the embodiments of this application will be described in conjunction with the apparatus for implementing the embodiments of this application. First, the text detection system provided in the embodiments of this application will be described. See [link to documentation]. Figure 1 , Figure 1 This is a schematic diagram of the network architecture of the text detection system provided in the embodiments of this application, such as... Figure 1 As shown, the text detection system 10 includes at least one terminal 100, a server 200, and a network 300. The terminal 100 is connected to the server 200 through the network 300, which can be a wide area network, a local area network, or a combination of both, and uses a wireless link to achieve data transmission.
[0041] In some embodiments, terminal 100 may be a laptop, tablet, desktop computer, smartphone, dedicated messaging device, portable gaming device, smart speaker, smartwatch, etc., or any device capable of generating the text to be detected. Server 200 may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server. Network 300 may be a wide area network or a local area network, or a combination of both. Terminal 100 and server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.
[0042] In the application scenario of this text detection system architecture, the terminal 100 first obtains the title, attributes and text to be detected of the object to be detected, generates a request message based on the title, attributes and text to be detected of the object to be detected, and sends the request message to the server 200 so that the server can perform text detection on the text to be detected.
[0043] Server 200 receives a request message from terminal 100, parses it to obtain the title, attributes, and text to be detected of the object to be detected carried in the request message; then, server 200 obtains a trained detection model, which is used to detect the consistency information between the text to be detected and the title and attributes, where the consistency information includes consistency and inconsistency types; the title, attributes, and text to be detected are input into the trained detection model for processing to obtain the detection result; finally, a response message carrying the detection result is sent to terminal 100.
[0044] After receiving the response message, terminal 100 processes the text to be detected based on the detection results carried in the response message.
[0045] The text detection method provided in this application determines the consistency of the text to be detected based on the title and attributes of the object to be detected. When the text to be detected is inconsistent with the title and attributes, the type of inconsistency is determined. In this way, multi-task detection of text can be achieved, and the type of inconsistency can be detected in a more refined manner, thereby improving the accuracy of text inconsistency detection.
[0046] The following describes the text detection method provided in the embodiments of this application. In some embodiments, the text detection method provided in the embodiments of this application can be... Figure 1 The server implementation of the network architecture shown. Figure 2 This is a schematic diagram illustrating an implementation process of the text detection method provided in this application embodiment, which will be combined with... Figure 2 The steps shown are explained.
[0047] Step S201: Receive a request message from the terminal for text detection.
[0048] The text detection method provided in this application can be applied to e-commerce scenarios, specifically for detecting product text on e-commerce platforms. With the rapid development of internet platforms, people can conduct various transactions online. To save time and effort, users prefer to see refined product text rather than complex product details. Therefore, accurately presenting product features in product text displayed on e-commerce platforms is crucial, as it helps users directly understand the products they browse. In practical applications, the method provided in this application can also be applied to any scenario requiring text consistency detection. Below, we will use an e-commerce scenario as an example to illustrate the method provided in this application.
[0049] The terminal obtains the title, attributes, and text to be detected of the object to be inspected. Based on the title, attributes, and text, it generates a request message and sends the request message to the server, so that the server can perform text inspection on the text. For example, the title, attributes, and text to be detected of the object are shown in Table 1:
[0050] Table 1. Examples of titles, attributes, and text to be detected for the objects to be inspected.
[0051]
[0052] The server receives the request message sent by the terminal, parses it, and obtains the title, attributes, and text to be detected of the object to be detected, as shown in Table 1.
[0053] Step S202: Obtain the trained detection model.
[0054] The trained detection model is obtained by the server training the initial detection model based on the training dataset. This trained detection model is used to detect the consistency information between the text to be detected and the title and attributes.
[0055] In one implementation, the consistency information includes consistency and inconsistency types. The server obtains a first training dataset and uses the first training data in this dataset to train an initial detection model, resulting in a trained detection model. This trained detection model can detect the consistency of the text to be detected. If the text to be detected is inconsistent with the title and attributes, the trained detection model further detects the inconsistency type of the text. In this way, multi-task detection of both text consistency and inconsistency types is achieved, enabling more refined detection of text inconsistency types and improving the accuracy of text inconsistency detection.
[0056] In another implementation, the consistency information, in addition to consistency and inconsistency type, may also include inconsistency intervals. The server obtains a second training dataset and uses the second training data in this dataset to train the constructed initial detection model, resulting in a trained detection model. This trained detection model can not only detect the consistency of the text to be detected, but also, if the text to be detected is inconsistent with the title and attributes, further detect the inconsistency type of the text to be detected, and also detect the inconsistency intervals of the text to be detected. In this way, multi-task detection of text consistency, inconsistency type, and inconsistency intervals is achieved, enabling more refined detection of text inconsistency types and intervals, further improving the accuracy of text inconsistency detection.
[0057] Step S203: Input the title, attributes, and text to be detected into the trained detection model for processing to obtain the detection results.
[0058] The title, attributes, and text to be detected are input into a trained detection model for processing to obtain detection results. These results include whether the text to be detected is consistent with the title and attributes, and when the text to be detected is inconsistent with the title and attributes, the type of inconsistency can be identified, such as factual consistency, attribute conflict, and content conjecture.
[0059] Taking the example in Table 1 above, the "Core i7 processor" in the text to be detected conflicts with the "i5" in the title and the "Intel i5" in the attribute. Based on this, it is determined that the text to be detected is inconsistent with the title and attribute, and the type of inconsistency between the text to be detected and the title and attribute is determined to be "attribute conflict".
[0060] Taking the text to be tested, with the title and attributes unchanged in Table 1 above, as an example, which reads "Built-in 11th generation Core processor, fearless of running multiple programs, 10 hours of standby time, no pressure for a whole day of office work. Backlit keyboard design, easy to use at night," the phrase "10 hours of standby time" does not appear in the title or attributes of this text, and this feature cannot be inferred from the title and attributes. No factual basis can be found. Therefore, it is determined that the text to be tested is inconsistent with the title and attributes, and the type of inconsistency is determined to be "content conjecture."
[0061] Taking the text to be tested, which is "Using liveness detection technology to protect privacy. Featuring a backlit keyboard design for effortless nighttime use," as an example, the term "liveness detection" does not appear in either the title or the attributes. Therefore, it is determined that the text to be tested is inconsistent with the title and attributes. Furthermore, based on the attribute "facial recognition," this feature can be inferred, thus providing factual evidence. Therefore, the type of inconsistency between the text to be tested and the title and attributes is determined to be "factual consistency."
[0062] Taking the title and attributes of Table 1 above as unchanged, and the text to be tested as "with backlit keyboard design, easy to use at night", the "backlit keyboard" in the text to be tested is consistent with the "backlit keyboard" in the attributes. Based on this, it is determined that the text to be tested is consistent with the title and attributes.
[0063] The text detection method provided in this application determines the consistency of the text to be detected based on the title and attributes of the object to be detected. When the text to be detected is inconsistent with the title and attributes, the type of inconsistency is determined, realizing multi-task detection of the text. It can detect the type of inconsistency in a more refined manner and improve the accuracy of text inconsistency detection.
[0064] Step S204: Send a response message carrying the detection result to the terminal so that the terminal can process the document to be detected based on the detection result.
[0065] After the server detects the results of the test text, it sends a response message to the terminal. This response message indicates the consistency information between the test text and the title and copy. Upon receiving the test results, the terminal processes the test text accordingly. Specifically, if the test text matches the title and copy, it indicates that the test text can be directly published on the e-commerce platform as a simplified version of the test text. If the test text does not match the title and copy, and the inconsistency type is factual consistency, it indicates that the test text can be directly published on the e-commerce platform as a simplified version of the test text. If the inconsistency type is attribute conflict or content conjecture, it indicates that the test text cannot yet be published on the e-commerce platform as a simplified version of the test text. Attribute conflicts or content conjecture need to be modified. The test text can only be published when it matches the title and copy or is factually consistent, ensuring the accuracy of the test text and avoiding misleading users.
[0066] The text detection method provided in this application includes: a server receiving a request message from a terminal for text detection, the request message carrying the title, attributes, and text to be detected of the object to be detected; acquiring a trained detection model, wherein the trained detection model is used to detect the consistency information between the text to be detected and the title and attributes, the consistency information including consistency and inconsistency types; inputting the title, attributes, and text to be detected into the trained detection model for processing to obtain a detection result; and sending a response message carrying the detection result to the terminal, so that the terminal processes the text to be detected based on the detection result. By using the server-trained detection model to process the text to be detected with the title and attributes of the object to be detected, the consistency of the text to be detected is determined. When the text to be detected is inconsistent with the title and attributes, the inconsistency type is determined, realizing multi-task detection of text, enabling refined detection of inconsistency types, and improving the accuracy of text inconsistency detection. The text detection method provided in this application can quickly and accurately detect inconsistent text, avoiding the publication of misleading text and enhancing platform credibility.
[0067] exist Figure 2 Based on the embodiments shown, this application further provides a text detection method. Figure 3 This is a schematic diagram illustrating another implementation process of the text detection method provided in the embodiments of this application, such as... Figure 3 As shown, the method includes the following steps:
[0068] Step S301: Receive a request message from the terminal for text detection.
[0069] The terminal obtains the title, attributes, and text to be detected of the object to be detected, generates a request message based on the title, attributes, and text to be detected of the object to be detected, and sends the request message to the server. The request message carries the title, attributes, and text to be detected of the object to be detected.
[0070] The server receives the request message sent by the terminal, parses it, and obtains the title, attributes, and text to be detected of the object to be detected.
[0071] The following steps S302 and S303 are Figure 2 One implementation of step S202 in the illustrated embodiment. Steps S302 and S303 can be executed before or after step S301.
[0072] Step S302: Obtain the first training dataset.
[0073] The first training data in the first training dataset includes a first training title, a first training attribute, a first training text, a first identifier, and a second identifier.
[0074] The first identifier here is used to indicate the consistency between the first training text and the first training title and the first training attribute, which includes both consistency and inconsistency.
[0075] The second identifier here is used to indicate the type of inconsistency between the first training text and the first training title and the first training attribute when the consistency is inconsistent. The inconsistency type includes factual consistency, attribute conflict and content conjecture.
[0076] Step S303: Train the constructed initial detection model using the first training data in the first training dataset to obtain the trained detection model.
[0077] The server constructs an initial detection model and trains it using the first training data in the first training dataset to obtain a trained detection model. This trained detection model is used to detect consistency information between the text to be detected and the title and attributes, where consistency information includes consistency and inconsistency types.
[0078] In this embodiment, the training process of the detection model can be viewed as a multi-task learning process involving a consistency determination task and an inconsistency category classification task. The server acquires the first training data, including the first training title, first training attribute, first training text, first identifier, and second identifier, from the first training dataset, and trains the constructed initial detection model to obtain a trained detection model. This trained detection model can detect the consistency of the text to be detected. If the text to be detected is inconsistent with the title and attributes, the trained detection model further detects the inconsistency type of the text. Thus, multi-task detection of text consistency and inconsistency type is achieved, enabling more refined detection of text inconsistency types and improving the accuracy of text inconsistency detection.
[0079] Step S304: Input the title, attributes, and text to be detected into the trained detection model for processing to obtain the detection results.
[0080] In this embodiment, the trained detection model can be viewed as two sub-models following the multi-task learning process described above: a trained first sub-model and a trained second sub-model. The title, attributes, and the text to be detected are input into the trained detection model. First, the binary classification trained first sub-model judges the consistency between the text to be detected and the title and attributes. When the output of the trained first sub-model indicates an inconsistency between the text to be detected and the title and attributes, the tri-class classification trained second sub-model further judges the type of inconsistency, determining whether the inconsistency belongs to factual consistency, attribute conflict, or content conjecture. Finally, based on the outputs of the trained first and second sub-models, the detection result of the trained detection model is determined.
[0081] The text detection method provided in this application determines the consistency of the text to be detected based on the title and attributes of the object to be detected. When the text to be detected is inconsistent with the title and attributes, the type of inconsistency is determined, realizing multi-task detection of the text. It can detect the type of inconsistency in a more refined manner and improve the accuracy of text inconsistency detection.
[0082] Step S305: Send a response message carrying the detection result to the terminal so that the terminal can process the document to be detected based on the detection result.
[0083] After the server detects the results of the test of the text to be tested, it sends a response message to the terminal. This response message indicates the consistency information between the text to be tested and the title and text. After receiving the test results, the terminal processes the text to be tested accordingly.
[0084] The text detection method provided in this application uses a trained detection model to detect the consistency information between the text to be detected and its title and attributes. This consistency information includes consistency and inconsistency types. The detection model, trained on a server, processes the text to be detected against the title and attributes of the target object to determine the consistency of the text. When the text to be detected is inconsistent with the title and attributes, the inconsistency type is determined. This achieves multi-task detection of the text, enabling refined detection of inconsistency types and improving the accuracy of text inconsistency detection. The text detection method provided in this application can quickly and accurately detect inconsistent text, preventing the publication of misleading text and enhancing platform credibility.
[0085] In some embodiments, Figure 3 Step S302, "Obtain the first training dataset," in the illustrated embodiment can be achieved through the following steps:
[0086] Step S3021: Obtain the trained generative model, the trained consistency detection model, and the test dataset.
[0087] The test dataset is a collection of test data for multiple test objects. Each test data in the test dataset includes a first training title and a first training attribute.
[0088] The server uses the title, attributes, and text of the sample object to train the initial generation model, resulting in a trained generation model. The trained generation model is then used to process the test title and test attributes to generate the text. The generated text is then marked for consistency. Finally, based on the test title, test attributes, generated text, and consistency mark, the initial consistency detection model is trained to obtain a trained consistency detection model.
[0089] Step S3022: Input the first training title and the first training attribute of each test data into the trained generative model for processing to obtain the first training text corresponding to each test data.
[0090] The server inputs the first training title and the first training attribute into the trained generative model to generate the first training text for the first test object. This first test object is the object described by the first training title and the first training attribute. It should be noted that the first training text here is not the text input by the user, but rather the text automatically generated by the generative model. This first training text may or may not be the same as the first training title and the first training attribute.
[0091] Step S3023: Input the first training title, first training attribute and corresponding first training text of each test data into the trained consistency detection model for processing, and obtain the consistency detection results of each first training text.
[0092] The server inputs the first training title, the first training attribute, and the generated first training text into the trained consistency detection model for consistency detection, and obtains the consistency detection results for each first training text. The consistency detection results indicate that the generated first training text is consistent with the first training title and the first training attribute, or that the generated first training text is inconsistent with the first training title and the first training attribute.
[0093] Step S3024: Determine the first identifier and the second identifier corresponding to each test data based on the consistency detection results.
[0094] In practical implementation, the first and second identifiers corresponding to the test data can be determined by the user, or semantic analysis can be used to determine the first and second identifiers corresponding to each test data. Based on the user input or the semantic analysis results, the first identifier corresponding to test data with consistent consistency detection results is marked as the first value; the first identifier corresponding to test data with inconsistent consistency detection results is marked as the second value. The second identifier corresponding to test data with consistent consistency detection results is marked as a default value, such as "NULL"; the second identifier corresponding to test data with inconsistent consistency detection results and the inconsistency type is factual consistency is marked as the third value; the second identifier corresponding to test data with inconsistent consistency detection results and the inconsistency type is attribute conflict is marked as the fourth value; and the second identifier corresponding to test data with inconsistent consistency detection results and the inconsistency type is content conjecture is marked as the fifth value.
[0095] Step S3025: Determine the first training dataset based on the first training title and first training attribute, the corresponding first training text, the first identifier and the second identifier included in each test data.
[0096] The first training title and first training attribute, the corresponding first training text, the first identifier and the second identifier of each test data are taken as a set of training data. The above steps are performed on each test data in the test dataset to obtain multiple sets of training data, which are then combined to form the first training dataset.
[0097] In some embodiments, the "obtaining the trained generative model" in step S3021 of the above embodiments can be achieved through the following steps:
[0098] Step S30211: Obtain content information of multiple collection objects.
[0099] The content information includes the title, attributes, and text. Multiple objects are randomly selected from those already published on the platform as the data collection targets, and their titles, attributes, and text are extracted as the content information. To facilitate differentiation between different data collection targets, each object's ID can also be collected as a unique identifier during the actual data collection process.
[0100] Step S30212: Determine the sample object set and the target attributes of each sample object in the sample object set based on the attributes of multiple collected objects.
[0101] In one implementation, determining the sample object set can be achieved by: obtaining the number of attributes of each collected object; and adding collected objects with a number of attributes greater than a first threshold as sample objects to the sample object set.
[0102] In practical applications, if the number of attributes of the collected objects is too small, it will not only affect the generation of the copy, but may also lead to a large error in the consistency judgment of the generated copy. In this embodiment of the application, in order to improve the accuracy of the detection model, the collected objects are screened. For example, if the number of attributes of the collected object is less than or equal to 5, the collected object is deleted, and the remaining collected objects with more than 5 attributes are used as sample objects.
[0103] In one implementation, determining the target attributes of each sample object in the sample object set can be achieved by: when the number of attributes of a sample object is greater than a second threshold, selecting the second threshold of attributes as the target attributes of the sample object based on the number of times the attributes of the sample object are collected.
[0104] In practical applications, an excessive number of attributes for a sample object can lead to overly complex and concise text, failing to meet the requirements of conciseness and reducing processing speed. In this embodiment, attributes of sample objects with an excessive number of attributes are filtered out. For example, if the number of attributes of a sample object is greater than 30, 30 attributes are randomly selected as the target attributes of that sample object; alternatively, the top 30 attributes can be selected based on their importance; or the top 30 attributes with the highest frequency of occurrence of the same attribute in different sample objects can be selected as the target attributes of that sample object. When the number of attributes of a sample object is greater than a first threshold and less than or equal to a second threshold, all attributes of that sample object are considered as the target attributes of that sample object.
[0105] Step S30213: Use the titles, target attributes and text of each sample object in the sample object set to train the constructed initial generation model to obtain the trained generation model.
[0106] After obtaining the set of sample objects and their target attributes, the server trains the initial generative model based on the title, target attributes, and text of each sample object, resulting in a trained generative model. This trained model can then generate text for a given object based on its title and attributes.
[0107] exist Figure 2 Based on the embodiments shown, this application further provides a text detection method. Figure 4 This is a schematic diagram illustrating another implementation flow of the text detection method provided in the embodiments of this application, such as... Figure 4 As shown, the method includes the following steps:
[0108] Step S401: Receive a request message from the terminal for text detection.
[0109] The terminal obtains the title, attributes, and text to be detected of the object to be detected, generates a request message based on the title, attributes, and text to be detected of the object to be detected, and sends the request message to the server. The request message carries the title, attributes, and text to be detected of the object to be detected.
[0110] The server receives the request message sent by the terminal, parses it, and obtains the title, attributes, and text to be detected of the object to be detected.
[0111] The following steps S402 and S403 are Figure 2 Another implementation of step S202 in the illustrated embodiment. Steps S402 and S403 can be executed before or after step S401.
[0112] Step S402: Obtain the second training dataset.
[0113] The second training dataset includes a second training title, a second training attribute, a second training text, a first identifier, a second identifier, and a third identifier.
[0114] The first identifier here is used to indicate the consistency between the second training text and the second training title and the second training attribute, which includes both consistency and inconsistency.
[0115] The second identifier here is used to indicate the type of inconsistency between the second training text, the second training title, and the second training attribute when consistency is inconsistent. This inconsistency type includes factual consistency, attribute conflict, and content conjecture. When consistency is consistent, the second identifier is the default value.
[0116] The third identifier here includes a first flag bit and a second flag bit, wherein the first flag bit is used to indicate the start position of the inconsistency interval and the second flag bit is used to indicate the end position of the inconsistency interval.
[0117] Step S403: Use each of the second training data in the second training dataset to train the constructed initial detection model to obtain the trained detection model.
[0118] The server constructs an initial detection model and trains it using the second training data from the second training dataset to obtain a trained detection model. This trained detection model is used to detect consistency information between the text to be detected and the title and attributes. The consistency information includes consistency, inconsistency type, and inconsistency range.
[0119] In this embodiment, the training process of the detection model can be viewed as a multi-task learning process consisting of a consistency determination task, a classification task for inconsistency categories, and a prediction task for inconsistency intervals. The server acquires the second training data, including the second training title, second training attributes, second training text, first identifier, second identifier, and third identifier, from the second training dataset. It then trains the constructed initial detection model to obtain a trained detection model. This trained detection model can not only detect the consistency of the text to be detected, but also, if the text to be detected is inconsistent with the title and attributes, further detect the inconsistency type of the text, and also detect the inconsistency intervals of the text. Thus, multi-task detection of text consistency, inconsistency type, and inconsistency intervals is achieved, enabling refined detection of text inconsistency types and intervals, further improving the accuracy of text inconsistency detection.
[0120] Step S404: Input the title, attributes, and text to be detected into the trained detection model for processing to obtain the detection results.
[0121] In this embodiment, the trained detection model can be viewed as three sub-models following the multi-task learning process described above: a trained first sub-model, a trained second sub-model, and a trained third sub-model. The title, attributes, and the text to be detected are input into the trained detection model. First, the binary classification trained first sub-model judges the consistency between the text to be detected and the title and attributes. When the output of the trained first sub-model indicates an inconsistency between the text to be detected and the title and attributes, the ternary classification trained second sub-model further judges the type of inconsistency, determining whether the inconsistency belongs to factual consistency, attribute conflict, or content conjecture. Then, the trained third sub-model judges the inconsistency range between the text to be detected and the title and attributes, determining the inconsistency range of the text to be detected. Finally, based on the outputs of the trained first, second, and third sub-models, the detection result of the trained detection model is determined.
[0122] The text detection method provided in this application determines the consistency of the text to be detected based on the title and attributes of the object to be detected. When the text to be detected is inconsistent with the title and attributes, the method determines the type and range of inconsistency, thereby realizing multi-task detection of the text and enabling more refined detection of the type and range of inconsistency, thus improving the accuracy of text inconsistency detection.
[0123] Step S405: Send a response message carrying the detection result to the terminal so that the terminal can process the document to be detected based on the detection result.
[0124] After the server detects the results of the test of the text to be tested, it sends a response message to the terminal. This response message indicates the consistency information between the text to be tested and the title and text. After receiving the test results, the terminal processes the text to be tested accordingly.
[0125] The text detection method provided in this application uses a trained detection model to detect the consistency information between the text to be detected and its title and attributes. This consistency information includes consistency, inconsistency type, and inconsistency range. The detection model, trained on a server, processes the text to be detected against the title and attributes of the target object to determine the consistency of the text. When the text to be detected is inconsistent with the title and attributes, the inconsistency type and inconsistency range are determined, enabling multi-task detection of the text. This allows for more refined detection of inconsistency types and ranges, improving the accuracy of text inconsistency detection. The text detection method provided in this application can quickly and accurately detect inconsistent text, preventing the publication of misleading text and enhancing platform credibility.
[0126] In some embodiments, Figure 4 Step S402, "Obtaining the second training dataset," in the illustrated embodiment can be achieved through... Figure 5 To achieve this, follow the steps shown:
[0127] Step S4021: Obtain the trained generative model, the trained consistency detection model, and the test dataset.
[0128] The test dataset is a collection of test data for multiple test objects, and each test data in the test dataset includes a second training title and a second training attribute.
[0129] The server uses the title, attributes, and text of the sample object to train the initial generation model, resulting in a trained generation model. The trained generation model is then used to process the test title and test attributes to generate the text. The generated text is then marked for consistency. Finally, based on the test title, test attributes, generated text, and consistency mark, the initial consistency detection model is trained to obtain a trained consistency detection model.
[0130] Step S4022: Input the second training title and second training attribute of each test data into the trained generative model for processing to obtain the second training text corresponding to each test data.
[0131] The server inputs the second training title and the second training attributes into the trained generative model to generate the second training text for the second test object. This second test object is the object described by the second training title and the second training attributes. It should be noted that this second training text is not the text input by the user, but rather text automatically generated by the generative model. This second training text may or may not be identical to the second training title and the second training attributes.
[0132] Step S4023: Input the second training title, second training attribute and corresponding second training text of each test data into the trained consistency detection model for processing, and obtain the consistency detection results of each second training text.
[0133] The server inputs the second training title, the second training attribute, and the generated second training text into the trained consistency detection model for consistency detection, and obtains the consistency detection results for each second training text. The consistency detection results indicate that the generated second training text is consistent with the second training title and the second training attribute, or that the generated second training text is inconsistent with the second training title and the second training attribute.
[0134] Step S4024: Determine the first identifier, second identifier, and third identifier corresponding to each test data based on the consistency detection results.
[0135] In practical implementation, the first, second, and third identifiers corresponding to the test data can be determined by the user, or they can be determined by combining semantic analysis. The third identifier includes a first flag bit and a second flag bit. The first flag bit indicates the start position of the inconsistency interval, and the second flag bit indicates the end position of the inconsistency interval. Based on user input or semantic analysis results, the first identifier corresponding to test data with consistent consistency is marked as the first value; the first identifier corresponding to test data with inconsistent consistency is marked as the second value. The second identifier corresponding to test data with consistent consistency is marked as a default value, such as "NULL"; the second identifier corresponding to test data with inconsistent consistency and an inconsistency type of factual consistency is marked as the third value; the second identifier corresponding to test data with inconsistent consistency and an inconsistency type of attribute conflict is marked as the fourth value; and the second identifier corresponding to test data with inconsistent consistency and an inconsistency type of content conjecture is marked as the fifth value. The starting position of the word or sentence in the training text corresponding to the test data with inconsistent consistency detection results that is inconsistent with the training title and training attributes is used as the first flag of the third identifier, and the ending position of the word or sentence in the training text corresponding to the test data with inconsistent consistency detection results that is inconsistent with the training title and training attributes is used as the second flag of the third identifier.
[0136] Step S4025: Determine the second training dataset based on the second training title and second training attribute, the corresponding second training text, the first identifier and the second identifier included in each test data.
[0137] The second training title and second training attribute, the corresponding second training text, the first identifier, the second identifier, and the third identifier of each test data are taken as a set of training data. The above steps are performed on each test data in the test dataset to obtain multiple sets of training data, which are then combined to form the second training dataset.
[0138] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.
[0139] Product copywriting generation can be abstracted as a text summarization task. It takes product information as input and processes that information using natural language to generate text describing the product. Existing methods often generate sentences that contradict the facts in the source document, significantly impacting the practicality of the generative model in real-world scenarios. For example, in Table 2, the source document describes a laptop computer from brand xxx equipped with a Core i5 processor. However, in summary example 1 generated by the generative model, the laptop is described as having a Core i7 processor, clearly contradicting product facts and severely impacting user experience. Similarly, in summary example 2 in Table 2, the model generates a sentence claiming the laptop has a 10-hour standby time, but this is not supported by the product title and attributes in the source document, potentially misleading users. Therefore, existing generative models may generate summaries that conflict with product information or contain assumptions about product attributes. Thus, detecting whether the generated summary text is consistent with the input product information—that is, the factual consistency of the generated summary—has significant practical application value.
[0140] Table 2 Examples of summaries generated by existing generative models that do not match the facts of the source documents.
[0141]
[0142] To evaluate factual consistency in generated summaries, some researchers have annotated a small number of summaries that are inconsistent with the source documents. The question-answering (QA)-based factual consistency evaluation metric, QAGS, is based on the assumption that asking the same question to both the summary and the source document should yield similar answers. However, small-scale annotated datasets are insufficient to learn the correct factual consistency evaluation metric or optimize factual consistency summary generation models. Since creating large-scale, high-quality datasets with human annotations is both expensive and time-consuming, related techniques employ a series of rule-based transformations, such as entity and number swapping, pronoun swapping, sentence negation, and noise injection, to generate adversarial examples for augmenting with small amounts of annotated data. Because the types of actual inconsistency errors generated by generative models are diverse, it is difficult to simulate all situations based solely on these rule transformations. Therefore, a large-scale, fine-grained annotated dataset is still needed, and a consistency detection model suitable for product copywriting generation should be proposed to facilitate the study of factual consistency between products and copywriting.
[0143] Compared to existing text summarization fact consistency models, fact consistency detection for product copy generation in e-commerce scenarios remains a blank. Traditional consistency detection models lack specific design for product attributes and do not have usable datasets of inconsistent product copy, resulting in the following main problems with traditional detection methods:
[0144] 1) Traditional methods fail to differentiate between types of factual inconsistencies, simply treating inconsistency detection as a binary classification task. This lack of fine-grained model design results in limited consistency model detection performance. For example, in the examples in Table 2, traditional methods only detect inconsistencies in both summary1 and summary2, without distinguishing whether summary1's inconsistency stems from attribute conflicts or summary2's inconsistency is due to content assumptions. Therefore, the effectiveness of traditional methods in inconsistency detection needs improvement.
[0145] 2) Traditional methods do not include an inconsistency interval prediction task; instead, they only design a binary classification task for inconsistency detection. This results in the loss of crucial data information and prevents the effective learning of multiple tasks. For example, in the examples in Table 2, traditional methods do not utilize the location information of the factual inconsistency or characterize which attribute caused the inconsistency. Specifically, summary 1 is due to a processor model inconsistency, and summary 2 is due to standby time inconsistency. Clearly, traditional methods do not fully utilize the data, leading to limited inconsistency detection performance.
[0146] This application provides a system for detecting the consistency between product information and the facts stated in the product description, specifically:
[0147] 1) To address the issue of not distinguishing between factual inconsistency types, we first use the pre-trained BERT model to encode product information and textual information, obtaining their encoding vectors [CLS]. Then, we construct a multi-layer perceptron as a multi-classification model, using the encoding vectors [CLS] as input to the multi-layer perceptron to construct a three-classification task: factual consistency, attribute conflict, and content conjecture.
[0148] 2) To address the issue of the lack of an auxiliary task—inconsistent interval prediction—this application proposes a multi-task learning framework based on a pre-trained model to improve the performance of text classification and interval prediction tasks. For the text classification task, the steps in 1) are used for construction. For the interval prediction task, the pre-trained model BERT from 1) is used to encode product information and copywriting information to obtain the encoded information of each word. Then, a neural network is used to predict the encoded information of each word, and finally, softmax is used to predict the start and end positions of the interval.
[0149] Figure 6 This is a flowchart illustrating the product description inconsistency detection method provided in this application embodiment. The following is a summary of the process. Figure 6 This paper introduces the training data collection and processing methods of the product copy inconsistency detection system, the training process of inconsistency detection, and the process of inconsistency detection in real scenarios.
[0150] Training data collection and processing methods for a product description inconsistency detection system:
[0151] 1) Training data collection for the text summarization model:
[0152] a) Given the product's content information, including product ID, product title, and product attributes, collect the product's copywriting information.
[0153] b) Based on the collected information, construct an attribute pool for each category. When the number of products contained in a certain attribute under a certain category is greater than N, the attribute is considered to be an important attribute for that category.
[0154] c) For each product, retain the relevant attributes of the product according to the attribute pool of each category.
[0155] d) When the number of attributes of a product is less than n1, delete the product. Here, n1 is a positive integer.
[0156] e) When the number of attributes of a product is greater than n2, only the top n2 attributes can be retained. Here, n2 is a positive integer and is greater than n1.
[0157] f) Finally, the product's triplet information (product title, product attributes, product description) was obtained.
[0158] 2) Training and testing of the text summarization model:
[0159] The generated model is trained using the obtained product text: (Product title, product attributes) are encoded as input, and the product text is decoded as output. The generated model is then trained to obtain the trained model. The following explanation uses the traditional pointer network Transformer-PT and the pre-trained T5-PEGASUS model as examples:
[0160] a) First, connect the product title and product attributes with a space and use it as the input text for Transformer-PT.
[0161] b) Then, using the pointer network, Transformer-PT generates new or copied words from the input text.
[0162] c) Divide the product dataset into a training dataset, a validation dataset, and a test dataset. Use the training dataset and the validation dataset to train the model and obtain a trained model.
[0163] d) Finally, for the test data in the test dataset, use the Transformer-PT model and T5-PEGASUS to generate summary texts for manual annotation in the following steps.
[0164] 3) Manual annotation of inconsistency types and intervals:
[0165] The generated copy is manually annotated based on the product content, following the rules below:
[0166] a) Delete the sample if the generated text contains a grammatical error.
[0167] b) Delete the sample if the facts presented in the generated copy cannot be inferred from the title and attributes.
[0168] c) Check whether the generated copy is consistent with the title and attributes of the product. If they are inconsistent, classify the type of inconsistency, including "factual consistency", "attribute conflict" and "content conjecture".
[0169] d) When the generated copy is classified as inconsistent (including "attribute conflict" and "content conjecture"), the start and end points of the inconsistency also need to be marked in the copy.
[0170] 4) Finally, obtain detailed information (product title, product attributes, generated copy, labels, start and end of the range).
[0171] Using the solution provided in this application, products in an e-commerce website database were tested, obtaining 7.3 million data entries of product triplet information (product title, product attributes, product description). 3.4 million data entries were randomly selected as the training dataset for training, 100,000 as the validation dataset for validation, and 100,000 as the test dataset for testing. The model was trained using the training and validation datasets to obtain a trained model. The 100,000 test data entries from the test dataset were input into the trained model, resulting in 200,000 generated descriptions. Professional annotators manually annotated the product content of the 100,000 test data entries and the 200,000 generated descriptions according to the aforementioned annotation rules, resulting in 36,804 data entries. Among these, 10,064 data entries were labeled as consistent, 4,601 data entries had attribute conflicts, and 22,139 data entries had content speculation.
[0172] In this embodiment of the application, the process of detecting inconsistencies in product copywriting is regarded as a multi-task learning of a logical consistency classification task and an interval prediction (fragment extraction) task. First, there is a consistency classification task, which determines whether the generated copywriting is consistent with the input title and attributes. Then, there is an interval prediction task for inconsistent copywriting, which finds the fragments in the copywriting that are inconsistent with the input title and attributes. Figure 7This is a schematic diagram of the framework of the multi-task joint learning model for product document inconsistency detection provided in this application embodiment. The system includes a logical inconsistency classification module, a logical inconsistency interval prediction module, and a multi-task joint learning module.
[0173] 1) Logical Inconsistency Classification Module: This module takes the product title, product attributes, and generated text as input to the classification model, obtaining three prediction results: "Factual Consistency," "Attribute Conflict," and "Content Illusion." Specifically, given the input title t, attribute a, and generated text s, the classification task can be defined as:
[0174] y = f([t,a],s) (1);
[0175] Here, f represents the trained classification model, and y is the output of a multi-dimensional vector. In this classification task, y is a three-dimensional vector representing the results of three classifications: factual consistency, attribute conflict, and content conjecture.
[0176] In practical applications, the pre-trained BERT model can be used as a unified encoder. The input to the classification model can be defined as ([CLS], t, a, [SEP], s, [SEP]), where [CLS] and [SEP] are special symbols. In this input, the title sequence t and the attribute sequence a can be simply connected using spaces. After encoding by the pre-trained BERT model, the hidden state h is obtained by outputting the [CLS] position. CLS Classification prediction is defined as follows:
[0177] y = softmax(W1h) CLS +b1) (2);
[0178] Among them, W1 and b1 are learnable parameters.
[0179] The training objective is the binary cross-entropy loss function, which is defined as:
[0180]
[0181] Where y i These are genuine human-generated labels.
[0182] 2) Logical Inconsistency Interval Prediction Module: This module takes the product title, product attributes, and generated text as input to the interval prediction model to obtain the start and end position information of the segments. Specifically, given the input title t, attribute a, and generated text s, the interval prediction task can be defined as:
[0183] p start ,p end =L([t,a],s) (4);
[0184] Where L() represents the trained interval prediction model, p start and p end These represent the start and end positions of inconsistent segments in the generated text, respectively.
[0185] In practical applications, similar to classification tasks, the input to the interval prediction model can also be defined as ([CLS], t, a, [SEP], s, [SEP]). First, a label vector, defined as h, is generated for each word in the generated text. i , where i represents the i-th word in the text. Given vector h i Calculate the probability that the i-th word is the beginning of a logically inconsistent segment, defined as follows:
[0186]
[0187]
[0188] in, It is a learnable parameter. This represents the probability that the i-th word is the beginning of a logically inconsistent segment. The softmax() operation is performed on the entire text sequence. During the inference phase, this is achieved through argmax(b start The starting position p can be calculated. start .
[0189] Similarly, the probability that the j-th word is the end of a logically inconsistent segment is calculated as follows:
[0190]
[0191]
[0192] in, It is a learnable parameter. This represents the probability that the j-th word is the end of a logically inconsistent passage. During the inference phase, argmax(b) is used to... end Calculate the starting position p end .
[0193] The training objective is to minimize the following cross-entropy loss:
[0194]
[0195] Where i* and j* represent the start and end positions of the manually assigned tags. If the generated summaries are consistent, the predictions for the start and end positions are concentrated at the [CLS] position.
[0196] 3) Multi-task joint learning module: To improve the performance of inconsistency detection, this embodiment proposes to model the correlation between the classification task and the interval prediction task, using a multi-task training method as a unified framework. Specifically, the training loss can be defined as:
[0197]
[0198] in and These are the loss functions for classification tasks and interval prediction tasks, respectively.
[0199] Figure 8 This is a schematic diagram of the structure of the product description inconsistency detection system provided in the embodiments of this application, as shown below. Figure 8 As shown, the product copywriting inconsistency detection system includes a pre-trained model unified encoding module 801, a logical inconsistency classification module 802, a logical inconsistency interval prediction module 803, and a multi-task joint learning module 804.
[0200] Pre-trained model unified encoding module 801: Given a product title, product attributes, and product copy, the pre-trained model BERT is used to encode the content of the title, attributes, and copy to obtain the vector representation of the overall input, the vector representation of each word of the input title attributes, and the vector representation of each word of the product copy.
[0201] The logical inconsistency classification module 802: This module takes the vector representation of the overall input from the pre-trained model's unified encoding module and inputs it into a multilayer perceptron. The classification model performs a neural network mapping on the overall input vector, followed by a softmax operation to obtain a three-dimensional vector representing the three classification results. The model is then trained by applying a cross-entropy loss function between the model's predicted results and the true labels.
[0202] The logically inconsistent interval prediction module 803: It performs a linear transformation on the vector representation of each word in the product copy from the pre-trained model's unified encoding module to obtain the probability representation of each word as the start position of an interval. Then, it calculates the normalized probability of each word in the entire copy being the start position of an interval using softmax. The true interval start position probability representation is a one-hot vector (a one-hot vector has exactly one element of 1, and all other elements are 0), meaning the vector value at the true start position is 1, and the vector values at other positions are 0. Similarly, it calculates the normalized probability of each word being the end position of an interval and the probability representation of the true interval end position. The normalized probabilities output by the model are then cross-entropy calculated with the true vectors to train this module.
[0203] Multi-task joint learning module 804: The loss function of the logical inconsistency classification module 802 and the loss function of the logical inconsistency interval prediction module 803 are superimposed to form a unified framework for multi-task training and optimized at the same time. The two tasks can learn each other's information, which helps to improve each other's performance.
[0204] The process of detecting inconsistencies in product descriptions in a real-world scenario is as follows:
[0205] Given the title information, attribute information, and text information of the product to be detected, the pre-trained BERT encoder is used to encode the title, attributes, and text information to be detected, obtaining the vector representation of the overall input and the vector representation of each input word.
[0206] The vector representation of the overall input is obtained by using the pre-trained BERT encoder model, and the classification result vector of the classification model is obtained by passing the multilayer perceptron of the logical inconsistency classification module.
[0207] If the first dimension of the classification result vector has the largest value, it proves that the copy is consistent with the original product; if the second dimension has the largest value, it proves that the copy may have an attribute conflict with the original product; if the third dimension has the largest value, it proves that the copy may have a content misrepresentation problem with the original product.
[0208] Here is a running example of a product description inconsistency detection system:
[0209] The product title is "xxxT14 Core Edition 14-inch T-series Lightweight Portable Business Laptop i5-1135G7, 8G, 512G," and the product attributes are "xxx-T series, facial recognition, backlit keyboard, 14.0-14.9 inch, full HD screen, dedicated graphics card, Intel i5, 512GB, 8GB, 3.5mm headphone jack, lightweight and portable." The generated text is "Equipped with a Core i7 processor, powerful performance, smooth operation without lag." A pre-trained BERT encoder model is used to encode the title, attributes, and text in 768 dimensions, obtaining a 768-dimensional vector representation of the overall input. This 768-dimensional vector representation is then used as input, passed through a multilayer perceptron network of a trained logical inconsistency classification model. The vector is multiplied by the W matrix, and then further processed by the multilayer perceptron operation on the b vector to obtain a three-dimensional vector representation.
[0210] Performing softmax normalization on the three-dimensional vector representation of the above classification model, the maximum value obtained through argmax is 2 (the second dimension of the vector has the largest value). This proves that the copy may have an attribute conflict with the original product. Furthermore, the starting position of the inconsistency interval is determined to be the position corresponding to the word "cool" and the ending position is the position corresponding to the word "device". Therefore, the inconsistency interval is "Core i7 processor".
[0211] This application proposes a method for detecting inconsistencies in product descriptions, namely, a method for detecting inconsistencies in product descriptions based on a unified framework of multi-task learning using a pre-trained model.
[0212] For training the logical inconsistency classification model, this application proposes to use the product's content information (title and attributes) and the product's copywriting information to distinguish inconsistent content in a fine-grained manner, perform multi-classification of inconsistent information, and thus detect the specific situation of inconsistency in a refined way.
[0213] For training the logical inconsistency interval prediction, this application embodiment utilizes the additional information brought by interval prediction to assist the logical consistency classification model in multi-task learning. This not only improves the performance of inconsistency interval prediction, but also effectively utilizes the information of this task to perform more effective logical consistency classification and improve the accuracy of product copy inconsistency detection.
[0214] In this embodiment, by combining product title and product attribute information and comparing the title attributes with the content of the generated copy, consistency judgment is made for the product copy. For the logical inconsistency classification model, further content comparison modeling can be performed, and the specific content of the copy and the product title attributes can be modeled in detail, which can effectively improve the accuracy of consistency detection. For interval prediction tasks, the interval prediction task can be designed as a more complex sequence labeling task, thereby improving the accuracy of interval prediction.
[0215] In this embodiment, the product copy consistency detection model is implemented based on the pre-trained model BERT. Other pre-trained models can also be used as encoders for further optimization to enhance the relational modeling of data, thereby improving the effectiveness of product copy consistency detection. This embodiment uses the idea of multi-task learning, combining logical consistency classification with logical inconsistency interval prediction tasks, which can improve the effect of product copy inconsistency detection.
[0216] Based on the foregoing embodiments, this application provides a text detection device. The various modules and units included in the device can be implemented by a processor in a computer device; of course, they can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPG A), etc.
[0217] This application embodiment further provides a document detection device. Figure 9 This is a schematic diagram of the composition structure of the document detection device provided in the embodiments of this application, such as... Figure 9 As shown, the document detection device 900 includes:
[0218] The receiving module 901 is used to receive a request message sent by the terminal for text detection, wherein the request message carries the title, attributes and text to be detected of the object to be detected;
[0219] The acquisition module 902 is used to acquire a trained detection model, which is used to detect the consistency information between the text to be detected and the title and attributes. The consistency information includes consistency and inconsistency types.
[0220] Processing module 903 is used to input the title, attributes and text to be detected into the trained detection model for processing to obtain detection results;
[0221] The sending module 904 is used to send a response message carrying the detection result to the terminal, so that the terminal can process the text to be detected based on the detection result.
[0222] In some embodiments, the acquisition module 902 includes:
[0223] The first acquisition unit is used to acquire a first training dataset, wherein each first training data in the first training dataset includes a first training title, a first training attribute, a first training text, a first identifier, and a second identifier;
[0224] The first identifier is used to indicate the consistency between the first training text and the first training title and the first training attribute, and the consistency includes consistency and inconsistency;
[0225] The second identifier is used to indicate the type of inconsistency between the first training text and the first training title and the first training attribute when the consistency is inconsistent, the inconsistency type includes factual consistency, attribute conflict and content conjecture;
[0226] The first training unit is used to train the constructed initial detection model using the first training data in the first training dataset to obtain the trained detection model.
[0227] In some embodiments, the first acquiring unit is further configured to:
[0228] Obtain a trained generative model, a trained consistency detection model, and a test dataset, wherein each test data in the test dataset includes a first training title and a first training attribute;
[0229] The first training title and the first training attribute included in each test data are input into the trained generative model for processing to obtain the first training text corresponding to each test data.
[0230] The test data, including the first training title, the first training attribute, and the corresponding first training text, are input into the trained consistency detection model for processing to obtain the consistency detection results of each first training text.
[0231] Based on the consistency detection results, determine the first identifier and the second identifier corresponding to each test data;
[0232] The first training dataset is determined based on the first training title and first training attribute, the corresponding first training text, the first identifier, and the second identifier included in each test data.
[0233] In some embodiments, the first acquiring unit is further configured to:
[0234] Acquire content information from multiple data collection objects, including titles, attributes, and text.
[0235] Based on the attributes of the multiple collected objects, determine the sample object set and the target attributes of each sample object in the sample object set;
[0236] The initial generative model is trained using the titles, target attributes, and text of each sample object in the sample object set to obtain a trained generative model.
[0237] In some embodiments, the first acquiring unit is further configured to:
[0238] Get the number of attributes for each collected object;
[0239] Collected objects with more than one attribute are added to the sample object set as sample objects;
[0240] When the number of attributes of a sample object is greater than the second threshold, the second threshold of attributes are selected as the target attributes of the sample object based on the number of times the attributes of the sample object are collected.
[0241] In some embodiments, the first acquiring unit is further configured to:
[0242] The first identifier corresponding to the test data whose consistency detection result is consistent is marked as a first value; the first identifier corresponding to the test data whose consistency detection result is inconsistent is marked as a second value; the second identifier corresponding to the test data whose consistency detection result is consistent is marked as a default value; the second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is factual consistency is marked as a third value; the second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is attribute conflict is marked as a fourth value; and the second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is content conjecture is marked as a fifth value.
[0243] In some embodiments, the consistency information further includes inconsistency intervals, which represent the locations where the text to be detected is inconsistent with the title and attributes;
[0244] The acquisition module 902 further includes:
[0245] The second acquisition unit is used to acquire a second training dataset. Each second training data in the second training dataset includes a second training title, a second training attribute, a second training text, a first identifier, a second identifier, and a third identifier. The first identifier is used to indicate the consistency between the second training text and the second training title and the second training attribute, where consistency includes consistency and inconsistency. The second identifier is used to indicate the type of inconsistency between the second training text and the second training title and the second training attribute when the consistency is inconsistent, where inconsistency includes factual consistency, attribute conflict, and content conjecture. The third identifier includes a first flag bit and a second flag bit, where the first flag bit is used to indicate the start position of the inconsistency interval, and the second flag bit is used to indicate the end position of the inconsistency interval.
[0246] The second training unit is used to train the constructed initial detection model using each of the second training data in the second training dataset to obtain the trained detection model.
[0247] It should be noted that the descriptions of the above-described document detection device embodiments are similar to the descriptions of the methods described above, and have the same beneficial effects as the method embodiments. For technical details not disclosed in the document detection device embodiments of this application, those skilled in the art should refer to the descriptions of the method embodiments of this application for understanding.
[0248] It should be noted that, in the embodiments of this application, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0249] Accordingly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps in the document detection method provided in the above embodiments.
[0250] This application provides a document detection device. Figure 10 This is a schematic diagram of the composition structure of a document detection device provided in an embodiment of this application. Figure 10 The exemplary structure of the text detection device 1000 shown can be used to foresee other exemplary structures of the text detection device 1000. Therefore, the structure described herein should not be regarded as a limitation. For example, some components described below may be omitted, or components not described below may be added to adapt to the special needs of certain applications.
[0251] Figure 10 The document detection device 1000 shown includes: a processor 1001, at least one communication bus 1002, a user interface 1003, at least one external communication interface 1004, and a memory 1005. The communication bus 1002 is configured to enable communication between these components. The user interface 1003 may include a display screen, and the external communication interface 1004 may include standard wired and wireless interfaces. The processor 1001 is configured to execute a program of a document detection method stored in the memory to implement the steps of the document detection method provided in the above embodiments.
[0252] The descriptions of the above-described document detection equipment and storage medium embodiments are similar to those of the above-described method embodiments, and have similar beneficial effects. For technical details not disclosed in the document detection equipment and storage medium embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0253] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0254] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0255] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0256] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0257] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0258] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0259] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0260] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of detecting a text, characterized by, The method includes: The receiving terminal sends a request message for text detection, the request message carrying the title, attributes and text to be detected of the object to be detected; A trained detection model is obtained, which is used to detect the consistency information between the text to be detected and the title and attributes. The consistency information includes consistency and inconsistency types. The inconsistency types include factual consistency, attribute conflict and content conjecture. The title, attributes, and text to be detected are input into the trained detection model for processing to obtain the detection results. Send a response message carrying the detection result to the terminal so that the terminal processes the text to be detected based on the detection result; The step of obtaining the trained detection model includes: Obtain a first training dataset, wherein each first training data in the first training dataset includes a first training title, a first training attribute, a first training text, a first identifier, and a second identifier; The first identifier is used to indicate the consistency between the first training text and the first training title and the first training attribute, and the consistency includes consistency and inconsistency; The second identifier is used to indicate the type of inconsistency between the first training text and the first training title and the first training attribute when the consistency is inconsistent; The initial detection model is trained using the first training data in the first training dataset to obtain the trained detection model. or, The consistency information also includes inconsistency intervals, which represent the locations where the text to be detected is inconsistent with the title and attributes; obtaining the trained detection model includes: Obtain a second training dataset, wherein each second training data in the second training dataset includes a second training title, a second training attribute, a second training text, a first identifier, a second identifier, and a third identifier; The first identifier is used to indicate the consistency between the second training text and the second training title and the second training attribute, wherein the consistency includes both consistency and inconsistency; The second identifier is used to indicate the type of inconsistency between the second training text and the second training title and the second training attribute when the consistency is inconsistent; The third identifier includes a first flag bit and a second flag bit, wherein the first flag bit is used to indicate the start position of the inconsistency interval and the second flag bit is used to indicate the end position of the inconsistency interval; The initial detection model is trained using the second training data in the second training dataset to obtain the trained detection model.
2. The method of claim 1, wherein, The process of obtaining the first training dataset includes: Obtain a trained generative model, a trained consistency detection model, and a test dataset, wherein each test data in the test dataset includes a first training title and a first training attribute; The first training title and the first training attribute included in each test data are input into the trained generative model for processing to obtain the first training text corresponding to each test data. The test data, including the first training title, the first training attribute, and the corresponding first training text, are input into the trained consistency detection model for processing to obtain the consistency detection results of each first training text. Based on the consistency detection results, determine the first identifier and the second identifier corresponding to each test data; The first training dataset is determined based on the first training title and first training attribute, the corresponding first training text, the first identifier, and the second identifier included in each test data.
3. The method of claim 2, wherein, The process of obtaining the trained generative model includes: Acquire content information from multiple data collection objects, including titles, attributes, and text. Based on the attributes of the multiple collected objects, determine the sample object set and the target attributes of each sample object in the sample object set; The initial generative model is trained using the titles, target attributes, and text of each sample object in the sample object set to obtain a trained generative model.
4. The method of claim 3, wherein, The step of determining the sample object set and the target attributes of each sample object in the sample object set based on the attributes of the multiple collected objects includes: Get the number of attributes for each collected object; Collected objects with more than one attribute are added to the sample object set as sample objects; When the number of attributes of a sample object is greater than the second threshold, the second threshold of attributes are selected as the target attributes of the sample object based on the number of times the attributes of the sample object are collected.
5. The method of claim 2, wherein, The step of determining the first identifier and second identifier corresponding to each test data based on the consistency detection result includes: The first identifier corresponding to the test data whose consistency detection result is consistent is marked as the first value; The first identifier corresponding to the test data whose consistency detection result is inconsistent is marked as the second value; The second identifier corresponding to the test data whose consistency detection result is consistent is marked as the default value; The second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is factual consistency is marked as the third value; The second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is attribute conflict is marked as the fourth value; The second identifier corresponding to the test data whose consistency detection result is inconsistent and whose inconsistency type is content conjecture is marked as the fifth value.
6. A script detection apparatus characterized by comprising: The device includes: The receiving module is used to receive a request message sent by the terminal for text detection, wherein the request message carries the title, attributes and text to be detected of the object to be detected; The acquisition module is used to acquire a trained detection model. The trained detection model is used to detect the consistency information between the text to be detected and the title and attributes. The consistency information includes consistency and inconsistency types. The inconsistency types include factual consistency, attribute conflict and content conjecture. The processing module is used to input the title, attributes, and text to be detected into the trained detection model for processing to obtain the detection result; A sending module is used to send a response message carrying the detection result to the terminal, so that the terminal processes the text to be detected based on the detection result; The acquisition module includes: The first acquisition unit is used to acquire a first training dataset, wherein each first training data in the first training dataset includes a first training title, a first training attribute, a first training text, a first identifier, and a second identifier; The first identifier is used to indicate the consistency between the first training text and the first training title and the first training attribute, and the consistency includes consistency and inconsistency; The second identifier is used to indicate the type of inconsistency between the first training text and the first training title and the first training attribute when the consistency is inconsistent; The first training unit is used to train the constructed initial detection model using each of the first training data in the first training dataset to obtain the trained detection model. The second acquisition unit is used to acquire a second training dataset. Each second training data in the second training dataset includes a second training title, a second training attribute, a second training text, a first identifier, a second identifier, and a third identifier. The first identifier is used to indicate the consistency between the second training text and the second training title and the second training attribute, where consistency includes consistency and inconsistency. The second identifier is used to indicate the inconsistency type between the second training text and the second training title and the second training attribute when the consistency is inconsistent. The third identifier includes a first flag bit and a second flag bit, where the first flag bit indicates the start position of the inconsistency interval, and the second flag bit indicates the end position of the inconsistency interval. The second training unit is used to train the constructed initial detection model using each of the second training data in the second training dataset to obtain the trained detection model.
7. A document detection apparatus characterized by comprising: include: processor; as well as Memory for storing computer programs that can run on the processor; When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions configured to perform the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Product information inconsistency detection
CN107545441A
Copywriting information generation method and device, storage medium and electronic equipment
CN112131848A
