WO2023022655A2 - 知识图谱构建方法、装置、存储介质及电子设备 - Google Patents

知识图谱构建方法、装置、存储介质及电子设备 Download PDF

Info

Publication number
WO2023022655A2
WO2023022655A2 PCT/SG2022/050578 SG2022050578W WO2023022655A2 WO 2023022655 A2 WO2023022655 A2 WO 2023022655A2 SG 2022050578 W SG2022050578 W SG 2022050578W WO 2023022655 A2 WO2023022655 A2 WO 2023022655A2
Authority
WO
WIPO (PCT)
Prior art keywords
subtree
entity
coded label
label
target
Prior art date
Application number
PCT/SG2022/050578
Other languages
English (en)
French (fr)
Other versions
WO2023022655A3 (zh
Inventor
熊泓宇
汪罕
高远
冯一琦
刘宾
Original Assignee
脸萌有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 脸萌有限公司 filed Critical 脸萌有限公司
Publication of WO2023022655A2 publication Critical patent/WO2023022655A2/zh
Publication of WO2023022655A3 publication Critical patent/WO2023022655A3/zh
Priority to US18/397,227 priority Critical patent/US20240135196A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • G06N5/022Knowledge engineering; Knowledge acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/02Knowledge representation; Symbolic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/288Entity relationship models
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • Knowledge map construction method is a structured semantic knowledge base, which is used to describe concepts in the physical world and their mutual relationships in symbolic form, and its basic unit is a triple.
  • triples as (entity entity, entity relationship relation, entity entity), if the entity is regarded as a node and the entity relationship (including attributes, categories, etc.) is regarded as an edge, entities are connected through entity The relationships are interconnected to form a net-like knowledge structure, so the knowledge base containing a large number of triples becomes a huge knowledge graph.
  • building a knowledge map relies on text mining.
  • the corpus is structured first to obtain structured data including subjects, predicates, and objects, and then a knowledge map is constructed based on the obtained structured data.
  • the recall rate and precision rate of this method are not high.
  • the present disclosure provides a method for constructing a knowledge graph, the method comprising: Identifying the entity concept from the title text of the target webpage, and identifying at least one entity corresponding to the entity concept from the body text of the target webpage; constructing the title according to the grammatical analysis rules of the language to which the title text belongs A grammatical analysis tree of the text, and determining modifiers for modifying the entity concept from the grammatical analysis tree; generating a knowledge graph according to the entity concept, the modifiers, and the at least one entity.
  • the present disclosure provides a device for constructing a knowledge graph, the device comprising: an identification module, configured to identify an entity concept from the title text of a target web page, and identify the corresponding entity concept from the body text of the target web page. at least one entity of the entity concept; a construction module, configured to construct a syntax analysis tree of the title text according to the syntax analysis rules of the language to which the title text belongs, and determine from the syntax analysis tree to modify the entity Modifiers of concepts; a generating module, configured to generate a knowledge map according to the entity concept, the modifiers, and the at least one entity.
  • the present disclosure provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processing device, the steps of any one of the methods described in the first aspect are implemented.
  • the present disclosure provides an electronic device, including: a storage device, on which a computer program is stored; a processing device, configured to execute the computer program in the storage device, so as to implement any one of the first aspect The steps of the method.
  • the grammatical analysis tree of the title text is constructed, and the modifiers used to modify the entity concept are determined from the grammatical analysis tree.
  • FIG. 1 is a flowchart of a method for constructing a knowledge graph according to an exemplary embodiment of the present disclosure.
  • Fig. 2 is a syntax analysis tree according to an exemplary embodiment of the present disclosure.
  • Fig. 3 shows a syntax analysis subtree according to an exemplary embodiment of the present disclosure.
  • Fig. 4 is a page source code shown according to an exemplary embodiment of the present disclosure.
  • Fig. 5 is an encoding tag tree corresponding to Fig. 4 shown according to an exemplary embodiment of the present disclosure.
  • Fig. 6 shows a target webpage according to an exemplary embodiment of the present disclosure.
  • Fig. 7 is an encoding tag tree corresponding to Fig. 6 shown according to an exemplary embodiment of the present disclosure.
  • Fig. 8 is a schematic diagram showing a first coded label subtree and a second coded label subtree according to an exemplary embodiment of the present disclosure.
  • Fig. 9 is a block diagram of an apparatus for building a knowledge graph according to an exemplary embodiment of the present disclosure.
  • Fig. 10 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
  • Fig. 1 is a flowchart showing a method for constructing a knowledge graph according to an exemplary embodiment of the present disclosure. As shown in Figure 1, the knowledge map construction method includes the following steps:
  • the acquisition method of the target webpage in the present disclosure is not limited to searching keywords/sentences based on a search engine.
  • the title text of the target web page refers to the text defined by the title tag of the target web page, such as the text defined by the HTML ⁇ title> tag.
  • the title text of the target webpage may be obtained by parsing it using a webpage title parser. Alternatively, the title text of the target web page may also be obtained by locating from the page source code of the target web page according to the title tag.
  • the identifying the entity concept from the title text of the target webpage includes: obtaining the page source code of the target web page; locating and obtaining the title text from the page source code according to the title tag ; Based on the preset entity concept word set, match the title text to obtain the entity concept.
  • a variety of entity concepts are pre-defined in the preset entity concept word set category. By matching the words in the title text with the keywords in the preset entity concept word set category, the entity concept carried in the title text is obtained from the title text. In this way, the entity concept used to construct the knowledge graph can be quickly obtained from the title text.
  • the main text of the target webpage refers to the text defined by the main text tag of the target webpage, such as the text defined by the HTML ⁇ body> tag.
  • the body text of the landing page can be obtained by Therefore, a webpage body text parser is used to parse and obtain the body text; or the body text can also be obtained by locating the source code of the target web page according to the body text tag.
  • the entity concept refers to a concept that uses specific things as the reflection object, and is opposite to the "attribute concept", which is used to reflect the object itself rather than the attribute of the object. Exemplarily, earth, ocean, animal, table, movie, etc. are entity concepts.
  • Entities are things that exist objectively and can be distinguished from each other.
  • movie 1 "XX” and movie 2 "XXX” are entities corresponding to the entity concept movie.
  • the entity concept can be identified as movies o from the title text, and the corresponding entity can be identified from the body text of the target web page
  • One or more entities of the concept movies for example, the entity may be movie 5 "XXXX", movie 6 "XXXXX" and so on.
  • the corresponding grammatical analysis rules are Chinese grammatical analysis rules.
  • a grammatical analysis tree of the title text is constructed as shown in FIG. 2 .
  • the modifier modifying the entity concept movies is korean.
  • the determining the modifier used to modify the entity concept from the syntax analysis tree includes: determining a grammatical subtree including the entity concept from the syntax analysis tree; determining the The title text segment corresponding to the grammatical subtree; and the adjective in the title text segment with the closest distance to the entity concept as the modifier.
  • FIG. 2 it is determined from the syntax analysis tree shown in FIG. 2 that the syntax subtree including the entity concept movies is the syntax subtree shown in FIG. 3 .
  • the corresponding title text segment is "top 10 best Korean movies”.
  • the entity concept movies in this title text fragment The nearest adjective (JJ) is Korean, so the modifier modifying the entity concept movies is Korean o
  • the method of determining the modifier modifying the entity concept from the grammatical analysis tree can be quickly and accurately Determines modifiers that modify entity concepts. This can improve the accuracy of the knowledge map.
  • the grammatical analysis tree of the title text is constructed, and the modifiers used to modify the entity concept are determined from the grammatical analysis tree.
  • the grammatical analysis tree of the title text is constructed according to the grammatical analysis rules of the language to which the title text belongs, and the modifiers used to modify the entity concept are determined from the grammatical analysis tree. Therefore, the application scenario of the technical solution of the present disclosure may be body concepts of search, recommendation, question answering scenarios. Among them, the specific entity concept is characterized by the combination of modifiers and entity concept. Exemplarily, specific entity concepts such as "Bollywood movie”, “seafood restaurant”, “science fiction” and so on. That is to say, by adopting the above method of the present disclosure, a knowledge graph based on a specific entity concept is obtained.
  • identifying at least one entity corresponding to the entity concept from the body text of the target webpage specifically includes the following steps: After obtaining the page source of the target webpage After coding, based on the coding tags in the page source code, generate a coding tag tree corresponding to the page source code; determine a plurality of target coding tag subtrees whose similarity is greater than a preset threshold from the coding tag tree; For each target coding tag subtree, the entity is determined from the body text segment corresponding to the target coding tag subtree. For example, assume that the page source code of the target webpage is as shown in FIG. 4 .
  • the text style of the title text is a top K text style.
  • HollywoodClassics You Shouldn't Miss, etc. are all title texts in the top K text style.
  • K can be determined by the following method: Determined from the syntax analysis tree of the title text Including the grammatical subtree of the entity concept; Determining the quantifier Ko corresponding to the cardinality label from the grammatical subtree Taking Fig. 2 and Fig. 3 as an example for illustration, determining from the grammatical analysis tree of the title text shown in Fig. 2 to include the entity The syntax subtree of the concept movies is shown in Figure 3. It can be seen from Fig. 3 that the quantifier K corresponding to the cardinality label (CD) in the grammatical subtree is 10o.
  • the coding label tree Determining a plurality of target coded label subtrees whose similarity is greater than a preset threshold includes: determining a target coded label node from the coded label tree, wherein the number of coded label subtrees under the target coded label node is greater than or equal to K ; Determine at least K target encoding label subtrees from all encoding label subtrees under the target encoding label node.
  • K is 6 from the title text Top 6 Nikon Vintage Camera Lenses.
  • a coding tag tree corresponding to the page source code is generated, as shown in FIG. 7 .
  • the nine coded label subtrees in the solid circles in Fig. 7 are coded label subtrees under the target coded label node.
  • & is calculated in such a way that the first subtree and the second subtree are used as two new coded label subtrees, and the execution of the first coded label subtree and the second
  • the step of determining the similarity s 0 between the first coded label subtree and the second coded label subtree; or in the first coded label subtree
  • determine the The step of the similarity s 1 between the first coded label subtree and the second coded label subtree; or when the root nodes of the first coded label subtree and the second coded label subtree are the same, and The case where the pre-order traversal results or post-order traversal results of the first code
  • the root nodes of the first coded label subtree and the second coded label subtree shown in FIG. 8 are the same, both being a.
  • the preorder traversal result of the first coded label subtree is abefcdg
  • the preorder traversal result of the second coded label subtree is abefdh, that is, the preorder traversal results of the first coded label subtree and the second coded label subtree are different.
  • an embodiment of the present disclosure also provides a block diagram of an apparatus for building a knowledge graph.
  • the knowledge map construction device 900 includes: an identification module 910, configured to identify an entity concept from the title text of the target webpage, and identify the entity concept corresponding to the entity concept from the body text of the target webpage.
  • the identification module includes: an acquisition submodule, configured to acquire the page source code of the target webpage; a location submodule, configured to locate and obtain the page source code according to the title tag The title text; a matching submodule, configured to match the title text to obtain the entity concept based on a preset entity concept word set.
  • the construction module includes: a first execution submodule, configured to determine a syntax subtree including the entity concept from the syntax analysis tree; a second execution submodule, configured to determining the title text segment corresponding to the grammatical subtree; a third execution submodule, configured to use an adjective in the title text segment closest to the entity concept as the modifier.
  • the identification module includes: a generating submodule, configured to generate, after obtaining the page source code of the target webpage, based on the encoding tag in the page source code, the A coding tag tree corresponding to the page source code; a fourth execution submodule, configured to determine a plurality of target coding tag subtrees whose similarity is greater than a preset threshold from the coding tag tree; a fifth execution submodule, for each A target encoding tag subtree, determining the entity from a body text segment corresponding to the target encoding tag subtree.
  • the text style of the title text is a top K text style
  • the fourth execution submodule is configured to: determine a target coding label node from the coding label tree, and the target coding The number of coded label subtrees under the label node is greater than or equal to K; at least K target coded label subtrees O are determined from all coded label subtrees under the target coded label node.
  • K is determined in the following manner: determining the grammatical subtree including the entity concept from the grammatical analysis tree; determining the quantifier Ko corresponding to the base label from the grammatical subtree using
  • the above-mentioned apparatus of the present disclosure recognizes the entity concept from the title text of the target webpage, and recognizes at least one entity corresponding to the entity concept from the body text of the target webpage.
  • the grammatical analysis tree of the title text is constructed, and the modifiers used to modify the entity concept are determined from the grammatical analysis tree.
  • Generate a knowledge graph based on entity concepts, modifiers, and obtained entities.
  • the present disclosure provides a new method for constructing a knowledge graph without structural processing of the corpus (target web page). Moreover, because the method of the present disclosure can avoid structural processing of the corpus and avoid noise introduced by the structural processing, the recall rate and accuracy rate of the knowledge graph can be improved.
  • the specific implementation steps of each module in the above device have been described in detail in the method embodiment of the device, and will not be repeated here.
  • FIG. 10 it shows a schematic structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure.
  • the terminal devices in the embodiments of the present disclosure may include but not limited to mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (eg mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, and the like.
  • the electronic device shown in FIG. 6 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure. As shown in FIG.
  • an electronic device 600 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may be randomly accessed according to a program stored in a read-only memory (ROM) 602 or loaded from a storage device 608 Various appropriate actions and processes are executed by programs in the memory (RAM) 603 . In the RAM 603, various programs and data necessary for the operation of the electronic device 600 are also stored.
  • the processing device 601 , ROM 602 and RAM 603 are connected to each other through a bus 604 . lose An input/output (I/O) interface 605 is also connected to bus 604.
  • I/O input/output
  • the following devices can be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, and a gyroscope; including, for example, a liquid crystal display (LCD), a speaker, a vibration an output device 607 such as a computer; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609.
  • the communication means 609 may allow the electronic device 600 to perform wireless or wired communication with other devices to exchange data. While FIG. 6 shows electronic device 600 having various means, it should be understood that implementing or possessing all of the illustrated means is not a requirement.
  • the processes described above with reference to the flowcharts can be implemented as computer software programs.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 609 , or from storage means 608 , or from ROM 602 .
  • the processing device 601 the above-mentioned functions defined in the methods of the embodiments of the present disclosure are executed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: electrical connections with one or more conductors, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium containing or storing a program, and the program may be used by or in combination with an instruction execution system, device, or device.
  • computer-readable The signal medium may include a data signal carrying computer readable program code in baseband or as part of a carrier wave.
  • the propagated data signal may take various forms, including but not limited to electromagnetic signal, optical signal, or any suitable combination of the above.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable signal medium may send, propagate or transmit a program for use by or in combination with an instruction execution system, apparatus or device .
  • the program code contained on the computer readable medium can be transmitted by any appropriate medium, including but not limited to: electric wire, optical cable, RF (radio frequency), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future developed network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communication (eg, communication network) interconnection.
  • network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communication (eg, communication network) interconnection.
  • Examples of communication networks include local area networks ("LANs”), wide area networks (“WANs”), Internets (e.g., the Internet) and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist independently without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: recognizes the entity concept from the title text of the target webpage, and obtains the Identify at least one entity corresponding to the entity concept in the body text of the title text; according to the grammar analysis rules of the language to which the title text belongs, construct a grammar analysis tree of the title text, and determine from the grammar analysis tree to modify A modifier of the entity concept; generating a knowledge graph according to the entity concept, the modifier, and the at least one entity.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, C++, and Includes conventional procedural programming languages such as "C" language or similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network—including a local area network (LAN) or a wide area network (WAN)—or it can be connected to an external connect).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code that contains one or more logic functions for implementing the specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block in the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented by a dedicated hardware-based system that performs specified functions or operations. , or may be implemented by a combination of special purpose hardware and computer instructions.
  • the modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • the functions described herein above may be performed at least in part by one or more hardware logic components.
  • exemplary types of hardware logic components include: field programmable gate array (FPGA), application specific integrated circuit (ASIC), application specific standard product (ASSP), system on chip (SOC), complex programmable Logical device (CPLD) and so on.
  • FPGA field programmable gate array
  • ASIC application specific integrated circuit
  • ASSP application specific standard product
  • SOC system on chip
  • CPLD complex programmable Logical device
  • a machine-readable medium may be a tangible medium, which may contain or be stored for use by an instruction execution system, device, or device or in combination with an instruction execution system, device, or device. Appropriately used programs.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, Random Access Memory (RAM), Read Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM or flash memory), optical fiber, compact disk read-only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM Random Access Memory
  • ROM Read Only Memory
  • EPROM Erasable Programmable Read Only Memory
  • CD-ROM compact disk read-only memory
  • Example 1 provides a knowledge map construction method, including: identifying entity concepts from the title text of the target webpage, and identifying the corresponding entity concepts from the body text of the target webpage constructing a grammatical analysis tree of the title text according to the grammatical analysis rules of the language to which the title text belongs, and determining modifiers for modifying the entity concept from the grammatical analysis tree; A knowledge map is generated according to the entity concept, the modifier, and the at least one entity.
  • Example 2 provides the method of Example 1, the identifying the entity concept from the title text of the target webpage includes: obtaining the page source code of the target webpage; The title text is obtained by locating in the page source code; and the entity concept is obtained by matching from the title text based on a preset entity concept word set.
  • Example 3 provides the method of Example 1, the determining the modifier used to modify the entity concept from the syntax analysis tree includes: from the syntax analysis tree determining a grammatical subtree including the entity concept; determining a title text segment corresponding to the grammatical subtree; and using an adjective closest to the entity concept in the title text segment as the modifier.
  • Example 4 provides the method of Example 1-3, the identifying at least one entity corresponding to the entity concept from the body text of the target webpage includes including: after obtaining the page source code of the target web page, based on the coding tags in the page source code, generating a coding tag tree corresponding to the page source code; determining from the coding tag tree that the similarity is greater than Multiple target coded tag subtrees with a preset threshold; for each target coded tag subtree, determine the entity from the body text segment corresponding to the target coded tag subtree.
  • Example 5 provides the method of Example 4, the text style of the title text is a top K text style, and the similarity is determined from the coding tag tree is greater than a preset threshold
  • a plurality of target coded label subtrees including: determining a target coded label node from the coded label tree, the number of coded label subtrees under the target coded label node is greater than or equal to K; from the target coded label node Determine at least K target coded label subtrees in all coded label subtrees below.
  • Example 7 provides the method of Example 5, K is through Determined in the following manner: determine the grammatical subtree including the entity concept from the grammatical analysis tree; determine the quantifier Ko corresponding to the base label from the grammatical subtree
  • an example 8 provides a device for constructing a knowledge graph, the device comprising: an identification module, configured to identify an entity concept from the title text of a target webpage, and identify an entity concept corresponding to the entity concept from the body text of the target webpage At least one entity; a construction module, configured to construct a grammatical analysis tree of the title text according to the grammatical analysis rules of the language to which the title text belongs, and determine modifiers for modifying the entity concept from the grammatical analysis tree ; a generating module, configured to generate a knowledge map according to the entity concept, the modifier and the at least one entity.
  • Example 9 provides the device of Example 8, and the identification module includes: an acquisition submodule, configured to acquire the page source code of the target webpage; a positioning submodule, configured according to The title tag is located from the page source code to obtain the title text; the matching submodule is configured to match the title text to obtain the entity concept based on a preset entity concept word set.
  • Example 10 provides the apparatus of Example 8, the construction module includes: a first execution submodule, configured to determine a grammar including the entity concept from the syntax analysis tree subtree; the second execution submodule is used to determine the title text segment corresponding to the grammar subtree; the third execution submodule is used to use the adjective closest to the entity concept in the title text segment as the modifiers.
  • a first execution submodule configured to determine a grammar including the entity concept from the syntax analysis tree subtree
  • the second execution submodule is used to determine the title text segment corresponding to the grammar subtree
  • the third execution submodule is used to use the adjective closest to the entity concept in the title text segment as the modifiers.
  • Example 11 provides the apparatus of Examples 8-10, the identification module includes: a generating submodule, configured to, after obtaining the page source code of the target webpage, based on the the coded tags in the page source code, and generate a coded tag tree corresponding to the page source code; a fourth execution submodule, configured to determine a plurality of target coded tags whose similarity is greater than a preset threshold from the coded tag tree subtrees; a fifth execution submodule, configured to, for each of the target encoding tag subtrees, determine the entity from the body text segment corresponding to the target encoding tag subtree.
  • a generating submodule configured to, after obtaining the page source code of the target webpage, based on the the coded tags in the page source code, and generate a coded tag tree corresponding to the page source code
  • a fourth execution submodule configured to determine a plurality of target coded tags whose similarity is greater than a preset threshold from the coded tag tree subtrees
  • Example 12 provides the apparatus of Example 11, the text style of the title text is a top K text style, and the fourth execution submodule is configured to: from the coded tag tree Determine the target coded label node in the target coded label node, the number of coded label subtrees under the target coded label node is greater than or equal to K; determine at least K target coded labels from all coded label subtrees under the target coded label node subtree.
  • Example 14 provides the apparatus of Example 12, determining a grammatical subtree including the entity concept from the grammatical analysis tree; determining from the grammatical subtree the corresponding Quantitative word Ko
  • Example 14 provides the apparatus of Example 12, determining a grammatical subtree including the entity concept from the grammatical analysis tree; determining from the grammatical subtree the corresponding Quantitative word Ko
  • the above description is only a preferred embodiment of the present disclosure and an illustration of the applied technical principle.
  • the technical solutions formed by a specific combination of the above technical features shall also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

说明书摘要本公开涉及一种知识图谱构建方法、装置、存储介质及电子设备。该知识图谱构建方法包括:从目标网页的标题文本中识别出实体概念,并从所述目标网页的主体文本中识别出对应所述实体概念的至少一个实体;根据所述标题文本所属语种的语法分析规则,构建所述标题文本的语法分析树,并从所述语法分析树中确定用于修饰所述实体概念的修饰词;根据所述实体概念、所述修饰词以及所述至少一个实体生成知识图谱。采用本公开的这种方式,无需对目标网页进行结构化处理也能构建准确率和召回率高的知识图谱。

Description

知 识图谱 构建 方法 、 装置、 存储介质 及电 子设 备 相关 申请的 交叉引用 本申 请基于 申请号为 202110939279.X、 申请日为 2021年 08月 16日, 名称 为 “知识图谱构建 方法、 装置、 存储介质及 电子设备 " 的中国专利申请 提 出, 并要求该中 国专利申请 的优先 权, 该中国专利 申请的全 部内容在 此引 入本 申请作 为参考。 技术 领域 本公 开涉及知 识图谱 技术领域, 具体地 , 涉及一种知识 图谱构建 方法、 装置 、 存储介质及电 子设备 。 背景 技术 知识 图谱 (Knowledge Graph) 是结构化的语义知识库, 用于以符号形 式 描述 物理世界 中的概 念及其相 互间的 关系, 其基本组 成单位是 三元组 。 具体 地, 我们可以把 三元组 理解为 (实体 entity, 实体关系 relation, 实体 entity) , 若将 实体看做 结点把 实体关 系 (包括属性, 类别等) 看做一条边, 实体之间 通过 实体关 系相互联 结, 构成网状的知 识结构 , 如此包含了大量 三元组 的知 识库 就成为 了一个庞 大的知识 图谱。 相关 技术中 , 构建知识图谱依 赖文本 挖掘, 通常会先 对语料 进行结构 化 处理 , 得到包括主语 、 谓语和宾语 的结构化 数据, 然后基于得到的 结构化数 据构 建知识 图谱。 然而, 这种方式的 召回率与 准确率均 不高。 发明 内容 提供 该发明 内容部分 以便以 简要的形 式介绍构 思, 这些构思将在 后面的 具体 实施方 式部分被 详细描述 。 该发明内容部 分并不 旨在标识 要求保护 的技 术方 案的关键 特征或 必要特征 , 也不旨在用于 限制所 要求的保 护的技 术方案 的范 围。 第一 方面, 本公开提供一种知 识图谱构 建方法 , 所述方法包括 : 从 目标网页的 标题文 本中识别 出实体概 念, 并从所述 目标网页 的主体文 本 中识别出 对应所述 实体概念 的至少 一个实体 ; 根据所述标题 文本所属 语种 的语 法分析规 则, 构建所述标 题文本 的语法分 析树, 并从所述语法分析 树中 确定 用于修饰 所述实 体概念的 修饰词 ; 根据所述实体概 念、 所述修饰词 以及 所述 至少一 个实体生 成知识 图谱。 第二 方面, 本公开提供一种知 识图谱构 建装置 , 所述装置包括 : 识别 模块, 用于从目标网页的 标题文本 中识别 出实体概 念, 并从所述 目 标 网页的主体 文本中 识别出对 应所述 实体概念 的至少一 个实体 ; 构建模 块, 用于根据所述标题 文本所属 语种的 语法分析 规则, 构建所述 标题 文本的语 法分析 树, 并从所述语 法分析树 中确定 用于修饰 所述实体 概念 的修 饰词; 生成 模块, 用于根据所述实体 概念、 所述修饰 词以及所 述至少 一个实体 生成 知识图谱 。 第三 方面, 本公开提供一种计 算机可读 介质, 其上存储有计算 机程序, 该程 序被处 理装置执 行时实现 第一方 面中任一 项所述 方法的 步骤。 第四 方面, 本公开提供一种 电子设备 , 包括: 存储 装置, 其上存储 有计算机 程序; 处理装置 , 用于执行所述 存储装置 中的 所述计 算机程序 , 以实现第一方 面中任一 项所述 方法的 步骤。 采用 上述技术 方案, 至少能够取得如下 的有益 技术效果 : 从 目标网页的 标题文 本中识别 出实体概 念, 并从该 目标网页的主 体文本 中识 别出对 应该实体 概念的至 少一个 实体。 同时, 根据标题文本所属语 种的 语法 分析规 则, 构建标题文 本的语法分 析树, 并从该语法分析 树中确定 用于 修饰 该实体概 念的修 饰词。 根据实体 概念、 修饰词以 及得到的 实体生成 知识 图谱 。 可见, 本公开提供了一 种新的 无需对语 料 (目标网页) 进行结构化处 理的 知识图谱 构建方 法。 而且, 因本公开的这 种方式 能够避免 对语料进 行结 构化 处理而 能够避免 结构化处 理所引 入的噪声 , 使知识图谱的 召回率与 准确 率提 高。 本公 开的其他 特征和优 点将在 随后的具 体实施 方式部分 予以详 细说明。 附 图说明 结合 附图并 参考以下 具体实施 方式,本公开 各实施 例的上述 和其他 特征、 优点 及方面将 变得更 加明显 。 贯穿附图中, 相同或相似 的附 图标记表示 相同 或相 似的元 素。应当理 解附图是 示意性 的, 原件和元素不一 定按照 比例绘制 。 在附 图中: 图 1是根据本公 开一示例 性实施 例示出 的一种知 识图谱构 建方法 的流程 图。 图 2是根据本公 开一示例 性实施 例示出 的一种语 法分析树 。 图 3是根据本公 开一示例 性实施 例示出 的一种语 法分析子 树。 图 4是根据本公 开一示例 性实施 例示出 的一种页 面源代码 。 图 5是根据本公 开一示例 性实施 例示出 的对应 图 4的编码标 签树。 图 6是根据本公 开一示例 性实施 例示出 的一种 目标网页。 图 7是根据本公 开一示例 性实施 例示出 的对应 图 6的编码标 签树。 图 8是根据本公 开一示例 性实施 例示出 的一种第 一编码标 签子树 和第二 编码 标签子树 示意图 。 图 9是根据本公 开一示例 性实施 例示出 的一种知 识图谱构 建装置 的框 图。 图 10是根据本公 开一示例 性实施 例示出 的一种电 子设备的 框图。 具体 实施方 式 下面 将参照 附图更详 细地描述 本公开 的实施例 。 虽然附图中显 示了本公 开的 某些实 施例, 然而应当理 解的是 , 本公开可以通过 各种形 式来实现 , 而 且不 应该被解 释为限 于这里 阐述的实 施例, 相反提供这 些实施 例是为 了更加 透彻 和完整地 理解本 公开。 应当理解 的是, 本公开的 附图及实 施例仅 用于示 例性 作用, 并非用于限制本公 开的保 护范围。 应 当理解, 本公开的方法实施 方式中记 载的各 个步骤 可以按照 不同的顺 序执 行, 和/或并行执行。 此外, 方法实施方式 可以包括 附加的 步骤和/或省略 执行 示出的 步骤。 本公开的 范围在此 方面不受 限制。 本文 使用的术 语 “包括” 及其变形是开放性 包括, 即 “包括但不限于” 。 术语 “基于” 是 “至少部分地 基于”。 术语 “一个实 施例” 表示 “至少一个 实 施例 "; 术语 “另一实施例 "表示 “至少一个另 外的实施 例 "; 术语“一些实 施例" 表示 “至少一些实 施例 "。 其他术语的相关定 义将在下 文描述 中给出。 需要 注意, 本公开中提及的 “第一 "、 “第二 "等概念仅用于对 不同的 装 置、 模块或单元进行 区分, 并非用于 限定这些 装置、 模块或单 元所执行 的功 能的 顺序或 者相互依 存关系 。 需要 注意, 本公开中提及的 “一个 "、 “多个” 的修饰是示意性 而非限 制 性的 , 本领域技术人 员应当理 解, 除非在上下 文另有 明确指出 , 否则应该理 解为 “一个或 多个 "。 本公 开实施 方式中的 多个装置 之间所 交互的消 息或者信 息的名 称仅用 于 说 明性的 目的, 而并不是用 于对这些 消息或信 息的范 围进行限 制。 在对 本公开 的技术方 案进行详 细的实 施例说 明之前, 需声明的是, 本公 开 中的目标 网页是在 合法情况 下获取使 用的。 图 1是根据本公 开一示 例性实施 例示出 的一种知 识图谱构 建方法 的流程 图。 如图 1所示, 该知识图谱构 建方法 包括以下 步骤:
S11、从 目标网页的 标题文 本中识别 出实体概 念, 并从所述目标 网页的主 体文 本中识 别出对应 所述实体 概念的 至少一个 实体。 本公 开中的 目标网页 的获取方 式不限 于基于搜 索引擎搜 索关键词 /句。 应 当说明的是 , 目标网页的标 题文本是 指目标 网页的标 题标签 所定义的 文本 , 如 HTML〈title〉 标签所定义的文本。 目标网页的标题文 本的获 取方式 可 以是使用 网页标题 解析器进 行解析得 到。 或者, 目标网页的标题文本 的获 取方 式还可 以是根据 标题标签 从目标 网页的 页面源代码 中定位 得到。 例如 一种可 能的实施 方式, 所述从 目标网页的 标题文 本中识别 出实体概 念, 包括: 获取 所述 目标网页的 页面源代 码; 根据标题标 签从所述 页面源 代码中 定 位得 到所述 标题文本 ; 基于预设实体 概念词集 , 从所述标题文 本中匹 配得到 所述 实体概念 。 其 中, 预设实体概念 词集 category中预先定义有多种实体 概念。 通过预 设实 体概念词 集 category中的关键词匹 配标题文 本中的 文字, 以从标题文 本 中 匹配得到 标题文本 携带的 实体概念 。 采用这种方式 , 可从标题文本 中快速 获取 到用于 构建知识 图谱的实 体概念 。 同理 地, 目标网页的主体文本 是指 目标网页的 主体文 本标签所 定义的文 本, 如 HTML <body>标签所定 义的文本 。 目标网页的主体 文本的获 取方式 可 以是 使用网 页主体文 本解析 器来解析得 到主体 文本; 或者还可以是根据 主体 文 本标签从 目标网页 的页面 源代码中 定位得到 主体文 本。 值得 解释的 是, 在本公开中 , 实体概念 (entitative concept) 指称以具体 事物 为反映 对象的概 念, 与 “属性概念" 相对, 用于反应对象本身 而不是对 象的 属性。 示例地, 地球、 海洋、 动物、 桌子、 电影等均为实体概念 。 实体 (Entity)是客观存在并可 相互区别 的事物 。示例地, 电影 1《X X》、 电影 2《X X X》 均为实体概念电 影对应的 实体。 举例 来说, 假设目标 网页的标 题文本 为 "top 10 best Korean movies of all time must watch 那么从该标题 文本中 可识别 出实体概念 为 movies o 而从该 目标网页的主 体文本 中可识 别出对应 实体概念 movies的一个或 多个实体 , 例 如实 体可能 为电影 5《X X X X》、 电影 6《X X X X X》 等。
S12、根据 所述标题 文本所 属语种 的语法分 析规则, 构建所述标 题文本 的 语 法分析树 , 并从所述语法分 析树 中确定用于 修饰所 述实体概 念的修饰 词。 由于 语种不 同, 其对应的语 法分析规 则也不尽 相同, 所以, 在构建标题 文 本的语法 分析树之 前, 需先确定标 题文本所 属语种 , 然后基于标题文 本所 属语 种的语 法分析规 则构建标 题文本 的语法分 析树。 举例 来说, 在标题文 本所属语 种为英 语的情况 下, 对应的语法 分析规 则 为英 语语法 分析规则 。 在标题文本所 属语种 为中文的 情况下 , 对应的语法分 析规 则为中 文语法分 析规则 。 示例 地, 假设标题文 本为 "top 10 best Korean movies of all time must watch”, 根据英语语法 分析规则 , 构建该标题文 本的语法 分析树如 图 2所示 。 从 图 2可知, 修饰实体 概念 movies的修饰词为 korean。 一种 可能的 实施方式 , 所述从所述语 法分析树 中确定 用于修饰 所述实体 概念 的修饰 词, 包括: 从所 述语法 分析树 中确定包括 所述实体 概念的 语法子树 ; 确定所述语法 子树 对应的 标题文本 片段; 将所述标 题文本 片段中的 与所述实 体概念 距离最 近的 形容词 作为所述 修饰词 。 以 图 2为例进行 说明, 从图 2所示的语法 分析树 中确定包括 实体概 念 movies的 语法子树 为图 3所示的语法 子树。 从图 3可知其对应的 标题文 本片 段 为 "top 10 best Korean movies"。 该标题文本片段中的与实体概念 movies 距 离最近 的形容词 (JJ) 为 Korean, 因此修饰实体概念 movies的修饰词为 Korean o 采 用这种构 建语法 分析树, 在从语法分析树 中确定修 改实体概 念的修 饰 词 的方式 , 能够快速、 准确地确定修 饰实体 概念的修 饰词。 如此可提 升知识 图谱的准确 性。
S13 、根据所述 实体概念 、所述修饰 词以及所 述至少 一个实体 生成知识 图 谱 。 从 目标网 页的标题 文本中识 别出实体 概念和 修饰词 , 并从目标网页的 主 体 文本中识 别出对 应实体概 念的至 少一个实 体之后 , 根据得到的实体 概念、 修 饰词以 及实体可 生成知识 图谱。 示 例地, 知识图谱 对应的 关系型数据 库如下 表所示:
Figure imgf000008_0001
采 用本公 开的上述 方法, 从目标网页的标 题文本 中识别出 实体概念 , 并 从 该目标 网页的主 体文本 中识别 出对应该 实体概念 的至少 一个实体 。 同时, 根 据标题 文本所属 语种的 语法分析 规则, 构建标题文本的 语法分析 树, 并从 该 语法分 析树中确 定用于 修饰该实 体概念 的修饰词 。 根据实体概念 、 修饰词 以及得到 的实体生 成知识 图谱。可见, 本公开提供 了一种新 的无需对 语料 (目 标 网页) 进行结构 化处理 的知识 图谱构建 方法。 而且, 因本公开的 这种方 式 能 够避免 对语料进 行结构 化处理 而能够避 免结构化 处理所 引入的噪 声, 使知 识 图谱的 召回率与 准确率提 高。 此 处值得说 明的是 , 由于在步骤 S12中, 根据标题文 本所属语 种的语 法 分 析规则 , 构建了标题文 本的语法 分析树 , 并从语法分析 树中确 定了用于 修 饰 实体概 念的修饰 词。 因此, 本公开技术 方案的应 用场景 可以是针 对特定 实 体概 念的搜 索、 推荐、 问答场景中 。 其中, 特定实体概念 由修饰词和 实体概 念组 合表征 。 示例地, 特定实体概念 如 “宝莱坞电影”、 “海鲜餐馆”、 “科幻小 说 ”等等。 也就是说, 采用本公开 的上述 方法, 得到的是基 于特定实 体概念 的 知识 图谱。 一种 可能的 实施方式 , 上述步骤 S11 中, 所述从所述目标网页的 主体文 本 中识别出 对应所述 实体概念 的至少 一个实体 , 具体包括以下 步骤: 在获 取到所 述目标 网页的页 面源代码 之后, 基于所述页面源 代码中 的编 码标 签, 生成与所述 页面源 代码对 应的编码 标签树 ; 从所述编码标 签树中确 定相 似度 大于预设 阈值的多 个目标 编码标签 子树; 针对每一 所述 目标编码标 签子 树, 从所述目标 编码标 签子树对 应的主体 文本片 段中确定 所述实体 。 举例 来说, 假设目标 网页的 页面源代码 如图 4所示。 基于页面源代码 中 的编 码标签 , 如 <html> > 〈head〉、 〈title〉、 〈body〉、 <p>、 <a>, 生成与页面 源代 码对应 的图 5所示的编码 标签树 。 从图 5所示的编 码标签树 中确定 相似 度 大于预设 阈值的多 个目标编 码标签 子树, 如图 5 圈中的三个目标编 码标签 子树 。 针对每一 目标编码标 签子树 , 从目标编码标 签子树对 应的主 体文本 片 段 中确定实 体。 图 5 圈中的三个 目标编码 标签子树 对应 的三个 实体为分 别 Elsie、 Lacies > link3。 采 用这种根 据目标 网页的页 面源代码 构建编码 标签树 的方式 , 能够快速 且更 加完整 的确定主 体文本 中的实体 。 一种 可能实 施方式, 所述标题文本的 文本样 式为 top K文本样式。 示例 地 , best bollywood movies > Top 6 Nikon Vintage Camera Lenses > 20Most Influential Scientists Alive Today > TWelve Most Interesting Children's Bookslin USA 、 10|Holly woodlClassics You Shouldn't Miss等均为 top K文本样式的标题 文 本。 其 中, K可 以是通过 如下方 式确定的 : 从标题文本的语 法分析 树中确 定 包括 所述实 体概念 的语法子 树; 从所述语法 子树中确 定基数 标签对 应的数量 词 Ko 以 图 2和图 3为例进行说 明, 从图 2所示 标题文本 的语法 分析树 中确定 包括 实体概 念 movies的语法子 树如图 3所示。 从图 3可知, 该语法子树 中的 基数 标签 (CD) 对应的数量词 K为 10o 相应 地, 在所述标题 文本的 文本样式 为 top K文本 样式的 情况下, 所述 从所 述编码 标签树 中确定相 似度大 于预设阈 值的多 个目标编 码标签 子树, 包 括 : 从所 述编码 标签树 中确定 目标编码标 签节点 , 所述目标编码 标签节 点下 的编 码标签 子树的数 量大于 或等于 K; 从所述目标编码 标签节 点下的所 有编 码标 签子树 中确定至 少 K个 所述 目标编码标 签子树。 以 图 6和图 7为例进行说 明。 根据图 6所示的 目标网页, 可从标题文本 Top 6 Nikon Vintage Camera Lenses中确定 K为 6。 在获 取到图 6所示的 目标网 页的页面 源代码之 后, 基于页面源 代码中 的 编码 标签, 生成与页面源代码 对应的 编码标签 树如图 7所示。 针对图 7所示 的编 码标签树 , 从中确定.目标编码标 签节点 。 图 7中实线圈中 的 9个编码 标 签子 树为 目标编码标 签节点 下的编码 标签子 树。 从目标编码 标签节 点下的 9 个编 码标签 子树中确 定至少 6个目标编 码标签 子树, 例如确定 图 7中虚 线圈 中的 6个目标编 码标签 子树。 可实 现的, 可通过如下方式 计算任 意两个编码 标签子 树中第 一编码 标签 子树 和第二 编码标签 子树之 间的相似 度: 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点不相同 的情 况下 , 确定所述第 一编码标签 子树和 所述第二 编码标 签子树的 相似度 s=0; 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点相同、 且所 述 第一编码 标签子树 和所述 第二编码 标签子 树的前 序遍历结 果以及 后序遍历 结果 均相同 的情况下 , 确定所述第一 编码标 签子树和 所述 第二编码 标签子树 的相 似度 S=l; 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点相同、 且所 述 第一编码 标签子树 和所述 第二编码 标签子 树的前 序遍历结 果或者 后序遍历 结 果 不 相 同 的情 况 下 , 确定所 述 两 个 编码 标 签 子 树 的相 似 度
Figure imgf000011_0001
数量 , &以所述第一编码 标签子 树的第一 层节点 中的第 i个节点为根节 点的第 一子 树与以 所述第二 编码标 签子树的 第一层 节点中的 第 i个节点为根 节点的 第二 子树之 间的相似 度。 应 当说明的 是, &的计算 方式为 将该第 一子树和 该第二 子树作 为新的 两 个编 码标签 子树, 返回执行 所述在 所述第一 编码标 签子树和 所述第 二编码标 签子 树的根 节点不相 同的情 况下, 确定所述 第一编码 标签子 树和所 述第二编 码标 签子树 的相似度 s=0的步 骤; 或者在所述 第一编码 标签子树 和所述 第二 编码 标签子 树的根 节点相 同、 且所述第一编 码标签 子树和所 述第二 编码标签 子树 的前序 遍历结果 以及后 序遍历 结果均相 同的情 况下, 确定所述 第一编码 标签 子树和 所述第二 编码标 签子树的 相似度 s=l 的步骤; 或者在所述第 一编 码标 签子树 和所述 第二编码 标签子树 的根节 点相同 、 且所述第一编码 标签子 树和 所述 第二编 码标签 子树的 前序遍 历结 果或后 序遍历 结果不 相同的 情况
Figure imgf000011_0002
到得 到的新 的两个编 码标签子 树的相似 度 &。 以 图 8为例进 行说明 , 图 8所示的第一 编码标签 子树和 第二编码 标签子 树的 根节点 相同, 均为 a。 第一编码标签子 树的前序 遍历结 果为 abefcdg, 第 二编 码标签 子树的前 序遍历 结果为 abefdh, 即第一编码标签 子树和 第二编码 标签 子树的 前序遍历 结果不相 同。 由此, 可确定 .图 8中两个编码标签子树的 相似 度的计 算公式为 s= 0.5 + 0.5 图 8中第一 编码标 签子树 中第
Figure imgf000012_0001
一层 节点分 别为 bed, 共 3个节点, 因此 N为 3。 第一编码标签子树和 第二编 码标 签子树 的相似度 为 s= 0.5 + 0.5
Figure imgf000012_0002
其 中, N为两个 编码标 签子树 中第一层 节点数的 最大值。 以数 据集 Movie-300对本公开 的上述知 识图谱构 建方法 进行验证 , 得到 验 £正结果为: Total 308 ; extractable 84; correct extraction 56 ; incorrect extraction 16o 由此可见 采用 本公开 的上述 方法构 建的知 识图 谱的召 回率 为 (correct / extractable)=66.70% , 准确率为 (correct / (correct + incorrect))77.80%。 基于 同一发 明构思,本公 开实施例 还提供一 种知识 图谱构建 装置的框 图。 如 图 9所示, 该知识 图谱构建装 置 900包括 : 识别 模块 910, 用于从目标 网页的标 题文本 中识别 出实体概 念, 并从所 述 目标网页 的主体文 本中识 别出对应 所述实体 概念的 至少一个 实体; 构建 模块 920, 用于根据所 述标题 文本所属 语种的语 法分析 规则, 构建 所述 标题文 本的语 法分析树 , 并从所述语法 分析树 中确定 用于修饰 所述实体 概念 的修饰 词; 生成 模块 930, 用于根据所 述实体 概念、 所述修饰 词以及所 述至少 一个 实体 生成知 识图谱。 在一 种可能 的实施 方式中, 所述识别模块, 包括: 获取子模块, 用于获 取所 述目标 网页的 页面源代码 ; 定位子模块 , 用于根据标题 标签从 所述页 面 源代 码中定位 得到所 述标题 文本; 匹配子模块 , 用于基于预设实体 概念词 集, 从所 述标题 文本中 匹配得到所 述实体 概念。 在一 种可能 的实施 方式中, 所述构建模块, 包括: 第一执行子模块 , 用 于从 所述语 法分析树 中确定 包括所述 实体概念 的语法 子树;第二执 行子模块 , 用 于确定所 述语法子 树对应 的标题文 本片段 ; 第三执行子模 块, 用于将所述 标题 文本片 段中的与 所述实体 概念距 离最近 的形容词 作为所述 修饰词 。 在一 种可能 的实施 方式中, 所述识别模块, 包括: 生成子模块, 用于在 获取 到所述 目标网页 的页面 源代码之 后,基于所述 页面源代 码中的 编码标签, 生成 与所述 页面源代 码对应 的编码 标签树 ; 第四执行子模块 , 用于从所述编 码标 签树 中确定相似 度大于 预设阈值 的多个 目标编码 标签子 树; 第五执行子 模块 , 用于针对每一 所述 目标编码 标签子树 , 从所述目标编 码标签 子树对应 的主 体文本 片段中确 定所述 实体。 在一 种可能 的实施方 式中, 所述标题文 本的文 本样式 为 top K文本样式, 所述 第四执 行子模块 , 用于: 从所述编码标 签树中确 定目标 编码标 签节点 , 所述 目标编码 标签节 点下的编 码标签 子树的数 量大于 或等于 K; 从所述目标 编码 标签节 点下的 所有编码 标签子 树中确 定至少 K 个所 述目标 编码标 签子 树 O 在一 种可能 的实施 方式中, 所述装置还包括 计算模 块, 用于通过如 下方 式计 算任意 两个编码 标签子 树中的 第一编码 标签子树 和第二 编码标 签子树之 间的 相似度 : 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点不相同 的情 况下 , 确定所述第 一编码标 签子树和 所述 第二编码 标签子树 的相似 度 s=0; 在所 述第一 编码标签 子树和 所述第 二编码标 签子树 的根节 点相同、 且所述第 一编 码标签 子树和所 述第二 编码标 签子树的 前序遍 历结果 以及后序 遍历结果 均相 同的情 况下, 确定所述 第一编码 标签子 树和所 述第二编 码标签 子树的相 似度 s=l ; 在所述第一编码标签 子树和所 述第二编 码标签 子树的根 节点相 同、 且所 述第一 编码标签 子树和 所述第 二编码标 签子树 的前序遍 历结果 或后序遍 历 结 果不 相 同 的情 况 下 , 确定 所 述两 个 编码 标 签 子树 的 相 似度 s= 0.5 + 0.5 其中, N 为所述第一编码 标签子 树中第 一层节 点的
Figure imgf000013_0001
数量 , §表示以所述第一 编码标 签子树 的第一层 节点中的 第 i个节点为 根节点 的 第一子树 与以所述 第二编码 标签子 树的第一 层节点 中的第 i个节点 为根节 点的 第二子树 之间的 相似度 。 在一 种可能 的实施方 式中, K 是通过 如下方 式确定的 : 从所述语法分析 树 中确定包括 所述实 体概念 的语法子 树; 从所述语 法子树 中确定基数 标签对 应的 数量词 Ko 采 用本公开 的上述装 置, 从目标网 页的标题 文本中识 别出实 体概念 , 并 从该 目标 网页的主体 文本 中识别出对 应该实 体概念 的至少一 个实体 。 同时, 根据 标题文 本所属语 种的语 法分析规 则, 构建标题 文本的语 法分析树 , 并从 该语 法分析 树中确 定用于修 饰该实体 概念的 修饰词 。 根据实体概念 、 修饰词 以及 得到的 实体生成 知识图谱 。可见, 本公开提供了 一种新的 无需对语 料 (目 标 网页) 进行结构化 处理的知 识图谱 构建方 法。 而且, 因本公开的这 种方式 能够 避免对 语料进行 结构化 处理而 能够避免 结构化处 理所 引入的噪 声, 使知 识 图谱的召 回率与准 确率提 高。 关于 上述装 置中各个 模块的 具体实 施步骤, 已经在有关该装 置的方 法实 施例 中进行 了详细的 说明, 此处不再赘述。 下 面参考图 10, 其示出了适于 用来实现 本公开实 施例的 电子设备 600的 结构 示意图 。 本公开实施例 中的终端 设备可 以包括但 不限于 诸如移 动电话 、 笔记 本电脑 、 数字广播接收 器、 PDA (个人数字助理)、 PAD (平板电脑)、 PMP (便携式多媒 体播放 器)、 车载终端 (例如车载导航终端 ) 等等的移动终 端 以及诸如 数字 TV、 台式计算机 等等的 固定终端 。 图 6示出的电子设备 仅仅 是一 个示例 , 不应对本公开 实施例的 功能和使 用范围 带来任何 限制。 如 图 10所示, 电子设备 600可以包括处 理装置 (例如中央处理器 、 图形 处理 器等) 601 , 其可以根据存储在只 读存储 器 (ROM) 602中的程序或者 从 存储 装置 608加载到随机 访问存 储器 (RAM) 603中的程 序而执行 各种适 当 的动 作和处 理。在 RAM 603中, 还存储有电 子设备 600操作所需 的各种程 序 和数 据。 处理装置 601、 ROM 602以及 RAM 603通过总线 604彼此相连 。输 入 /输出 (I/O) 接口 605也连接至总线 604。 通常 , 以下装置可以连 接至 I/O接口 605 : 包括例如触摸屏、 触摸板、 键 盘 、 鼠标、 摄像头、 麦克风、 加速度计、 陀螺仪等的输入装 置 606 ; 包括例 如液 晶显示 器 (LCD)、 扬声器、 振动器等的输出装置 607 ; 包括例如磁带、 硬盘 等的存 储装置 608 ; 以及通信装置 609。通信装置 609可以允许 电子设 备 600 与其他 设备进 行无线或 有线通信 以交换 数据。 虽然图 6示出 了具有各种 装置 的电子 设备 600, 但是应理解 的是, 并不要求 实施或具 备所有 示出的 装 置。 可以替代地实施 或具备更 多或更 少的装置 。 特别 地, 根据本公开 的实施 例, 上文参考流 程图描 述的过程 可以被 实现 为计 算机软 件程序 。 例如, 本公开的实施例 包括一 种计算机 程序产 品, 其包 括承 载在非 暂态计算 机可读 介质上 的计算机 程序, 该计算机 程序包含 用于执 行流 程图所 示的方 法的程序 代码。 在这样的 实施例 中, 该计算机程 序可以通 过通 信装置 609从网络上 被下载 和安装, 或者从存储装置 608被安装 , 或者 从 ROM 602被安装。在该 计算机程 序被处 理装置 601执行时, 执行本公开 实 施例 的方法 中限定的 上述功 能。 需要 说明的 是, 本公开上述 的计算机 可读介 质可以是 计算机 可读信 号介 质或 者计算 机可读存 储介质 或者是上 述两者 的任意 组合。 计算机可读 存储介 质例 如可以 是 - 但不限 于 - 电、 磁、 光、 电磁、 红外线、 或半导体的系 统 、 装置或器件, 或者任意 以上的 组合。 计算机可 读存储介 质的更 具体的例 子可 以包括但 不限于 : 具有一个或 多个导线 的电连接 、 便携式计算 机磁盘 、 硬盘 、 随机访问存储 器 (RAM)、 只读存储器 (ROM)、 可擦式可编程只读 存 储器 (EPROM 或闪 存)、 光纤、 便携式紧凑磁盘只读存 储器 (CD-ROM)、 光 存储 器件、 磁存储器件、 或者上述 的任意合 适的组合 。 在本公开中 , 计算机 可读 存储介 质可以是 任何包 含或存储 程序的 有形介 质, 该程序可以 被指令执 行 系统、 装置或者器 件使用 或者与其 结合使 用。 而在本公开 中, 计算机可读 信号 介质可 以包括在 基带 中或者作 为载波一 部分传播 的数据 信号, 其中承载 了计 算机可 读的程序 代码。 这种传播的数据 信号可 以采用 多种形式 , 包括但 不 限于电磁 信号、 光信号或 上述的任 意合适 的组合 。 计算机可读信 号介质还 可 以是计算 机可读存 储介质 以外的任 何计算 机可读 介质, 该计算机 可读信号 介质 可以发 送、 传播或者传 输用于 由指令执 行系统 、 装置或者器件 使用或者 与其 结合使 用的程序 。 计算机可读介 质上 包含的程 序代码 可以用任 何适当的 介质 传输, 包括但不限于: 电线、 光缆、 RF (射频) 等等, 或者上述的任意 合适 的组合 。 在一 些实 施方式 中, 客户端、 服务器可以利 用诸如 HTTP (HyperText Transfer Protocol, 超文本传输协议) 之类的任何当前 已知或未 来研发的 网络 协议 进行通 信, 并且可以与 任意形 式或介质 的数字 数据通信 (例如, 通信网 络 ) 互连。 通信网络的示例 包括局域 网 ("LAN"), 广域网 ("WAN"), 网际 网 (例如, 互联网) 以及端对端网络 (例如, ad hoc端对端网络), 以及任何 当前 已知或 未来研发 的网络 。 上述 计算机 可读介质 可以是 上述电子 设备 中所包含 的; 也可以是单 独存 在 , 而未装配入该电 子设备 中。 上述 计算机 可读介质 承载有 一个或者 多个程 序, 当上述一个 或者多 个程 序被 该电子 设备执行 时, 使得该电 子设备 : 从目标网页的标 题文本 中识别 出 实体 概念, 并从所述目标 网页的主体 文本 中识别出 对应所述 实体概念 的至 少 一个 实体 ; 根据所述标题文 本所属语 种的语 法分析 规则, 构建所述 标题文 本 的语 法分析树 ,并从所述 语法分析 树中确 定用于修 饰所述 实体概念 的修饰词 ; 根据 所述实 体概念、 所述修饰词以及 所述至 少一个实 体生成知 识图谱 。 可 以以一种 或多种程 序设计 语言或其 组合来 编写用 于执行 本公开的操 作 的计 算机程 序代码 , 上述程序设计语 言包括 但不限 于面向对 象的程 序设计语 言一 诸如 Java、 Smalltalk、 C++, 还包括常规的过程式程序设计语言 诸如 “C”语言 或类似 的程序设 计语言 。 程序代码可以 完全地在 用户计算 机上执 行、 部分 地在用 户计算机 上执行 、 作为一个独立 的软件 包执行 、 部分在用户计算 机上 部分在 远程计算 机上执 行、 或者完全在 远程计 算机或服 务器上 执行。 在 涉及 远程计 算机的情 形中, 远程计算机可 以通过任 意种类的 网络 — 包括 局 域 网 (LAN) 或广域网 (WAN) — 连接 到用户 计算机, 或者, 可以连接到 外部 计算机 (例如利用因特 网服务提供 商来通 过因特 网连接)。 附 图中的流程 图和框 图, 图示了按照 本公开 各种实施 例的 系统、 方法和 计算 机程序 产品的可 能实现 的体系 架构、 功能和操作 。 在这点上, 流程图或 框 图中的每个 方框可 以代表一 个模块 、 程序段、 或代码的一 部分, 该模块、 程序 段、 或代码的一 部分包 含一个 或多个 用于实现规 定的逻 辑功能 的可执行 指令 。 也应当注意 , 在有些作为替换 的实现 中, 方框中所标 注的功 能也可 以 以不 同于附 图中所标 注的顺 序发生 。 例如, 两个接连地表示 的方框 实际上可 以基 本并行 地执行 , 它们有时也可 以按相反 的顺序执 行, 这依所涉 及的功 能 而定 .。 也要注意的是, 框图和 /或流程图中的每个方框 、 以及框图和/或流程 图 中的 方框的 组合, 可以用执 行规定的 功能或 操作的 专用的基 于硬件 的系统来 实现 , 或者可以用专 用硬件 与计算机 指令的组 合来实 现。 描述 于本公 开实施例 中所涉 及到的模 块可 以通过软件 的方式 实现, 也可 以通 过硬件 的方式来 实现。 其中, 模块的名称在某 种情况下 并不构成 对该模 块本 身的限 定。 本文 中以上描 述的功 能可以 至少部分 地由一 个或多个 硬件逻 辑部件 来执 行 。 例如, 非限制性地, 可以使用 的示范类 型的硬件 逻辑部 件包括 : 现场可 编程 门阵列 (FPGA)、 专用集成电路 (ASIC)、 专用标准产品 (ASSP)、 片 上 系统 (SOC)、 复杂可编程逻辑设备 (CPLD) 等等。 在本 公开的 上下文 中, 机器可读介质 可以是 有形的介 质, 其可以包含 或 存储 以供指 令执行 系统、 装置或设备 使用或 与指令执 行系统 、 装置或设备结 合地 使用的程 序。 机器可读 介质可 以是机器 可读信 号介质或 机器可 读储存介 质。 机器可读介质可 以包括但 不限 于电子的 、 磁性的、 光学的、 电磁的、 红 外的 、 或半导体系统 、 装置或设备 , 或者上述内容 的任何合 适组合 。 机器可 读存 储介质 的更具体 示例会 包括基 于一个或 多个线 的电气连 接、 便携式计算 机盘 、 硬盘、 随机存取存储器 (RAM)、 只读存储器 (ROM)、 可擦除可编程 只读 存储 器 (EPROM 或快闪 存储器 )、 光纤、 便捷式紧凑 盘只 读存储 器 (CD-ROM )、 光学储存设备 、 磁储存设备、 或上述内 容的任何 合适组合 。 根据 本公开 的一个或 多个实施 例,示例 1提供了一种知 识图谱 构建方 法, 包括 : 从目标网页的 标题文 本中识别 出实体 概念, 并从所述 目标网 页的主体 文本 中识别 出对应所 述实体 概念的至 少一个 实体; 根据所述 标题文 本所属语 种的 语法分析 规则, 构建所述标题文 本的语 法分析树 , 并从所述语 法分析树 中确 定用于修 饰所述 实体概念 的修饰 词; 根据所述 实体概念 、 所述修饰词 以 及所 述至少一 个实体 生成知识 图谱。 根据 本公开 的一个或 多个实施 例, 示例 2提供 了示例 1的方法, 所述从 目标 网页的标 题文本 中识别 出实体概 念, 包括: 获取所述 目标网页的 页面源 代码 ; 根据标题标签 从所述 页面源代 码中定 位得到所 述标题 文本; 基于预设 实体 概念词 集, 从所述标题文 本中匹 配得到所 述实体概 念。 根据 本公开 的一个或 多个实施 例, 示例 3提供 了示例 1的方法, 所述从 所述 语法分析 树中确 定用于修 饰所述 实体概 念的修饰 词, 包括: 从所述语法 分析 树中确 定包括所 述实体概 念的语 法子树 ; 确定所述语法 子树对应 的标题 文本 片段; 将所述标 题文本 片段中 的与所述 实体概念 距离最 近的形 容词作为 所述 修饰词 。 根据 本公开 的一个或 多个实施 例, 示例 4提供 了示例 1-3的方法, 所述 从所 述目标 网页的主 体文本 中识别 出对应所 述实体概 念的至 少一个 实体, 包 括 : 在获取到所述 目标网页 的页面 源代码之 后, 基于所述 页面源代码 中的编 码标 签, 生成与所述 页面源 代码对 应的编码 标签树 ; 从所述编码标 签树中确 定相 似度 大于预设 阈值的多 个目标 编码标签 子树; 针对每一 所述 目标编码标 签子 树, 从所述目标 编码标 签子树对 应的主体 文本片 段中确定 所述实体 。 根据 本公开 的一个或 多个实 施例, 示例 5提供 了示例 4的方法, 所述标 题文 本的文 本样式为 top K文本样 式, 所述从所 述编码标 签树中确 定.相似度 大 于预设阈 值的多个 目标编 码标签 子树, 包括: 从所述编码标签树 中确定 目 标编 码标签 节点, 所述目标 编码标 签节点下 的编码 标签子树 的数量 大于或等 于 K; 从所述 目标编码标 签节点下 的所有编 码标签 子树中确 定至少 K个所 述 目标编码标 签子树。 根据 本公开 的一个或 多个实 施例, 示例 6提供 了示例 5的方法, 所述方 法还 包括 : 通过如下方式计 算任意 两个编码 标签子树 中的 第一编码 标签子树 和 第二编码 标签子树 之间的 相似度 : 在所述第一编码 标签子 树和所 述第二编 码标 签子树 的根节 点不相 同的情况 下, 确定所述第 一编码标 签子树和 所述 第 二编 码标签 子树的相 似度 s=0; 在所述第一 编码标 签子树和 所述 第二编码 标 签子 树的根 节点相 同、 且所述第一 编码标签 子树和 所述第二 编码标 签子树 的 前序 遍历结 果以及后 序遍历 结果均 相同的情 况下, 确定所述 第一编码 标签子 树和 所述第 二编码标 签子树 的相似 度 s=l ; 在所述第一编码标签子 树和所 述 第二 编码标 签子树 的根节点 相同、 且所述第一编码 标签子树 和所述 第二编码 标签 子树的 前序遍历 结果或 后序遍历 结果不 相同的 情况下 , 确定所述两个编 码标 签子树 的相似度 s- 0.5 + 0.5 其中, N 为所述第 一编码标 签
Figure imgf000019_0001
子树 中第一 层节点 的数量 , 6表示以所 述第一 编码标签 子树的 第一层 节点中 的 第 i个节点为根 节点的第 一子树 与以所述 第二编码 标签子树 的第一 层节点 中的 第 i个节点为 根节点 的第二子 树之间的 相似度 。 根据 本公开 的一个或 多个实 施例, 示例 7提供 了示例 5的方法, K是通 过如 下方式确 定的 :从所述语法分 析树中确 定包括 所述实体 概念的 语法子树; 从所 述语法 子树中确 定基数标 签对应 的数量词 Ko 根据 本公开 的一个或 多个实 施例,示例 8提供了一种 知识图谱 构建装 置, 所述 装置包 括: 识别模块, 用于从目标网 页的标题 文本中识 别出实体 概念 , 并从 所述 目标网页的 主体文 本中识 别出对应 所述实体 概念的 至少一 个实体 ; 构建 模块, 用于根据所述标 题文本所 属语种 的语法 分析规则 , 构建所述标题 文 本的语法 分析树 , 并从所述语法 分析树 中确定用 于修饰所 述实体概 念的修 饰词 ; 生成模块, 用于根据所述实体 概念、 所述修饰词以及 所述至 少一个 实 体生 成知识 图谱。 根据 本公开 的一个或 多个实 施例, 示例 9提供 了示例 8的装置, 所述识 别模 块, 包括: 获取子模块 , 用于获取所述 目标网 页的页 面源代码 ; 定位子 模块 , 用于根据标题 标签从 所述页 面源代码 中定位 得到所述 标题文 本; 匹配 子模 块, 用于基于预 设实体 概念词 集, 从所述标题 文本中 匹配得到 所述实体 概念 。 根据 本公开 的一个或 多个实 施例, 示例 10提供了示 例 8的装置 , 所述构 建模 块, 包括: 第一执行子 模块, 用于从所述语法 分析树 中确定包括 所述实 体概 念的语 法子树 ; 第二执行子模 块, 用于确定所 述语法子 树对应 的标题文 本 片段; 第三执行子 模块, 用于将所述标题 文本片 段中的 与所述实 体概念距 离最 近的形 容词作为 所述修饰 词。 根据 本公开 的一个或 多个实 施例, 示例 11提供了示例 8-10的装置, 所 述识 别模块 , 包括: 生成子模块, 用于在获取到所 述目标 网页的页 面源代码 之后 , 基于所述页 面源代码 中的编码 标签, 生成与所述页 面源代码 对应的编 码标 签树 ; 第四执行子模块 , 用于从所述编 码标签树 中确定 相似度 大于预设 阈值 的多个 目标编码 标签子 树; 第五执行子 模块, 用于针对每一所 述目标编 码标 签子树 ,从所述目标 编码标签 子树对 应的主体 文本片段 中确定 所述实体 。 根据 本公开 的一个或 多个实施 例, 示例 12提供了示例 11的装置, 所述 标题 文本的 文本样式 为 top K文 本样式, 所述第四执行子模 块, 用于: 从所 述编 码标签树 中确定 目标编码 标签 节点, 所述目标编 码标签 节点下 的编码标 签子 树的数量 大于或 等于 K; 从所述 目标编码标 签节点 下的所有 编码标 签子 树 中确定至 少 K个所 述目标 编码标签 子树。 根据 本公开 的一个或 多个实施 例, 示例 13提供 了示例 12的装置, 所述 装置 还包括 计算模块 , 用于通过如 下方式计 算任意 两个编码 标签子树 中的 第 一编 码标签 子树和第 二编码标 签子树 之间的相 似度: 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节点 不相同 的情 况下 , 确定所述第 一编码标 签子树和 所述 第二编码 标签子树 的相似 度 s=0; 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点相同、 且所述第 一编 码标签 子树和所 述第二 编码标 签子树的 前序遍历 结果 以及后序遍 历结果 均相 同的情 况下, 确定所述 第一编码 标签子 树和所 述第二编 码标签子 树的相 似度 s=l ; 在所述第一编码标签子 树和所 述第二编 码标签 子树的根 节点相 同、 且所 述第一 编码标签 子树和 所述第二 编码标 签子树 的前序遍 历结果 或后序遍 历 结 果不 相 同 的情 况 下 , 确定 所 述两 个 编码 标 签 子树 的 相 似度 s= 0.5 其中, N 为所述第一编码 标签子 树中第 一层节点 的
Figure imgf000021_0001
数量 ,茂表示以所述 第一编码 标签子树 的第一 层节点 中的第 i个节点为根节 点 的 第一子树 与以所述 第二编码 标签子树 的第一 层节点 中的第 i个节点 为根节 点的 第二子树 之间的 相似度 。 根据 本公开 的一个或 多个实施 例, 示例 14提供 了示例 12的装置, 从所 述语 法分析树 中确定 包括所 述实体概 念的语 法子树 ; 从所述语法子树 中确定 基数 标签对 应的数量 词 Ko 以上 描述仅 为本公开 的较佳 实施例 以及对所 运用技术 原理的 说明。 本领 域技 术人 员应当理解 , 本公开中所 涉及的公 开范围 , 并不限于上述 技术特征 的特 定组合 而成的技 术方案 , 同时也应涵盖在不脱 离上述公 开构思 的情况下 , 由上 述技术 特征或其 等同特 征进行任 意组合 而形成 的其它技 术方案 。 例如上 述特 征与本 公开中公 开的 (但不限于) 具有类似功 能的技术 特征进 行互相替 换 而形成的 技术方案 。 此外 , 虽然采用特定 次序描 绘了各操 作, 但是这不应 当理解 为要求 这些 操作 以所示 出的特 定次序或 以顺序次 序执行 来执行 。 在一定环境下 , 多任务 和并 行处理 可能是有 利的。 同样地, 虽然在上面论 述中包含 了若干 具体实现 细 节, 但是这些不应 当被解 释为对 本公开的 范围的 限制。 在单独的 实施例的 上下 文中描 述的某些 特征还 可以组合 地实现 在单个 实施例 中。 相反地, 在单 个实 施例的 上下文 中描述的 各种特征 也可 以单独地 或以任何 合适的子 组合的 方式 实现在 多个实施 例中。 尽管 已经采 用特定于 结构特征 和 /或方法逻辑动作 的语言描 述了本主 题, 但是 应当理 解所附权 利要求 书中所 限定的主 题未必 局限于上 面描述 的特定特 征或 动作。 相反, 上面所描述的特 定特征和 动作仅 仅是实现 权利要 求书的示 例形 式。 关于上述实 施例 中的装置 , 其中各个模块执 行操作 的具体 方式已经 在有 关该方 法的实施 例中进行 了详细 描述, 此处将不做 详细 阐述说明 。

Claims

权 利 要 求 书
1、 一种知识 图谱构建 方法, 所述方法 包括: 从 目标网页的 标题文 本中识 别出实体 概念, 并从所述目标网 页的主体 文 本 中识别出对 应所述 实体概念 的至少一 个实体 ; 根据 所述标题 文本所 属语种 的语法分 析规则 , 构建所述标题 文本的语 法 分析 树, 并从所述语 法分析树 中确定 用于修饰 所述实体 概念的 修饰词 ; 根据 所述实体 概念、 所述修饰词以及所 述至少 一个实体 生成知 识图谱。
2、 根据权利要 求 1所述的 方法, 其中, 所述从目标网 页的标题 文本中识 别 出实体概念 , 包括: 获取 所述 目标网页的 页面源代码 ; 根据 标题标签 从所述 页面源代 码中定位 得到所 述标题文 本; 基于 预设实体 概念词 集, 从所述标题文 本中 匹配得到所 述实体 概念。
3、 根据权利要 求 1所述的 方法, 其中, 所述从所述语 法分析树 中确定 用 于修 饰所述 实体概念 的修饰词 , 包括: 从所 述语法分 析树中确 定包括 所述实体 概念的 语法子树 ; 确定 所述语法 子树对应 的标题 文本片段 ; 将所 述标题文 本片段 中的与 所述实体 概念距 离最近的 形容词 作为所述 修 饰词 。
4、 根据权利要 求 1-3中任一项 所述的 方法, 其中, 所述从所述 目标网页 的主 体文本 中识别出 对应所述 实体概念 的至少 一个实体 , 包括: 在获 取到所 述目标 网页的页 面源代码 之后, 基于所述页面源 代码中 的编 码标 签, 生成与所述 页面源代 码对应 的编码标 签树; 从所 述编码 标签 树中确 定相似 度大于 预设 阈值的 多个 目标编码 标签子 树 ; 针对 每一所 述目标编 码标签 子树, 从所述 目标编码 标签子树 对应的 主体 文 本片段中确 定所述 实体。
5、根据权 利要求 4所述的方 法,其中,所述 标题文本 的文本样 式为 top K 文 本样式, 所述从所述编码 标签树 中确定相 似度大 于预设 阈值的多 个目标编 码标 签子树 , 包括: 从所 述编码 标签树 中确定 目标编码标 签节点 , 所述目标编码 标签节 点下 的编 码标签 子树的数 量大于 或等于 K; 从所 述目标 编码标签 节点下 的所有编码 标签子 树中确 定至少 K个所述 目 标编 码标签 子树。
6、 根据权利要 求 5所述的 方法, 其中, 所述方法还 包括: 通过如下方 式 计算 任意两 个编码标 签子树 中的第一 编码标 签子树和 第二编 码标签 子树之 间 的相 似度: 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点不相同 的情 况下 , 确定所述第 一编码标签 子树和 所述第二 编码标 签子树的 相似度 s=0; 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点相同、 且所 述 第一编码 标签子树 和所述 第二编码 标签子 树的前 序遍历结 果以及 后序遍历 结果 均相同 的情况下 , 确定所述第一 编码标 签子树和 所述 第二编码 标签子树 的相 似度 s=l ; 在所 述第一 编码标签 子树和 所述第二 编码标 签子树 的根节 点相同、 且所 述 第一编码 标签子树 和所述 第二编码 标签子 树的前序 遍历结 果或后 序遍历结 果 不 相 同 的情 况 下 , 确定所 述 两 个 编 码 标 签 子 树 的 相 似 度 S= 0.5 + 0.5
Figure imgf000025_0001
其中 , N 为所述第一 编码标签 子树中 第一层节 点的
Figure imgf000025_0002
的第 一子树 与以所述 第二编码 标签子树 的第一 层节点 中的第 i个节点 为根节 点的 第二子树 之间的 相似度 。
7、 根据权利要 求 5所述 的方法, 其中, K是通过如 下方式确 定的: 从所 述语法分 析树中确 定包括 所述实体 概念的 语法子树 ; 从所 述语法子 树中确 定基数标 签对应的 数量词 Ko
8、 一种知识 图谱构建装 置, 所述装置 包括: 识别 模块, 用于从目标网页 的标题文 本中识 别出实体 概念, 并从所述目 标 网页的主体 文本中 识别出对 应所述 实体概念 的至少一 个实体 ; 构建模 块, 用于根据所述标题 文本所 属语种 的语法分 析规则 , 构建所述 标题 文本的语 法分析 树, 并从所述语 法分析 树中确 定用于修 饰所述 实体概念 的修 饰词; 生成 模块, 用于根据所述实 体概念 、 所述修饰词以及 所述至 少一个 实体 生成 知识图谱 。
9、 一种计算机 可读介质 , 其上存储有计算 机程序 , 该程序被处理装 置执 行时 实现权 利要求 1-7中任一项所述 方法的 步骤。
10、 一种电子设 备, 包括: 存储 装置, 其上存储 有计算机 程序; 处理 装置, 用于执行所述存储 装置 中的所述计 算机程 序, 以实现权利 要 求 1-7中任一项所述 方法的步 骤。
PCT/SG2022/050578 2021-08-16 2022-08-15 知识图谱构建方法、装置、存储介质及电子设备 WO2023022655A2 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/397,227 US20240135196A1 (en) 2021-08-16 2023-12-27 Method and apparatus for knowledge graph construction, storage medium, and electronic device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110939279.X 2021-08-16
CN202110939279.XA CN113609309B (zh) 2021-08-16 2021-08-16 知识图谱构建方法、装置、存储介质及电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/397,227 Continuation US20240135196A1 (en) 2021-08-16 2023-12-27 Method and apparatus for knowledge graph construction, storage medium, and electronic device

Publications (2)

Publication Number Publication Date
WO2023022655A2 true WO2023022655A2 (zh) 2023-02-23
WO2023022655A3 WO2023022655A3 (zh) 2023-04-13

Family

ID=78308687

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/SG2022/050578 WO2023022655A2 (zh) 2021-08-16 2022-08-15 知识图谱构建方法、装置、存储介质及电子设备

Country Status (3)

Country Link
US (1) US20240135196A1 (zh)
CN (1) CN113609309B (zh)
WO (1) WO2023022655A2 (zh)

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8898583B2 (en) * 2011-07-28 2014-11-25 Kikin Inc. Systems and methods for providing information regarding semantic entities included in a page of content
CN104484379B (zh) * 2014-12-09 2018-06-12 百度在线网络技术(北京)有限公司 确定音乐实体关系的方法和装置及查询处理方法和装置
CN105279277A (zh) * 2015-11-12 2016-01-27 百度在线网络技术(北京)有限公司 知识数据的处理方法和装置
CN106156365B (zh) * 2016-08-03 2019-06-18 北京儒博科技有限公司 一种知识图谱的生成方法及装置
CN106484767B (zh) * 2016-09-08 2019-06-21 中国科学院信息工程研究所 一种跨媒体的事件抽取方法
CN107169078A (zh) * 2017-05-10 2017-09-15 京东方科技集团股份有限公司 中医药知识图谱及其建立方法以及计算机系统
CN107341215B (zh) * 2017-06-07 2020-05-12 北京航空航天大学 一种基于分布式计算平台的多源垂直知识图谱分类集成查询系统
US11334692B2 (en) * 2017-06-29 2022-05-17 International Business Machines Corporation Extracting a knowledge graph from program source code
CN108376160B (zh) * 2018-02-12 2022-02-18 北京大学 一种中文知识图谱构建方法和系统
CN108959433B (zh) * 2018-06-11 2022-05-03 北京大学 一种从软件项目数据中提取知识图谱并问答的方法与系统
CN109033160A (zh) * 2018-06-15 2018-12-18 东南大学 一种知识图谱动态更新方法
US10846288B2 (en) * 2018-07-02 2020-11-24 Babylon Partners Limited Computer implemented method for extracting and reasoning with meaning from text
CN109033358B (zh) * 2018-07-26 2022-06-10 李辰洋 新闻聚合与智能实体关联的方法
CN109885698A (zh) * 2019-02-13 2019-06-14 北京航空航天大学 一种知识图谱构建方法及装置、电子设备
CN110096599B (zh) * 2019-04-30 2023-03-21 长沙知了信息科技有限公司 知识图谱的生成方法及装置
CN110263351A (zh) * 2019-06-17 2019-09-20 深圳前海微众银行股份有限公司 一种网页的多语言翻译方法、装置及设备
CN111177591B (zh) * 2019-12-10 2023-09-29 深圳市数康云信息技术有限公司 面向可视化需求的基于知识图谱的Web数据优化方法
CN111414489B (zh) * 2020-03-25 2023-10-27 中金智汇科技有限责任公司 知识图谱构建方法、装置、电子设备及可读存储介质
CN111813950B (zh) * 2020-05-20 2024-02-27 淮阴工学院 一种基于神经网络自适应寻优调参的建筑领域知识图谱构建方法
CN111723186A (zh) * 2020-06-23 2020-09-29 宁波富万信息科技有限公司 用于对话系统的基于人工智能的知识图谱生成方法、电子设备
CN112507076A (zh) * 2020-12-14 2021-03-16 英大传媒投资集团有限公司 一种语义分析搜索方法、装置及存储介质

Also Published As

Publication number Publication date
CN113609309A (zh) 2021-11-05
WO2023022655A3 (zh) 2023-04-13
US20240135196A1 (en) 2024-04-25
CN113609309B (zh) 2024-02-06

Similar Documents

Publication Publication Date Title
CN110647614B (zh) 智能问答方法、装置、介质及电子设备
US10586155B2 (en) Clarification of submitted questions in a question and answer system
CN109783651B (zh) 提取实体相关信息的方法、装置、电子设备和存储介质
US20230004721A1 (en) Method for training semantic representation model, device and storage medium
WO2023221408A1 (zh) 深度学习框架的算子处理方法、装置、设备和存储介质
JP2022046759A (ja) 検索方法、装置、電子機器及び記憶媒体
US20170308620A1 (en) Making graph pattern queries bounded in big graphs
US10083398B2 (en) Framework for annotated-text search using indexed parallel fields
CN111488742B (zh) 用于翻译的方法和装置
JP2019212289A (ja) 情報を生成するための方法及び装置
WO2024021790A1 (zh) 一种基于数据湖的虚拟列构建方法以及数据查询方法
WO2023273596A1 (zh) 确定文本相关性的方法、装置、可读介质及电子设备
CN111314388A (zh) 用于检测sql注入的方法和装置
US20190147053A1 (en) Method and apparatus for updating multimedia playlist
WO2023018379A2 (zh) 知识图谱构建方法、装置、存储介质及电子设备
CN116383412B (zh) 基于知识图谱的功能点扩增方法和系统
CN116860941A (zh) 问答方法、装置、电子设备及存储介质
WO2023022655A2 (zh) 知识图谱构建方法、装置、存储介质及电子设备
US11321331B1 (en) Generating query answers
CN112988778A (zh) 一种处理数据库查询脚本的方法和装置
CN115587123B (zh) 基于aql检索不同数据库的方法、装置、设备及存储介质
CN114625757B (zh) 基于领域特定语言的任务执行方法及装置、介质、设备
CN115994151B (zh) 数据请求变更方法、装置、电子设备和计算机可读介质
WO2021218564A1 (zh) 一种语义理解方法、装置、设备和存储介质
WO2023125504A1 (zh) 一种关键词检测方法、装置、电子设备和存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE