A text knowledge extraction method, device, electronic device and storage medium

By establishing a document object model and segmenting the tags, extracting text knowledge and forming a knowledge graph, the problem of relying on humans to manually establish an ontological knowledge base and being unable to deal with complex text organization forms in the existing technology is solved, and the automated extraction and in-depth utilization of text knowledge is realized.

CN113934854BActive Publication Date: 2025-04-29CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010671474.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-13
Publication Date
2025-04-29
Estimated Expiration
2040-07-13

AI Technical Summary

Technical Problem

The prior art is difficult to deal with complex text organization forms without relying on ontological knowledge bases established manually by humans to achieve in-depth extraction of text knowledge.

Method used

By establishing a document object model (DOM), the label set is determined, and the label is divided into words, text knowledge is extracted, and the relationship between adjacent word segments is represented, a knowledge base is formed and stored in the form of a knowledge graph.

Benefits of technology

It realizes the automatic extraction of text knowledge, can handle complex text organization forms, without humans providing ontological structure, and improves the efficiency and accuracy of knowledge extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934854B_ABST
    Figure CN113934854B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, electronic device and computer storage medium for extracting text knowledge. The method comprises: obtaining a document to be processed; establishing a DOM for the document, and determining a first tag set according to the DOM; performing word segmentation on at least one tag in the first tag set; extracting text knowledge based on the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag; thus, for the extraction of text knowledge, the method neither relies on an ontology knowledge base manually established by humans nor places any restrictions on the organization form of the text in the document, thereby realizing the automatic extraction of text knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a text knowledge extraction method, device, electronic equipment and computer storage medium. Background Art

[0002] The extraction of textual knowledge has always been a key technology for acquiring knowledge in the field of artificial intelligence. Due to the huge amount of electronic text data on the Internet and in various enterprises, the potential scale of knowledge in the text is huge, so the technology of extracting knowledge from electronic text plays an important role in promoting the rapid growth of structured knowledge.

[0003] In the related art, the extraction of text knowledge mainly includes three types: structured text, semi-structured text and unstructured text; the main processing object of the knowledge extraction method for structured text is tabular data, for example, tabular data exported from a database, tabular data in a Hypertext Markup Language (HTML) document, tabular data in an Excel document, tabular data in a Word document, etc. The header information in the tabular data generally summarizes the concept name of the corresponding column. In addition to the concept name, the corresponding column generally corresponds to the instance information of the concept name. Based on this main relationship principle, additional auxiliary methods can be used to filter non-conceptual knowledge, thereby realizing the extraction of text knowledge. The characteristic of this type of method is to determine the candidate range of text knowledge extraction based on the structural information of the table. Because the structure of the table contains the experience of human organizational knowledge, the accuracy of this type of method is relatively high. However, this type of method is not suitable for continuous text with free structure.

[0004] The texts that the knowledge extraction method for semi-structured text is generally oriented to are: title text and sentence segment. Among them, the title text is a short text, and the sentence segment is a text content of a long text. For example, its basic organizational form can be:

[0005] Vitamin brand: XXX

[0006] Manufacturer: YYY Health Technology Company

[0007] Vitamin function: Supplement ZZ vitamins to help KK with physical discomfort

[0008] Practical vitamins: 1 capsule per day, before meals

[0009] Among them, the vitamin brand, manufacturer, etc. before the colon are the title text, and the text content after the colon is the sentence segment corresponding to the title text.

[0010] The knowledge extraction method for semi-structured text establishes the associated knowledge between the title text and the corresponding sentence segment by segmenting the title text. In the process of applying this kind of knowledge, the corresponding sentence segment is retrieved by matching the keywords of the title text; while the deep knowledge extraction for semi-structured text extracts the sentence segment, and its basic method is similar to the following knowledge extraction method for unstructured text.

[0011] In the text knowledge extraction method for unstructured text, the target knowledge to be extracted includes two categories: entity knowledge and entity relationship knowledge. Entity knowledge includes information such as the attribute value of an entity. Entity relationship knowledge refers to whether a given type of relationship exists between two entities. A key foundation for extracting these two types of knowledge is the domain ontology, which contains concepts in the discipline, the attributes of concepts, the relationships between concepts, and the constraints of attributes and relationships. Knowledge extraction can only be performed when the domain ontology exists. The process of knowledge extraction includes a series of processing processes such as text segmentation, text part-of-speech tagging, dependency analysis between words, and named entity recognition (NER) to obtain candidate data for knowledge extraction. The method of extracting knowledge on candidate data is based on the analysis method based on specific rules and the method based on learning classification. Among them, the specific rules are formulated by experts in a specific field based on experience; the learning classification method consists of three main parts: training sample collection, model training, and model prediction. The mainstream type of model is deep convolutional neural network (DCNN) or more specific long short-term memory network (LSTM).

[0012] Since knowledge extraction methods for structured and semi-structured texts only support a single text organization form, knowledge extraction methods for unstructured texts ignore the text organization form and rely on an explicit ontology structure provided by humans to guide knowledge extraction. Therefore, how to mine the implicit ontology knowledge structure for complex text organization forms and achieve deep extraction of text knowledge without the need for humans to provide the ontology structure is a difficulty in knowledge extraction from text data. Summary of the invention

[0013] The present invention provides a text knowledge extraction method, device, electronic device and computer storage medium. For the extraction of text knowledge, the method does not rely on an ontology knowledge base manually established by humans, but can handle complex text organization forms, thereby realizing the automatic extraction of text knowledge.

[0014] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0015] In a first aspect, the present invention provides a text knowledge extraction method, the method comprising:

[0016] Get the documents to be processed;

[0017] Establishing a Document Object Model (DOM) for the document, and determining a first tag set according to the DOM;

