Request processing method and device, equipment and storage medium
Patent Information
- Application Number
- CN202480004209.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2026-02-13
AI Technical Summary
Existing text retrieval methods are prone to semantic dispersion when processing long texts, which affects retrieval accuracy.
By generating multiple associated texts, semantic understanding is performed using language models and world knowledge. Associated texts shorter than the original text are generated, and a matching second text is determined from the candidate texts based on these associated texts to generate a response.
It effectively solves the problem of semantic dispersion caused by excessively long texts and improves the accuracy of long text retrieval.
Smart Images

Figure CN121532760A_ABST
Abstract
Description
Request processing method, apparatus, device, and storage medium TECHNICAL FIELD
[0001] Example embodiments of the present disclosure generally relate to the field of computers, and in particular to a request processing method, apparatus, device, and computer-readable storage medium. BACKGROUND
[0002] Text retrieval is one of the most basic and important tasks of natural language processing. Text retrieval has been applied in many scenarios, such as intelligent question answering, intent recognition, semantic understanding, semantic generation, etc. For example, an electronic device can retrieve other texts matching a text included in a query request based on the text content, etc.
[0003] SUMMARY
[0004] In a first aspect of the present disclosure, a request processing method is provided. The method comprises: obtaining a query request, the query request comprising a first text; in response to a first length of the first text being greater than a threshold, generating a plurality of associated texts based on the first text, a second length of the associated text being less than the first length; determining at least one second text matching the query request from a set of candidate texts based on a plurality of first feature representations of the plurality of associated texts; and generating a response to the query request based on the at least one second text.
[0005] In a second aspect of the present disclosure, an apparatus for request processing is provided. The apparatus comprises: an obtaining module configured to obtain a query request, the query request comprising a first text; a first generating module configured to, in response to a first length of the first text being greater than a threshold, generate a plurality of associated texts based on the first text, a second length of the associated text being less than the first length; a first determining module configured to determine at least one second text matching the query request from a set of candidate texts based on a plurality of first feature representations of the plurality of associated texts; and a second generating module configured to generate a response to the query request based on the at least one second text.
[0006] In a third aspect of the present disclosure, an electronic device is provided. The device comprises at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. The instructions, when executed by the at least one processing unit, cause the device to perform the method of the first aspect.
[0007] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium has stored thereon a computer program, the computer program being executable by a processor to implement the method of the first aspect.
[0008] It is to be understood that the content described in this Background section of this document is not to be taken as an acknowledgement that this content is prior art to the present disclosure relative to any present or future application. The disclosure of other documents and artifacts herein, if any, is not to be taken as an acknowledgement that any of the contents of such documents or artifacts is prior art relative to the present disclosure relative to any present or future application. BRIEF DESCRIPTION OF DRAWINGS
[0009] The above and other features, aspects, and advantages of various embodiments of the present disclosure will become more apparent with reference to the following detailed description when taken in conjunction with the accompanying drawings. In the drawings, like reference numerals refer to like elements, wherein:
[0010] FIG. 1 shows a schematic diagram of an example environment in which embodiments of the present disclosure can be implemented;
[0011] FIG. 2 shows a flowchart of a process of request processing according to some embodiments of the present disclosure;
[0012] FIG. 3 shows a schematic diagram of a process of request processing according to some embodiments of the present disclosure;
[0013] FIG. 4 shows a schematic structural block diagram of an apparatus for request processing according to certain embodiments of the present disclosure; and
[0014] FIG. 5 shows a block diagram of an electronic device capable of implementing various embodiments of the present disclosure. DETAILED DESCRIPTION
[0015] Embodiments of the present disclosure will be described hereinafter with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be construed as being limited to the embodiments set forth herein; rather, these embodiments are provided so that the present disclosure will be thorough and complete, and fully convey the scope of the present disclosure to those skilled in the art. It is understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of the present disclosure.
[0016] It is noted that the headings provided herein are not limitations of the various embodiments described herein. Various embodiments are described throughout this document and can be included under any heading. Additionally, embodiments described in any heading can be combined with any other embodiment described in the same heading and / or a different heading in any manner.
[0017] In the description of the embodiments of the present disclosure, the term "comprising" and its similar terms are understood to be open-ended, i.e., "including but not limited to". The term "based on" is understood to be "based, at least in part, on". The term "one embodiment" or "the embodiment" is understood to be "at least one embodiment". The term "some embodiments" is understood to be "at least some embodiments". The following can also include other explicit and implicit definitions. The terms "first", "second", etc. can refer to different or the same objects. The following can also include other explicit and implicit definitions.
[0018] The embodiments of the present disclosure can involve data of users, acquisition and / or use of data, etc. These aspects all comply with the corresponding laws and regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user is aware of and confirms. Accordingly, when implementing the embodiments of the present disclosure, the type of data or information that can be involved, the use range, the use scenario, etc. should be notified to the user and the authorization of the user should be obtained through appropriate means according to the relevant laws and regulations. The specific notification and / or authorization method can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.
[0019] In the present specification and embodiments, if the scheme involves processing of personal information, it will be processed on the premise of having a legal basis (for example, obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the prescribed or agreed range. The user refuses to process personal information other than the necessary information required for the basic function, which does not affect the user's use of the basic function.
[0020] Traditionally, the text matching method mainly includes: a topic extraction matching method based on supervised learning, a matching method based on text segmentation, a matching method based on text semantic segmentation, and a semantic depth matching method. These traditional text retrieval methods only consider the word / semantic information of the text itself, and do not consider the problem that inappropriate segmentation will lead to low accuracy of text retrieval caused by semantic segmentation or semantic dispersion.
[0021] The embodiments of the present disclosure propose a request processing scheme. According to the scheme, a query request can be acquired, the query request including a first text; further, in response to a first length of the first text being greater than a threshold, a plurality of associated texts can be generated based on the first text, a second length of the associated text being less than the first length; further, based on a plurality of first feature representations of the plurality of associated texts, at least one second text matching the query request can be determined from a group of candidate texts; further, based on the at least one second text, a response to the query request can be generated.
[0022] Based on such a manner, embodiments of the present disclosure can generate a plurality of associated texts with lengths less than the first text based on the first text, and match at least one second text associated based on the plurality of associated texts, which can effectively solve the problem of semantic dispersion caused by long texts, and improve the retrieval accuracy of texts with large lengths.
[0023] Example Environment
[0024] FIG. 1 shows a schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. As shown in FIG. 1, the example environment 100 can include an electronic device 110.
[0025] In this example environment 100, the electronic device 110 can retrieve other texts matched based on a first text in a query request, where the first text corresponds to a first length greater than a threshold (which can also be referred to as a "long text" or "long text content" in the present disclosure). The query request can be any appropriate request, which can be input by a user, or automatically generated by the electronic device, which will not be described here.
[0026] As an example, the electronic device can retrieve a novel B similar to a novel A and recommend the novel B when receiving a query request for other novels similar to the novel A input by a user.
[0027] As another example, the electronic device can automatically recommend a tool for a bot created by a user based on information related to the bot when the user creates the bot based on a bot creation platform, where the information related to the bot can be long text content composed of text information such as an identification of the bot, a description of the bot, a system prompt item of the bot, and the description information of the tool is equivalent to other texts retrieved based on the information related to the bot.
[0028] The electronic device 110 can be any type of mobile terminal, fixed terminal, or portable terminal including a mobile handset, a tablet computer, a laptop computer, a notebook computer, a netbook computer, a smartbook, a media tablet, a palmtop computer, a portable gaming terminal, a VR / AR device, a Personal Communication System (PCS) device, a personal navigation device, a Personal Digital Assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a game device, or any combination thereof, including accessories and peripherals of these devices, or any combination thereof. In some embodiments, the electronic device 110 can also support any type of interface to a target user (such as "wearable" circuitry, etc.).
[0029] The electronic device 110 can also be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network, and basic cloud computing services such as big data and artificial intelligence platform, etc. The electronic device 110 may, for example, include a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, etc.
[0030] It should be understood that the structure and function of the various elements in the environment 100 are described for illustrative purposes only, without implying any limitation on the scope of the present disclosure.
[0031] Some example embodiments of the present disclosure will be described below with continued reference to the accompanying drawings.
[0032] Example process
[0033] FIG. 2 shows a flowchart of a process 200 of request processing according to some embodiments of the present disclosure. The process 200 can be implemented at the electronic device 110. The process 200 is described below with reference to FIG. 1.
[0034] At block 210, the electronic device 110 can obtain a query request, the query request including a first text.
[0035] In some embodiments, the first text can be any appropriate text, which can correspond to a base text for a query. The query request can be any appropriate request, which can be input by a user, and can also be automatically generated by the electronic device 110, which is not described here in detail. The process of the electronic device 110 generating a response to the query request based on the query request includes retrieving / matching based on the first text.
[0036] At block 220, the electronic device 110 can generate a plurality of associated texts based on the first text in response to a first length of the first text being greater than a threshold, a second length of the associated texts being less than the first length.
[0037] To solve the problem that the length of the text is too long, the semantic is scattered, and the accuracy of the text retrieval is affected, in some embodiments, the electronic device 110 can generate first input information of the first model based on the first text, the first input information comprising a first prompt item, the first prompt item being used to instruct the first model to generate associated text of a preset length based on the first text. The predetermined length can be any appropriate length, and the predetermined length can be a predetermined length value, or a predetermined length range. For example, the first prompt item can instruct the first model to generate associated text of a length not greater than a predetermined length threshold based on the first text, or instruct the first model to generate a plurality of associated texts of a length A based on the first text, and the like. In the present disclosure, the associated text can also be regarded as a "short text" or "short text content".
[0038] In some embodiments, the first prompt item can also be used to instruct the number of associated texts generated by the first model, the format of the associated texts, how to generate the associated texts based on the first text, and the like, which will not be described herein. For example, the first prompt item can be "give you a text, which may contain multiple intents, you need to understand these intents of the text, and split them into shorter texts that can represent these intents".
[0039] The electronic device 110 can input the first input information into the first model to obtain a plurality of associated texts output by the first model. The second length of the plurality of associated texts is less than the first length of the first text, and the second lengths corresponding to the plurality of associated texts can be the same or different, which can be set according to requirements.
[0040] In some embodiments, the first model can be any appropriate model. In order to improve the accuracy of retrieval, the first model can be a model with strong generalization ability and capable of better handling long-distance dependencies, such as a language model.
[0041] In some embodiments, the electronic device 110 can use the first model to perform semantic understanding on the first text, and generate a plurality of associated texts based on the semantic understanding result.
[0042] In some embodiments, the electronic device 110 can also use the world knowledge of the first model to perform semantic understanding on the first text to generate a plurality of associated texts, wherein the world knowledge can be any appropriate and general knowledge that can assist the first model to understand the semantic of the text. For example, the world knowledge can include "there are seven continents in the world" and the like.
[0043] The electronic device 110 uses the first model to generate a plurality of associated texts can effectively solve the problem of catastrophic forgetting caused by the length of the text, and can improve the relevance of the plurality of associated texts generated and the first text, and can perform accurate semantic segmentation, and achieve strong generalization in semantics.
[0044] At block 230, the electronic device 110 can determine at least one second text matching the query request from the set of candidate texts based on the plurality of first feature representations of the plurality of related texts.
[0045] In some embodiments, the length of the second text can be greater than the length of the plurality of related texts, and the length of the second text can be greater than a predetermined threshold, i.e., the second text can be a text (e.g., long text content) matching the first text.
[0046] In some embodiments, the electronic device 110 can determine at least one second text matching the semantic information from the set of candidate texts based on the semantic information of the plurality of related texts, i.e., the electronic device 110 can determine at least one second text matching the semantic information from the set of candidate texts based on the comparison result of the semantic information of the plurality of related texts and the semantic information of the set of candidate texts.
[0047] In some other embodiments, the electronic device 110 can determine at least one second text matching the text information from the set of candidate texts based on the text information of the plurality of related texts, i.e., the electronic device 110 can determine at least one second text matching the text information from the set of candidate texts based on the comparison result of the text information of the plurality of related texts and the text information of the set of candidate texts. The text information can be the plurality of related texts themselves, or other text information extracted based on the related texts, such as keywords, etc.
[0048] In some embodiments, the electronic device 110 can determine at least one second text matching the query request based on the text information and the semantic information of the plurality of associated texts. In some embodiments, the electronic device 110 can determine at least one first candidate text matching the text information from the set of candidate texts. The electronic device 110 can determine at least one second candidate text matching the semantic information from the set of candidate texts. The electronic device 110 can determine at least one second text matching the query request based on the at least one first candidate text and the at least one second candidate text. As an example, the electronic device 110 can determine both the at least one first candidate text and the at least one second candidate text as the second text. As another example, the electronic device 110 can determine a common candidate text from the at least one first candidate text and the at least one second candidate text as the second text. For instance, the set of candidate texts includes candidate text A, candidate text B, candidate text C, and candidate text D, the electronic device 110 determines candidate text A and candidate text B matching the query request from the set of candidate texts based on the semantic information, and the electronic device 110 determines candidate text A and candidate text C from the set of candidate texts based on the text information, the electronic device 110 can determine candidate text A as the second text.
[0049] In some embodiments, the electronic device 110 can determine a first ranking result of the at least one first candidate text and the at least one second candidate text based on the relevance of the at least one first candidate text and the at least one second candidate text to the plurality of associated texts. The electronic device 110 can determine at least one second text matching the query request based on the ranked plurality of candidate texts.
[0050] In some embodiments, the electronic device can concatenate the feature representations corresponding to the plurality of associated texts to obtain a target feature representation, and determine the relevance of the at least one first candidate text and the at least one second candidate text to the plurality of associated texts based on the at least one first candidate text and the at least one second candidate text and the feature representations corresponding to the plurality of associated texts and the target feature representation.
[0051] In some embodiments, the electronic device 110 can determine a second ranking result of the at least one first candidate text and the plurality of second candidate texts based on the relevance of the at least one first candidate text and the plurality of second candidate texts to the first text. The electronic device 110 can determine at least one second text matching the query request based on the ranked plurality of candidate texts.
[0052] As an example, the electronic device 110 can determine a target Euclidean distance based on the semantic feature representation corresponding to each candidate text and the semantic feature representation corresponding to the first text. Further, the electronic device 110 can determine the relevance of each candidate text to the first text based on the target Euclidean distance, where the smaller the target Euclidean distance, the higher the relevance.
[0053] In some embodiments, the electronic device 110 can determine at least one second text matching the query request based on the attribute information of the at least one first candidate text and the plurality of second candidate texts. In some embodiments, the attribute information can be any appropriate information, such as popularity, user feedback information, and the like. Taking a novel as an example of the second text, the user feedback information can be the number of times the user views, the number of times the user likes, the number of times the user collects, and the like.
[0054] The determination process of the semantic information and the text information corresponding to the set of candidate texts is described below.
[0055] In some embodiments, the electronic device 110 can obtain a set of candidate texts. The electronic device 110 can obtain a plurality of description texts corresponding to each candidate text in the set of candidate texts output by the second model by inputting the set of candidate texts into the second model, where the length of the description text is less than the length of the candidate text. In some embodiments, the second model can be any appropriate model. The second model can be a model with strong generalization ability and can better handle long text content. For example, it can be a language model or the like.
[0056] In some embodiments, the electronic device 110 can perform semantic understanding on each candidate text using the second model, and generate a plurality of description texts based on the semantic understanding result. In some embodiments, the electronic device 110 can also use the world knowledge of the second model to perform semantic understanding on each candidate text to generate a plurality of description texts.
[0057] The electronic device 110 can determine the semantic information of the plurality of description texts corresponding to each candidate text in the set of candidate texts. The electronic device 110 can also determine the text information of the plurality of description texts corresponding to each candidate text in the set of candidate texts.
[0058] The electronic device 110 can also save the corresponding relationship of the candidate text, the description text corresponding to the candidate text, the semantic information of the description text corresponding to the candidate text, and the text information of the description text corresponding to the candidate text in the vector database, to support the electronic device 110 to generate a plurality of associated texts based on the semantic information and / or the text information of the first text in the query request. The at least one second text matching the query request matched or retrieved.
[0059] In some embodiments, for each associated text generated based on the long text, the electronic device 110 can determine one or more description texts that match the associated text in semantic information and / or text information. Further, the electronic device 110 can determine a candidate text corresponding to the one or more description texts as the second text matching the long text.
[0060] At block 240, the electronic device 110 can generate a response to the query request based on the at least one second text.
[0061] In some embodiments, the electronic device 110 can generate the response to the query request based on the at least one second text directly, i.e., determining the at least one second text as the text matching the first text.
[0062] In some other embodiments, the electronic device 110 can further determine any one of the at least one second text as a target text, and generate the response to the query request based on the target text.
[0063] In some other embodiments, the electronic device 110 can further provide the first text, the plurality of associated texts, and the at least one second text to a third model. The electronic device 110 can obtain a target text determined by the third model from the at least one second text, the target text being determined based on the first text and the plurality of associated texts. The target text is a text further determined by the electronic device 110 from the at least one second text based on the first text and the plurality of associated texts, and the target text is more relevant to the first text. The electronic device 110 can utilize the target text to generate the response to the query request.
[0064] In some embodiments, the third model can be instructed to determine the target text from the at least one second text based on the relevance of the at least one second text to the first text and the plurality of associated texts. As an example, the electronic device 110 can generate second input information input into the third model based on the first text, the plurality of associated texts, and the at least one second text, wherein the second input information includes a second prompt.
[0065] The second prompt can be used to instruct the third model how to determine the target text from the at least one second text, and the like, which will not be repeated here. For example, the second prompt can be “give you a long text and some intents corresponding to the long text, the intents do not necessarily cover all intents corresponding to the text. In addition, give you some candidate texts, you need to understand the text, and find the text matching the long text from the candidate texts based on the text and the plurality of intents corresponding to the text”.
[0066] The electronic device 110 can obtain, based on the second input information, a target text determined by the third model based on the second input information.
[0067] FIG. 3 shows a process diagram of request processing according to some embodiments of the present disclosure, which will now be described with reference to FIG. 3.
[0068] The electronic device 110 can obtain a query request including a long text with a length greater than a threshold. The electronic device 110 can generate m short texts with lengths less than or equal to a small threshold by understanding semantic information corresponding to the long text using a language model. The electronic device 110 can obtain semantic representations (semantic information) corresponding to the m short texts. The electronic device 110 can determine m*k first matching texts based on the m long texts and a plurality of description texts respectively corresponding to each candidate text saved in the vector database. The electronic device 110 can also determine m*k first matching texts based on semantic representations of the m long texts and semantic representations of the plurality of description texts respectively corresponding to each candidate text saved in the vector database.
[0069] It should be noted that the plurality of description texts respectively corresponding to each candidate text in the vector database can also be obtained based on understanding semantic information of each candidate text using a language model, and the manner of obtaining semantic representations of the plurality of description texts respectively corresponding to each candidate text can be the same as or different from the manner of obtaining semantic representations of the m short texts corresponding to the long text, which will not be described here.
[0070] After determining (m+m)*k first matching texts based on text matching of the short texts and semantic matching of the short texts, the electronic device 110 can filter a second matching text from the (m+m)*k matching texts based on a model, where a is less than (m+m)*k. Further, the electronic device 110 can further perform matching based on the long text in the query request, the m short texts, and the a second matching texts using a language model to obtain a target matching text matching the long text, and generate a response to the query request based on the target matching text.
[0071] It should be noted that the electronic device 110 can be preconfigured with parameter configuration information, which can include but is not limited to m, k, and a, etc. described above.
[0072] Based on such a manner, embodiments of the present disclosure can generate a plurality of associated texts with lengths less than a first text based on the first text, and retrieve at least one second text associated with the first text based on the plurality of associated texts, which can effectively solve the problem of semantic dispersion caused by a long text, and can improve the accuracy of retrieval of a text with a large length.
[0073] Example apparatus and devices
[0074] Embodiments of the present disclosure also provide a corresponding apparatus for implementing the above method or process. FIG. 4 shows a schematic structural block diagram of an apparatus 400 for request processing according to certain embodiments of the present disclosure. The apparatus 400 can be implemented as or included in the electronic device 110 as discussed above. Various modules / components in the apparatus 400 can be implemented by hardware, software, firmware, or any combination thereof.
[0075] As shown in FIG. 4, the apparatus 400 includes an acquisition module 410 configured to acquire a query request, the query request including a first text; a first generation module 420 configured to, in response to a first length of the first text being greater than a threshold, generate a plurality of associated texts based on the first text, a second length of the associated text being less than the first length; a first determination module 430 configured to determine at least one second text matching the query request from a set of candidate texts based on a plurality of first feature representations of the plurality of associated texts; and a second generation module 440 configured to generate a response to the query request based on the at least one second text.
[0076] In some embodiments, the first generation module 420 is specifically configured to generate first input information of the first model based on the first text, the first input information including a first prompt item, the first prompt item being used to instruct the first model to generate an associated text of a preset length based on the first text; and acquire the plurality of associated texts output by the first model.
[0077] In some embodiments, the first determination module 420 is specifically configured to determine at least one second text matching the text information and / or the semantic information from the set of candidate texts based on semantic information and / or text information of the plurality of associated texts.
[0078] In some embodiments, the first determination module 420 is specifically configured to determine at least one first candidate text matching the text information from the set of candidate texts; determine at least one second candidate text matching the semantic information from the set of candidate texts; and determine the at least one second text matching the query request based on the at least one first candidate text and the at least one second candidate text.
[0079] In some embodiments, the apparatus 400 further includes a semantic determination module configured to: acquire a set of candidate texts; acquire a plurality of description texts corresponding to each candidate text in the set of candidate texts output by a second model by inputting the set of candidate texts into the second model, wherein a length of the description text is less than that of the candidate text; and determine semantic information of the corresponding candidate text based on the plurality of description texts.
[0080] In some embodiments, the first determining module 420 is specifically configured to sort the at least one first candidate text and the at least one second candidate text based on the relevance of each candidate text to the plurality of related texts and / or the first text; and determine the at least one second text matching the query request based on the sorted candidate texts.
[0081] In some embodiments, the first determining module 420 is specifically configured to determine the at least one second text matching the query request from the at least one first candidate text and the at least one second candidate text based on the attribute information of each candidate text.
[0082] In some embodiments, the second generating module 440 is specifically configured to provide the first text, the plurality of related texts and the at least one second text to the third model.
[0083] obtain a target text determined by the third model from the at least one second text, the target text being determined based on the first text and the plurality of related texts; and generate a response to the query request by using the target text.
[0084] In some embodiments, the third model is instructed to determine the target text from the at least one second text based on the relevance of the at least one second text to the first text and the plurality of related texts.
[0085] The units included in the apparatus 400 can be implemented in various ways, including by means of software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, e.g., machine-executable instructions stored on a storage medium. In addition to, or alternatively, some or all of the units in the apparatus 400 can be implemented at least partially by one or more hardware logic components. As an example and not by way of limitation, example types of hardware logic components that can be used include field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SOCs), complex programmable logic devices (CPLDs), etc.
[0086] FIG. 5 shows a block diagram of an electronic device 500 in which one or more embodiments of the disclosure can be implemented. It should be understood that the electronic device 500 shown in FIG. 5 is merely an example and should not be construed to limit the functionality and scope of the embodiments described herein. The electronic device 500 shown in FIG. 5 can be used to implement the electronic device 110 shown in FIG. 1.
[0087] As shown in FIG. 5, electronic device 500 is in the form of a general-purpose electronic device. Components of electronic device 500 can include, but are not limited to, one or more processors or processing units 510, memory 520, storage 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. Processing unit(s) 510 can be real or virtual processors and capable of executing various processing in accordance with programs stored in memory 520. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing power of electronic device 500.
[0088] Electronic device 500 typically includes a plurality of computer storage media. Such media can be removable and / or non-removable, and can include volatile and / or nonvolatile media. Memory 520 can be volatile (such as, for example, registers, cache, random access memory (RAM)), non-volatile (such as, for example, read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. Storage 530 can be removable or non-removable and can include machine-readable media, such as, for example, flash drives, disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible by electronic device 500.
[0089] Electronic device 500 can further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in FIG. 5, a disk drive or other computer-readable media drive can be provided for reading from or writing to a removable, non-removable, volatile, or non-volatile media slot (e.g., a “floppy disk”). In such cases, each drive can be connected to the bus (not shown) by one or more data media interfaces. Memory 520 can include a computer program product 525 having one or more program modules configured to carry out the various methods or actions of the various embodiments of the present disclosure.
[0090] Communication unit(s) 540 enable communication with other electronic devices via communication media. Additionally, functionality of components of electronic device 500 can be implemented in a single computing cluster or a plurality of computer machines capable of communicating over a communication connection. As such, electronic device 500 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network nodes in a distributed computing environment.
[0091] The input device 550 can be one or more input devices, such as a mouse, a keyboard, a trackball, etc. The output device 560 can be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 500 can also communicate with one or more external devices (not shown), such as storage devices, display devices, etc., one or more devices that enable a user to interact with the electronic device 500, or any devices (e.g., a network card, a modem, etc.) that enable the electronic device 500 to communicate with one or more other electronic devices, as desired, via the communication unit 540. Such communication can be carried out via an input / output (I / O) interface (not shown).
[0092] According to an example implementation of the present disclosure, a computer readable storage medium is provided having computer executable instructions stored thereon, where the computer executable instructions are executed by a processor to implement the method described above. According to an example implementation of the present disclosure, a computer program product is also provided that is tangibly stored on a non-transitory computer readable medium and includes computer executable instructions, where the computer executable instructions are executed by a processor to implement the method described above.
[0093] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0094] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0095] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0096] The computer program product of the present disclosure can be a computer program product, which is a machine-readable medium (media) having instances of the software embodied thereon, such as computer software, firmware, wireless application protocol (WAP), middleware or microcode. For example, a computer program product can be a floppy disk, a CD-ROM, a DVD, a Blu-ray Disc™, a flash drive, a memory stick, a magnetic tape, or a hard disk drive. The machine-readable medium can be a single medium, or multiple media, of the same or different type. The computer program product can be one or more computer program components embodied in medium and / or transmission signals. The computer program product can have one or more computer readable and / or computer executable components embodied in medium and / or transmission signals. The computer program product can be one or more computer readable and / or computer executable components embodied in medium and / or transmission signals. The computer program product can also be at least one or combination of controller(s) with associated computer program component(s), the computer program component(s) being an example of computer program product.
[0097] Various implementations of the disclosure have been described in detail above. The foregoing description is exemplary and explanatory only, and is not intended to be exhaustive or to limit various implementations of the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teachings without departing from the scope and spirit of the disclosure. It is intended that the scope of the disclosure be limited only by the claims and the equivalents thereof. The terms "comprise," "include," and "have," and variations thereof, are intended to be inclusive and mean that there is at least the presence of the stated elements or features of the present disclosure, but do not exclude the presence of one or more additional elements or features. The terms "comprise," "comprising," "include," "including," "have," "has," "contain," "containing," "include," "including," "comprise," "comprising," and "contain" are used in their broadest context.
Claims
1. A request processing method, comprising: Obtain a query request, the query request including a first text; In response to the first text having a first length greater than a threshold, multiple associated texts are generated based on the first text, wherein the second length of the associated texts is less than the first length; Based on multiple first feature representations of the multiple associated texts, at least one second text matching the query request is determined from a set of candidate texts; as well as Based on the at least one second text, a response to the query request is generated.
2. The method according to claim 1, wherein generating a plurality of associated texts based on the first text comprises: Based on the first text, first input information for the first model is generated. The first input information includes a first prompt item, which is used to instruct the first model to generate associated text of a preset length based on the first text. as well as Obtain the multiple associated texts output by the first model.
3. The method of claim 1, wherein determining at least one second text matching the query request from a set of candidate texts based on a plurality of first feature representations of the plurality of associated texts comprises: Based on the semantic and / or textual information of the plurality of associated texts, at least one second text that matches the textual and / or semantic information is determined from a set of candidate texts.
4. The method of claim 3, wherein determining the at least one second text matching the text information and / or the semantic information from a set of candidate texts based on the semantic information and / or text information of the plurality of associated texts comprises: Determine at least one first candidate text that matches the text information from the set of candidate texts; Determine at least one second candidate text from the set of candidate texts that matches the semantic information; as well as Based on the at least one first candidate text and the at least one second candidate text This determines at least one second text that matches the query request.
5. The method according to claim 4, further comprising: Obtain the set of candidate texts; By inputting the set of candidate texts into the second model, multiple descriptive texts corresponding to each candidate text in the set of candidate texts output by the second model are obtained, wherein the length of the descriptive texts is less than that of the candidate texts; as well as Based on the multiple descriptive texts, the semantic information of the corresponding candidate texts is determined.
6. The method of claim 4, wherein determining the at least one second text matching the query request based on the at least one first candidate text and the at least one second candidate text comprises: Based on the correlation between each candidate text and the plurality of associated texts and / or the first text, sort the at least one first candidate text and the at least one second candidate text; as well as Based on the sorted candidate texts, at least one second text that matches the query request is determined.
7. The method of claim 4, wherein determining the at least one second text matching the query request based on the at least one first candidate text and the at least one second candidate text comprises: Based on the attribute information of each candidate text, at least one second text that matches the query request is determined from at least one first candidate text and at least one second candidate text.
8. The method of claim 1, wherein generating a response to the query request based on the at least one second text comprises: The first text, the plurality of associated texts, and the at least one second text are provided to the third model; Obtain the target text determined by the third model from the at least one second text, the target text being determined based on the first text and the plurality of associated texts; and Using the target text, a response to the query request is generated.
9. The method of claim 8, wherein the third model is instructed to: determine the target text from the at least one second text based on the relevance of the at least one second text to the first text and the plurality of associated texts.
10. An apparatus for request processing, comprising: The acquisition module is configured to acquire a query request, the query request including a first text; The first generation module is configured to generate multiple associated texts based on the first text in response to the first text having a first length greater than a threshold, wherein the second length of the associated texts is less than the first length. The first determining module is configured to determine at least one second text that matches the query request from a set of candidate texts based on multiple first feature representations of the multiple associated texts; as well as The second generation module is configured to generate a response to the query request based on the at least one second text.
11. An electronic device, comprising: At least one processing unit; as well as At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of claims 1 to 9.