Disclosure of Invention
In view of this, embodiments of the present application provide a method, an information query method, an apparatus, and a device for constructing a knowledge base, which can establish a drug information query knowledge base, and quickly provide a relatively complete and accurate query result based on the query knowledge base, so as to facilitate a user to query drug information.
In order to solve the above problem, the technical solution provided by the embodiment of the present application is as follows:
a method of building a knowledge base, the method comprising:
acquiring a drug entity record, wherein the drug entity record comprises a drug entity and drug entity information of the drug entity, and the drug entity information comprises at least one drug information field and drug information corresponding to the drug information field;
establishing a drug knowledge base based on the drug entities, the drug entity records corresponding to the drug entities and the incidence relation between the drug entities and the drug entity records;
determining a relevant knowledge base associated with the drug knowledge base according to drug information historical query records, wherein the relevant knowledge base comprises non-drug domain entities having association with the drug entities;
establishing an incidence relation between the drug entity and a non-drug field entity in the relevant knowledge base according to the drug entity information of the drug entity;
and generating a drug information query knowledge base based on the drug knowledge base, a related knowledge base associated with the drug knowledge base and an association relation between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base.
In a possible implementation manner, the establishing a drug knowledge base based on the drug entity, the drug entity record corresponding to the drug entity, and the association relationship between the two includes:
determining an association relation between the medicine entities according to medicine information corresponding to a contraindication information field and/or a notice field in the medicine entity information and medicine information corresponding to a medicine component type field;
and adding the drug entity records to a drug knowledge base, and associating the drug entities with association relation aiming at the drug entities corresponding to the drug entity records in the drug knowledge base.
In a possible implementation manner, the determining, according to the drug information corresponding to the taboo information field and/or the caution item field in the drug entity information and the drug information corresponding to the drug component type field, an association relationship between the drug entities includes:
reading a contraindication information field and/or a notice field in the drug entity information of a first drug entity to obtain the contraindication information and/or the notice of the first drug entity; the first drug entity is any one of the drug entities;
identifying information related to the drug components and the association relationship from the contraindication information and/or the notice information of the first drug entity, determining the identified information related to the drug components as a target drug component type, and determining the identified information related to the association relationship as a target association relationship type;
and acquiring the drug entities of which the drug component types belong to the target drug component types in the drug knowledge base, constructing the association relationship between the drug entities and the first drug entity, and setting the association relationship type as the target association relationship type.
In one possible implementation manner, the determining, according to the historical query record of the drug information, a relevant knowledge base associated with the drug knowledge base includes:
entity identification is carried out on the historical inquiry record of the medicine information to obtain the entity of the non-medicine field and the type of the entity which are included in the historical inquiry record of the medicine information;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
In one possible implementation, the relevant knowledge base includes a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base;
the establishing of the incidence relation between the drug entity and the non-drug domain entity in the related knowledge base according to the drug entity information of the drug entity comprises:
and establishing an association relation between the drug entity and the symptom entity in the symptom knowledge base, the crowd entity in the crowd knowledge base, the food material entity in the food material knowledge base and the motion entity in the motion knowledge base according to the drug entity information of the drug entity.
In one possible implementation, the method includes: reading information corresponding to an indication field in medicine entity information of a second medicine entity to obtain an indication of the second medicine entity; the second drug entity is any one of the drug entities;
and acquiring a symptom entity corresponding to the indication of the second medicine entity in the symptom knowledge base, and constructing an association relation between the symptom entity and the second medicine entity.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to applicable people from contra-indication information and/or notice information of the second drug entity;
and acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base, and constructing an association relation between the crowd entity and the second medicine entity.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to food material from contra-indication information and/or notice information of the second drug entity;
and acquiring food material entities corresponding to the information related to the food materials in the food material knowledge base, and constructing an association relation between the food material entities and the second medicine entities.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to movement from contra-indication information and/or notice information of the second drug entity;
and acquiring a motion entity corresponding to the motion related information in the motion knowledge base, and constructing an association relationship between the motion entity and the second medicine entity.
An information query method, the method comprising:
acquiring a query request of medicine information sent by a client;
identifying at least one of a drug entity or a non-drug domain entity from the query request;
determining a query intention according to the query request;
inquiring an inquiry knowledge base according to the inquiry intention and at least one of the obtained medicine entity or non-medicine field entity to obtain an inquiry result; the query knowledge base is constructed according to the method for constructing the knowledge base;
and sending the query result to the client.
In one possible implementation manner, before querying a query knowledge base according to the query intent and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result, the method further includes:
acquiring portrait information of a user;
and obtaining a corresponding non-medicine field entity according to the user figure image information.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a medicine entity is inquired in an inquiry knowledge base, determining a medicine information field to be inquired corresponding to the medicine entity according to the inquiry intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the method further includes:
acquiring non-drug domain entities associated with the drug entities according to the query intention based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base, wherein the association relationship is included in the query knowledge base;
and acquiring entity information corresponding to the non-drug field entity associated with the drug entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a query knowledge base is queried according to non-drug domain entities, acquiring drug entities associated with the non-drug domain entities based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the relevant knowledge base, wherein the association relationship is included in the query knowledge base;
determining a drug information field to be queried corresponding to the drug entity according to the query intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the method further includes:
and acquiring entity information corresponding to the non-drug field entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
An apparatus for building a knowledge base, the apparatus comprising:
the system comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a drug entity record, the drug entity record comprises a drug entity and drug entity information of the drug entity, and the drug entity information comprises at least one drug information field and drug information corresponding to the drug information field;
the first establishing unit is used for establishing a medicine knowledge base based on the medicine entity, the medicine entity record corresponding to the medicine entity and the incidence relation between the medicine entity record and the medicine entity record;
a first determination unit, configured to determine, according to a historical query record of drug information, a relevant knowledge base associated with the drug knowledge base, where the relevant knowledge base includes non-drug domain entities having an association with the drug entities;
the second establishing unit is used for establishing an incidence relation between the medicine entity and a non-medicine field entity in the related knowledge base according to the medicine entity information of the medicine entity;
and the generation unit is used for generating a drug information query knowledge base based on the drug knowledge base, a related knowledge base associated with the drug knowledge base and the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base.
In a possible implementation manner, the first establishing unit includes:
the first determining subunit is used for determining the association relationship between the medicine entities according to the medicine information corresponding to the taboo information field and/or the caution item field in the medicine entity information and the medicine information corresponding to the medicine component type field;
and the association subunit is used for adding the medicine entity records to a medicine knowledge base and associating the medicine entities with association relation aiming at the medicine entities corresponding to the medicine entity records in the medicine knowledge base.
In one possible implementation manner, the first determining subunit includes:
the first reading subunit is used for reading a contraindication information field and/or a notice field in the medicine entity information of the first medicine entity to obtain the contraindication information and/or the notice of the first medicine entity; the first drug entity is any one of the drug entities;
a second determining subunit, configured to identify information related to the drug component and the association relationship from the contraindication information and/or the notice information of the first drug entity, determine the identified information related to the drug component as a target drug component type, and determine the identified information related to the association relationship as a target association relationship type;
and the construction subunit is used for acquiring the medicine entities of which the medicine component types belong to the target medicine component types in the medicine knowledge base, constructing the association relationship between the medicine entities and the first medicine entity, and setting the association relationship type as the target association relationship type.
In a possible implementation manner, the first determining unit is specifically configured to perform entity identification on a historical query record of drug information to obtain a non-drug domain entity and a type to which the entity belongs, where the historical query record of drug information includes the non-drug domain entity;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
In one possible implementation, the relevant knowledge base includes a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base;
the generating unit is specifically configured to establish, according to the medicine entity information of the medicine entity, an association relationship between the medicine entity and the symptom entity in the symptom knowledge base, the crowd entity in the crowd knowledge base, the food material entity in the food material knowledge base, and the motion entity in the motion knowledge base.
In one possible implementation manner, the generating unit includes:
the first reading subunit is used for reading information corresponding to an indication field in the medicine entity information of the second medicine entity to obtain an indication of the second medicine entity; the second drug entity is any one of the drug entities;
the first construction subunit is configured to acquire a symptom entity corresponding to the indication of the second drug entity in the symptom knowledge base, and construct an association relationship between the symptom entity and the second drug entity.
In one possible implementation manner, the generating unit includes:
the second reading subunit is configured to read information corresponding to a contraindication information field and/or a notice field in the drug entity information of the second drug entity to obtain contraindication information and/or a notice of the second drug entity; the second drug entity is any one of the drug entities;
a first identifying subunit, configured to identify information related to applicable people from the contraindication information and/or the notice information of the second drug entity;
and the second construction subunit is used for acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base and constructing the association relationship between the crowd entity and the second medicine entity.
In one possible implementation manner, the generating unit includes:
the third reading subunit is configured to read information corresponding to a taboo information field and/or a notice field in the drug entity information of the second drug entity, so as to obtain the taboo information and/or the notice of the second drug entity; the second drug entity is any one of the drug entities;
a second identification subunit, configured to identify information related to food materials from the contraindication information and/or the notice information of the second medicine entity;
and the third construction subunit is used for acquiring a food material entity corresponding to the information related to the food material in the food material knowledge base and constructing an association relation between the food material entity and the second medicine entity.
In one possible implementation manner, the generating unit includes:
the fourth reading subunit is configured to read information corresponding to a taboo information field and/or a notice field in the drug entity information of the second drug entity, so as to obtain the taboo information and/or the notice of the second drug entity; the second drug entity is any one of the drug entities;
a third identifying subunit, configured to identify information related to exercise from the contraindication information and/or the notice information of the second drug entity;
and the fourth construction subunit is configured to acquire a motion entity corresponding to the motion-related information in the motion knowledge base, and construct an association relationship between the motion entity and the second drug entity.
An information querying device, the device comprising:
the second acquisition unit is used for acquiring a query request of the medicine information sent by the client;
an identification unit, configured to identify at least one of a drug entity or a non-drug domain entity from the query request;
a second determining unit, configured to determine a query intention according to the query request;
the query unit is used for querying a query knowledge base according to the query intention and at least one of the obtained medicine entity or non-medicine field entity to obtain a query result; the query knowledge base is constructed according to the knowledge base constructing device;
and the sending unit is used for sending the query result to the client.
In one possible implementation, the apparatus further includes:
a third acquisition unit configured to acquire user portrait information;
and the fourth acquisition unit is used for acquiring the corresponding non-medicine field entity according to the user character image information.
In one possible implementation manner, the query unit includes:
the third determining subunit is used for determining a medicine information field to be queried corresponding to the medicine entity according to the query intention when the medicine entity queries the query knowledge base;
and the first acquiring subunit is configured to acquire, based on the drug knowledge base included in the query knowledge base, drug information corresponding to the drug information field to be queried, so as to obtain a query result.
In one possible implementation, the apparatus further includes:
a second obtaining subunit, configured to obtain, according to the query intention, a non-drug domain entity associated with the drug entity based on an association relationship between the drug entity in the drug knowledge base and the non-drug domain entity in the relevant knowledge base that is included in the query knowledge base;
and the third acquiring subunit is configured to acquire, based on the relevant knowledge base included in the query knowledge base, entity information corresponding to the non-drug-domain entity associated with the drug entity, and add the entity information to the query result.
In one possible implementation manner, the query unit includes:
a fourth obtaining subunit, configured to, when querying a query knowledge base according to a non-drug domain entity, obtain a drug entity associated with the non-drug domain entity based on an association relationship, included in the query knowledge base, between a drug entity in the drug knowledge base and the non-drug domain entity in the relevant knowledge base;
a fourth determining subunit, configured to determine, according to the query intention, a to-be-queried drug information field corresponding to the drug entity;
and the fifth acquiring subunit is configured to acquire, based on the drug knowledge base included in the query knowledge base, drug information corresponding to the drug information field to be queried, so as to obtain a query result.
In one possible implementation, the apparatus further includes:
and the sixth acquiring subunit is configured to acquire, based on the relevant knowledge base included in the query knowledge base, entity information corresponding to the non-drug-domain entity, and add the entity information to the query result.
An apparatus for building a knowledge base, comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured for execution by one or more processors the one or more programs include instructions for:
acquiring a drug entity record, wherein the drug entity record comprises a drug entity and drug entity information of the drug entity, and the drug entity information comprises at least one drug information field and drug information corresponding to the drug information field;
establishing a drug knowledge base based on the drug entities, the drug entity records corresponding to the drug entities and the incidence relation between the drug entities and the drug entity records;
determining a relevant knowledge base associated with the drug knowledge base according to drug information historical query records, wherein the relevant knowledge base comprises non-drug domain entities having association with the drug entities;
establishing an incidence relation between the drug entity and a non-drug field entity in the relevant knowledge base according to the drug entity information of the drug entity;
and generating a drug information query knowledge base based on the drug knowledge base, a related knowledge base associated with the drug knowledge base and an association relation between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base.
In a possible implementation manner, the establishing a drug knowledge base based on the drug entity, the drug entity record corresponding to the drug entity, and the association relationship between the two includes:
determining an association relation between the medicine entities according to medicine information corresponding to a contraindication information field and/or a notice field in the medicine entity information and medicine information corresponding to a medicine component type field;
and adding the drug entity records to a drug knowledge base, and associating the drug entities with association relation aiming at the drug entities corresponding to the drug entity records in the drug knowledge base.
In a possible implementation manner, the determining, according to the drug information corresponding to the taboo information field and/or the caution item field in the drug entity information and the drug information corresponding to the drug component type field, an association relationship between the drug entities includes:
reading a contraindication information field and/or a notice field in the drug entity information of a first drug entity to obtain the contraindication information and/or the notice of the first drug entity; the first drug entity is any one of the drug entities;
identifying information related to the drug components and the association relationship from the contraindication information and/or the notice information of the first drug entity, determining the identified information related to the drug components as a target drug component type, and determining the identified information related to the association relationship as a target association relationship type;
and acquiring the drug entities of which the drug component types belong to the target drug component types in the drug knowledge base, constructing the association relationship between the drug entities and the first drug entity, and setting the association relationship type as the target association relationship type.
In one possible implementation manner, the determining, according to the historical query record of the drug information, a relevant knowledge base associated with the drug knowledge base includes:
entity identification is carried out on the historical inquiry record of the medicine information to obtain the entity of the non-medicine field and the type of the entity which are included in the historical inquiry record of the medicine information;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
In one possible implementation, the relevant knowledge base includes a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base;
the establishing of the incidence relation between the drug entity and the non-drug domain entity in the related knowledge base according to the drug entity information of the drug entity comprises:
and establishing an association relation between the drug entity and the symptom entity in the symptom knowledge base, the crowd entity in the crowd knowledge base, the food material entity in the food material knowledge base and the motion entity in the motion knowledge base according to the drug entity information of the drug entity.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
reading information corresponding to an indication field in medicine entity information of a second medicine entity to obtain an indication of the second medicine entity; the second drug entity is any one of the drug entities;
and acquiring a symptom entity corresponding to the indication of the second medicine entity in the symptom knowledge base, and constructing an association relation between the symptom entity and the second medicine entity.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to applicable people from contra-indication information and/or notice information of the second drug entity;
and acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base, and constructing an association relation between the crowd entity and the second medicine entity.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to food material from contra-indication information and/or notice information of the second drug entity;
and acquiring food material entities corresponding to the information related to the food materials in the food material knowledge base, and constructing an association relation between the food material entities and the second medicine entities.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to movement from contra-indication information and/or notice information of the second drug entity;
and acquiring a motion entity corresponding to the motion related information in the motion knowledge base, and constructing an association relationship between the motion entity and the second medicine entity.
An apparatus for information querying, comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured for execution by one or more processors the one or more programs including instructions for:
acquiring a query request of medicine information sent by a client;
identifying at least one of a drug entity or a non-drug domain entity from the query request;
determining a query intention according to the query request;
inquiring an inquiry knowledge base according to the inquiry intention and at least one of the obtained medicine entity or non-medicine field entity to obtain an inquiry result; the query knowledge base is constructed according to the equipment for constructing the knowledge base;
and sending the query result to the client.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
acquiring portrait information of a user;
and obtaining a corresponding non-medicine field entity according to the user figure image information.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a medicine entity is inquired in an inquiry knowledge base, determining a medicine information field to be inquired corresponding to the medicine entity according to the inquiry intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
acquiring non-drug domain entities associated with the drug entities according to the query intention based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base, wherein the association relationship is included in the query knowledge base;
and acquiring entity information corresponding to the non-drug field entity associated with the drug entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a query knowledge base is queried according to non-drug domain entities, acquiring drug entities associated with the non-drug domain entities based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the relevant knowledge base, wherein the association relationship is included in the query knowledge base;
determining a drug information field to be queried corresponding to the drug entity according to the query intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the processor is further specifically configured to execute the one or more programs including instructions for:
and acquiring entity information corresponding to the non-drug field entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
A computer readable medium having stored thereon instructions, which when executed by one or more processors, cause an apparatus to perform the above-described method of building a knowledge base, or perform the above-described information query method.
Therefore, the embodiment of the application has the following beneficial effects:
according to the method, the device and the equipment for constructing the knowledge base, the information query method, the device and the equipment, the medicine knowledge base is established firstly through medicine entity records; determining a related knowledge base associated with the medicine knowledge base according to the historical inquiry records of the medicine information; and finally, determining the incidence relation between the drug entities in the drug knowledge base and the non-drug field entities in the related knowledge base based on the drug entity information corresponding to the drug entities in the drug knowledge base. And generating a drug information query knowledge base by utilizing the drug knowledge base, the related knowledge base and the incidence relation between the drug entity and the non-drug field entity in the related knowledge base. Based on the query knowledge base, more accurate and complete drug information query can be carried out. By acquiring the query request aiming at the medicine information sent by the client, the corresponding entity and the query intention can be identified and obtained from the query request, and the query is carried out in the query knowledge base according to the entity and the query intention obtained by identification to obtain the query result. The established inquiry knowledge base can realize the quick inquiry of the medicine information, and the accurate and comprehensive medicine information meeting the user requirements can be obtained.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, embodiments accompanying the drawings are described in detail below.
In order to facilitate understanding of the technical solutions provided in the present application, the following description will first be made on the background of the present application.
After researching the traditional medicine information acquisition method, the inventor finds that for common and light diseases, a patient may consider to select a medicine by himself; for the drug prescribed by the doctor, the patient may need to know the related attention for taking the drug before using the drug. The user has a need to obtain the drug information, and the user can generally obtain the drug information by inquiring, reading the specification of the drug or inquiring a professional doctor or pharmacist through the network. However, the medicine information obtained by the user through the above method may not be accurate and comprehensive enough, and may not be in accordance with the required medicine information.
Based on this, the embodiment of the application provides a method, an information query method, a device and equipment for constructing a knowledge base, wherein a medicine knowledge base is established firstly through medicine entity records; then, according to the historical inquiry records of the medicine information, a relevant knowledge base associated with the medicine knowledge base can be determined; and finally, determining the incidence relation between the drug entities in the drug knowledge base and the non-drug field entities in the related knowledge base based on the drug entity information corresponding to the drug entities in the drug knowledge base. And generating a drug information query knowledge base by utilizing the drug knowledge base, the related knowledge base and the incidence relation between the drug entity and the non-drug field entity in the related knowledge base.
The query knowledge base includes: the drug knowledge base, a related knowledge base associated with the drug knowledge base, and an association between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base. Based on the query knowledge base, more accurate and complete drug information query can be carried out. By acquiring the query request aiming at the medicine information sent by the client, the corresponding entity and the query intention can be identified and obtained from the query request, and the query is carried out in the query knowledge base according to the entity and the query intention obtained by identification to obtain the query result. The established inquiry knowledge base can realize the quick inquiry of the medicine information to obtain the accurate medicine information which meets the needs of users.
In order to facilitate understanding of the method for constructing a knowledge base and the information query method provided in the embodiment of the present application, an application scenario of the information query method provided in the embodiment of the present application is described below with reference to fig. 1. Fig. 1 is a schematic diagram of a framework of an exemplary application scenario of an information query method according to an embodiment of the present application. The information query method provided by the embodiment of the application can be applied to the server 20.
In practical application, a drug entity record corresponding to a drug entity may be first constructed, where the drug entity record includes the drug entity and drug entity information corresponding to the drug entity. And establishing a drug knowledge base based on the drug entities, the corresponding drug entity records and the incidence relation between the drug entities and the corresponding drug entity records.
In addition, the user may also query other factors related to the medicine when querying the medicine, such as people, symptoms, food materials, sports, and the like. Correspondingly, according to the historical query records aiming at the medicine information, a relevant knowledge base associated with the medicine knowledge base can be determined. The related knowledge base may include non-drug domain entities (hereinafter, referred to as related entities) having an association with the drug entities, and entity information corresponding to each entity. The association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the relevant knowledge base is established, and the drug information query knowledge base 30 can be generated by using the drug knowledge base, the relevant knowledge base, and the association relationship between the drug entities and the non-drug domain entities in the relevant knowledge base.
The query knowledge base 30 includes: the drug knowledge base, the related knowledge base associated with the drug knowledge base, and the association between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base may be queried for drug information by querying the knowledge base 30. If a user needs to query some drug information, a query request of the drug information may be sent through the client 10, the server 20 identifies and obtains at least one entity after obtaining the query request, determines a query intention of the entity, and queries in the query knowledge base 30 according to the query intention and the obtained entity to obtain a query result. And sending the query result to the client 10 so that the user can check the query result through the client 10 to obtain the required medicine information.
Those skilled in the art will appreciate that the block diagram shown in fig. 1 is merely an example in which embodiments of the present application may be implemented. The scope of applicability of the embodiments of the present application is not limited in any way by this framework.
It is noted that client 10 may be any user device now existing, developing or later developed that is capable of interacting with each other through any form of wired and/or wireless connection (e.g., Wi-Fi, LAN, cellular, coaxial, etc.), including but not limited to: smart wearable devices, smart phones, non-smart phones, tablets, laptop personal computers, desktop personal computers, minicomputers, midrange computers, mainframe computers, and the like, either now in existence, under development, or developed in the future. The embodiments of the present application are not limited in any way in this respect. It should also be noted that the server 20 in the embodiment of the present application may be an example of an existing device, a device under development or a device developed in the future, which is capable of performing the above operations. The embodiments of the present application are not limited in any way in this respect.
In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, a method for constructing a knowledge base provided by the embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 2, which is a flowchart of a method for building a knowledge base according to an embodiment of the present application, as shown in fig. 2, the method may include S201 to S204:
s201: the method comprises the steps of obtaining a drug entity record, wherein the drug entity record comprises a drug entity and drug entity information of the drug entity, and the drug entity information comprises at least one drug information field and drug information corresponding to the drug information field.
The drug entity record includes drug entities and drug entity information corresponding to the drug entities. The drug entity may be a name of a drug, and the drug entity information may be drug information related to the drug, such as information on the price, components, properties, indications, specifications, usage, adverse reactions, contraindications, cautions, and the like of the drug.
The drug entity information at least comprises a drug information field and drug information corresponding to the drug information field. The drug information field may be used to represent a type corresponding to the drug information, for example, the name of the information type corresponding to the drug information may be specific, and the drug information may be specific content corresponding to the drug information field. For example, the drug information field is "indication", and the corresponding drug information is "for relieving symptoms such as fever, headache, sore throat, nasal obstruction, sneeze, and the like caused by common cold or influenza".
The embodiment of the application does not limit the specific implementation manner of acquiring the drug entity record. The method can be obtained through the specifications of various medicines, and can also be obtained through books, articles, network query results and the like related to the medicines. The medicine instruction book has a structured field, the structured field in the instruction book can be extracted, and the corresponding general field is determined to be used as the medicine information field in the medicine entity record.
As an example, the drug information field and the drug information corresponding to the drug information field may be expressed as: [ drug information field: drug information ]. For example, it may be: [ indications: otitis media, sinusitis, pharyngitis, and obstinate dermatitis, [ medicinal ingredients: beta-lactam antibiotics, penicillins ].
S202: and establishing a drug knowledge base based on the drug entities, the drug entity records corresponding to the drug entities and the incidence relation between the drug entities and the drug entity records.
Based on the acquired drug entity records, the drug entities and the drug entity information in each drug entity record may be determined.
In addition, the drug knowledge base may further include an association relationship between each drug entity. For example, the relationship indicates "taboo" relationship that cannot be taken simultaneously and "apto" relationship that can be taken together. The association between each drug entity in the drug knowledge base can be constructed, so that the drug knowledge base is established according to the drug entity records and the association relation between each drug entity. Specifically, the drug knowledge base can be established by deep learning, knowledge maps and other technologies.
For the drug entity records corresponding to the drugs with the same components but different drug names, the corresponding drug entities can be respectively established. For example, ibuprofen sustained-release capsules, ibuprofen sustained-release tablets and fenpride are all medicines with ibuprofen as a component. Wherein, ibuprofen is the name of chemical drugs and belongs to the name of drug raw materials. The ibuprofen sustained-release capsules and the ibuprofen sustained-release tablets are common names of medicines. Fenbide is the trade name of medicine. In order to facilitate a user to obtain more accurate medicine information, four medicine entities of ibuprofen, an ibuprofen sustained-release capsule, an ibuprofen sustained-release tablet and fenpride can be respectively established, and the four medicine entities respectively have corresponding medicine entity information.
In a possible implementation manner, an embodiment of the present application provides a specific implementation manner for establishing a drug knowledge base based on drug entities, drug entity records corresponding to the drug entities, and an association relationship between the drug entities and the drug entity records, please refer to the following.
S203: and determining a relevant knowledge base associated with the medicine knowledge base according to the historical inquiry records of the medicine information, wherein the relevant knowledge base comprises non-medicine field entities having association with the medicine entities.
The relevant knowledge base can include a symptom knowledge base, a crowd knowledge base, a food material knowledge base, a sports knowledge base and the like.
The use of drugs is also associated with other factors, such as symptoms, applicable populations, dietary and exercise contraindications, etc. When the user inquires the medicine information, the medicine information meeting the conditions can be inquired through other related factors.
In order to determine the knowledge base having an association with the drug knowledge base from the various knowledge bases, the factors associated with the drug may be determined according to the historical query records of the drug information, so as to determine the non-drug domain entities associated with the drug entities, i.e., the related entities. And determining a relevant knowledge base corresponding to each relevant field based on the relevant entities of the relevant field. The drug information history query record may specifically be a history query record of a user for drug information, where the history query record includes information associated with a drug entity. By analyzing the historical query records of the drug information, factors related to drug entities can be obtained, and further a related knowledge base related to the drug knowledge base is determined.
For example, according to "cold medicine that pregnant women can eat? "," antipyretic for children? "it can be determined that there is an association between a particular population and a drug, and a corresponding knowledge base of the population associated with the knowledge base of the drug is determined. Similarly, the history record of drug information may also include "what drug is taken by headache to relieve", "can take anti-inflammatory drug after drinking" and "can drive after taking cold drug". Correspondingly, the relevant knowledge base can be determined to further comprise a symptom knowledge base, a food material knowledge base and a motion knowledge base.
In a possible implementation manner, an embodiment of the present application further provides a specific implementation manner of determining a relevant knowledge base associated with a knowledge base of a drug according to a historical query record of drug information, please refer to the following.
S204: and establishing an incidence relation between the drug entity and the non-drug field entity in the related knowledge base according to the drug entity information of the drug entity.
S205: and generating a drug information query knowledge base based on the drug knowledge base, a related knowledge base associated with the drug knowledge base and an association relation between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base.
Specifically, the association relationship between the drug entity and the symptom entity in the symptom knowledge base, the association relationship between the crowd entity in the crowd knowledge base, the association relationship between the food entity in the food knowledge base, and the association relationship between the food entity in the motion knowledge base can be established.
After determining the relevant knowledge base, it is necessary to establish an association relationship between the entities in the relevant knowledge base and the drug entities. The drug entity information of the drug entity includes information related to the drug entity, and may include information related to non-drug domain entities such as a symptom entity, a crowd entity, a food entity, and a motion entity. Based on the drug entity information, an association relationship between the drug entity and the non-drug domain entity in the relevant knowledge base can be determined and established, and the non-drug domain entity having an association relationship with the drug entity is the relevant entity.
Based on the drug knowledge base, the relevant knowledge base and the incidence relation between the drug entities and the non-drug domain entities in the relevant knowledge base, a query knowledge base of drug information can be established. The query knowledge base comprises: the drug knowledge base, a related knowledge base associated with the drug knowledge base, and an association between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base. And correspondingly inquiring the medicine information according to the entity and the incidence relation in the inquiry knowledge base.
Based on the related contents of S201-S205, a knowledge base integrating knowledge related to drugs can be obtained by establishing a query knowledge base including a drug knowledge base, a related knowledge base associated with the drug knowledge base, and an association relationship between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base. Therefore, the user can inquire the related information of the medicine more accurately and comprehensively based on the inquiry knowledge base of the medicine information.
It is understood that there are interrelationships between drugs that affect each other. For example, there may be drugs that cannot be used simultaneously or that need to be used together to be effective. When establishing the drug knowledge base, the association relationship between drug entities also needs to be established.
The embodiment of the present application provides a specific implementation manner for S202 establishing a drug knowledge base based on a drug entity, a drug entity record corresponding to the drug entity, and an association relationship between the drug entity and the drug entity, including the following two steps a1-a 2:
a1: and determining the association relationship between the medicine entities according to the medicine information corresponding to the taboo information field and/or the notice field in the medicine entity information and the medicine information corresponding to the medicine component type field.
The drug entity information may have a taboo information field, and the drug information corresponding to the taboo information field is taboo information. The contraindication information has specific usage contraindications associated with the pharmaceutical entity. For example, the contraindication information corresponding to the contraindication information field in the drug entity information of the ibuprofen tablet is that the patients allergic to aspirin or other non-steroidal anti-inflammatory drugs can have cross allergic reaction to the ibuprofen tablet, and the ibuprofen tablet can also cause bronchospasm in the patients allergic to aspirin. The product is contraindicated for such patients.
The drug entity information may have a notice field, and the drug information corresponding to the notice field is a notice. Of the notes, there are notes that require special attention in relation to the use of the pharmaceutical entity. For example, the notice field in the drug entity information of "ibuprofen tablet" corresponds to the notice of "1. for women with late pregnancy, the pregnancy can be prolonged, which causes dystocia and prolonged labor course. It is not suitable for pregnant women and women in lactation period. 2. Has effects in inhibiting platelet aggregation, prolonging bleeding time, and eliminating after stopping administration for 24 hr.
At least one of the medicine information corresponding to the contraindication information field or the notice field may have related information of other medicine entities associated with the medicine entity, and the other medicine entities having an association relationship with the medicine entity may be determined through at least one of the contraindication information or the notice. For example, the term "enhance anticoagulation with an anticoagulant" is included in the notice of the drug entity information of "gankang". Based on the cautionary matters, it can be determined that there is an association between the drug entity corresponding to "gankang" and the drug entity corresponding to the anticoagulant.
There may be a drug component type field in the drug entity information. The medicine information corresponding to the medicine component type field is a medicine component type and is used for determining a specific medicine component type. Based on the pharmaceutical ingredient type, a pharmaceutical entity belonging to the pharmaceutical ingredient type may be determined.
And determining the medicine entities with the association relationship according to at least one of the contraindication information or the notice in the medicine entity information and the medicine component types corresponding to the medicine component type fields.
The embodiment of the present application provides a specific implementation manner for determining an association relationship between drug entities according to drug information corresponding to a contraindication information field and/or a notice field in drug entity information and drug information corresponding to a drug component type field, please refer to the following.
A2: and adding the drug entity records to a drug knowledge base, and associating the drug entities with association relation aiming at the drug entities corresponding to the drug entity records in the drug knowledge base.
When the drug knowledge base is established, the drug entity records can be added into the drug knowledge base, and then drug entities with association relations are associated based on drug entities corresponding to the drug entity records in the drug knowledge base. And finally obtaining a medicine knowledge base comprising the medicine entities, the medicine entity information and the incidence relation among the medicine entities.
Based on the above, the drug entities having the association relationship can be determined according to the contraindication information and/or the cautionary matters in the drug entity information corresponding to the drug entities and the types of the drug components. And further, a medicine knowledge base comprising the incidence relation among medicine entities can be established, so that the information in the medicine knowledge base is more perfect, and the accuracy and comprehensiveness of query results obtained when a user queries and the like are improved.
Further, an embodiment of the present application provides a specific implementation manner of determining an association relationship between drug entities according to drug information corresponding to a contraindication information field and/or a notice field in the drug entity information and drug information corresponding to a drug component type field in step a1, and specifically includes the following four steps B1-B4:
b1: reading a contraindication information field and/or a notice field in the drug entity information of the first drug entity to obtain the contraindication information and/or the notice of the first drug entity; the first drug entity is any one of the drug entities.
Taking any drug entity in the drug knowledge base as a first drug entity, and reading at least one of a contraindication information field or a notice field in drug entity information of the first drug entity. The contraindication information of the first drug entity can be obtained according to the contraindication information field. The notice information for the first drug entity may be obtained from the notice field. The contra-indication information and the notice information have information related to the first drug entity that requires attention in use.
B2: identifying information related to the drug component and the association relationship from the contra-indication information and/or the notice information of the first drug entity, determining the identified information related to the drug component as a target drug component type, and determining the identified information related to the association relationship as a target association relationship type.
The contraindication information and/or notice information of the first drug entity is identified, and information related to the drug components and the association relationship can be obtained.
The information related to the pharmaceutical ingredient is the type of pharmaceutical ingredient involved in the contraindication information and/or the notice information. And determining the identified information related to the medicine component as the target medicine component type. For example, if the contraindication information of the first drug entity "amoxicillin capsule" is "cannot be taken simultaneously with tetracycline drugs and chloramphenicol drugs", the corresponding information related to the drug components identified is "tetracycline drugs" and "chloramphenicol drugs", and "tetracycline drugs" and "chloramphenicol drugs" are set as the target drug component types.
The information related to the association relationship refers to a type to which the association relationship between the type of the medicine component and the first medicine entity, which is involved in the contraindication information and/or the notice information, belongs. And determining the identified information related to the incidence relation as a target incidence relation type.
The association relationship type may be "taboo" or "advisable". "taboo" means that the first drug entity and the drug entity corresponding to the target drug ingredient type may not be taken simultaneously. "preferably" means that the first drug entity and the drug entity corresponding to the target drug component type are to be administered simultaneously. Taking the above-mentioned contraindication information as an example, the association relationship type between the first drug entity and the drug entities corresponding to the "tetracycline drugs" and the "chloramphenicol drugs" is "contraindication", and the "contraindication" is taken as the target associated component type.
B3: acquiring a drug entity of which the drug component type belongs to the target drug component type in a drug knowledge base, constructing an incidence relation between the drug entity and a first drug entity, and setting the incidence relation type as the target incidence relation type.
Reading the medicine entity information of the medicine entities except the first medicine entity in the medicine knowledge base, acquiring the medicine component types from the medicine entity information, if the medicine component type of a certain medicine entity belongs to the target medicine component type, constructing the incidence relation between the medicine entity of which the medicine component type belongs to the target medicine component type and the first medicine entity, and setting the incidence relation type as the target incidence relation type.
For example, the first drug entity is an amoxicillin capsule, the corresponding target drug component types are tetracycline drugs and chloramphenicol drugs, and the target association type is "taboo". The type of the medicine component corresponding to the thiamphenicol is a chloramphenicol medicament, and the thiamphenicol and the amoxicillin capsule can be associated and the association is set as 'taboo'.
In a possible implementation manner, the drug entity information of other drug entities in the drug knowledge base may be identified through the identification model of the drug component type field, so as to obtain the drug component type. The type of the medicine component can also be obtained by searching keywords or keywords corresponding to a preset field of the type of the medicine component.
In the embodiment of the application, by determining the target drug component type and the target association relationship type corresponding to the first drug entity, an association relationship between the drug entity belonging to the target drug component type and the first drug entity can be established, where the association relationship belongs to the target association relationship type. Therefore, a relatively complete incidence relation between the drug entities can be established, and the comprehensiveness and accuracy of drug information query based on the query knowledge base are improved.
In a possible implementation manner, the historical query records of the medicine information have entities, and the related knowledge base to be established can be determined by performing entity identification on the historical query records of the medicine information. The embodiment of the present application provides a method for determining, in S203, a relevant knowledge base associated with a knowledge base of a drug according to a historical query record of drug information, including:
entity identification is carried out on the historical inquiry records of the medicine information to obtain the entity in the non-medicine field and the type of the entity;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
There may be entities in the drug information history query record that represent a particular meaning. By performing entity identification on the historical query records of the medicine information, the entities and entity types included in the historical query records of the medicine information can be obtained. The identified entity type is used for representing the type of the entity. Specifically, the entity identification may be performed on the drug information history query record through an entity identification model obtained through pre-training, and the entity type may be a predefined entity type that may appear in the drug information history query record.
And identifying the obtained entity type as the entity type related to the drug entity, and determining a related knowledge base needing to be associated with the drug knowledge base from various established knowledge bases according to the obtained entity type.
Based on the above, the relevant knowledge base associated with the medicine knowledge base is determined through the historical inquiry records of the medicine information, and the completeness of the inquiry knowledge base of the medicine information can be ensured through the determination of the relevant knowledge base required by the inquiry of the user, so that the user can inquire the required medicine information based on the inquiry knowledge base.
In one possible implementation, the relevant knowledge base may include a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base; then, an embodiment of the present application further provides a specific implementation manner for S204 establishing an association relationship between a drug entity and a non-drug domain entity in a related knowledge base according to drug entity information of the drug entity, including:
and establishing an incidence relation between the drug entity and the symptom entity in the symptom knowledge base, the crowd entity in the crowd knowledge base, the food material entity in the food material knowledge base and the motion entity in the motion knowledge base according to the drug entity information of the drug entity.
Specifically, the above process may be implemented by:
in a possible implementation manner, in order to establish an association relationship between a drug entity and a symptom entity in a symptom knowledge base, information corresponding to an indication field in drug entity information of a second drug entity may be read to obtain an indication of the second drug entity; acquiring a symptom entity corresponding to the indication of the second medicine entity in a symptom knowledge base, and constructing an incidence relation between the symptom entity and the second medicine entity; the second drug entity is any one of the drug entities.
It is understood that a drug product has the symptoms of the corresponding treatment, i.e. the indication for which the drug product corresponds. The medicine entity information of the medicine entity comprises an indication field of the medicine, and the information corresponding to the indication field is the specific content of the indication. And taking any one of the medicine entities as a second medicine entity, and reading information corresponding to the indication field in the medicine entity information of the second medicine entity to obtain the indication of the second medicine entity.
"Gankang" is taken as the second drug entity as an example, and the content of the indication corresponding to the indication field in the drug entity information of "Gankang" is "suitable for relieving symptoms such as fever, headache, soreness and pain of limbs, sneezing, rhinorrhea, nasal obstruction, pharyngalgia and the like caused by common cold and influenza". According to the information of the indication symptoms corresponding to the indication symptom field, the indication symptoms of the second medicine entity 'Gankang' can be determined to be symptoms such as fever, headache, aching pain of limbs, sneezing, rhinorrhea, nasal obstruction, pharyngalgia and the like caused by common cold and influenza.
Referring to fig. 3, the figure is a schematic structural diagram of a query knowledge base according to an embodiment of the present application. The inquiry knowledge base comprises a medicine knowledge base and a related knowledge base, wherein the related knowledge base is a symptom knowledge base.
The symptom knowledge base has symptom entities therein, and the symptom entities may correspond to respective symptoms. And determining a symptom entity corresponding to the indication of the second medicine entity from the symptom knowledge base, and establishing an association relationship between the determined symptom entity and the second medicine entity, so as to realize the establishment of the association relationship between the symptom entity in the symptom knowledge base and the medicine entity in the medicine knowledge base.
Taking the second medicine entity "Gankang" as an example, the indications of the second medicine entity "Gankang" are symptoms such as fever, headache, soreness and pain of limbs, sneezing, rhinorrhea, nasal obstruction, pharyngalgia and the like caused by common cold and influenza. The symptom entities "fever", "headache", "soreness of the extremities", "sneezing", "rhinorrhea", "nasal obstruction" and "sore throat" in the symptom knowledge base can be associated with the second drug entity "gankang", respectively.
In one possible implementation manner, in order to establish an association relationship between the drug entity and the crowd entity in the crowd knowledge base, information corresponding to the taboo information field and/or the notice field in the drug entity information of the second drug entity may be read to obtain the taboo information and/or the notice of the second drug entity; identifying information related to applicable people from contra-indication information and/or notice information of the second drug entity; acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base, and constructing an association relation between the crowd entity and the second medicine entity; the second drug entity is any one of the drug entities.
At least one of a contraindication information field or a notice field in the drug entity information of the second drug entity is read. And obtaining the contraindication information of the second medicine entity according to the information corresponding to the contraindication information field. And obtaining the notice information of the second medicine entity according to the information corresponding to the notice field. The contraindication information and the notice information have attention-requiring information related to the second drug entity.
The contraindication information and/or the notice information of the second drug entity have information related to the second drug entity and applicable people. And carrying out entity identification on the contraindication information and/or the notice information of the second medicine entity to obtain related entities included in the contraindication information and/or the notice information. The related entities may be crowd entities.
For example, if the "ibuprofen tablet" is used as the second drug entity, the notice information corresponding to the notice field in the drug entity information of the "ibuprofen tablet" has the effect that the pregnancy period of the woman in late pregnancy can be prolonged, which causes dystocia and the labor course to be prolonged. It is not suitable for pregnant women and women in lactation. Through the entity recognition of the notice information, the crowd entities of the pregnant women and the lactation women corresponding to the ibuprofen tablets of the second medicine entity can be obtained.
Referring to fig. 3, the relevant knowledge base may also include a crowd knowledge base. The crowd knowledge base has crowd entities, which may correspond to various crowds, such as pregnant women, children, people with hypertension, and the like. The crowd entity may have corresponding crowd entity information, which may be information for explaining the crowd. For example, the crowd entity information corresponding to "children" may be anyone under 18 years of age.
And determining a crowd entity corresponding to the second medicine entity from the crowd knowledge base, and establishing an association relation between the determined crowd entity and the second medicine entity. Thus, the establishment of the incidence relation between the crowd knowledge base and the medicine knowledge base is realized.
Taking the second drug substance "ibuprofen tablet" as an example, the second drug substance "ibuprofen tablet" includes the entities of the population of "pregnant women" and "women in lactation". The human entity 'pregnant woman' and 'lactating woman' in the human knowledge base are respectively associated with the second medicine entity 'ibuprofen tablet'.
In one possible implementation manner, in order to establish an association relationship between the drug entity and the food material entity in the food material knowledge base, information corresponding to the taboo information field and/or the notice field in the drug entity information of the second drug entity may be read to obtain the taboo information and/or the notice of the second drug entity; identifying information related to the food material from the contra-indication information and/or the notice information of the second drug entity; acquiring food material entities corresponding to the information related to food materials in the food material knowledge base, and constructing an association relation between the food material entities and the second medicine entities; the second drug entity is any one of the drug entities.
Similarly, at least one of a contraindication information field or a notice field in the drug entity information of the second drug entity is read. And obtaining the contraindication information of the second medicine entity according to the information corresponding to the contraindication information field. And obtaining the notice information of the second medicine entity according to the information corresponding to the notice field. The contraindication information and the notice information have attention-requiring information related to the second drug entity.
The contraindication information and/or the notice information of the second medicine entity comprise information related to the food material and related to the second medicine entity. And carrying out entity identification on the contraindication information and/or the notice information of the second medicine entity to obtain related entities included in the contraindication information and/or the notice information. The related entities may be food material entities.
For example, with "999 ganmaoling granules" as the second drug entity, the contraindication information of "999 ganmaoling granules" includes "avoiding smoking, alcohol and spicy, uncooked and greasy food". By carrying out entity identification on the taboo information, the food material entities of 'tobacco', 'wine', 'spicy', 'uncooked' and 'greasy' corresponding to the second medicine entity '999 Ganmaoling granule' can be obtained.
Referring to fig. 3, the related knowledge base may further include a food material knowledge base. The food material knowledge base is provided with food material entities, and the food material entities correspond to various foods. Determining a food material entity corresponding to the second medicine entity from the food material knowledge base, and establishing an association relationship between the determined food material entity and the second medicine entity.
Taking the second medicine entity "999 ganmaoling granules" as an example, the food material entities included in the second medicine entity "999 ganmaoling granules" are "tobacco" and "wine". Correspondingly, the 999 Ganmaoling granules can be respectively associated with the food material entities 'tobacco' and 'wine' in the food material knowledge base.
It should be noted that the food material entity may also include a generic term entity of a type of food. Such as seafood, greasy, spicy, etc. The food material entity can have corresponding food material entity information, and the food material entity information includes object types specifically included in the food materials. For example, the food material entity information corresponding to "spicy" includes foods such as hot pepper, shallot, ginger, leek, garlic, caraway, pepper, onion, and the like. Taking the second medicine entity "999 Ganmaoling granule" as an example, the food material entities included in the second medicine entity "999 Ganmaoling granule" are "spicy", "cold" and "greasy". Correspondingly, the 999 Ganmaoling granules can be respectively associated with the pungent taste, the uncooked cold and the greasy taste in the food material knowledge base.
In a possible implementation manner, in order to establish an association relationship between a drug entity and a motion entity in a motion knowledge base, information corresponding to a contraindication information field and/or a notice field in drug entity information of a second drug entity may be read to obtain contraindication information and/or a notice of the second drug entity; identifying information related to the movement from contra-indication information and/or notice information of the second drug entity; acquiring a motion entity corresponding to motion related information in a motion knowledge base, and constructing an association relation between the motion entity and a second medicine entity; the second drug entity is any one of the drug entities.
Similarly, at least one of a contraindication information field or a notice field in the drug entity information of the second drug entity is read. And obtaining the contraindication information of the second medicine entity according to the information corresponding to the contraindication information field. And obtaining the notice information of the second medicine entity according to the information corresponding to the notice field. The contraindication information and the notice information have attention-requiring information related to the second drug entity.
The contraindication information and/or the notice information of the second drug entity has information related to the second drug entity and related to the movement. And carrying out entity identification on the contraindication information and/or the notice information of the second medicine entity to obtain related entities included in the contraindication information and/or the notice information. The related entities may be moving entities.
For example, if "gankang" is used as the second medicine entity, the "gankang" medicine entity information contains "this product may cause symptoms such as sleepiness and drowsiness, and thus, the driver, the vehicle, the ship, and the high-altitude operation, the mechanical operation, and the operation of the precision equipment during the administration of the medicine are not required. The entity recognition is carried out on the notice information of the 'Gangkang', and the motion entities of 'driving', 'high-altitude operation', 'mechanical operation' and 'precision instrument operation' corresponding to the 'Gangkang' of the second medicine entity can be obtained.
Referring to fig. 3, the relevant knowledge base may also include a motion knowledge base. The motion knowledge base is provided with motion entities, and the motion entities correspond to various types of motions. And determining a motion entity corresponding to the second medicine entity from the motion knowledge base, and establishing an association relationship between the determined motion entity and the second medicine entity.
Taking the second medicine entity "Gankang" as an example, the "Gankang" includes moving entities of "driving", "overhead working", "mechanical working" and "operating precision instruments". The association relation between the motion entity 'driving', 'overhead operation', 'mechanical operation' and 'operation precise instrument' in the motion knowledge base and the 'Gankang' is respectively established.
Also, it should be noted that a motion entity may correspond to a generic term for a type of motion. The motion entity may have corresponding motion entity information, and the motion entity information may include a motion category specifically included in the motion entity. For example, the motion entity information corresponding to the "high-altitude operation" includes specific motion types such as limb, hole, climbing, suspending, crossing, and the like.
In the embodiment of the application, the association relationship between the drug entity in the drug knowledge base and the entities of other related knowledge bases can be established according to the indication and the various entities corresponding to the second drug entity. Based on the established association relationship, the generated inquiry knowledge base is more complete, so that a user can conveniently inquire the medicine information through other information related to the medicine, and the accuracy of the inquired medicine information is improved.
Based on the method for constructing the knowledge base provided by the embodiment, the embodiment of the application further provides an information query method. The information query method provided by the embodiment of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 4, which is a flowchart of an information query method provided in an embodiment of the present application, as shown in fig. 4, the method may include S401 to S405:
s401: and acquiring a query request of the medicine information sent by the client.
When inquiring the medicine information, the user can trigger an inquiry request for generating the medicine information in the client. And the client sends the query request to a corresponding server. The server acquires the query request sent by the client.
The query request includes related information provided by the user when the user queries the medicine information. The query request may include the content of the user's query question. By analyzing the query request, the information to be queried by the user can be determined.
S402: at least one of a drug entity or a non-drug domain entity is identified from the query request.
The drug information query request includes entities related to drug information, which may be at least one of drug entities or non-drug domain entities. Specifically, the non-pharmaceutical field entity may include at least one of a symptom entity, a crowd entity, a food material entity, or a sports entity.
Entity identification is carried out on the inquiry request, so that entities related to the medicine information can be obtained, and inquiry of the medicine information is further realized.
For example, if the query is "what drug is taken for a fever", entity identification of the query may result in a symptom entity "fever". If the query request is that the medicine entity is the 'Gankang' for treatment, the medicine entity 'Gankang' can be obtained by identification. If the inquiry request is that the children can eat the watermelon after eating the infantile common cold granules, the crowd entity 'children', the medicine entity 'infantile common cold granules' and the food material entity 'watermelon' can be obtained by identification. If the query request is that the 999 Ganmaoling granules can be eaten during driving, the sports entity driving and the medicine entity 999 Ganmaoling granules can be identified.
S403: and determining the query intention according to the query request.
When inquiring the medicine information, the user has the intention to inquire. The query intention is used for embodying the target of the medicine information to be queried by the user, and the specific medicine information to be acquired by the user can be determined according to the query intention. For example, if the query request is "what drug to eat a fever", the corresponding query intent is the drug name. If the query request is '999 Ganmaoling granules can be eaten when driving', the corresponding query intention is the notice of medicine use.
The implementation manner of determining the query intention of the query request is not limited in the embodiments of the present application, and in one possible implementation manner, the intention of the query request may be identified by an intention identification model obtained through pre-training.
S404: inquiring the inquiry knowledge base according to the inquiry intention and at least one of the obtained medicine entity or the obtained non-medicine field entity to obtain an inquiry result; the query knowledge base is constructed according to the method for constructing the knowledge base in any embodiment.
And based on at least one of the obtained entities identified from the query request and the determined query intention, performing query in the query knowledge base established in the embodiment to obtain a corresponding query result. The inquiry result has medicine information corresponding to the inquiry request.
In particular, the identified entities may be used to determine associated entities and related information, and the determined query intent may be used to determine queried drug information.
In a specific implementation manner, the embodiment of the present application provides a specific implementation manner for querying a query knowledge base according to a query intention and at least one of an obtained drug entity or a non-drug domain entity to obtain a query result, please refer to the following.
S405: and sending the query result to the client.
The inquiry result has the medicine information which is acquired by the user. And sending the query result to the client so that the client can display the query result.
In order to improve the user experience, in one possible implementation, the query result may be displayed to the user in a natural language interactive manner. In particular, the query results may be converted to a natural language form by a language model. In addition, the query result can also be converted into a natural language form through a preset language rule or a response template. For example, reply templates for different types of query requests may be preset, and the determined query results may be used to complete the corresponding reply templates to form query results in a natural language. In practical application, an interface with the human image of the pharmacist can be displayed at the client, and the query result is displayed to the user in the interface, so that the query process is closer to the communication process of the natural language.
Based on the above-mentioned relevant contents of S401-S405, by identifying and analyzing the query request for the drug information, the entity included in the query request and the query intention can be determined. Based on the determined entity and the query intention, a query result of the medicine information which is more in line with the needs of the user can be obtained through query, so that the obtained query result is more accurate. By using the query knowledge base constructed by the method of any embodiment, the completeness of the queried knowledge base can be ensured, so that a user can query and obtain required medicine information, and the obtained medicine information is more accurate.
Further, when the user performs the query, the user may perform the query of the corresponding medicine information based on the self condition. In order to make the query result more accurate, information related to the user can be acquired, and the query result can be determined based on the information related to the user.
In one possible implementation manner, before querying the query knowledge base according to the query intent and the obtained at least one of the drug entity or the non-drug domain entity to obtain the query result, the method further includes:
acquiring portrait information of a user;
and obtaining a corresponding non-medicine field entity according to the user character image information.
In this case, the non-pharmaceutical domain entity may be a human entity and/or a symptom entity.
The user portrait information is information related to the user and is used to more accurately determine the needs of the user. The portrait information of the user may include related information such as sex, age, occupation, basic medical history, etc. of the user.
The user portrait information may be personal information that the user has previously registered before making a query using the client. Such as gender, age, basic medical history, etc., provided by the user at registration. Or may be personal information of the user acquired through interaction with the user.
The user portrait information may be triggered to be retrieved based on a query request. Specifically, for example, when the user portrait information is also required when a query is made based on the query request, the acquisition of the user portrait information is triggered. For example, the query request of the user is '999 how the Ganmaoling granule is taken', and since the taking rules of people of different ages are different, in order to provide medicine information to the user more accurately, user figure information can be obtained, and the accurate taking rule can be determined according to the user figure information.
And performing entity recognition on the acquired user portrait information to obtain a crowd entity and/or a symptom entity included in the user portrait information. For example, the user portrait information includes a history of diseases in which the user is 65 years old and has high blood pressure. Correspondingly, the identified entity of the population is "elderly" and the symptom entity is "hypertension".
In the embodiment of the application, through the portrait information of the user, the crowd entity and/or symptom entity related to the user can be determined, so that the related information of the user can be further determined, and a more accurate query result can be determined.
Because the user inquires the medicine information, the obtained inquiry result comprises the information or the entity related to the medicine entity. If the drug entity is identified and obtained in the query request, the query result can be obtained according to the drug entity information of the drug entity or the related entity associated with the drug entity; if the query request identifies the related entities, the drug entities can be determined according to the related entities, and then query results are obtained.
In a possible implementation manner, an embodiment of the present application provides a method for S404 querying a query knowledge base according to a query intention and at least one of the obtained drug entity or non-drug domain entity to obtain a query result, including the following two steps C1-C2:
c1: and when the inquiry knowledge base is inquired according to the medicine entity, determining the medicine information field to be inquired corresponding to the medicine entity according to the inquiry intention.
C2: and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
For the inquiry of the information related to the medicine entity, the inquiry knowledge base is inquired, and the medicine information field to be inquired corresponding to the medicine entity can be determined based on the determined inquiry intention. The drug information field corresponds to drug information related to the drug entity, and a query result corresponding to the query request can be obtained by reading the drug information corresponding to the drug information field to be queried.
For example, the query request is "what is treated by Gangkang", the obtained drug entity is identified as "Gangkang", and the determined query intent is the indication of the drug. And the medicine information field to be inquired corresponding to the 'Gankang' determined based on the inquiry intention is 'indication'. The medicine information corresponding to the 'indication' of 'Gankang' is read from the inquiry knowledge base, and the inquiry result is 'suitable for relieving symptoms such as fever, headache, aching pain of limbs, sneezing, rhinorrhea, nasal obstruction, pharyngalgia and the like caused by common cold and influenza'. For another example, the query request is that the amoxicillin capsule can be eaten together with thiamphenicol, the obtained medicine entities are identified as the amoxicillin capsule and the thiamphenicol, the determined query intention is the relationship between the amoxicillin capsule and the thiamphenicol, and the related entity 'thiamphenicol' of the amoxicillin capsule can be determined based on the determined query intention. Reading the correlation between the amoxicillin capsules and the thiamphenicol from the query knowledge base as 'taboo', and obtaining the corresponding query result as 'unable'.
In a possible implementation manner, on the basis of the steps C1-C2, the non-drug domain entities associated with the drug entities may be obtained according to the query intention based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base included in the query knowledge base; and acquiring entity information corresponding to non-drug field entities associated with the drug entities based on the related knowledge base included in the query knowledge base, and adding the entity information into a query result.
If the drug entity is identified in the drug information query request, the non-drug domain entity associated with the drug entity to be queried by the user can be determined according to the query intention.
For the query of the related entities of the drug entities, the query knowledge base can be queried, and the non-drug domain entities related to the drug entities can be determined according to the determined query intention based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base. The associated non-pharmaceutical domain entities may be one or more of symptom entities, crowd entities, food material entities, and motion entities. From the related knowledge base included in the query knowledge base, entity information corresponding to non-drug domain entities associated with the drug entities can be acquired and added to the query results
For example, the query request is "how can drink cephalo completely eaten", the obtained medicine entity is identified as "cephalo", the food material entity is identified as "wine", and the determined query intent is the type of the association relationship between "cephalo" and "wine". Based on the determined query intent, the associated entity of "cephalosporin" alcohol "may be determined. Reading the correlation between the cephalo and the wine from the query knowledge base as 'taboo' and obtaining the corresponding query result as 'unable'.
In a possible implementation manner, an embodiment of the present application provides a method for S404 querying a query knowledge base according to a query intention and at least one of the obtained drug entities or non-drug domain entities to obtain a query result, including the following three steps D1-D3:
d1: when the inquiry knowledge base is inquired according to the non-medicine field entities, the medicine entities related to the non-medicine field entities are obtained based on the incidence relation between the medicine entities in the medicine knowledge base and the non-medicine field entities in the related knowledge base.
D2: and determining the drug information field to be queried corresponding to the drug entity according to the query intention.
D3: and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
If one or more of non-drug domain entities such as symptom entities, crowd entities, food entities or motion entities are identified in the query request, it can be determined that the drug entity associated with the entity is queried by the user.
And inquiring the inquiry knowledge base, and acquiring medicine entities related to one or more of the identified symptom entities, crowd entities, food entities or motion entities according to the determined inquiry intention on the basis of the incidence relation between the medicine entities in the medicine knowledge base and the non-medicine field entities in the related knowledge base. Further, the medicine information field to be inquired corresponding to the medicine entity is determined according to the inquiry intention, and the medicine information corresponding to the medicine information field to be inquired is obtained from the medicine knowledge base included in the inquiry knowledge base to obtain the inquiry result.
For example, the query request is "what drugs were sneezed to catch a cold," the resulting symptom entity is identified as "sneezing," and the determined query is intended to be a drug. From the query knowledge base, the drug entities 'Gankang', '999 Ganmaoling granules', and the like which are associated with 'sneeze' are determined according to the query intention, and finally, the query result is obtained according to the determined drug entities.
In a possible implementation manner, on the basis of the steps D1-D3, entity information corresponding to the non-drug domain entity may be obtained based on the related knowledge base included in the query knowledge base, and added to the query result.
If one or more of non-drug domain entities such as symptom entities, crowd entities, food entities or motion entities are identified and obtained in the query request, entity information corresponding to the non-drug domain entities can be obtained from a related knowledge base included in the query knowledge base, and the query result is added.
In addition, when the obtained entities have multiple types, a part of medicine entities can be determined according to the part of entities and the query intention, and related medicine entities are determined in the part of medicine entities by using the rest of entities to obtain a query result.
For example, if the query request is "what anti-inflammatory drugs can be taken by penicillin allergic people in tonsil inflammation", the obtained symptom entity is identified as "tonsil inflammation", the crowd entity is "penicillin allergic people", and the determined query intent is a drug. The medicine entities related to the tonsil inflammation can be determined to be penicillin anti-inflammatory drugs, cephalosporin anti-inflammatory drugs and the like from the query knowledge base according to the query intention. And removing the penicillin anti-inflammatory drugs based on the fact that the crowd entity is a penicillin allergic person and the association relation between the penicillin allergic person and the penicillin anti-inflammatory drugs is ' taboo ', and finally determining the associated drug entities as cephalosporin anti-inflammatory drugs ' and the like to obtain a query result.
In the embodiment of the application, the information or the entity to be queried is determined based on the entity of different types obtained by identification and the query intention, and then the query result is determined. By inquiring in the inquiry knowledge base based on the inquiry intention, the result to be inquired by the user can be more accurately determined, and the inquiry requirement of the user is met.
Based on the method for constructing the knowledge base provided by the method embodiment, the embodiment of the application also provides a device for constructing the knowledge base, which is explained and explained below with reference to the attached drawings.
Referring to fig. 5, the figure is a schematic structural diagram of an apparatus for building a knowledge base according to an embodiment of the present application. The device for constructing the knowledge base provided by the embodiment of the application comprises:
a first obtaining unit 501, configured to obtain a drug entity record, where the drug entity record includes a drug entity and drug entity information of the drug entity, and the drug entity information includes at least one drug information field and drug information corresponding to the drug information field;
a first establishing unit 502, configured to establish a drug knowledge base based on the drug entity, a drug entity record corresponding to the drug entity, and an association relationship between the drug entity and the drug entity record;
a first determining unit 503, configured to determine, according to a historical query record of drug information, a relevant knowledge base associated with the drug knowledge base, where the relevant knowledge base includes non-drug domain entities having associations with the drug entities;
a second establishing unit 504, configured to establish, according to the drug entity information of the drug entity, an association relationship between the drug entity and a non-drug domain entity in the relevant knowledge base;
a generating unit 505, configured to generate an inquiry knowledge base of drug information based on the drug knowledge base, a related knowledge base associated with the drug knowledge base, and an association relationship between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base.
In a possible implementation manner, the first establishing unit 502 includes:
the first determining subunit is used for determining the association relationship between the medicine entities according to the medicine information corresponding to the taboo information field and/or the caution item field in the medicine entity information and the medicine information corresponding to the medicine component type field;
and the association subunit is used for adding the medicine entity records to a medicine knowledge base and associating the medicine entities with association relation aiming at the medicine entities corresponding to the medicine entity records in the medicine knowledge base.
In one possible implementation manner, the first determining subunit includes:
the first reading subunit is used for reading a contraindication information field and/or a notice field in the medicine entity information of the first medicine entity to obtain the contraindication information and/or the notice of the first medicine entity; the first drug entity is any one of the drug entities;
a second determining subunit, configured to identify information related to the drug component and the association relationship from the contraindication information and/or the notice information of the first drug entity, determine the identified information related to the drug component as a target drug component type, and determine the identified information related to the association relationship as a target association relationship type;
and the construction subunit is used for acquiring the medicine entities of which the medicine component types belong to the target medicine component types in the medicine knowledge base, constructing the association relationship between the medicine entities and the first medicine entity, and setting the association relationship type as the target association relationship type.
In a possible implementation manner, the first determining unit 503 is specifically configured to perform entity identification on a historical query record of drug information to obtain a non-drug domain entity and a type to which the entity belongs, where the historical query record of drug information includes the non-drug domain entity;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
In one possible implementation, the relevant knowledge base includes a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base;
the generating unit 505 is specifically configured to establish, according to the drug entity information of the drug entity, an association relationship between the drug entity and a symptom entity in the symptom knowledge base, a crowd entity in the crowd knowledge base, a food material entity in the food material knowledge base, and a motion entity in the motion knowledge base.
In a possible implementation manner, the generating unit 505 includes:
the first reading subunit is used for reading information corresponding to an indication field in the medicine entity information of the second medicine entity to obtain an indication of the second medicine entity; the second drug entity is any one of the drug entities;
the first construction subunit is configured to acquire a symptom entity corresponding to the indication of the second drug entity in the symptom knowledge base, and construct an association relationship between the symptom entity and the second drug entity.
In a possible implementation manner, the generating unit 505 includes:
the second reading subunit is configured to read information corresponding to a contraindication information field and/or a notice field in the drug entity information of the second drug entity to obtain contraindication information and/or a notice of the second drug entity; the second drug entity is any one of the drug entities;
a first identifying subunit, configured to identify information related to applicable people from the contraindication information and/or the notice information of the second drug entity;
and the second construction subunit is used for acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base and constructing the association relationship between the crowd entity and the second medicine entity.
In a possible implementation manner, the generating unit 505 includes:
the third reading subunit is configured to read information corresponding to a taboo information field and/or a notice field in the drug entity information of the second drug entity, so as to obtain the taboo information and/or the notice of the second drug entity; the second drug entity is any one of the drug entities;
a second identification subunit, configured to identify information related to food materials from the contraindication information and/or the notice information of the second medicine entity;
and the third construction subunit is used for acquiring a food material entity corresponding to the information related to the food material in the food material knowledge base and constructing an association relation between the food material entity and the second medicine entity.
In a possible implementation manner, the generating unit 505 includes:
the fourth reading subunit is configured to read information corresponding to a taboo information field and/or a notice field in the drug entity information of the second drug entity, so as to obtain the taboo information and/or the notice of the second drug entity; the second drug entity is any one of the drug entities;
a third identifying subunit, configured to identify information related to exercise from the contraindication information and/or the notice information of the second drug entity;
and the fourth construction subunit is configured to acquire a motion entity corresponding to the motion-related information in the motion knowledge base, and construct an association relationship between the motion entity and the second drug entity.
Based on the information query method provided by the above method embodiment, the embodiment of the present application further provides an information query device, which is explained and explained below with reference to the accompanying drawings.
Referring to fig. 6, this figure is a schematic structural diagram of an information query apparatus according to an embodiment of the present application. The information inquiry device provided by the embodiment of the application comprises:
a second obtaining unit 601, configured to obtain an inquiry request of the drug information sent by the client;
an identifying unit 602, configured to identify at least one of a drug entity or a non-drug domain entity from the query request;
a second determining unit 603, configured to determine a query intention according to the query request;
the query unit 604 is configured to query the query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity, so as to obtain a query result; the query knowledge base is constructed according to the device for constructing the knowledge base in any embodiment;
a sending unit 605, configured to send the query result to the client.
In one possible implementation, the apparatus further includes:
a third acquisition unit configured to acquire user portrait information;
and the fourth acquisition unit is used for acquiring the corresponding non-medicine field entity according to the user character image information.
In a possible implementation manner, the querying unit 604 includes:
the third determining subunit is used for determining a medicine information field to be queried corresponding to the medicine entity according to the query intention when the medicine entity queries the query knowledge base;
and the first acquiring subunit is configured to acquire, based on the drug knowledge base included in the query knowledge base, drug information corresponding to the drug information field to be queried, so as to obtain a query result.
In one possible implementation, the apparatus further includes:
a second obtaining subunit, configured to obtain, according to the query intention, a non-drug domain entity associated with the drug entity based on an association relationship between the drug entity in the drug knowledge base and the non-drug domain entity in the relevant knowledge base that is included in the query knowledge base;
and the third acquiring subunit is configured to acquire, based on the relevant knowledge base included in the query knowledge base, entity information corresponding to the non-drug-domain entity associated with the drug entity, and add the entity information to the query result.
In a possible implementation manner, the querying unit 604 includes:
a fourth obtaining subunit, configured to, when querying a query knowledge base according to a non-drug domain entity, obtain a drug entity associated with the non-drug domain entity based on an association relationship, included in the query knowledge base, between a drug entity in the drug knowledge base and the non-drug domain entity in the relevant knowledge base;
a fourth determining subunit, configured to determine, according to the query intention, a to-be-queried drug information field corresponding to the drug entity;
and the fifth acquiring subunit is configured to acquire, based on the drug knowledge base included in the query knowledge base, drug information corresponding to the drug information field to be queried, so as to obtain a query result.
In one possible implementation, the apparatus further includes:
and the sixth acquiring subunit is configured to acquire, based on the relevant knowledge base included in the query knowledge base, entity information corresponding to the non-drug-domain entity, and add the entity information to the query result.
FIG. 7 shows a block diagram of an apparatus 1200 for building a knowledge base. For example, the device 1200 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 7, device 1200 may include one or more of the following components: processing component 1202, memory 1204, power component 1206, multimedia component 1208, audio component 1210, input/output (I/O) interface 1212, sensor component 1214, and communications component 1216.
The processing component 1202 generally controls overall operation of the device 1200, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 1202 may include one or more processors 1220 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 1202 can include one or more modules that facilitate interaction between the processing component 1202 and other components. For example, the processing component 1202 can include a multimedia module to facilitate interaction between the multimedia component 1208 and the processing component 1202.
The memory 1204 is configured to store various types of data to support operation at the device 1200. Examples of such data include instructions for any application or method operating on device 1200, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1204 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
A power supply component 1206 provides power to the various components of the device 1200. Power components 1206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for device 1200.
The multimedia components 1208 include a screen that provides an output interface between the device 1200 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1208 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1200 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
Audio component 1210 is configured to output and/or input audio signals. For example, audio assembly 1210 includes a Microphone (MIC) configured to receive external audio signals when device 1200 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1204 or transmitted via the communication component 1216. In some embodiments, audio assembly 1210 further includes a speaker for outputting audio signals.
The I/O interface provides an interface between the processing component 1202 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1214 includes one or more sensors for providing various aspects of state assessment for the device 1200. For example, the sensor assembly 1214 may detect an open/closed state of the device 1200, the relative positioning of the components, such as a display and keypad of the device 1200, the sensor assembly 1214 may also detect a change in the position of the device 1200 or a component of the device 1200, the presence or absence of user contact with the device 1200, orientation or acceleration/deceleration of the device 1200, and a change in the temperature of the device 1200. The sensor assembly 1214 may include a proximity sensor configured to detect the presence of a nearby object in the absence of any physical contact. The sensor assembly 1214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1214 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communications component 1216 is configured to facilitate communications between device 1200 and other devices in a wired or wireless manner. The device 1200 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1216 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1216 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 1200 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the following methods:
acquiring a drug entity record, wherein the drug entity record comprises a drug entity and drug entity information of the drug entity, and the drug entity information comprises at least one drug information field and drug information corresponding to the drug information field;
establishing a drug knowledge base based on the drug entities, the drug entity records corresponding to the drug entities and the incidence relation between the drug entities and the drug entity records;
determining a relevant knowledge base associated with the drug knowledge base according to drug information historical query records, wherein the relevant knowledge base comprises non-drug domain entities having association with the drug entities;
establishing an incidence relation between the drug entity and a non-drug field entity in the relevant knowledge base according to the drug entity information of the drug entity;
and generating a drug information query knowledge base based on the drug knowledge base, a related knowledge base associated with the drug knowledge base and an association relation between drug entities in the drug knowledge base and non-drug domain entities in the related knowledge base.
In a possible implementation manner, the establishing a drug knowledge base based on the drug entity, the drug entity record corresponding to the drug entity, and the association relationship between the two includes:
determining an association relation between the medicine entities according to medicine information corresponding to a contraindication information field and/or a notice field in the medicine entity information and medicine information corresponding to a medicine component type field;
and adding the drug entity records to a drug knowledge base, and associating the drug entities with association relation aiming at the drug entities corresponding to the drug entity records in the drug knowledge base.
In a possible implementation manner, the determining, according to the drug information corresponding to the taboo information field and/or the caution item field in the drug entity information and the drug information corresponding to the drug component type field, an association relationship between the drug entities includes:
reading a contraindication information field and/or a notice field in the drug entity information of a first drug entity to obtain the contraindication information and/or the notice of the first drug entity; the first drug entity is any one of the drug entities;
identifying information related to the drug components and the association relationship from the contraindication information and/or the notice information of the first drug entity, determining the identified information related to the drug components as a target drug component type, and determining the identified information related to the association relationship as a target association relationship type;
and acquiring the drug entities of which the drug component types belong to the target drug component types in the drug knowledge base, constructing the association relationship between the drug entities and the first drug entity, and setting the association relationship type as the target association relationship type.
In one possible implementation manner, the determining, according to the historical query record of the drug information, a relevant knowledge base associated with the drug knowledge base includes:
entity identification is carried out on the historical inquiry record of the medicine information to obtain the entity of the non-medicine field and the type of the entity which are included in the historical inquiry record of the medicine information;
and determining a related knowledge base associated with the medicine knowledge base according to the type of the entity.
In one possible implementation, the relevant knowledge base includes a symptom knowledge base, a crowd knowledge base, a food material knowledge base, and a sports knowledge base;
the establishing of the incidence relation between the drug entity and the non-drug domain entity in the related knowledge base according to the drug entity information of the drug entity comprises:
and establishing an association relation between the drug entity and the symptom entity in the symptom knowledge base, the crowd entity in the crowd knowledge base, the food material entity in the food material knowledge base and the motion entity in the motion knowledge base according to the drug entity information of the drug entity.
In one possible implementation, the method includes: reading information corresponding to an indication field in medicine entity information of a second medicine entity to obtain an indication of the second medicine entity; the second drug entity is any one of the drug entities;
and acquiring a symptom entity corresponding to the indication of the second medicine entity in the symptom knowledge base, and constructing an association relation between the symptom entity and the second medicine entity.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to applicable people from contra-indication information and/or notice information of the second drug entity;
and acquiring a crowd entity corresponding to the information related to the applicable crowd in the crowd knowledge base, and constructing an association relation between the crowd entity and the second medicine entity.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to food material from contra-indication information and/or notice information of the second drug entity;
and acquiring food material entities corresponding to the information related to the food materials in the food material knowledge base, and constructing an association relation between the food material entities and the second medicine entities.
In one possible implementation, the method includes:
reading information corresponding to a contraindication information field and/or a notice field in medicine entity information of a second medicine entity to obtain the contraindication information and/or the notice of the second medicine entity; the second drug entity is any one of the drug entities;
identifying information related to movement from contra-indication information and/or notice information of the second drug entity;
and acquiring a motion entity corresponding to the motion related information in the motion knowledge base, and constructing an association relationship between the motion entity and the second medicine entity.
Fig. 8 shows a block diagram for an information query device 1300. For example, the device 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and so forth.
Referring to fig. 8, device 1300 may include one or more of the following components: a processing component 1302, a memory 1304, a power component 1306, a multimedia component 1308, an audio component 1310, an input/output (I/O) interface 1313, a sensor component 1314, and a communication component 1316.
The processing component 1302 generally controls overall operation of the device 1300, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the method described above. Further, the processing component 1302 can include one or more modules that facilitate interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate interaction between the multimedia component 1308 and the processing component 1302.
The memory 1304 is configured to store various types of data to support operation at the device 1300. Examples of such data include instructions for any application or method operating on device 1300, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1304 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 1306 provides power to the various components of the device 1300. Power components 1306 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for device 1300.
The multimedia component 1308 includes a screen that provides an output interface between the device 1300 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front facing camera and/or a rear facing camera. The front-facing camera and/or the back-facing camera may receive external multimedia data when the device 1300 is in an operational mode, such as a capture mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1310 is configured to output and/or input audio signals. For example, the audio component 1310 includes a Microphone (MIC) configured to receive external audio signals when the device 1300 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 1304 or transmitted via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.
The I/O interface provides an interface between the processing component 1302 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1314 includes one or more sensors for providing various aspects of state assessment for the device 1300. For example, the sensor assembly 1314 may detect the open/closed state of the device 1300, the relative positioning of components, such as a display and keypad of the device 1300, the sensor assembly 1314 may also detect a change in the position of the device 1300 or a component of the device 1300, the presence or absence of user contact with the device 1300, orientation or acceleration/deceleration of the device 1300, and a change in the temperature of the device 1300. The sensor assembly 1314 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1314 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1316 is configured to facilitate communications between the device 1300 and other devices in a wired or wireless manner. The device 1300 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1316 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1316 also includes a Near Field Communications (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 1300 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the following methods:
acquiring a query request of medicine information sent by a client;
identifying at least one of a drug entity or a non-drug domain entity from the query request;
determining a query intention according to the query request;
inquiring an inquiry knowledge base according to the inquiry intention and at least one of the obtained medicine entity or non-medicine field entity to obtain an inquiry result; the query knowledge base is constructed according to the method for constructing the knowledge base in any embodiment;
and sending the query result to the client.
In one possible implementation manner, before querying a query knowledge base according to the query intent and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result, the method further includes:
acquiring portrait information of a user;
and obtaining a corresponding non-medicine field entity according to the user figure image information.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a medicine entity is inquired in an inquiry knowledge base, determining a medicine information field to be inquired corresponding to the medicine entity according to the inquiry intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the method further includes:
acquiring non-drug domain entities associated with the drug entities according to the query intention based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the related knowledge base, wherein the association relationship is included in the query knowledge base;
and acquiring entity information corresponding to the non-drug field entity associated with the drug entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
In a possible implementation manner, the querying a query knowledge base according to the query intention and the obtained at least one of the drug entity or the non-drug domain entity to obtain a query result includes:
when a query knowledge base is queried according to non-drug domain entities, acquiring drug entities associated with the non-drug domain entities based on the association relationship between the drug entities in the drug knowledge base and the non-drug domain entities in the relevant knowledge base, wherein the association relationship is included in the query knowledge base;
determining a drug information field to be queried corresponding to the drug entity according to the query intention;
and acquiring the medicine information corresponding to the medicine information field to be inquired based on the medicine knowledge base included in the inquiry knowledge base to obtain an inquiry result.
In one possible implementation, the method further includes:
and acquiring entity information corresponding to the non-drug field entity based on a related knowledge base included in the query knowledge base, and adding the entity information into the query result.
Fig. 9 is a schematic structural diagram of a server in an embodiment of the present invention. The server 1400 may vary widely by configuration or performance, and may include one or more Central Processing Units (CPUs) 1422 (e.g., one or more processors) and memory 1432, one or more storage media 1430 (e.g., one or more mass storage devices) that store applications 1442 or data 1444. Memory 1432 and storage media 1430, among other things, may be transient or persistent storage. The program stored on storage medium 1430 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a server. Still further, a central processor 1422 may be provided in communication with the storage medium 1430, and a series of instruction operations in the storage medium 1430 for performing the above-described method of constructing a knowledge base or information query method are executed on the server 1400.
The server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input-output interfaces 1456, one or more keyboards 1456, and/or one or more operating systems 1441, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the system or the device disclosed by the embodiment, the description is simple because the system or the device corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more. "and/or" for describing an association relationship of associated objects, indicating that there may be three relationships, e.g., "a and/or B" may indicate: only A, only B and both A and B are present, wherein A and B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "at least one of the following" or similar expressions refer to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.