[0018] Performing word segmentation on at least one tag in the first tag set;

[0019] Text knowledge is extracted from the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag.

[0020] Optionally, the performing word segmentation on at least one tag in the first tag set includes:

[0021] When the font size and the number of characters of the at least one tag meet the first set condition, or the font size and the horizontal starting position of the at least one tag meet the second set condition, the at least one tag is segmented.

[0022] Optionally, the method further includes:

[0023] When the font size of the label in the first label set is larger than the font sizes of two adjacent labels in the first label set, and the number of characters in the label in the first label set is less than K, it is determined that the label in the first label set meets the first set condition, where K is a positive integer greater than 0;

[0024] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the second set condition.

[0025] Optionally, the method further includes:

[0026] searching, according to the DOM, for a title-type tag in the first tag set, wherein the title-type tag refers to a tag whose font size or horizontal starting position satisfies a third set condition;

[0027] Find the parent tag of the title-type tag, and if the parent tag is a title-type tag, perform word segmentation on the title-type tag and the parent tag of the title-type tag;

[0028] A third knowledge set is extracted, wherein the third knowledge set represents a relationship between a word segmentation result of the title-type tag and a word segmentation result of a corresponding parent tag.

[0029] Optionally, the method further includes:

[0030] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, or the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the labels in the first label set meet the third set condition.

[0031] Optionally, the method further includes:

[0032] Merging the textual knowledge and the third knowledge set to form a knowledge base;

[0033] The knowledge base is stored in the form of a knowledge graph.

[0034] Optionally, the performing word segmentation on at least one tag in the first tag set includes:

[0035] Performing English word segmentation and part-of-speech tagging on the English content segment of each tag in the at least one tag to obtain a first word segmentation result;

[0036] Performing Chinese word segmentation and part-of-speech tagging on the Chinese content segment of each tag in the at least one tag to obtain a second word segmentation result;

[0037] The first word segmentation result and the second word segmentation result are combined to obtain a word segmentation result of the at least one tag.

[0038] Optionally, extracting text knowledge from the word segmentation result of the at least one tag includes:

[0039] When it is determined according to the segmentation result of the at least one tag that there are sequentially adjacent noun participles in the at least one tag, a first knowledge set is extracted, wherein the first knowledge set represents an attribute relationship between the adjacent noun participles;

[0040] According to the segmentation result of the at least one tag, it is determined that there are adjacent noun participles and verb participles in the at least one tag, or, if there are adjacent noun participles and gerund participles, a second knowledge set is extracted, wherein the second knowledge set represents an operational relationship between adjacent participles;

[0041] The first knowledge set and the second knowledge set are combined to obtain the text knowledge.

[0042] In a second aspect, the present invention provides a text knowledge extraction device, the device comprising:

[0043] The acquisition module is used to obtain the documents to be processed;

[0044] A determination module, configured to establish a DOM for the document and determine a first tag set according to the DOM;

[0045] The extraction module is used to segment at least one tag in the first tag set; extract text knowledge based on the segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent segmentations in the tag.

[0046] Optionally, the extraction module is used to perform word segmentation on at least one tag in the first tag set, including:

[0047] When the font size and the number of characters of the at least one tag meet the first set condition, or the font size and the horizontal starting position of the at least one tag meet the second set condition, the at least one tag is segmented.

[0048] Optionally, the extraction module is further used to:

[0049] When the font size of the label in the first label set is larger than the font sizes of two adjacent labels in the first label set, and the number of characters in the label in the first label set is less than K, it is determined that the label in the first label set meets the first set condition, where K is a positive integer greater than 0;

[0050] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the second set condition.

[0051] Optionally, the extraction module is used to:

[0052] searching, according to the DOM, for a title-type tag in the first tag set, wherein the title-type tag refers to a tag whose font size or horizontal starting position satisfies a third set condition;

[0053] Find the parent tag of the title-type tag, and if the parent tag is a title-type tag, perform word segmentation on the title-type tag and the parent tag of the title-type tag;

[0054] A third knowledge set is extracted, wherein the third knowledge set represents a relationship between a word segmentation result of the title-type tag and a word segmentation result of a corresponding parent tag.

[0055] Optionally, the extraction module is further used to:

[0056] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, or the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the labels in the first label set meet the third set condition.

[0057] Optionally, the method further includes a storage module, wherein the storage module is used to:

[0058] Merging the textual knowledge and the third knowledge set to form a knowledge base;

[0059] The knowledge base is stored in the form of a knowledge graph.

[0060] Optionally, the extraction module is used to perform word segmentation on at least one tag in the first tag set, including:

[0061] Performing English word segmentation and part-of-speech tagging on the English content segment of each tag in the at least one tag to obtain a first word segmentation result;

[0062] Performing Chinese word segmentation and part-of-speech tagging on the Chinese content segment of each tag in the at least one tag to obtain a second word segmentation result;

[0063] The first word segmentation result and the second word segmentation result are combined to obtain a word segmentation result of the at least one tag.

[0064] Optionally, the extraction module is used to extract text knowledge based on the word segmentation result of the at least one tag, including:

[0065] When it is determined according to the segmentation result of the at least one tag that there are sequentially adjacent noun participles in the at least one tag, a first knowledge set is extracted, wherein the first knowledge set represents an attribute relationship between the adjacent noun participles;

[0066] According to the segmentation result of the at least one tag, it is determined that there are adjacent noun participles and verb participles in the at least one tag, or, if there are adjacent noun participles and gerund participles, a second knowledge set is extracted, wherein the second knowledge set represents an operational relationship between adjacent participles;

[0067] The first knowledge set and the second knowledge set are combined to obtain the text knowledge.

[0068] In a third aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the text knowledge extraction method provided by one or more of the aforementioned technical solutions is implemented.

