Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
FIG. 1 is a schematic structural diagram of a method for constructing a knowledge base according to an embodiment of the present application; as shown in fig. 1, it includes:
s101, determining a sample question and a corresponding basic answer;
in this embodiment, the framework of the knowledge base may be completed offline. When the knowledge base is constructed off-line, the constructed data of the knowledge base comprises two entities, namely the sample question and the answer of the sample question, and meanwhile, in order to provide a response meeting the requirement for a user when the knowledge base is used on line, the association relationship between the sample question and the answer is required to be included. Further, in a specific application scenario, the knowledge base includes question-answer data pairs, and a question-answer data pair includes one or more answers corresponding to a question and includes an index relationship between the question and the answers.
In this embodiment, the sample questions and the basic answers may be collected in real time by a background server of the intelligent question and answer community, and stored on the background server or other data servers. Further, the sample questions and the basic answers can be generated based on the sample questions and the basic answers existing in the knowledge base, or the reasoning sample questions and the reasoning basic answers can be obtained through reasoning of the knowledge base. In particular, the reasoning described above can be performed by an inference engine of RDFS and OWL rule sets. In other words, the sample questions include the collected sample questions and the inferred sample questions inferred based on the collected sample questions, and correspondingly, the basic answers include the collected basic answers and the inferred basic answers inferred based on the collected basic answers.
In this embodiment, the basic answer is a comprehensive and generalized answer that can satisfy the question and answer requirements of most users.
S102, expanding the basic answers according to a set answer expansion rule to determine a plurality of extension answers;
in this embodiment, the extension rule of the answer defines an extension angle of the basic answer, that is, the basic answer is extended from different angles.
Further, in this embodiment, the step S102 may specifically include expanding the basic answer from a plurality of different expansion angles according to a set answer expansion rule to generate a plurality of extended answers. Each extended answer includes a base extended answer and a plurality of similar extended answers corresponding to the base extended answer.
In a specific implementation, in step S102 or after step S102, a basic extended answer layer and a similar extended answer layer are established, where the basic extended answer constitutes the basic extended answer layer, and a plurality of similar extended answers corresponding to the basic extended answer constitutes the similar extended answer layer.
Such as the sample problem related to "Liuxiang": who Liu Xiang is, or who is Liu Xiang. The basic answer "Liu Xiang is a hurdle athlete", if the basic answer is expanded from the user attribute angle indicated by "Liu Xiang", basic extended answers such as "Liu Xiang is a man hurdle athlete", "Liu Xiang is a Chinese hurdle athlete", "Liu Xiang is a man hurdle athlete in the upper sea of China", "Liu Xiang, number Asian flier" and the like can be obtained, under each basic extended answer, a plurality of similar extended answers exist, for example, for "Liu Xiang is a man hurdle athlete", a plurality of approximate extended answers exist: "Liu Xiang emerges from the Shanghai and is a man hurdle athlete, Liu Xiang is born in the Shanghai in 1983 and is a man hurdle athlete, belonging to track and field projects", and the like.
S103, constructing a knowledge base according to the corresponding relation among the sample questions, the basic answers and the extension answers.
In this embodiment, as described above, since the knowledge base is used for providing answers meeting the user's question when used online, in addition to establishing the corresponding relationship between the sample question and the basic answer, that is, the association relationship, the corresponding relationship between the sample question and the extended answer is also established. In this embodiment, since the extension answer is obtained by performing extension processing on the basic answer, the corresponding relationship between the basic answer and the extension answer is directly established, that is, the corresponding relationship between the sample question and the extension answer, that is, the association relationship is indirectly established.
In this embodiment, the basic answer, the basic extended answer, and the display extended answer substantially form a progressive top-bottom association relationship.
It should be noted that, in this embodiment, the basic answer and the extended answer do not absolutely limit the correctness of the answers.
FIG. 2 is a schematic structural diagram of a construction method of a knowledge base according to a second embodiment of the present application; as shown in fig. 2, it includes:
s201, determining a sample question and a corresponding basic answer;
s202, expanding the basic answers according to a set answer expansion rule to determine a plurality of extension answers;
in this embodiment, steps S201 and S202 are similar to steps S101 and S102 in fig. 1, and are not repeated again.
And S203, calculating the quality indexes of the multiple basic answers and/or the extended answers according to the set quality evaluation rule.
However, the difference between the basic answer and the extended answer is not absolute, and in some application scenarios, a part of the extended answers may also be converted into the basic answer, so as to form a plurality of basic answers; alternatively, when the basic answer is determined in step S201, a plurality of answers which reply to the same question from a plurality of angles and can satisfy a vast number of usage questioning requirements are taken as the plurality of basic answers.
As described above, the knowledge base is constructed mainly for responding to the online question of the user with the matching answers, and since the selectable answers in the knowledge base are higher in order and different answers are very different, a quality index is configured for each basic answer and extended answer (including the basic extended answer and the similar extended answer) so as to accurately match the online question of the user. Or, it is also called, selecting an optimal answer from the database as the answer to the online question.
For example, the quality index is specifically proportional to a user authority level (a related score of a user authentication system), a user community behavior level (an answer rate in a community, a contribution rate), and the like. Certainly, in specific implementation, the user authority level and the user community behavior level may be considered at the same time, and different calculation weights are given to the user authority level and the user community behavior level, so as to calculate the quality index of the basic answer and the extended answer.
S204, sequencing the multiple basic answers and the multiple extended answers corresponding to each sample question according to the quality index to respectively generate a basic answer queue and an extended answer queue.
S205, constructing a knowledge base according to the corresponding relation among the sample questions, the basic answers and the extension answers.
In this embodiment, in step S204, the correspondence between the sample question, the basic answer, and the extended answer is specifically set with reference to a basic answer queue and an extended answer queue, and for the basic answer, the higher the quality index is, the closer the position of the basic answer queue is, the better the recommendation is made when online recommending to the user. Similarly, for the extended answers (basic extended answers, similar extended answers), the higher the quality index, the earlier the extended answer queue is, the preference is given to online recommendation to the user.
In this embodiment, the quality index is directly associated with the priority of recommendation, which may also be referred to as a recommendation index.
Since the answer (the basic answer or the extended answer) is recommended to the user for online use, subsequent user behavior may be generated, and thus, the quality index of the extended answer may be further updated according to the subsequent user behavior. For example, if the answer obtains the praise behavior of a large number of users, the quality index is correspondingly increased, and the position in the answer queue is adjusted to be higher. Conversely, if a large number of users' click behaviors are obtained, their quality index is correspondingly lowered and the positions in their answer queue are adjusted further back.
FIG. 3 is a flowchart illustrating a method for determining answers in the third embodiment of the present application; as shown in fig. 3, it includes:
s301, acquiring a real-time problem presented on line currently;
in this embodiment, the real-time question is captured through a user input interface, such as an input box, that is only provided by the question and answer community.
S302, determining a sample problem matched with the real-time problem from a knowledge base established in an off-line manner;
in this embodiment, the real-time problem may be first analyzed to obtain the keywords thereof, and then the keywords are compared with the keywords of the sample problem in the knowledge base to complete the matching of the real-time problem and the sample problem.
S303, obtaining a basic answer and an extension answer corresponding to the sample question according to the corresponding relation among the sample question, the basic answer and the extension answer;
s304, screening out answers aiming at the real-time questions from the basic answers and the extended answers.
Optionally, in an embodiment of the present application, the step of screening the answer to the real-time question from the basic answer and the extended answer includes: and screening the basic answer and/or the extended answer with the highest quality index from the basic answers and the extended answers and using the basic answer and/or the extended answer as the answer for the real-time question.
FIG. 4 is a schematic structural diagram of a device for constructing a knowledge base according to a fourth embodiment of the present application; as shown in fig. 4, it includes:
an answer determining unit 401, configured to determine a question and a corresponding basic answer;
an answer extension unit 402, configured to extend the basic answer according to a set answer extension rule to determine multiple extension answers;
a constructing unit 403, configured to construct a knowledge base according to the corresponding relationship between the question, the basic answer, and the extended answer.
FIG. 5 is a schematic structural diagram of a device for constructing a knowledge base according to a fifth embodiment of the present application; as shown in fig. 5, the answer determining unit 401, the answer expanding unit 402, and the constructing unit 403 in the embodiment of fig. 4 further include: the quality evaluation unit 404 is configured to calculate quality indexes of the plurality of basic answers and the extended answers according to a set quality evaluation rule.
Optionally, in an embodiment of the present application, the answer extension unit 402 is further configured to sort, according to the quality index, a plurality of extended answers corresponding to each question to generate an extended answer queue.
FIG. 6 is a schematic structural diagram of a device for constructing a knowledge base according to a sixth embodiment of the present application; as shown in fig. 6, the answer determining unit 401, the answer expanding unit 402, and the constructing unit 403 in the embodiment of fig. 4 further include: an updating unit 405, configured to update the quality indexes of the basic answer and the extended answer according to the user behavior for the basic answer and the extended answer.
Optionally, in an embodiment of the present application, the answer extension unit 402 is further configured to extend the basic answer from a plurality of different extension angles according to a set answer extension rule to generate a plurality of extension answers.
Optionally, in an embodiment of the present application, each extended answer includes a base extended answer and a plurality of similar extended answers corresponding to the base extended answer.
FIG. 7 is a schematic structural diagram of a device for constructing a knowledge base according to a seventh embodiment of the present application; as shown in fig. 7, the device includes an answer determining unit 401, an answer expanding unit 402, and a constructing unit 403 in the above embodiment of fig. 4, and further includes: the answer layer establishing unit 406 is configured to establish a basic extended answer layer and a similar extended answer layer, where the basic extended answer constitutes the basic extended answer layer, and a plurality of similar extended answers corresponding to the basic extended answer constitutes the similar extended answer layer.
FIG. 8 is a schematic diagram of an apparatus for determining an answer according to an eighth embodiment of the present application; as shown in fig. 8, it includes:
a real-time problem obtaining unit 801, configured to obtain a real-time problem currently presented online;
a sample question matching unit 802, configured to determine a sample question matching the real-time question from a knowledge base established offline;
an answer obtaining unit 803, configured to obtain a basic answer and an extended answer corresponding to the sample question according to a corresponding relationship between the sample question, the basic answer, and the extended answer;
an answer screening unit 804 screens answers to the real-time questions from the basic answers and the extended answers.
Optionally, in an embodiment of the present application, the answer screening unit 804 is further configured to screen the basic answer and/or the extended answer with the highest quality index from the basic answers and the extended answers and use the basic answer and/or the extended answer as the answer to the real-time question.
FIG. 9 is a schematic structural diagram of an electronic device according to a ninth embodiment of the present application; the electronic device may include:
one or more processors 901;
a computer-readable medium 902, which may be configured to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a method as in any one of the embodiments described above.
Fig. 10 is a hardware structure of an electronic device according to a tenth embodiment of the present application; as shown in fig. 10, the hardware structure of the electronic device may include: a processor 1001, a communication interface 1002, a computer-readable medium 1003, and a communication bus 1004;
wherein the processor 1001, the communication interface 1002, and the computer readable medium 1003 complete communication with each other through the communication bus 1004;
optionally, the communication interface 1002 may be an interface of a communication module, such as an interface of a GSM module;
the processor 1001 may be specifically configured to: determining a sample question and a corresponding basic answer; according to a set answer extension rule, extending the basic answers to determine a plurality of extension answers; and constructing a knowledge base according to the corresponding relation among the sample question, the basic answer and the extension answer. Or,
the processor 1001 may be specifically configured to: acquiring a real-time problem which is currently put forward online; determining a sample question matched with the real-time question from a knowledge base established off line; obtaining a basic answer and an extension answer corresponding to the sample question according to the corresponding relation among the sample question, the basic answer and the extension answer; and screening out answers aiming at the real-time questions from the basic answers and the extended answers.
The Processor 1001 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code configured to perform the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section, and/or installed from a removable medium. The computer program, when executed by a Central Processing Unit (CPU), performs the above-described functions defined in the method of the present application. It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access storage media (RAM), a read-only storage media (ROM), an erasable programmable read-only storage media (EPROM or flash memory), an optical fiber, a portable compact disc read-only storage media (CD-ROM), an optical storage media piece, a magnetic storage media piece, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code configured to carry out operations for the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may operate over any of a variety of networks: including a Local Area Network (LAN) or a Wide Area Network (WAN) -to the user's computer, or alternatively, to an external computer (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions configured to implement the specified logical function(s). In the above embodiments, specific precedence relationships are provided, but these precedence relationships are only exemplary, and in particular implementations, the steps may be fewer, more, or the execution order may be modified. That is, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an answer determination unit for determining a question and its corresponding base answer; the answer extension unit is used for extending the basic answers according to a set answer extension rule to determine a plurality of extension answers; and the construction unit is used for constructing a knowledge base according to the corresponding relation among the questions, the basic answers and the extension answers. Alternatively, a processor comprises: the real-time problem acquisition unit is used for acquiring the real-time problem which is currently proposed online; the sample question matching unit is used for determining a sample question matched with the real-time question from a knowledge base established off line; the answer obtaining unit is used for obtaining a basic answer and an extension answer corresponding to the sample question according to the corresponding relation among the sample question, the basic answer and the extension answer; and the answer screening unit is used for screening out answers aiming at the real-time questions from the basic answers and the extended answers.
Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, the answer determination unit may also be described as a "unit for determining a question and its corresponding base answer".
As a further aspect, the present application also provides a computer-readable medium, on which a computer program is stored, which program, when executed by a processor, performs the method as described in any of the embodiments above.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: determining a sample question and a corresponding basic answer; according to a set answer extension rule, extending the basic answers to determine a plurality of extension answers; constructing a knowledge base according to the corresponding relation among the sample questions, the basic answers and the extension answers; or,
acquiring a real-time problem which is currently put forward online; determining a sample question matched with the real-time question from a knowledge base established off line; obtaining a basic answer and an extension answer corresponding to the sample question according to the corresponding relation among the sample question, the basic answer and the extension answer; and screening out answers aiming at the real-time questions from the basic answers and the extended answers.
In addition, in the above embodiments, the answer determining unit, the answer extending unit, and the constructing unit may also be referred to as a first program unit, a second program unit, and a third program unit, respectively.
In the above embodiments, the real-time question acquiring unit, the sample question matching unit, the answer acquiring unit, and the answer screening unit may also be referred to as a third program unit, a fourth program unit, a fifth program unit, and a sixth program unit, respectively.
The expressions "first", "second", "said first" or "said second" as used in various embodiments of the present application may modify various components irrespective of order and/or importance, but these expressions do not limit the respective components. The above description is only configured for the purpose of distinguishing elements from other elements. For example, the first user equipment and the second user equipment represent different user equipment, although both are user equipment. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of the present application.
When an element (e.g., a first element) is referred to as being "operably or communicatively coupled" or "connected" (operably or communicatively) to "another element (e.g., a second element) or" connected "to another element (e.g., a second element), it is understood that the element is directly connected to the other element or the element is indirectly connected to the other element via yet another element (e.g., a third element). In contrast, it is understood that when an element (e.g., a first element) is referred to as being "directly connected" or "directly coupled" to another element (a second element), no element (e.g., a third element) is interposed therebetween.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.