Text search method and device, electronic equipment and storage medium
By extracting information from the document and generating structured information of the full text and paragraph text, the single-dimensional problem based on title search in the existing technology is solved, and multi-dimensional text search is realized, which improves the search efficiency and accuracy.
Patent Information
- Application Number
- CN202311018582.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-11
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, search can only be performed based on document titles, and the search dimensions are single, resulting in poor search efficiency and accuracy.
By obtaining the target document, the text content of each document is extracted separately to obtain the full text structured information and paragraph text structured information. When receiving the text search request, the target text search results are determined based on these structured information.
It realizes multi-dimensional search, is suitable for a variety of search scenarios, and can search the target text content more quickly and accurately, breaking through the limitations of the search granularity of the entire document.
Smart Images

Figure CN119513046A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing, and in particular to a text search method, device, electronic device and storage medium. Background Art
[0002] With the development of information technology, the amount of information on the Internet has grown rapidly, forming more and more documents. At present, when searching for text content in massive documents, the main method is to search the document title through file management tools, and then open the document to check after finding the relevant document, and then find the relevant text content.
[0003] It can be seen that the existing text content search method can only search based on the document title, the search dimension is single, and the search efficiency and accuracy are poor. Summary of the invention
[0004] The present application provides a text search method, device, electronic device and storage medium to solve the technical problems in the prior art that searches can only be performed based on document titles, the search dimension is single, and the search efficiency and accuracy are poor.
[0005] In a first aspect, the present application provides a text search method, comprising:
[0006] Obtain at least one target document;
[0007] Extracting information from the text content of each target document to obtain text structured information of each target document, wherein the text structured information includes full text structured information and paragraph text structured information;
[0008] When a text search request is received, a target text search result is determined according to text structured information of at least one target document.
[0009] Optionally, extracting information from the text content of each of the target documents to obtain text structured information of each of the target documents includes:
[0010] The following processing is performed for each target document:
[0011] Extracting information from the entire text content of the target document as a whole to obtain full text structured information of the target document; and,
[0012] The target document is segmented into paragraphs to obtain a plurality of paragraphs of the target document; information is extracted from the text content of each paragraph to obtain paragraph text structured information of each paragraph.
[0013] Optionally, extracting information from the entire text content of the target document as a whole to obtain full-text text structured information of the target document includes:
[0014] The outline of the target document is extracted from the entire text content of the target document, and the outline is determined as the full text structured information of the target document.
[0015] Optionally, extracting information from the entire text content of the target document as a whole to obtain full-text text structured information of the target document includes:
[0016] At least one item of document information of the target document is extracted from the entire text content of the target document, and the at least one item of document information is determined as the full-text structured information of the target document.
[0017] Optionally, extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes:
[0018] For each of the paragraphs, the following processing is performed:
[0019] Preprocessing the text content in the paragraph;
[0020] Segment the preprocessed paragraph to obtain multiple sentences;
[0021] Among the multiple sentences, sentences containing entities and designated prompt words are determined as opinion sentences, and the opinion sentences are determined as paragraph text structured information of the paragraph.
[0022] Optionally, extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes:
[0023] For each of the paragraphs, the following processing is performed:
[0024] Preprocessing the text content in the paragraph;
[0025] Input the preprocessed paragraphs into the trained case recognition model to obtain the case recognition results;
[0026] When the case recognition result indicates that the paragraph contains a case, the case label is determined as paragraph text structured information of the paragraph.
[0027] Optionally, extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes:
[0028] For each of the paragraphs, the following processing is performed:
[0029] For each preset target scene, determining whether the paragraph contains the scene text of the target scene;
[0030] When it is determined that the paragraph contains the scene text of the target scene, the target scene is determined as the paragraph text structured information of the paragraph.
[0031] Optionally, after determining the target text search result according to the text structured information of at least one target document, the method further includes:
[0032] In response to a first triggering operation on the target text search result, the target text search result is copied into a text editing area.
[0033] Optionally, after determining the target text search result according to the text structured information of at least one target document, the method further includes:
[0034] In response to a second triggering operation on the target text search result, a target document associated with the target text search result is displayed, and text content associated with the target text search result is marked and displayed in the associated target document.
[0035] In a second aspect, the present application provides a text search device, the device comprising:
[0036] A document acquisition module, used to acquire at least one target document;
[0037] An information extraction module, used to extract information from the text content in each of the target documents to obtain text structured information of each of the target documents, wherein the text structured information includes full text structured information and paragraph text structured information;
[0038] The search module is used to determine the target text search result according to the text structured information of at least one target document when receiving a text search request.
[0039] Optionally, the information extraction module includes:
[0040] A first information extraction unit is used to perform the following processing for each target document: extract information based on the entire text content of the target document as a whole to obtain full text structured information of the target document;
[0041] The second information extraction unit is used to segment the target document into paragraphs to obtain multiple paragraphs of the target document; and extract information from the text content in each paragraph to obtain paragraph text structured information of each paragraph.
[0042] Optionally, the first information extraction unit is specifically used to:
[0043] The outline of the target document is extracted from the entire text content of the target document, and the outline is determined as the full text structured information of the target document.
[0044] Optionally, the first information extraction unit is specifically used to:
[0045] At least one item of document information of the target document is extracted from the entire text content of the target document, and the at least one item of document information is determined as the full-text structured information of the target document.
[0046] Optionally, the second information extraction unit includes:
[0047] The preprocessing subunit is used to perform the following processing on each of the paragraphs: preprocessing the text content in the paragraph;
[0048] Sentence division unit, used to divide the preprocessed paragraph into sentences to obtain multiple sentences;
[0049] The opinion extraction subunit is used to determine the sentences containing entities and designated prompt words among the multiple sentences as opinion sentences, and determine the opinion sentences as paragraph text structured information of the paragraph.
[0050] Optionally, the second information extraction unit includes:
[0051] The preprocessing subunit is used to perform the following processing on each of the paragraphs: preprocessing the text content in the paragraph;
[0052] A case recognition subunit is used to input the preprocessed paragraphs into the trained case recognition model to obtain case recognition results;
[0053] The information determination subunit is used to determine the case label as the paragraph text structured information of the paragraph when the case recognition result indicates that the paragraph contains a case.
[0054] Optionally, the second information extraction unit is specifically used to:
[0055] For each of the paragraphs, the following processing is performed:
[0056] For each preset target scene, determining whether the paragraph contains the scene text of the target scene;
[0057] When it is determined that the paragraph contains the scene text of the target scene, the target scene is determined as the paragraph text structured information of the paragraph.
[0058] Optionally, the device further comprises:
[0059] The editing module is used for, after determining the target text search result according to the text structured information of at least one target document, copying the target text search result into a text editing area in response to a first triggering operation on the target text search result.
[0060] Optionally, the device further comprises:
[0061] The original text link module is used to display the target document associated with the target text search result in response to a second trigger operation on the target text search result after determining the target text search result based on the text structured information of at least one of the target documents, and mark and display the text content associated with the target text search result in the associated target document.
[0062] In a third aspect, the present application provides an electronic device, comprising: a processor and a memory, wherein the processor is used to execute a text search program stored in the memory to implement the text search method described in any one of the first aspects.
[0063] In a fourth aspect, the present application provides a storage medium storing one or more programs, wherein the one or more programs can be executed by one or more processors to implement the text search method described in any one of the first aspects.
[0064] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application, by acquiring at least one target document, extracts information from the text content in each target document respectively, and obtains the text structured information of each target document, the text structured information includes the full-text text structured information and the paragraph text structured information, and when a text search request is received, the target text search result is determined according to the text structured information of at least one target document, thereby realizing multi-dimensional search based on the full-text text structured information and the paragraph text structured information, being suitable for a variety of search scenarios, and being able to break through the limitation of the entire document as the search granularity, so that the search granularity can sink to part of the text content in the document, which helps to search for the target text content faster and more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0066] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0067] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0068] Figure 1 A flowchart of an embodiment of a text search method provided in an embodiment of the present application;
[0069] Figure 2 A flowchart of an embodiment for extracting information from a paragraph to obtain paragraph text structured information;
[0070] Figure 3 A flowchart of another embodiment for extracting information from a paragraph to obtain paragraph text structured information;
[0071] Figure 4 A flowchart of another embodiment for extracting information from a paragraph to obtain paragraph text structured information;
[0072] Figure 5 An example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0073] Figure 6 Another example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0074] Figure 7 Another example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0075] Figure 8 Another example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0076] Fig. 9 Another example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0077] Fig.10 Another example of a search scenario involved in the text search method provided in the embodiment of the present application;
[0078] Fig.11 A block diagram of an embodiment of a text search device provided in an embodiment of the present application;
[0079] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0081] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0082] In order to solve the technical problems in the prior art that searches can only be performed based on document titles, the search dimension is single, and the search efficiency and accuracy are poor, the present application provides a text search method that can realize multi-dimensional search, is suitable for a variety of search scenarios, and helps to search for target text content more quickly and accurately.
[0083] Figure 1 A flowchart of an embodiment of a text search method provided in an embodiment of the present application.
[0084] like Figure 1 As shown, the following steps are included:
[0085] Step 101: Obtain at least one target document.
[0086] The target document may be a document in a format such as .doc, .docx, .ppt, .txt, or .pdf, or a document in a picture format such as .jpg or .jpeg. For a document in a picture format, the text content therein may be recognized by using OCR (Optical Character Recognition) technology.
[0087] In one embodiment, at least one target document may be obtained from a specified directory, for example, documents in a specified folder may be obtained, and each obtained document may be determined as a target document. The specified folder may include one or more folders. When multiple folders are included, the multiple folders may be located in the same directory or in different directories, and this application does not specifically limit this.
[0088] Step 102: extract information from the text content of each target document to obtain text structured information of each target document. The text structured information includes full-text text structured information and paragraph text structured information.
[0089] In the embodiment of the present application, the document structured information is extracted from two levels, the full text of the document and the paragraphs in the document, that is, for each target document, the full text structured information and the paragraph text structured information of the target document are extracted respectively. Here, there can be multiple paragraph text structured information. Wherein, as an optional implementation method, each paragraph in the target document can correspond to a paragraph text structured information respectively, that is, for each paragraph in the target document, the paragraph text structured information of the paragraph is extracted respectively. As another optional implementation method, some paragraphs in the target document correspond to a paragraph text structured information respectively. In other words, only for some paragraphs in the target document, the paragraph text structured information of the paragraph is extracted respectively.
[0090] In the case of extracting paragraph text structured information only for some paragraphs in the target document, as an optional implementation method, the execution subject of the embodiment of the present application can provide a human-computer interaction interface, so that the user can select the paragraphs whose paragraph text structured information needs to be extracted from the target document through the human-computer interaction interface. Here, the user usually selects paragraphs containing important content (or called key content) to extract paragraph text structured information, and does not extract paragraph text structured information for unimportant paragraphs.
[0091] As another optional implementation, the execution subject of the embodiment of the present application can realize autonomous selection of some important paragraphs from the target document through intelligent analysis to extract paragraph text structured information. For example, the execution subject of the embodiment of the present application can extract the summary information (or main information, or theme information) of the target document, and then analyze the semantic relevance between each paragraph and the summary information (or main information, or theme information) in the target document, and determine the paragraphs with higher semantic relevance as important paragraphs to extract paragraph text structured information. Here, the extraction tool trained in advance can be used to extract the summary information (or main information, or theme information) of the target document, and the semantic analysis technology in the natural language processing technology is used to analyze the relevance between each paragraph and the summary information (or main information, or theme information) in the target document. Wherein, the above-mentioned extraction tool can be a pre-trained artificial intelligence model, and the artificial intelligence model can adopt a kernel linear discriminant analysis model, a convolutional neural network model, etc., and the embodiment of the present application does not limit this.
[0092] In an embodiment of the present application, only the paragraph text structured information of important paragraphs in the target document is extracted. On the one hand, it can save computing resources, and on the other hand, it can prevent invalid or unimportant information from interfering with subsequent text searches based on the paragraph text structured information, thereby affecting the accuracy of text search results.
[0093] In addition, it should be noted that the full-text text structured information may include multiple items of information. Similarly, the paragraph text structured information may also include multiple items of information, and the number and type of specific information items in the paragraph text structured information corresponding to different paragraphs may be different. For example, the paragraph text structured information corresponding to paragraph 1 includes two items of information A1 and A2, and the paragraph text structured information corresponding to paragraph 2 includes three items of information B1, B2 and B3. The embodiments of the present application do not limit the number and type of information items in the full-text text structured information and the paragraph text structure of each paragraph.
[0094] Furthermore, the business scenarios corresponding to full-text structured information and paragraph text structured information are different, and the required structured information extraction capabilities are also different. Therefore, when extracting structured information, the full text of the document and the paragraphs in the document can be processed separately through different processes. The following examples describe how to extract information from the text content in the target document to obtain full-text structured information and paragraph text structured information:
[0095] Firstly, for the full-text structured information, information extraction is performed based on the entire text content of the target document as a whole to obtain the full-text structured information of the target document.
[0096] In one embodiment, an outline of the target document is extracted from the entire text content of the target document, and the outline is determined as full-text text structured information of the target document.
[0097] Among them, the outline of the target document can be extracted from the entire text content of the target document using a set outline extraction method. Here, the set outline extraction method can be implemented based on an artificial intelligence model, that is, an outline extraction model can be pre-trained, and when applied, the target document is input into the outline extraction model to obtain the outline of the target document. The above-mentioned artificial intelligence model can be implemented based on a machine learning method, and a model is constructed by training already labeled data. Here, the labeled data refers to documents with labeled outlines; it can also be implemented based on a deep learning method, using a deep neural network (such as a convolutional neural network or a recurrent neural network) to process the document, thereby realizing automatic extraction of the article outline.
[0098] In one embodiment, after extracting the outline of the target document from the entire text content of the target document, the type of the outline may be further identified, where the types of the outline include but are not limited to: idiom type, poem type, number type, question type, metaphor type, keyword type, single word repetition type, etc. The type of the outline may also be determined as the full text structured information of the target document later.
[0099] Among them, natural language processing technology or a combination of natural language processing technology and artificial intelligence model can be used to identify the type of outline. As for the specific implementation of outline type identification, this application will not elaborate.
[0100] In one embodiment, at least one item of document information of the target document is extracted from the entire text content of the target document, and the at least one item of document information is determined as the full text structured information of the target document. Here, the document information is, for example, information such as the document publishing time, document publishing region, publishing author, document tags, etc. Among them, the document tag can be used to identify the type of text content in the document, such as argumentative essays, narrative essays, explanatory essays, etc., and also for example, commentary type, documentary type, fantasy type, etc.
[0101] Among them, a large language model can be used to extract the above document information from the entire text content of the target document. As for the specific implementation process, this application will not describe it in detail.
[0102] It should be noted that the full text structured information may include the above outline, the type of outline and at least one document information at the same time, or may include only one of the information. Moreover, the above are only a few examples of the representation of the full text structured information. In practical applications, other forms of full text structured information may be designed according to specific business scenarios, and the embodiments of the present application do not limit this.
[0103] For paragraph text structured information, the target document is segmented into paragraphs to obtain multiple paragraphs of the target document, and information is extracted from the text content in each paragraph to obtain the paragraph text structured information of each paragraph, or information is extracted from the text content in some paragraphs to obtain the paragraph text structured information of the paragraphs.
[0104] As an optional implementation method, the target document can be segmented into paragraphs according to the typesetting format of the target document. For example, the line that is indented (for example, indented by 2 characters) relative to the left edge of the document page is used as the first line of the paragraph, and the first line of the paragraph is used to define the last line of the previous paragraph. For example, if the document includes ten lines of text, and the first and fifth lines of the document are indented relative to the left edge of the document page, then the first and fifth lines can be determined as the first lines of the paragraph, respectively, and the fourth line can be determined as the last line of the paragraph, that is, the first to fourth lines are divided into one paragraph, and the fifth to tenth lines are divided into one paragraph.
[0105] As another optional implementation method, the target document may be first segmented into sentences, for example, according to punctuation marks (such as period, question mark, exclamation mark, line break \n), and then the semantic relevance between two adjacent sentences may be analyzed. When the semantic relevance between two adjacent sentences is greater than or equal to a set relevance threshold, the two adjacent sentences may be divided into the same paragraph. Conversely, when the semantic relevance between two adjacent sentences is less than the set relevance threshold, the two adjacent sentences may be divided into two paragraphs.
[0106] For example, suppose that the target document is segmented into five sentences, A, B, C, D, and E. Starting from the first sentence A, the semantic relevance between sentence A and sentence B, the semantic relevance between sentence B and sentence C, the semantic relevance between sentence C and sentence D, and the semantic relevance between sentence D and sentence E are calculated in sequence. Assuming that the semantic relevance between sentence A and sentence B is greater than the set relevance threshold, then sentence A and sentence B are divided into one paragraph (for the convenience of description, recorded as paragraph 1); assuming that the semantic relevance between sentence B and sentence C is greater than the set relevance threshold, then sentence B and sentence C are divided into one paragraph. Since sentence B has been divided into paragraph 1, sentence C is also divided into paragraph 1; assuming that the semantic relevance between sentence C and sentence D is less than the set relevance threshold, then sentence D is no longer divided into paragraph 1. Continuing to assume that the semantic relevance between sentence D and sentence E is greater than the set relevance threshold, then sentence D and sentence E are divided into one paragraph (for the convenience of description, recorded as paragraph 2). At this point, the target document is segmented into two paragraphs.
[0107] In one embodiment, the opinion sentence can be extracted from the text content of the paragraph as the paragraph text structured information. Figure 2 As shown, it is a flow chart of an embodiment of extracting information from a paragraph to obtain paragraph text structured information, including the following steps:
[0108] Step 201: pre-process the text content in the paragraph.
[0109] The above-mentioned preprocessing process includes data cleaning (removing stop words, special characters, etc.), format conversion, word normalization (i.e. converting words into a standard format, including but not limited to spelling correction, uppercase and lowercase letter conversion, etc.), etc. Among them, format conversion may include removing unnecessary formats, such as HTML tags, language conversion (e.g., converting from English to Chinese), etc.
[0110] Step 202: Segment the preprocessed paragraph to obtain a plurality of sentences.
[0111] In one embodiment, the preprocessed paragraph may be segmented into sentences according to punctuation marks, such as a period, a question mark, an exclamation mark, a line break (\n), etc., to obtain a plurality of sentences.
[0112] Step 203: Determine the sentences containing entities and designated prompt words among the multiple sentences as opinion sentences, and determine the opinion sentences as paragraph text structured information of the paragraph.
[0113] The above-mentioned entities may be names of people, places, etc., and the above-mentioned designated prompt words may be words expressing thoughts or opinions, such as “say”, “think”, and “think”.
[0114] In one embodiment, natural language processing technology and entity recognition technology are used to find sentences containing entities and designated prompt words from the multiple sentences obtained in step 202 to determine them as opinion sentences. As for the specific implementation process, please refer to the relevant description in the prior art, and this application will not elaborate on it.
[0115] For example, the preprocessed paragraph is:
[0116] The famous physicist Newton discovered problems from the ordinary phenomenon of an apple falling to the ground, dared to ask questions, and actively thought, and finally put forward the view that "there is mutual attraction between any objects."
[0117] By executing the above steps 202 and 203, the opinion statement finally determined is:
[0118] Newton proposed that "there is mutual attraction between any objects."
[0119] In one embodiment, it is possible to identify whether a paragraph contains a story case. If the paragraph contains a story case, a case tag is set for the paragraph to indicate that the paragraph contains a story case, and the case tag is further used as paragraph text structured information of the paragraph. Figure 3 As shown, it is a flowchart of another embodiment of extracting information from a paragraph to obtain paragraph text structured information, including the following steps:
[0120] Step 301: pre-process the text content in the paragraph.
[0121] The above-mentioned preprocessing process includes data cleaning (removing stop words, removing special characters, etc.), format conversion and other processing processes.
[0122] Step 302: Input the preprocessed paragraphs into the trained case recognition model to obtain case recognition results.
[0123] Step 303: When the case recognition result indicates that the paragraph contains a case, the case label is determined as the paragraph text structured information of the paragraph.
[0124] In one embodiment, artificial intelligence technology is used to pre-train a case recognition model, and the case recognition model is used to identify whether the input text contains story cases. The case recognition model can be a linear regression model, a logistic regression model, a decision tree, etc., and the model structure adopted by the case recognition model is not limited here. When training the case recognition model, multiple labeled training samples can be obtained, and the multiple training samples can be divided into positive samples and negative samples. The positive sample is a text containing a story case, and its label indicates that it contains a story case. Conversely, the negative sample is a text that does not contain a story case, and its label indicates that it does not contain a story case. The initial model is trained using these training samples until the model converges to obtain a case recognition model that can identify whether the input text contains a story case.
[0125] For example, the preprocessed paragraph is:
[0126] Sima Hui and Xu Shu recommended Zhuge Liang to Liu Bei, and Liu Bei, Guan Yu, and Zhang Fei went to Longzhong to visit him. The first time, Zhuge Liang was out. The second time, the three of them braved the snow, but Zhuge Liang was not there again. Liu Bei left a letter to express his admiration. The third time, Zhuge Liang was sleeping. Liu Bei stood at the bottom of the stairs and waited for Zhuge Liang to wake up, begging him in tears. Seeing that Liu Bei had great ambitions and was eager to recruit talents, Zhuge Liang was moved by his sincerity and decided to come out of retirement to assist him.
[0127] By executing the above step 302, the above paragraph is input into the case recognition model, and the case recognition result of the paragraph can be obtained: the current input paragraph is a story case. Then the case label is determined as the paragraph text structured information of the paragraph.
[0128] In one embodiment, scenes can be extracted from the text content of a paragraph as paragraph text structured information. Figure 4 As shown, a flowchart of another embodiment of extracting information from a paragraph to obtain paragraph text structured information includes the following steps:
[0129] Step 401: for each preset target scene, determine whether the paragraph contains the scene text of the target scene.
[0130] Step 402: When it is determined that the paragraph contains the scene text of the target scene, the target scene is determined as the paragraph text structured information of the paragraph.
[0131] The following is a unified description of step 401 and step 402:
[0132] The target scenario is, for example, a numerical scenario, a regional scenario, an amount scenario, etc. In actual applications, the target scenario can be set according to business needs.
[0133] The scene text of the target scene refers to the text that meets the target scene. For example, the scene text of the numerical scene refers to the text containing the numerical value, the scene text of the regional scene refers to the text containing the regional information, and the scene text of the amount scene refers to the text containing the amount.
[0134] In one embodiment, a scene text recognition model is pre-trained using artificial intelligence technology, and the scene text recognition model is used to recognize whether the input text contains the scene text of the target scene. Further, the scene text recognition model can also extract the scene text of the target scene from the input text. Afterwards, the scene text of the target scene is also determined as the paragraph text structured information of the paragraph.
[0135] In one embodiment, entity recognition technology can be used to extract entity knowledge graphs from the text content of a paragraph as paragraph text structured information. Here, entities can include people, places, etc.
[0136] For example, the paragraph is "Sima Hui and Xu Shu recommended Zhuge Liang to Liu Bei, and Liu Bei, Guan Yu, and Zhang Fei went to Longzhong to visit him. For the first time, Kong Ming was away."
[0137] The entity knowledge graph extracted from this paragraph is: Characters: Sima Hui, Xu Shu, Liu Bei, Zhuge Liang, Guan Yu, Zhang Fei; Location: Longzhong.
[0138] It should be noted that the paragraph text structured information may include one or more of the above-mentioned opinion statements, case labels, scenes, scene texts, and at least one document information in the entity knowledge graph. Moreover, the above are only a few examples of the expression forms of paragraph text structured information. In practical applications, other forms of paragraph text structured information can also be designed according to specific business scenarios, and the embodiments of this application do not limit this.
[0139] For example, in practical applications, paragraphs can also be divided into long paragraphs and short paragraphs according to the length of the paragraph text content, and this information can be used as paragraph text structured information. For another example, it is possible to identify whether a paragraph contains a set type of text, such as famous quotes, ancient poems, proverbs, etc., and mark the paragraph according to the set type of text contained in the paragraph, and use the mark as the paragraph text structured information. This is similar to the above-mentioned identification of story cases for paragraphs. The specific identification process can also be found in the above description, which will not be repeated here.
[0140] In addition, in one embodiment, after obtaining the text structured information of the target document, the text structured information of the target document can be displayed to the user so that the user can intuitively understand the text structured information of the target document, thereby assisting the user to understand the text structure of the target document more clearly, which also provides a basis for implementing other applications based on text structured information.
[0141] Furthermore, when the user believes that there are errors in the text structured information of the target document, or when the text search through the text structured information of the target document ultimately fails to obtain search results, or when the user is dissatisfied with the search results obtained through the text search through the text structured information of the target document, the text structured information of the target document can also be corrected. Two correction methods are provided here by way of example. First, the user manually corrects the text structured information of the target document. For example, the entity knowledge graph extracted from the paragraph includes invalid entities, and the user can manually delete the invalid entities. For another example, the case recognition model mistakenly identifies a paragraph containing a story case as not containing a story case, and the user can manually add a case label to the paragraph. Second, one-click automatic correction specifically means that the user can control the execution subject of the embodiment of the present application to re-extract the text structured information of the target document by triggering the corresponding function button / control. Here, you can trigger the re-extraction of text structured information for the entire target document with one click, or you can trigger the re-extraction of text structured information for part of the text content in the target document with one click. For example, select one or several paragraphs in the target document and trigger the re-extraction of text structured information for the one or several paragraphs with one click.
[0142] Further, after re-extracting the text structured information, the execution subject of the embodiment of the present application can compare and present the re-extracted text structured information with the previously extracted text structured information, such as split-screen display, and can further locate the difference between the two, and mark and display the difference, such as highlighting. Through this processing, the user can understand the difference between the extraction results obtained by the two extraction processes. On this basis, the user can manually select which extraction result of the extraction process to be used as the basis, so as to make the user experience more friendly. Of course, after re-extracting the text structured information, the re-extracted text structured information can be directly used to cover the previously extracted text structured information, which can also be manually set by the user, such as the user setting to turn on the default overwrite function, so each time after re-extracting the text structured information, the previous text structured information is overwritten.
[0143] Step 103: upon receiving a text search request, determining target text search results according to text structured information of at least one target document.
[0144] In the embodiment of the present application, at least one target document and its text structured information are used as the data source for text search, so that search can be performed based on text structured information. Compared with the prior art that can only search based on document titles, this broadens the dimension of search, thereby enabling multi-dimensional search and better meeting the user's search needs. In addition, since the text structured information also includes paragraph text structured information, the search is no longer limited to the granularity of the entire document, but can be further refined to the specific text content in the document, thereby achieving accurate positioning of the search results required by the user.
[0145] For ease of understanding, the following search examples are shown:
[0146] Search example 1: Figure 5 As shown, the search scenario is to search for documents published in 2023 and whose titles include Industrial Internet. Then, in the search options, select to search by document title and tags, and select 2023 by time to filter out documents published in 2023 and whose titles include Industrial Internet and present them as target text search results.
[0147] In addition, in one embodiment, when there are no search results, in order to improve the user experience, the execution subject of the embodiment of the present application can further interact with the user, such as generating and displaying a prompt message for instructing the user to check whether the search keyword entered by the user is correct. The search keyword here is, for example, Figure 5 In the interface shown, the content entered in the search bar can be manually checked based on the prompt message to see if the entered search keyword is correct.
[0148] As another optional implementation, the execution entity of the embodiments of the present application can automatically correct the search keywords input by the user. The correction mentioned here can include correcting typos. For example, if the user inputs "gongye huliwang" which contains typos, then the execution entity of the embodiments of the present application can correct the typos through the pinyin data (such as gongye) of the search keywords input by the user. The correction mentioned here can also include semantic correction. For example, if the user inputs "gongye huliwanglian" which contains the word "huliwanglian" with incorrect semantics, the execution entity of the embodiments of the present application can identify the true semantics it wants to express as "Internet" through semantic recognition technology and thus correct the search keywords input by the user to "industrial Internet".
[0149] Here, after the execution entity of the embodiments of the present application corrects the search keywords input by the user, it can further input a prompt message, such as "No results for the current search. Please select whether to re-search with *** as the keyword". In the case where the user selects "Yes", re-search is performed with the corrected search keywords.
[0150] Through this kind of processing, it can be realized that in the case of no search results, further interaction with the user is carried out to maximize the satisfaction of the user's search needs and improve the user experience.
[0151] Search example two: As Figure 6 shown, the search scenario is to search for documents with viewpoints and comments on the industrial Internet. Then, select to search by comment viewpoints in the search options and input "industrial Internet" in the search bar to filter out the documents with viewpoints and comments on the industrial Internet as the target text search results for presentation.
[0152] Search example three: As Figure 7 shown, the search scenario is to search for the outline content of the document and not care about the full text content. Then, the outline search function can be used. Select to search by official document outline and input the content of interest, such as "Brief discussion on the network security of the industrial Internet", in the search bar. At this time, the outlines of the documents related to the content of interest input in the search bar can be filtered out as the target text search results for presentation.
[0153] The above search examples involve the overall document search level. Next, several examples are shown for the document paragraph search level.
[0154] Search example four: As Figure 8 shown, the search scenario is to search for text paragraphs containing numerical values in the document. Then, select to search by numerical values and input the content of interest, such as "economy", in the search bar. At this time, the text paragraphs containing economy-related numerical values in the document can be filtered out as the target text search results for presentation.
[0155] Search Example 5: Fig. 9 As shown, the search scenario is to search for text paragraphs containing opinions in a document. In this case, you can choose to search by opinion. At this time, you can filter out opinion sentences in the document and present them as target text search results.
[0156] Search example 6: Fig.10 As shown, the search scenario is to search for text paragraphs containing cases in the document. Then you can choose to search by case. At this time, you can filter out the paragraphs containing cases in the document and present them as target text search results.
[0157] It can be seen from the above search examples four to six that the application of the text search method provided in the embodiments of the present application can break through the limitation of the search granularity of the entire document, so that the search granularity can be sunk to part of the text content in the document, thereby making the search result positioning more accurate and better satisfying the user experience.
[0158] In addition, in actual applications, there may be other search scenarios, such as searching for text paragraphs containing famous quotes in a document, or searching for text paragraphs containing ancient poems in a document, etc. It can be seen that the technical solution provided by the embodiment of the present application is applicable to a variety of search scenarios, and based on the content already recorded in this specification, more search scenarios can be easily and reasonably expanded, and these reasonable expansions should also fall within the protection scope of this application.
[0159] The method provided by the embodiment of the present application obtains at least one target document, extracts information from the text content in each target document, and obtains text structured information of each target document, wherein the text structured information includes full-text text structured information and paragraph text structured information. When a text search request is received, the target text search result is determined according to the text structured information of at least one target document, thereby realizing multi-dimensional search based on full-text text structured information and paragraph text structured information. The method is suitable for a variety of search scenarios and can break through the limitation of using the entire document as the search granularity, so that the search granularity can be lowered to part of the text content in the document, which helps to search for the target text content more quickly and accurately.
[0160] At present, after searching for text content, if you need to quote the searched text content, you can copy the text content in the search results and then paste it into the text editing area. It can be seen that the operation of quoting the searched text content in the prior art is complicated. In this regard, the embodiment of the present application proposes a one-key quoting function.
[0161] Specifically, in one embodiment, after determining the target text search result according to the text structured information of at least one target document, the target text search result is copied to the text editing area in response to a first triggering operation on the target text search result.
[0162] For example, see Fig. 9 or Fig.10 In the example of, when the executing subject of the embodiment of the present application detects that the "reference" icon is triggered, it detects the first trigger operation on the target text search result, and then in response to the first trigger operation, copies the target text search result selected at this time to the text editing area on the left.
[0163] It can be seen that the embodiment of the present application can achieve one-click reference to the searched text content when editing text, which is easy to operate and can improve the user experience.
[0164] In addition, in one embodiment, the above-mentioned reference may also include referencing the text search results to other places other than the text editing area, such as to a chat session, a schedule, a to-do list, etc., which is not specifically limited in the embodiment of the present application. Specifically, as an optional implementation method, after the execution subject of the embodiment of the present application detects the first trigger operation on the target text search structure, a list of icons corresponding to the above-mentioned reference destinations (such as a chat session, a schedule, a to-do list, a text editing area, etc.) is displayed on the interface, so that the user can select the target reference destination from the list, thereby realizing one-click reference.
[0165] At present, after searching for text content, it may also involve viewing the context of the text content. In the prior art, to view the context of the searched text content, it is necessary to first find the document where the text content is located, then open the document and find the text content from the document, and finally determine the context of the text content. It can be seen that the operation in the prior art is very complicated, and the embodiment of the present application proposes a one-click viewing original text function.
[0166] Specifically, in one embodiment, after determining a target text search result based on text structured information of at least one target document, in response to a second trigger operation on the target text search result, the target document associated with the target text search result is displayed, and the text content associated with the target text search result is marked in the associated target document for display.
[0167] For example, see Fig. 9 or Fig.10In the example of, when the execution subject of the embodiment of the present application detects that the "locate original text" icon is triggered, it detects the second trigger operation on the target text search result, and then in response to the second trigger operation, displays the target document associated with the target text search result, and marks and displays (e.g., highlights) the text content associated with the target text search result in the associated target document. By marking and displaying the text content associated with the target text search result in the associated target document, the user can quickly locate the search result in the document, thereby improving the user experience.
[0168] In addition, here, the target document associated with the target text search result can be displayed in the editing area on the left, or the target text associated with the target text search result can be displayed through an independent interface, and the embodiment of the present application does not limit this.
[0169] It can be seen that the embodiment of the present application can realize the one-click original text positioning function, allowing users to quickly view the original text where the search results are located, as well as the contextual information of the search results in the original text. The operation is simple and can improve the user experience.
[0170] Fig.11 This is a block diagram of an embodiment of a text search device provided in an embodiment of the present application. Fig.11 As shown, the device comprises:
[0171] The document acquisition module 1101 is used to acquire at least one target document;
[0172] The information extraction module 1102 is used to extract information from the text content in each of the target documents to obtain text structured information of each of the target documents, wherein the text structured information includes full text structured information and paragraph text structured information;
[0173] The search module 1103 is configured to determine target text search results according to text structured information of at least one target document when a text search request is received.
[0174] Optionally, the information extraction module 1102 includes:
[0175] A first information extraction unit is used to perform the following processing for each target document: extract information based on the entire text content of the target document as a whole to obtain full text structured information of the target document;
[0176] The second information extraction unit is used to segment the target document into paragraphs to obtain multiple paragraphs of the target document; and extract information from the text content in each paragraph to obtain paragraph text structured information of each paragraph.
[0177] Optionally, the first information extraction unit is specifically used to:
[0178] The outline of the target document is extracted from the entire text content of the target document, and the outline is determined as the full text structured information of the target document.
[0179] Optionally, the first information extraction unit is specifically used to:
[0180] At least one item of document information of the target document is extracted from the entire text content of the target document, and the at least one item of document information is determined as the full-text structured information of the target document.
[0181] Optionally, the second information extraction unit includes:
[0182] The preprocessing subunit is used to perform the following processing on each of the paragraphs: preprocessing the text content in the paragraph;
[0183] Sentence division unit, used to divide the preprocessed paragraph into sentences to obtain multiple sentences;
[0184] The opinion extraction subunit is used to determine the sentences containing entities and designated prompt words among the multiple sentences as opinion sentences, and determine the opinion sentences as paragraph text structured information of the paragraph.
[0185] Optionally, the second information extraction unit includes:
[0186] The preprocessing subunit is used to perform the following processing on each of the paragraphs: preprocessing the text content in the paragraph;
[0187] A case recognition subunit is used to input the preprocessed paragraphs into the trained case recognition model to obtain case recognition results;
[0188] The information determination subunit is used to determine the case label as the paragraph text structured information of the paragraph when the case recognition result indicates that the paragraph contains a case.
[0189] Optionally, the second information extraction unit is specifically used to:
[0190] For each of the paragraphs, the following processing is performed:
[0191] For each preset target scene, determining whether the paragraph contains the scene text of the target scene;
[0192] When it is determined that the paragraph contains the scene text of the target scene, the target scene is determined as the paragraph text structured information of the paragraph.
[0193] Optionally, the device further comprises:
[0194] The editing module is used for, after determining the target text search result according to the text structured information of at least one target document, copying the target text search result into a text editing area in response to a first triggering operation on the target text search result.
[0195] Optionally, the device further comprises:
[0196] The original text link module is used to display the target document associated with the target text search result in response to a second trigger operation on the target text search result after determining the target text search result based on the text structured information of at least one of the target documents, and mark and display the text content associated with the target text search result in the associated target document.
[0197] like Fig.12 As shown, an embodiment of the present application provides an electronic device, including a processor 121, a communication interface 122, a memory 123 and a communication bus 124, wherein the processor 121, the communication interface 122, and the memory 123 communicate with each other through the communication bus 124.
[0198] Memory 123, used for storing computer programs;
[0199] In one embodiment of the present application, the processor 121 is used to execute the program stored in the memory 123 to implement the text search method provided by any of the above method embodiments, including:
[0200] Obtain at least one target document;
[0201] Extracting information from the text content of each target document to obtain text structured information of each target document, wherein the text structured information includes full text structured information and paragraph text structured information;
[0202] When a text search request is received, a target text search result is determined according to text structured information of at least one target document.
[0203] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the text search method provided in any of the aforementioned method embodiments are implemented.
[0204] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0205] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0206] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0207] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A text search method, characterized in that: The method comprises: Obtain at least one target document; Extracting information from the text content of each target document to obtain text structured information of each target document, wherein the text structured information includes full text structured information and paragraph text structured information; When a text search request is received, a target text search result is determined according to text structured information of at least one target document.
2. The method according to claim 1, characterized in that The extracting information from the text content of each target document to obtain text structured information of each target document includes: The following processing is performed for each target document: Extracting information from the entire text content of the target document as a whole to obtain full text structured information of the target document; and, The target document is segmented into paragraphs to obtain a plurality of paragraphs of the target document; information is extracted from the text content of each paragraph to obtain paragraph text structured information of each paragraph.
3. The method according to claim 2, characterized in that The information extraction is performed based on the entire text content of the target document as a whole to obtain the full text structured information of the target document, including: The outline of the target document is extracted from the entire text content of the target document, and the outline is determined as the full text structured information of the target document.
4. The method according to claim 2, characterized in that: The information extraction is performed based on the entire text content of the target document as a whole to obtain the full text structured information of the target document, including: At least one item of document information of the target document is extracted from the entire text content of the target document, and the at least one item of document information is determined as the full-text structured information of the target document.
5. The method according to claim 2, characterized in that: The extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes: For each of the paragraphs, the following processing is performed: Preprocessing the text content in the paragraph; Segment the preprocessed paragraph to obtain multiple sentences; Among the multiple sentences, sentences containing entities and designated prompt words are determined as opinion sentences, and the opinion sentences are determined as paragraph text structured information of the paragraph.
6. The method according to claim 2, characterized in that The extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes: For each of the paragraphs, the following processing is performed: Preprocessing the text content in the paragraph; Input the preprocessed paragraphs into the trained case recognition model to obtain the case recognition results; When the case recognition result indicates that the paragraph contains a case, the case label is determined as paragraph text structured information of the paragraph.
7. The method according to claim 2, characterized in that The extracting information from each of the paragraphs to obtain paragraph text structured information of each of the paragraphs includes: For each of the paragraphs, the following processing is performed: For each preset target scene, determining whether the paragraph contains the scene text of the target scene; When it is determined that the paragraph contains the scene text of the target scene, the target scene is determined as the paragraph text structured information of the paragraph.
8. The method according to claim 1, characterized in that After determining the target text search result according to the text structured information of at least one target document, the method further includes: In response to a first triggering operation on the target text search result, the target text search result is copied into a text editing area.
9. The method according to claim 1, characterized in that: After determining the target text search result according to the text structured information of at least one target document, the method further includes: In response to a second triggering operation on the target text search result, a target document associated with the target text search result is displayed, and text content associated with the target text search result is marked and displayed in the associated target document.
10. A text search device, characterized in that: The device comprises: A document acquisition module, used to acquire at least one target document; An information extraction module, used to extract information from the text content in each of the target documents to obtain text structured information of each of the target documents, wherein the text structured information includes full text structured information and paragraph text structured information; The search module is used to determine the target text search result according to the text structured information of at least one target document when receiving a text search request.
11. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to execute a text search program stored in the memory to implement the text search method according to any one of claims 1 to 9.
12. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the text search method according to any one of claims 1 to 9.