[0069] In a fourth aspect, a computer storage medium is provided, wherein the computer storage medium stores a computer program; after the computer program is executed, the text knowledge extraction method provided by one or more of the aforementioned technical solutions can be implemented.

[0070] The present invention provides a method, device, electronic device and computer storage medium for extracting text knowledge. The method comprises: obtaining a document to be processed; establishing a DOM for the document, and determining a first tag set according to the DOM; performing word segmentation on at least one tag in the first tag set; extracting text knowledge based on the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag; thus, for the extraction of text knowledge, the method neither relies on an ontology knowledge base manually established by humans nor places any restrictions on the organization form of the text in the document, thereby realizing the automatic extraction of text knowledge. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 is a flow chart of the text knowledge extraction method of the present invention;

[0072] Figure 2 A schematic diagram of the content of an HTML document and the page rendering result;

[0073] Figure 3 A schematic diagram of the DOM model of an HTML document;

[0074] Figure 4 It is a schematic diagram of the structure of the text knowledge extraction device of the present invention;

[0075] Figure 5 This is a schematic structural diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0076] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention.

[0077] Text knowledge extraction refers to the extraction of entities, events, and related attributes from texts, and the organization of this knowledge in a structured manner, providing a certain basis for the search and reasoning of cyberspace knowledge. For the extraction of text knowledge, the existing technical solutions include three types: structured text, semi-structured text, and unstructured text.

[0078] In the related art, the text knowledge extraction method has the following disadvantages:

[0079] 1) Methods for structured texts completely rely on the rule-based extraction of relationships from the same data in the table data when extracting text knowledge, thus requiring the data to be organized into a manually processed table structure, which places high demands on human work. In addition, this type of method generally does not perform in-depth knowledge extraction on the data in different columns of each row, but stores each column of data as a whole in the knowledge base, which has certain limitations.

[0080] 2) Semi-structured text-oriented methods also strictly rely on the text separation structure when extracting text knowledge, and rely on specific separators to distinguish the title text from the corresponding sentence segment. On the one hand, a single restriction is imposed on the organization form of text data, that is, all texts are organized in the form of title text and paragraph text; on the other hand, this type of method usually does not perform in-depth knowledge extraction on the text content of the sentence segment, but stores the sentence segment text as a whole in the knowledge base.

[0081] 3) Knowledge extraction methods for unstructured text usually do not consider the structure of the text, but only consider that the text consists of paragraphs. Therefore, the organization form of unstructured text is usually unstyled American Standard Code for Information Interchange (ASCII) text files, that is, different paragraphs use different fonts and sizes. On the other hand, the key to its knowledge extraction process is to rely on the established ontology or knowledge base.

[0082] From the analysis of structured text and semi-structured text, we can see that the organization of text in the document is an implicit representation of the ontology structure corresponding to the knowledge, but these two methods can only support a single text organization form. The method for unstructured text ignores the organization of text and relies on an explicit ontology structure provided by humans to extract knowledge.

[0083] In addition, in the real world, there is a large amount of text data with rich organizational forms, such as text in HTML format, text in .doc format, text in .pdf format, etc. The mining and utilization of organizational forms in such texts can further expand the data processing boundaries of knowledge extraction methods and further accelerate the speed and volume of knowledge acquisition.

[0084] In view of the above technical problems, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments provided herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the embodiments provided below are partial embodiments for implementing the present invention, rather than providing all embodiments for implementing the present invention. In the absence of conflict, the technical solutions recorded in the present invention can be implemented in any combination.

[0085] It should be noted that, in the present invention, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly stated, but also other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.

[0086] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.

[0087] For example, the text knowledge extraction method provided by the present invention includes a series of steps, but the text knowledge extraction method provided by the present invention is not limited to the recorded steps. Similarly, the text knowledge extraction device provided by the present invention includes a series of modules, but the text knowledge extraction device provided by the present invention is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on information.

[0088] The present invention can be implemented based on electronic devices, where the electronic devices can be thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, and the like.

[0089] Electronic devices may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. In general, program modules may include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems may be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules may be located on local or remote computing system storage media including storage devices.

[0090] Based on the application scenarios described above, the following embodiments are proposed.

[0091] Figure 1 is a flow chart of the data processing method of the present invention, such as Figure 1 As shown, the process may include:

[0092] Step 100: Obtain the document to be processed.

[0093] In one implementation, the document to be processed may represent a document for text knowledge extraction; illustratively, the document to be processed may include at least one of the following: text in HTML format, text in Excel format, text in Word format, text in PDF format, etc., which is not limited in this embodiment of the present invention.

[0094] In one implementation, the text data in the document may be tabular data, for example, tabular data exported from a database, tabular data in an HTML document, tabular data in an Excel document, tabular data in a Word document, etc., which is not limited in the embodiments of the present invention.

[0095] In one implementation, the text data in the document may also be a combination of title text and sentence segments, as well as paragraph data without a fixed style, etc.

[0096] In one implementation, the text data in the document may be composed of Chinese characters, English characters, or mixed characters of other different languages.

[0097] The embodiment of the present invention does not limit the implementation method of obtaining the document to be processed. For example, it can be a document input by a user as needed, or it can be a document captured by a data capture tool.

[0098] It should be noted that the embodiment of the present invention has no restriction on the organization form of text data in a document. As long as the document can be converted into an HTML document, text knowledge extraction can be performed.

[0099] Step 101: Create a DOM for the document, and determine a first tag set according to the DOM.

[0100] In one implementation, a corresponding DOM is established for the document to be processed to describe the structure of the document, and each tag in the document is obtained according to the DOM. The tag set composed of each tag can be called a first tag set.

[0101] In the embodiment of the present invention, DOM is a standard application programming interface (API) that can process HTML documents. DOM provides an access model to the entire document, and regards the document as a tree structure. Each node of the tree represents an HTML tag or a text item within a tag. The DOM tree structure accurately describes the interrelationships between tags in the HTML document.

[0102] After the HTML document is parsed, it is converted into a DOM tree, so the processing of the HTML document can be achieved by operating the DOM tree. The DOM model not only describes the structure of the document, but also defines the behavior of the node object. Using the methods and properties of the object, you can easily access, modify, add and delete the nodes and content of the DOM tree.

[0103] In one implementation, step 101 may include:

[0104] Step A1: When the document to be processed is an HTML document, use an HTML document parsing program to establish the corresponding DOM for the HTML document, and determine the first tag set according to the DOM in a top-down order. Determine each Tag label and its corresponding tag text according to the DOM to form the first tag set Tags = {tag-1, tag-2, tag-3, ..., tag-n}; wherein text(tag-i) represents the text of the i-th tag tag-i, fontSize(tag-i) represents the font size of tag-i, and hPos(tag-i) represents the horizontal coordinate of tag-i in the Web browser.

[0105] Exemplarily, the text, font size and horizontal coordinate of each Tag tag in the first tag set Tags are determined according to the HTML document to be processed.

[0106] Step 102: Segment at least one tag in the first tag set.

[0107] In the embodiment of the present invention, word segmentation is the process of recombining continuous character sequences into word sequences according to certain specifications. Since the text of the tags in the first tag set may include English content fragments and Chinese content fragments, word segmentation of the tags may include English word segmentation and Chinese word segmentation.

[0108] It should be noted that the word segmentation process of at least one tag in the first tag set can be implemented by a corresponding word segmentation algorithm; illustratively, English word segmentation can be implemented by StanfordNLP, which is open source from Stanford University, and Chinese word segmentation can be implemented by pkuseg, which is open source from Peking University. The specific word segmentation algorithm used is set according to the actual application scenario, and the embodiment of the present invention does not limit it.

[0109] In one implementation, at least one tag may be segmented when the font size and the number of characters of at least one tag meet a first set condition, or the font size and the horizontal starting position of at least one tag meet a second set condition.

[0110] Exemplarily, when the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the number of characters in the label in the first label set is less than K, it is determined that the label in the first label set satisfies the first set condition, where K is a positive integer greater than 0; when the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the second set condition.

[0111] Exemplarily, K here represents the number of characters contained in the label. According to experience, K=25 can be taken. The specific value can be set according to actual conditions and is not limited in the embodiment of the present invention.

[0112] Exemplarily, the font size and the number of characters of the current tag in the first tag set are compared with the font size and the number of characters of two tags adjacent to the current tag to determine whether the current tag meets the first set condition; the font size and the coordinates of the horizontal starting position of the current tag in the first tag set are compared with the font size and the coordinates of the horizontal starting position of the two tags adjacent to the current tag to determine whether the current tag meets the second set condition; only when the current tag in the first tag set meets the first set condition or the second set condition, the current tag can be segmented.

[0113] In one implementation, step 102 may include:

[0114] Step A2: According to the following three rules B1-B3, determine whether to perform word segmentation on the i-th tag tag-i in the first tag set Tags = {tag-1, tag-2, tag-3, ..., tag-n}, where i is a positive integer greater than 0 and less than or equal to n.

[0115] Rule B1: The number of characters in text(tag-i) is less than K, where K can be set according to empirical values. For example, K = 25.

[0116] Rule B2: The font size of tag-i is greater than the font size of the text of the previous tag and at the same time greater than the font size of the next tag, that is, fontSize(tag-i)>fontSize(tag-i-1) and fontSize(tag-i)>fontSize(tag-i+1), then this tag is a "title-type tag".

[0117] Rule B3: The horizontal starting position coordinate of tag-i in the Web browser is less than the horizontal starting position coordinate of the previous tag and less than the horizontal starting position coordinate of the next tag, that is, hPos(tag-i)<hPos(tag-i-1) and hPos(tag-i)<hPos(tag-i+1), then tag-i is a "title-type tag".

[0118] Tags that satisfy both Rule B1 and Rule B2 are "knowledge-type tags".

[0119] Tags that satisfy both Rule B1 and Rule B3 are "knowledge-type tags".

[0120] Segment the knowledge-type tags in the first tag set.

[0121] In the embodiments of the present invention, the implementation manner of segmenting at least one tag in the first tag set. Exemplarily, English word segmentation and part-of-speech tagging can be performed on the English content segments of each tag in the at least one tag to obtain a first word segmentation result; Chinese word segmentation and part-of-speech tagging can be performed on the Chinese content segments of each tag in the at least one tag to obtain a second word segmentation result; the first word segmentation result and the second word segmentation result are merged to obtain the word segmentation result of the at least one tag.

[0122] In one implementation manner, during the process of segmenting at least one tag in the first tag set, English word segmentation and part-of-speech tagging can be performed on the English content segments of each tag first, and then Chinese word segmentation and part-of-speech tagging can be performed on the Chinese content segments of each tag; or Chinese word segmentation and part-of-speech tagging can be performed on the Chinese content segments of each tag first, and then English word segmentation and part-of-speech tagging can be performed on the English content segments of each tag. The embodiments of the present invention do not make any restrictions.

[0123] Step A3: Tokenize and perform part-of-speech tagging (POS Tagging) on the text(tag-i) of the i-th tag tag-i in the first tag set Tags = {tag-1, tag-2, tag-3, …, tag-n}. A three-stage tokenization method can be adopted, which can be divided into the following sub-steps.

[0124] Step A31: Extract the English content fragments therein, perform English tokenization and part-of-speech tagging to obtain a part-of-speech tag sequence posEN = (<w-1, pos(w-1)>, …, <w-m, pos(w-m)>), where w-i is an English word and pos(w-i) is the part of speech of w-i such as noun, verb, etc. Remove these English words from text(tag-i) to obtain textCN(tag-j).

[0125] Step A32: Perform Chinese tokenization on textCN(tag-j) to obtain a part-of-speech tag sequence posCN = (<s-1, pos(s-1)>, …, <s-k, pos(s-k)>), where s-j is a Chinese word and pos(s-j) is the part of speech of s-j such as noun, verb, etc.

[0126] Step A33: Merge nouns in posCN = (<s-1, pos(s-1)>, …, <s-k, pos(s-k)>) in reverse order. The rules are as follows:

[0127] Rule B4: If s’ before the noun s is a noun, proper noun, or verbal noun, then connect s’s as a single noun. Delete s and s’ in posCN and insert <s’s, noun> at the position of s in posCN.

[0128] Exemplarily, the phrase "car beauty" contains two nouns, "car" and "beauty". First, determine that "beauty" is a noun, and then determine "car". Through this reverse order method, then merge these two nouns into a single noun "car beauty".

[0129] Step A34: Sort and merge posEN and posCN according to their positions in text(tag-i) to form posTerm(tag-i).

[0130] Exemplarily, posTerm(tag-i) is the tokenization result of the i-th tag tag-i obtained by merging the English tokenization result posEN and the Chinese tokenization result posCN.

[0131] Step A3 is the process of word segmentation for a mixed Chinese and English text. This step adopts the "three-stage word segmentation" method for word segmentation, in which the first stage separately segments the English in the text, the second stage performs basic Chinese word segmentation, and the third stage performs refined Chinese word segmentation, and the results are spliced ​​with the word segmentation results of the first stage in sequence.

[0132] It can be seen that the "three-stage segmentation" method can avoid segmenting "CPU" (abbreviation for central processing unit) in mixed Chinese and English text into "CP" (network synonym for couples) and "U", and can avoid segmenting "hot plug power supply" into "hot plug" and "power supply". Therefore, in the results of text knowledge extraction, the recall rate and completeness of knowledge can be effectively improved.

[0133] Step 103: extracting text knowledge from the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag.

[0134] In an embodiment of the present invention, an implementation method for performing word segmentation on at least one tag in a first tag set can, exemplarily, be to extract a first knowledge set when it is determined that there are sequentially adjacent noun participles in the at least one tag based on the word segmentation result of the at least one tag; wherein the first knowledge set represents the attribute relationship between the adjacent noun participles; extract a second knowledge set when it is determined that there are adjacent noun participles and verb participles in the at least one tag, or when there are adjacent noun participles and gerund participles; wherein the second knowledge set represents the operational relationship between adjacent participles; and merge the first knowledge set and the second knowledge set to obtain the text knowledge.

[0135] Exemplarily, for the result after word segmentation posTerm(tag-i), if it is determined that there are two adjacent noun participles n1 and n2 in sequence in posTerm(tag-i), n2 is taken as the attribute relationship of n1, and the first knowledge set is determined based on the set composed of adjacent noun participles such as n1 and n2 having an attribute relationship.

[0136] Exemplarily, if it is determined that there are noun n1 and verb v1, noun n1 and gerund g1, verb v1 and noun n1, and gerund g1 and noun n1 in sequence in posTerm(tag-i), then n1 is taken as the operational relationship of v1 and g1, and the second knowledge set is determined based on the set composed of adjacent participles with operational relationship such as n1, v1, and g1.

[0137] In one implementation, step 103 may include:

[0138] Step A4: Perform text knowledge analysis on the word segmentation result posTerm(tag-i) of the i-th tag tag-i in the first tag set, which is divided into the following sub-steps:

[0139] Step A41: extract the first knowledge set, that is, the attribute relationship between adjacent noun participles, and the processing rules are as follows:

[0140] If posTerm(tag-i) exists in the order of (w1, noun) and (w2, noun), then w2 is taken as the attribute of w1 and represented by "attribute knowledge" (w1, 'has', w2). The set of all "attribute relationships" is recorded as the "attribute knowledge" library featureKG, that is, the first knowledge set.

[0141] Step A42: extract the second knowledge set, that is, the operational relationship between adjacent word segments, and the processing rules are as follows:

[0142] Rule B5: posTerm(tag-i) exists in the order (w1, noun) and (w2, verb);

[0143] Rule B6: posTerm(tag-i) exists in the order (w1, noun), (w2, gerund);

[0144] Rule B7: posTerm(tag-i) exists in the order (w1, gerund), (w2, noun);

[0145] Rule B8: posTerm(tag-i) exists in the order (w1, verb), (w2, noun);

[0146] For w1 and w2 that satisfy rule B5 or rule B6 or rule B7 or rule B8, w2 is regarded as the operational knowledge that w1 can execute, expressed as (w1, 'can', w2), and the set of all "operation relations" is recorded as "operation knowledge base" actionKG, which is the second knowledge set.

[0147] Exemplarily, the first knowledge set featureKG and the second knowledge set actionKG are merged to obtain text knowledge.

[0148] In one embodiment, according to DOM, a title-type tag in the first tag set can be searched, wherein the title-type tag represents a tag whose font size or horizontal starting position satisfies a third set condition; a parent tag of the title-type tag is searched, and when the parent tag is a title-type tag, the title-type tag and the parent tag of the title-type tag are segmented; and a third knowledge set is extracted, wherein the third knowledge set represents the relationship between the segmentation result of the title-type tag and the segmentation result of the corresponding parent tag.

[0149] Exemplarily, a title-type tag represents a tag that satisfies rule B2 or rule B3. When it is determined that both the title-type tag and the parent tag of the title-type tag satisfy rule B2 or rule B3, the title-type tag and the parent tag of the title-type tag are segmented respectively, and the results obtained after the segmentation of the title-type tag and the parent tag of the title-type tag establish a relationship between the segmentations. For example, w1 is a segmentation in the title-type tag, and w2 is a segmentation in the parent tag. When w1 and w2 are nouns or proper nouns, a correlation relationship between w1 and w2 is established.

[0150] Among them, w1 and w2 can be Chinese or English. For example, w1 is "IP" and w2 is "address", and the correlation between "IP" and "address" is established.

[0151] Exemplarily, when the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, or the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the third set condition.

[0152] In one embodiment, when a title-type tag satisfies a third set condition, a tag corresponding to the title-type tag and a parent tag of the title-type tag are searched. When the parent tag also satisfies the third set condition, the title-type tag and the parent tag of the title-type tag are segmented, and a relationship between the segmented results is established.

[0153] Step A5: Search for the parent titles of all tags in the first knowledge set. The specific sub-steps are as follows:

[0154] Step A51: Initialize the dual set parTags.

[0155] Step A52: According to DOM, take out the next tag tag, and determine whether the tag is a "title type tag" according to rule B2 or rule B3 in step A2. If it is, go to step A53.

[0156] Step A53: Find the first "title tag" tag2 in front of the tag according to the DOM tree structure, and set tag2 as the parent tag of tag.<tag,tag2> Add parTags, if there is a next tag, go to step A52, otherwise, the parent tag search ends.

[0157] For example, if the current tag is tag, and the parent tag of the current tag is found to be tagP, and its parent tag is tagPP, then the current tag tag, the parent tag tagP, and the parent tag tagPP will all be<tag,tagP> ,<tag,tagPP> is added to the dual set parTags in the form of.

[0158] Step A6: After the parent titles of all tags are determined, the association relationship between nouns is extracted according to the dual set parTags. The specific sub-steps are as follows:

[0159] Step A61: Take the next pair in parTags<tag,tag2> , if there is no next duality, go to step A62.

[0160] Step A62: perform word segmentation on the tag tag according to steps A31-A34 recorded in step 103, and obtain the result, which is posTerm(tag).

[0161] Step A63: perform word segmentation on tag tag2 according to steps A31-A34 recorded in step 103, and obtain the result, which is posTerm(tag2).

[0162] Step A64: For (w1, t)∈posTerm(tag) and (w2, t)∈posTerm(tag2), where t is one of {noun, proper noun}, establish the correlation between w1 and w2, recorded as (w1, 'relating', w2). The knowledge set formed by all (w1, 'relating', w2) is recorded as relatingKG, that is, the third knowledge set.

[0163] Step A65: Step A6 ends.

[0164] In one implementation, the textual knowledge and the third knowledge set are merged to form a knowledge base; and the knowledge base is stored in the form of a knowledge graph.

[0165] In one implementation, the first knowledge set featureKG, the second knowledge set actionKG, and the third knowledge set relatingKG are merged to form a knowledge base corresponding to the document to be processed. The knowledge graph can more intuitively show the relationship between the entities in the knowledge base and the interconnected knowledge structure.

[0166] Furthermore, the knowledge base corresponding to the document can be stored in the form of a knowledge graph through the Neo2J graph database.

[0167] Knowledge Graph (KG) is a structured semantic knowledge base that is used to describe concepts and their relationships in the knowledge base in symbolic form. Its basic components are (entity-relationship-entity) triples, as well as entities and their (related attribute-value) pairs. Entities are connected to each other through relationships to form a network knowledge structure.

[0168] The present invention provides a method, device, electronic device and computer storage medium for extracting text knowledge. The method comprises: obtaining a document to be processed; establishing a document object model DOM for the document, and determining a first tag set according to the DOM; performing word segmentation on at least one tag in the first tag set; extracting text knowledge based on the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag; thus, for the extraction of text knowledge, the method neither relies on an ontology knowledge base manually established by humans nor places any restrictions on the organization form of the text in the document, thereby realizing the automatic extraction of text knowledge.

[0169] In order to better understand the present invention, an embodiment of implementing the present invention using a specific third-party tool is first given. It should be noted that the text knowledge extraction method of the present invention is not limited to using the following specific tools, but can work effectively when using similar tools.

[0170] Step 21: If you need to use a third-party HTML document DOM model building tool, you can use Python-based Beautiful Soup4 (BS4 for short). If you need to use a third-party HTML rendering tool, you can use Python-based selenium. The Text(tag-i) function can be implemented using the get_text() method of the tag object provided by BS4. fontSize(tag-i) can be obtained by using the location['x'] method of the web page element after rendering the HTML document using selenium's Webdriver. fontSize(tag-i) can be implemented using value_of_css_property("font-size").

[0171] Step 22: For the parameter K in rule B1 of step 102, the value may be 25; the basis is the Chinese convention that the title should not exceed 25 Chinese characters.

[0172] The English word segmentation in step A31 can be implemented using StanfordNLP, an open source program from Stanford University, and the Chinese word segmentation in step A32 can be implemented using pkuseg, an open source program from Peking University.

[0173] Figure 2 A schematic diagram of the content of an HTML document and the page rendering results. Figure 3A schematic diagram of the DOM model of an HTML document.

[0174] The following is a specific HTML document content fragment, such as Figure 2 As shown, and its corresponding DOM structure, such as Figure 3 As shown, the processing process of the method proposed in the present invention is described.

[0175] According to step A1, from Figure 3 It can be seen that according to the DOM structure of the HTML document, corresponding to Figure 2 The tag type corresponding to the title "9.1 Query the IP address of the management network port" is <h3>Each line below it corresponds to a tag, type .

[0176] According to step A2: the tag corresponding to "9.1 Query the IP address of the management network port" satisfies rules B1 and B2, and is therefore identified as a "knowledge-based title".

[0177] In step A3: "9.1" in "9.1 query the management network port IP address" is removed to obtain the string "query the management network port IP address"; here, the reason for removing 9.1 is that it does not belong to the knowledge-based label.

[0178] According to step A31: in the first stage of English word segmentation, the result obtained is {<"IP", professional noun>}.

[0179] According to step A32: the Chinese word segmentation result can be obtained as {<"query", verb>, <"management", gerund>, <"network port", noun>, <"address", noun>}.

[0180] The results of A31 and A32 are combined to obtain the word segmentation and part-of-speech tagging results: posTerm = {<"query", verb>, <"management", gerund>, <"network port", noun>, <"IP", professional noun>, <"address", noun>}

[0181] According to step A33: process posTerm, use rule B4 therein, merge <"IP", proper noun>, <"address", noun>, get <"IP address", noun>, merge <"management", gerund>, <"network port", noun> get <"management network port", noun>. Finally get posTerm = {<"query", verb>, <"management network port", noun>, <"IP address", noun>}.

[0182] In step A34: according to the method of step A4, obtain the "attribute knowledge" library featureKG = {<"management network port", 'has', "IP address">}.

[0183] According to rule B8 of step A42, the "operation knowledge base" actionKG = {<"management network port", 'can', "query">} is obtained.

[0184] In step A5: Figure 2 The tag name of each text line is shown in Table 1:

[0185]

[0186] Table 1

[0187] In step A51 and step A52, the following parent tag relationship parTags is identified as shown in Table 2:

[0188] Tag Name The parent tag identified in step A5 of the method of the present invention tag-0 null tag-1 null tag-2 tag-1 tag-3 tag-1 tag-4 tag-1 tag-5 tag-1 tag-6 null tag-7 tag-6

[0189] Table 2

[0190] Where null means no parent tag. To facilitate understanding, the meaning of a row in the above table is further explained: For example, the last row means parTags(tag-7) = tag-6.<tag-6,tag-7> Belongs to the label duality.

[0191] In step A6, taking parTags(tag-7)=tag-6 as an example, the text of tag-6 is segmented and POS tagged to obtain {<"default IP", noun>}. The nouns obtained by segmenting and POS tagged tag-7 are {<"iBMC", noun><"management network port", noun>, <"default IP", noun>}, and the relatingKG is obtained as {("iBMC",'relating',"default IP"), ("management network port",'relating',"default IP"), ("default IP",'relating',"default IP")}.

[0192] Finally, featureKG, actionKG, and relatingKG are combined to obtain Figure 2 The knowledge triplet set of the HTML document shown is KG = {("management network port",'has',"IP address"), ("management network port",'can',"query"), ("iBMC",'relating',"default IP"), ("management network port",'relating',"default IP"), ("default IP",'relating',"default IP")}.

[0193] The obtained knowledge graph can be stored in Neo2J graph database.

[0194] Figure 4 It is a schematic diagram of the composition structure of the text knowledge extraction of the present invention, such as Figure 4 As shown, the device includes: an acquisition module 400, a determination module 401 and an extraction module 402, wherein:

[0195] An acquisition module 400 is used to acquire a document to be processed;

[0196] A determination module 401 is used to establish a DOM for the document and determine a first tag set according to the DOM;

[0197] The extraction module 402 is used to perform word segmentation on at least one tag in the first tag set; extract text knowledge based on the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag.

[0198] In one implementation, the extraction module 402 is used to segment at least one tag in the first tag set, including:

[0199] When the font size and the number of characters of the at least one tag meet the first set condition, or the font size and the horizontal starting position of the at least one tag meet the second set condition, the at least one tag is segmented.

[0200] In one implementation, the extraction module 402 is further configured to:

[0201] When the font size of the label in the first label set is larger than the font sizes of two adjacent labels in the first label set, and the number of characters in the label in the first label set is less than K, it is determined that the label in the first label set meets the first set condition, where K is a positive integer greater than 0;

[0202] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the second set condition.

[0203] In one implementation, the extraction module 402 is used to:

[0204] searching, according to the DOM, for a title-type tag in the first tag set, wherein the title-type tag refers to a tag whose font size or horizontal starting position satisfies a third set condition;

[0205] Find the parent tag of the title-type tag, and if the parent tag is a title-type tag, perform word segmentation on the title-type tag and the parent tag of the title-type tag;

[0206] A third knowledge set is extracted, wherein the third knowledge set represents a relationship between a word segmentation result of the title-type tag and a word segmentation result of a corresponding parent tag.

[0207] In one implementation, the extraction module 402 is further configured to:

[0208] When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, or the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the labels in the first label set meet the third set condition.

[0209] In one embodiment, the method further includes a storage module 403, wherein the storage module 403 is configured to:

[0210] Merging the textual knowledge and the third knowledge set to form a knowledge base;

[0211] The knowledge base is stored in the form of a knowledge graph.

[0212] In one implementation, the extraction module 402 is used to segment at least one tag in the first tag set, including:

[0213] Performing English word segmentation and part-of-speech tagging on the English content segment of each tag in the at least one tag to obtain a first word segmentation result;

[0214] Performing Chinese word segmentation and part-of-speech tagging on the Chinese content segment of each tag in the at least one tag to obtain a second word segmentation result;

[0215] The first word segmentation result and the second word segmentation result are combined to obtain a word segmentation result of the at least one tag.

[0216] In one implementation, the extraction module 402 is used to extract text knowledge based on the word segmentation result of the at least one tag, including:

[0217] When it is determined according to the segmentation result of the at least one tag that there are sequentially adjacent noun participles in the at least one tag, a first knowledge set is extracted, wherein the first knowledge set represents an attribute relationship between the adjacent noun participles;

[0218] According to the segmentation result of the at least one tag, it is determined that there are adjacent noun participles and verb participles in the at least one tag, or, if there are adjacent noun participles and gerund participles, a second knowledge set is extracted, wherein the second knowledge set represents an operational relationship between adjacent participles;

[0219] The first knowledge set and the second knowledge set are combined to obtain the text knowledge.

[0220] In practical applications, the acquisition module 400, determination module 401, extraction module 402 and storage module 403 can all be implemented by a processor located in an electronic device, and the processor can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.

[0221] In addition, each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software functional modules.

[0222] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the relevant technology or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method of this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0223] Specifically, the computer program instructions corresponding to a text knowledge extraction method in this embodiment can be stored on a storage medium such as a CD, a hard disk, or a USB flash drive. When the computer program instructions corresponding to a text knowledge extraction method in the storage medium are read or executed by an electronic device, any one of the text knowledge extraction methods in the aforementioned embodiments is implemented.

[0224] Based on the same technical concept as the above embodiments, see Figure 5 , which shows an electronic device 500 provided by the present invention, which may include: a memory 501 and a processor 502; wherein,

[0225] Memory 501, used for storing computer programs and data;

[0226] The processor 502 is used to execute the computer program stored in the memory to implement any one of the text knowledge extraction methods in the aforementioned embodiments.

[0227] In practical applications, the memory 501 may be a volatile memory, such as RAM; or a non-volatile memory, such as ROM, flash memory, hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 502.

[0228] The processor 502 may be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor. It is understandable that for different augmented reality cloud platforms, the electronic device used to implement the processor function may also be other, which is not specifically limited in the embodiment of the present invention.

[0229] In some embodiments, the functions or modules included in the apparatus provided in the embodiments of the present invention can be used to execute the method described in the above method embodiment. The specific implementation can refer to the description of the above method embodiment. For the sake of brevity, it will not be repeated here.

[0230] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.

[0231] The methods disclosed in the various method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.

[0232] The features disclosed in the various product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.

[0233] The features disclosed in the various method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0234] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.

[0235] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0236] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0237] The above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention.< / h3>

Claims

1. A text knowledge extraction method, characterized in that: The method comprises: Get the documents to be processed; Establishing a document object model DOM for the document, and determining a first tag set according to the DOM; When the font size and the number of characters of at least one tag meet the first set condition, or the font size and the horizontal starting position of the at least one tag meet the second set condition, segmenting at least one tag in the first tag set; Text knowledge is extracted from the word segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent word segments in the tag.

2. The method according to claim 1, characterized in that The method further comprises: When the font size of the label in the first label set is larger than the font sizes of two adjacent labels in the first label set, and the number of characters in the label in the first label set is less than K, it is determined that the label in the first label set meets the first set condition, where K is a positive integer greater than 0; When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, and the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the label in the first label set satisfies the second set condition.

3. The method according to claim 1, characterized in that The method further comprises: searching, according to the DOM, for a title-type tag in the first tag set, wherein the title-type tag refers to a tag whose font size or horizontal starting position satisfies a third set condition; Find the parent tag of the title-type tag, and if the parent tag is a title-type tag, perform word segmentation on the title-type tag and the parent tag of the title-type tag; A third knowledge set is extracted, wherein the third knowledge set represents a relationship between a word segmentation result of the title-type tag and a word segmentation result of a corresponding parent tag.

4. The method according to claim 3, characterized in that The method further comprises: When the font size of a label in the first label set is larger than the font size of two adjacent labels in the first label set, or the coordinates of the horizontal starting position of a label in the first label set are smaller than the coordinates of the horizontal starting position of two adjacent labels in the first label set, it is determined that the labels in the first label set meet the third set condition.

5. The method according to claim 3, characterized in that: The method further comprises: Merging the textual knowledge and the third knowledge set to form a knowledge base; The knowledge base is stored in the form of a knowledge graph.

6. The method according to claim 1, characterized in that The performing word segmentation on at least one tag in the first tag set includes: Performing English word segmentation and part-of-speech tagging on the English content segment of each tag in the at least one tag to obtain a first word segmentation result; Performing Chinese word segmentation and part-of-speech tagging on the Chinese content segment of each tag in the at least one tag to obtain a second word segmentation result; The first word segmentation result and the second word segmentation result are combined to obtain a word segmentation result of the at least one tag.

7. The method according to claim 1, characterized in that The extracting text knowledge from the word segmentation result of the at least one tag includes: When it is determined according to the segmentation result of the at least one tag that there are sequentially adjacent noun participles in the at least one tag, a first knowledge set is extracted, wherein the first knowledge set represents an attribute relationship between the adjacent noun participles; According to the segmentation result of the at least one tag, it is determined that there are adjacent noun participles and verb participles in the at least one tag, or, if there are adjacent noun participles and gerund participles, a second knowledge set is extracted, wherein the second knowledge set represents an operational relationship between adjacent participles; The first knowledge set and the second knowledge set are combined to obtain the text knowledge.

8. A text knowledge extraction device, characterized in that: The device comprises: The acquisition module is used to obtain the documents to be processed; A determination module, configured to establish a document object model DOM for the document, and determine a first tag set according to the DOM; The extraction module is used to segment at least one tag in the first tag set when the font size and the number of characters of at least one tag meet the first set condition, or the font size and the horizontal starting position of the at least one tag meet the second set condition; extract text knowledge based on the segmentation result of the at least one tag; the text knowledge represents the relationship between adjacent segmented words in the tag.

9. An electronic device, characterized in that: The device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the steps of the method according to any one of claims 1 to 7 are implemented when the processor executes the program.

10. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for extracting relevant person theme information from webpage

    CN107590219A

  • Knowledge base construction system based on new word discovery algorithm

    CN111291197A