A document-based field extraction method and system
By analyzing the text display attributes and content in the document and intelligently modifying the document name, the problem that document naming in the existing technology cannot reflect the content is solved, and users' ability and experience when creating multiple documents are improved.
Patent Information
- Application Number
- CN202411288297.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-09-14
AI Technical Summary
In the prior art, document naming cannot effectively reflect document content, resulting in difficulty for users to distinguish when creating multiple documents and poor user experience.
By analyzing the text display attributes in the document, identify key paragraphs, and modify the document name according to the text in the key paragraphs. If the key paragraphs are insufficient, the document name is determined by analyzing the comparison sentence pattern and the comparison string.
It realizes intelligent modification of document names, helping users to effectively distinguish multiple documents in a short time, and improves user experience.
Smart Images

Figure CN118796969B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a document-based field extraction method and system. Background Art
[0002] With the rapid development of information technology, diversified electronic document formats such as PDF, Word (DOC / DOCX) and image files (such as PNG, etc.) have become standard carriers for data storage and exchange. These formats are widely used in many fields such as corporate reports, academic research, business analysis and daily office.
[0003] In the related technology, when a user creates a new Word document, the document will be named "New Document". At this time, the user can modify the document name by renaming it. When the user does not create the document but directly opens the corresponding software through the shortcut, if the user edits the corresponding document content and saves it, the document will be named according to the content at the front of the document.
[0004] With respect to the above-mentioned related technologies, the inventor believes that no matter what method is used to create a new document, the naming of the document cannot achieve a good effect, and the subsequent user still needs to modify it as a whole; and once the user creates a large number of Word documents in a short period of time and fails to modify the document name in time, the user will not be able to distinguish between the documents. At this time, the user needs to open the document one by one to understand the content recorded in the document. The overall process is relatively cumbersome, resulting in a poor overall user experience, and there is still room for improvement. Summary of the invention
[0005] In order to improve the overall experience of users when using documents, the present application provides a document-based field extraction method and system.
[0006] In the first aspect, the present application provides a document-based field extraction method, which adopts the following technical solution:
[0007] A document-based field extraction method, comprising:
[0008] Get the text display properties of each text paragraph in the document;
[0009] The paragraphs whose text display attributes are consistent with the preset centering attributes are determined as key paragraphs, and the remaining paragraphs are determined as normal paragraphs;
[0010] Count the key paragraphs to determine the number of key points, and determine whether the number of key points is less than one;
[0011] If the number of key points is not less than one, a unique use paragraph is determined in each key paragraph, and text is extracted from the use paragraph to modify the document name according to the extracted text;
[0012] If the number of emphasis points is less than one, each text paragraph is divided according to two adjacent symbols to determine a comparison sentence pattern, and a comparison string of random width is determined from front to back in the comparison sentence pattern starting from any character;
[0013] In all comparison statements, the number of characters in the comparison string that are the same is counted to determine the total number of comparisons, and the width of the string is determined by counting the characters in the comparison string;
[0014] The selection parameters are determined by calculating the overall number of comparisons and the corresponding string width;
[0015] The selection parameter with the largest value is determined according to a preset sorting rule, and the comparison string corresponding to the selection parameter is extracted to modify the document name.
[0016] Optionally, if the number of key points is not less than one, the document-based field extraction method further includes:
[0017] Get the overall width of each paragraph based on each key paragraph;
[0018] A movable text demarcation interval is established according to the overall width of the paragraph, and the front end point of the text demarcation interval is controlled to be aligned with any text in the document;
[0019] Determine the interval character string according to the text demarcation interval, and determine the interval words of the interval character string and the key words of the key paragraph according to the preset word recognition strategy;
[0020] Compare the interval words with the key words to determine the overlap ratio, and define the interval character string with an overlap ratio greater than a preset benchmark ratio as a valid character string;
[0021] Counting is performed based on valid character strings to determine the valid number, and key paragraphs whose valid number is less than a preset baseline required number are converted into normal paragraphs.
[0022] Optionally, word recognition strategies include:
[0023] Randomly determine a character in the character string of the requirement analysis as the starting character;
[0024] Delimiting the recognition comparison words with a preset fixed width according to the starting characters, and matching the recognition comparison words with a preset word database to define the successfully matched recognition comparison words as valid words;
[0025] Define the characters in the valid word that are not the starting characters as accompanying characters, and determine whether the accompanying characters are in another valid word;
[0026] If the accompanying character is not in another valid word, the original valid word is maintained;
[0027] If the accompanying character is in another valid word, the accompanying character is defined as an abnormal character, and another character in the valid word other than the abnormal character is defined as a determination character;
[0028] Determine whether the character is in another valid word;
[0029] If the determined character is in another valid word, the valid word formed by the determined character and the abnormal character is cancelled;
[0030] If the determined character is not in another valid word, the valid word formed by the determined character and the abnormal character is retained.
[0031] Optionally, after the effective quantity is determined, the document-based field extraction method further includes:
[0032] Calculate the effective number based on the overall width of the paragraph and the effective number to correct the effective number;
[0033] Determine whether there are at least two effective and maximum key paragraphs;
[0034] If there are not at least two key paragraphs with the same and largest effective number, the key paragraph with the largest effective number will be determined as the used paragraph;
[0035] If there are at least two key paragraphs with the same and largest effective number, then count the interval words that overlap with the key words in the effective character string to determine the number of word overlaps;
[0036] The overall suitability parameter is determined by calculating the number of word overlaps, and the overall suitability parameter with the largest value is determined according to the sorting rule, and the key paragraph corresponding to the overall suitability parameter is determined as the use paragraph.
[0037] Optionally, after the document name is modified, the document-based field extraction method further includes:
[0038] Get document header information;
[0039] Get the header text information when the document header information is inconsistent with the preset empty header information;
[0040] Determine whether the text information of each header is consistent;
[0041] If the text information of each header is consistent, the text corresponding to the header text information is extracted, and the extracted text is added to the document name as a suffix;
[0042] If the header text information is not consistent, the original document name will be maintained.
[0043] Optionally, if the text information of each header is not consistent, the document-based field extraction method also includes:
[0044] Get the document creation address;
[0045] Forming a header text combination according to different header text information;
[0046] Determine the search scope according to the document creation address, and obtain the header text combination of each document within the search scope;
[0047] Determine whether there is a document within the search range with a header text combination that is consistent with the header text combination of the currently determined document;
[0048] If there is no document in the search range whose header text combination is consistent with the header text combination of the currently determined document, the original document name is maintained;
[0049] If there is a document in the search range whose header character combination is consistent with the header character combination of the currently determined document, the corresponding document in the search range is defined as a similar document, and the similar name of the similar document is obtained;
[0050] Counting similar documents to determine the number of similarities, and extracting characters based on similar names to determine the number of identical characters;
[0051] The character proportion is determined by counting the number of characters and the number of similarities, and characters whose character proportion is greater than a preset required value are determined as extracted characters, and the extracted characters are combined to be added to the document name as a suffix.
[0052] In a second aspect, the present application provides a document-based field extraction system, which adopts the following technical solution:
[0053] A document-based field extraction system, comprising:
[0054] An acquisition module is used to acquire the text display attributes of each text paragraph in the document;
[0055] A processing module, connected to the acquisition module and the judgment module, for storing and processing information;
[0056] A judgment module, connected with the acquisition module and the processing module, for judging the information;
[0057] The processing module determines the paragraphs whose text display attributes are consistent with the preset centering attribute as key paragraphs, and determines the remaining paragraphs as normal paragraphs;
[0058] The processing module counts the key paragraphs to determine the number of key points, and enables the judging module to judge whether the number of key points is less than one;
[0059] If the determination module determines that the number of key points is not less than one, the processing module determines a unique use paragraph in each key paragraph, and extracts text from the use paragraph to modify the document name according to the extracted text;
[0060] If the judging module judges that the number of key points is less than one, the processing module divides each text paragraph according to two adjacent symbols to determine a comparison sentence pattern, and determines a comparison string of random width from front to back in the comparison sentence pattern starting from any character;
[0061] The processing module counts the comparison strings with the same characters in all comparison sentences to determine the total number of comparisons, and counts the characters in the comparison strings to determine the string width;
[0062] The processing module performs calculations based on the overall number of comparisons and the corresponding string widths to determine the selection parameters;
[0063] The processing module determines the selection parameter with the largest value according to a preset sorting rule, and extracts text from the comparison string corresponding to the selection parameter to modify the document name.
[0064] In a third aspect, the present application provides a computer storage medium capable of storing corresponding programs, which has the characteristics of improving the overall experience of users when using documents, and adopts the following technical solutions:
[0065] A computer-readable storage medium stores a computer program that can be loaded by a processor and execute any of the above document-based field extraction methods.
[0066] In summary, the present application includes at least one of the following beneficial technical effects:
[0067] When a user creates a document, the name of the document can be modified according to the content displayed in the center of the document or the content that appears repeatedly, so that when the user creates multiple documents at the same time, the documents can be effectively distinguished, thereby improving the overall experience of the user when using the document;
[0068] When there is content displayed in the center, the actual situation of the content can be analyzed to further improve the accuracy of document naming for user reminders;
[0069] By analyzing the header, a suffix can be added to the document to further help users distinguish between documents. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 is a flowchart of the document-based field extraction method.
[0071] Figure 2 It is a flow chart of the paragraph situation analysis method.
[0072] Figure 3 It is a flow chart of the word recognition method.
[0073] Figure 4 is a flow chart of the method using paragraph determination.
[0074] Figure 5 It is a flowchart of the method for adding a document suffix.
[0075] Figure 6 It is a flow chart of a method for improving the accuracy of document suffix names.
[0076] Figure 7 It is a module flow chart of the document-based field extraction method. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solutions and advantages of this application more clear, the following Figure 1-7 It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0078] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.
[0079] The embodiment of the present application discloses a document-based field extraction method. When a user creates a Word document, the document content when the user saves the document is analyzed to modify the document name. Therefore, when the user creates multiple documents at the same time and does not actively modify the names, different documents can be effectively distinguished, thereby improving the overall experience of the user when using the document.
[0080] Reference Figure 1 ,The method flow of the document-based field extraction method includes the following steps:
[0081] Step S100: Obtaining text display attributes of each text paragraph in the document.
[0082] The text display attributes are the attributes of text displayed in a document, including the text left alignment attribute, the text right alignment attribute, and the centering attribute.
[0083] Step S101: determining paragraphs whose text display attributes are consistent with the preset centering attribute as key paragraphs, and determining the remaining paragraphs as normal paragraphs.
[0084] Generally, the title in a document will be displayed in the center, so distinguishing between key paragraphs and normal paragraphs based on the text display properties can facilitate subsequent analysis.
[0085] Step S102: Count the key paragraphs to determine the number of key points, and determine whether the number of key points is less than one.
[0086] The number of key points is the total number of midpoint paragraphs in the document, which can be obtained by counting different key paragraphs one by one. The purpose of the judgment is to find out whether there is a key paragraph.
[0087] Step S1021: If the number of key points is not less than one, a unique used paragraph is determined in each key paragraph, and text is extracted from the used paragraph to modify the document name according to the extracted text.
[0088] When the number of highlights is not less than one, it indicates that there is a highlight paragraph. At this time, a unique use paragraph can be determined from the highlight paragraph to modify the document name according to the text in the use paragraph. In one embodiment, the method for determining the use paragraph is to obtain the total number of words in the highlight paragraph, determine the highlight paragraphs whose total number of words falls within a set fixed interval, and then randomly select one from the highlight paragraphs in the fixed interval as the use paragraph; in another embodiment, the method for determining the use paragraph is specifically steps S400-S402.
[0089] Step S1022: If the number of emphasis points is less than one, each text paragraph is divided according to two adjacent symbols to determine a comparison sentence pattern, and a comparison string of random width is determined from front to back in the comparison sentence pattern starting from any character.
[0090] When the number of key points is less than one, it means that there is no key paragraph. At this time, it is necessary to extract the text that can reflect the document content from each text; the two adjacent symbols mean any two adjacent punctuation marks, and the punctuation marks include paragraph start symbols, periods, commas, semicolons, etc., which can be used to pause sentences; the comparison sentence is the sentence corresponding to two adjacent punctuation marks, and the comparison string is a string with any character as the starting point and any width in the comparison sentence; for example, there is a sentence pattern "ABCDEFG", where when C is the starting point, the corresponding comparison string may include "C", "CD", "CDE", "CDEF", "CDEFG".
[0091] Step S103 : Counting the comparison strings with the same characters in all comparison sentences to determine the total number of comparisons, and counting the characters in the comparison strings to determine the string width.
[0092] The overall comparison count is the total number of times a single comparison string appears repeatedly, that is, the total number of times the comparison string appears in all comparison sentences; the string width is the overall length of the comparison string, that is, the number of characters in the comparison string. Taking the above "CDEFG" as an example, the corresponding string width is 5.
[0093] Step S104: performing calculations based on the overall number of comparisons and the corresponding character string width to determine the selection parameter.
[0094] The selection parameter is a parameter that reflects whether the selected comparison string can reflect the document content. The larger the parameter is, the more it can reflect the document content, that is, the comparison string can be used to modify the document name. The specific calculation formula for the selection parameter is: , where θ is the selection parameter, S is the overall number of comparisons, Max is the maximum value parameter, K is the string width, and α is the fixed parameter value set by the staff.
[0095] Step S105: determining the selection parameter with the largest value according to a preset sorting rule, and extracting text from the comparison string corresponding to the selection parameter to modify the document name.
[0096] The sorting rule is a method set by the staff to sort the size of values, such as the bubble method. The sorting rule can be used to determine the selection parameter with the largest value, that is, the comparison string corresponding to the selection parameter can effectively reflect the document content. At this time, the document name can be modified according to the comparison string.
[0097] Reference Figure 2 , if the number of key points is not less than one, the document-based field extraction method also includes:
[0098] Step S200: obtaining the overall width of each key paragraph.
[0099] The overall paragraph width is the total number of characters in the determined key paragraph. For example, if the key paragraph is "ABCDEFG", the corresponding overall paragraph width is 7.
[0100] Step S201: establishing a movable text delineation interval according to the overall width of the paragraph, and controlling the front end point of the text delineation interval to be aligned with any text in the document.
[0101] The text demarcation interval is an interval that can be used to divide text and has a width equal to the overall width of the paragraph. The front end point of the text demarcation interval is controlled to be aligned with any text in the document to achieve frame selection of different texts.
[0102] Step S202: determining an interval character string according to the text demarcation interval, and determining the interval words of the interval character string and the key words of the key paragraph according to a preset word recognition strategy.
[0103] An interval character string is a character string formed by characters within a defined interval of text. A word recognition strategy is a method for determining words formed by combining adjacent characters in an interval character string. Taking the name of the invention of this application as an example, "A document-based field extraction method and system", the corresponding words that can be obtained include "a", "based on", "document", "field", "extraction", "method", and "system". Therefore, the corresponding interval words are the words obtained after the interval character string passes through the word recognition strategy, and the key words are the words obtained after the key paragraph passes through the word recognition strategy.
[0104] Step S203: comparing the interval words with the key words to determine the overlap ratio, and defining the interval character string whose overlap ratio is greater than a preset reference ratio as a valid character string.
[0105] The overlap ratio is the ratio of the number of words that overlap with the interval words to all the key words. The benchmark ratio is the minimum overlap ratio set by the staff when the interval character string is highly correlated or similar to the key paragraph. When the overlap ratio is greater than the benchmark ratio, it means that the currently defined interval character string is relatively similar to the key paragraph. At this time, it is defined as a valid character string to distinguish between different interval character strings, which is convenient for subsequent analysis.
[0106] Step S204: Counting is performed according to the valid character strings to determine the valid number, and the key paragraphs whose valid number is less than the preset reference required number are converted into normal paragraphs.
[0107] The valid number is the total number of valid character strings determined, and the benchmark requirement number is the minimum valid number set by the staff to identify the key paragraphs as the basis for document naming modification. When the valid number is less than the benchmark requirement number, it means that the current key paragraph is most likely not a normal paragraph. At this time, it will be converted into a normal paragraph to reduce the occurrence of inaccurate document naming in the future.
[0108] Reference Figure 3 , word recognition strategies include:
[0109] Step S300: randomly determining a character in the character string to be analyzed as a starting character.
[0110] The character string for demand analysis is the character string that needs to be determined. For example, when interval words need to be determined as mentioned above, the corresponding character string is the interval character string.
[0111] Step S301: Delimiting recognition and comparison words with a preset fixed width according to the starting characters, and matching the recognition and comparison words with a preset word database to define the successfully matched recognition and comparison words as valid words.
[0112] The fixed width is the width of the word that needs to be determined set by the staff. Generally, the fixed width is set to 2. The recognition comparison word is a word composed of the starting character and the characters adjacent to the back end in the string. Taking the string "ABCDEFG" as an example, when the starting character is B, the determined recognition comparison word is "BC"; the word database is a database that stores a large number of words. The database is established in advance by the staff. A successful match means that the recognition comparison word can be found in the word database. At this time, a valid word is defined to indicate that the determined recognition comparison word exists, so as to facilitate subsequent analysis.
[0113] Step S302: defining characters in a valid word that are not initial characters as accompanying characters, and determining whether the accompanying characters are in another valid word.
[0114] Define accompanying characters to distinguish two different characters. Take the example of the above-mentioned recognition comparison word "BC" for illustration. The corresponding accompanying character is "C". The purpose of the judgment is to know whether a character can form a valid word with two adjacent characters respectively, so as to analyze and determine the words in the normal context.
[0115] Step S3021: If the accompanying character is not in another valid word, the originally determined valid word is maintained.
[0116] When the accompanying character is not in another valid word, it means that the valid word determined at this time is a word in a normal context, and it can be maintained as a determined valid word. The maintained valid word is a word that can be determined in the character string, that is, an interval word in the interval character string.
[0117] Step S3022: If the accompanying character is in another valid word, the accompanying character is defined as an abnormal character, and another character in the valid word other than the abnormal character is defined as a determination character.
[0118] When the accompanying character is in another valid word, it means that one of the two valid words currently determined is a word in an abnormal context and needs further analysis; abnormal characters and judgment characters are defined to distinguish different accompanying characters for subsequent analysis.
[0119] Step S303: Determine whether the character is in another valid word.
[0120] The purpose of the judgment is to find out whether the determined character can only form a valid word with the abnormal character.
[0121] Step S3031: If the determined character is in another valid word, the valid word formed by the determined character and the abnormal character is cancelled.
[0122] When it is determined that the character is in another valid word, it indicates that the character can still form a valid character with the subsequent characters. That is, in this case, the word formed by the character to be determined and the abnormal character is probably not a word in the normal context. At this time, a cancellation operation is performed to reduce the occurrence of inaccurate word determination. For example, there is a string "identical sample". Among them, the words "identical", "same", and "sample" can be determined. In the normal context, the words to be determined should be "identical" and "sample". At this time, when the starting character is "lei", the corresponding abnormal character is "tong". The character to be determined is "yang". Since "yang" and "ben" can form a valid word "sample", the word "same" formed by the abnormal character "tong" and the character to be determined "yang" is cancelled.
[0123] Step S3032: If the character to be determined is not in another valid word, retain the valid word formed by the character to be determined and the abnormal character.
[0124] When the character to be determined is not in another valid word, it indicates that the character can only form a word with the abnormal character. In this case, it is highly probable that the word formed by the character to be determined and the abnormal character conforms to the normal context. Therefore, the formed valid word is retained and maintained.
[0125] Refer to Figure 4 , after the effective quantity is determined, the method for extracting fields from the document further includes:
[0126] Step S400: Calculate according to the overall width of the paragraph and the effective quantity to correct the effective quantity.
[0127] Since the effective strings in the same part will be repeatedly calculated, the currently determined effective quantity will be much higher than the actual effective quantity, and correction processing is required. The larger the overall width of the paragraph, the more times it will be repeatedly calculated. Therefore, the formula for the effective quantity is , where T0 is the corrected effective quantity, T1 is the effective quantity before correction, I is the overall width of the paragraph, and β is a fixed parameter value set by the staff.
[0128] Step S401: Determine whether there are at least two key paragraphs with the same and maximum effective quantity.
[0129] The purpose of the determination is to find out whether there are multiple key paragraphs that meet the requirements.
[0130] Step S4011: If there are not at least two key paragraphs with the same and maximum effective quantity, determine the key paragraph with the maximum effective quantity as the used paragraph.
[0131] When there are not at least two key paragraphs with the same and largest effective number, it means that only one key paragraph has the largest effective number, that is, this key paragraph can better reflect the document content. At this time, it is determined as a used paragraph to make subsequent document name modification more accurate.
[0132] Step S4012: If there are at least two key paragraphs with the same and largest effective number, count the interval words that overlap with the key words in the effective character string to determine the number of word overlaps.
[0133] When there are at least two key paragraphs with the same and largest effective number, it means that there are multiple key paragraphs that meet the requirements and need further analysis; the number of word overlaps is the total number of words in the interval that can be determined to be the same as the key words.
[0134] Step S402: Calculate the number of word overlaps to determine the overall suitability parameter, determine the overall suitability parameter with the largest value according to the sorting rule, and determine the key paragraph corresponding to the overall suitability parameter as the use paragraph.
[0135] The overall suitability parameter is the average value of the number of word overlaps determined in a single key paragraph. The larger the value, the greater the degree of relevance between the key paragraph and the document content. Therefore, the overall suitability parameter with the largest value is determined through sorting rules, and the paragraph to be used is determined based on the overall suitability parameter, so that the overall effect of subsequent document name modification is better.
[0136] Reference Figure 5 After the document name is modified, the document-based field extraction method also includes:
[0137] Step S500: Obtain document header information.
[0138] Document header information refers to the header information implemented in the Word document.
[0139] Step S501: acquiring header text information when the document header information is inconsistent with the preset empty header information.
[0140] Empty header information refers to the document header information when no header is used in a Word document. When the document header information is inconsistent with the empty header information, it means that the document has a header. Some documents will place document-related content in the header, such as "Project Plan"; header text information refers to the header text in the document.
[0141] Step S502: Determine whether the text information of each header is consistent.
[0142] The purpose of the judgment is to find out whether the document describes only one content.
[0143] Step S5021: If the text information of each header is consistent, the text corresponding to the header text information is extracted, and the extracted text is added to the document name as a suffix.
[0144] When the text information of each header is consistent, it means that the document only describes one content. At this time, the text of the header text information can be extracted and added to the document name as a suffix to further refine the document name. For example, if the original document name is "XXX" and the header text information is "Project Plan", then the document name obtained after adding the suffix is "XXX-Project Plan".
[0145] Step S5022: If the text information of each header is not consistent, the original document name is maintained.
[0146] When the text information of each header is not consistent, it means that the correct suffix name cannot be determined. In this case, just maintain the original document name.
[0147] Reference Figure 6 If the text information of each header is not consistent, the document-based field extraction method also includes:
[0148] Step S600: Obtain the document creation address.
[0149] The document creation address is the address where the user wants to keep the corresponding document generated after editing the document content.
[0150] Step S601: forming a header text combination according to different header text information.
[0151] The header text combination is a combination formed by collecting the header text information.
[0152] Step S602: determining a search range according to the document creation address, and obtaining a header text combination of each document within the search range.
[0153] The search scope is the range that includes the document creation address. The specific size of the range is set by the staff based on actual conditions. For example, if the document creation address is in "C:\Users\Administrator\Desktop", the maximum search range is to search within the C drive, and the minimum search range is to search within the "Desktop" folder.
[0154] Step S603: Determine whether there is a document within the search range whose header character combination is consistent with the header character combination of the currently determined document.
[0155] The purpose of the judgment is to find out whether there is a document in the search range that has been named and has the same header as the current document.
[0156] Step S6031: If there is no document within the search range whose header character combination is consistent with the header character combination of the currently determined document, the original document name is maintained.
[0157] When there is no document in the search range whose header text combination is consistent with the header text combination of the currently determined document, it means that the current document name cannot be determined through the previous document. In this case, the original document name can be maintained.
[0158] Step S6032: If there is a document in the search range whose header text combination is consistent with the header text combination of the currently determined document, the corresponding document in the search range is defined as a similar document, and the similar name of the similar document is obtained.
[0159] When there are documents within the search range whose header text combination is consistent with the header text combination of the currently determined document, it means that the name of the current document may be modified through the naming of the previous document, and further analysis is required; similar documents are defined to distinguish different documents for subsequent analysis; similar names are the overall names of similar documents.
[0160] Step S604: Count similar documents to determine the number of similarities, and extract characters based on similar names to determine the number of identical characters.
[0161] The number of similarities is the total number of similar documents determined, and the number of characters is the total number of times a single character appears repeatedly under different similar names. When corresponding characters appear repeatedly under the same similar name, the number of characters is simply increased by one.
[0162] Step S605: Count the number of characters and the number of similarities to determine the character ratio, and determine the characters whose character ratio is greater than a preset required value as extracted characters, and combine the extracted characters to add them to the document name as a suffix.
[0163] The character ratio is the value obtained by dividing the number of characters by the number of similar names. The required value is the minimum character ratio set by the staff to determine when the frequency of occurrence is high. When the character ratio is greater than the required value, it means that the corresponding characters are likely to be named when this type of header appears. At this time, they are determined as extracted characters and combined to be added as a suffix name; for the combination of extracted characters, the order of the number of times each extracted character appears in different similar names can be determined, so as to effectively determine the order of the extracted character combinations, which is convenient for determining a more accurate suffix name.
[0164] Reference Figure 7 Based on the same inventive concept, an embodiment of the present invention provides a document-based field extraction system, including:
[0165] An acquisition module is used to acquire the text display attributes of each text paragraph in the document;
[0166] A processing module, connected to the acquisition module and the judgment module, for storing and processing information;
[0167] A judgment module, connected with the acquisition module and the processing module, for judging the information;
[0168] The processing module determines the paragraphs whose text display attributes are consistent with the preset centering attribute as key paragraphs, and determines the remaining paragraphs as normal paragraphs;
[0169] The processing module counts the key paragraphs to determine the number of key points, and enables the judging module to judge whether the number of key points is less than one;
[0170] If the determination module determines that the number of key points is not less than one, the processing module determines a unique use paragraph in each key paragraph, and extracts text from the use paragraph to modify the document name according to the extracted text;
[0171] If the judging module judges that the number of key points is less than one, the processing module divides each text paragraph according to two adjacent symbols to determine a comparison sentence pattern, and determines a comparison string of random width from front to back in the comparison sentence pattern starting from any character;
[0172] The processing module counts the comparison strings with the same characters in all comparison sentences to determine the total number of comparisons, and counts the characters in the comparison strings to determine the string width;
[0173] The processing module performs calculations based on the overall number of comparisons and the corresponding string widths to determine the selection parameters;
[0174] The processing module determines the selection parameter with the largest value according to the preset sorting rule, and extracts the text of the comparison string corresponding to the selection parameter to modify the document name;
[0175] The paragraph situation analysis module analyzes the specific situation of key paragraphs to update them;
[0176] A word recognition module is used to recognize words in each paragraph;
[0177] Use the paragraph determination module to determine the only paragraph to be used among multiple key paragraphs that meet the requirements;
[0178] The suffix name adding module adds the suffix name of the file according to the header situation;
[0179] The suffix name precision module determines the more accurate suffix name to be added according to the specific situation of the document.
[0180] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0181] An embodiment of the present invention provides a computer-readable storage medium storing a computer program that can be loaded by a processor and execute a document-based field extraction method.
[0182] Computer storage media include, for example, various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
Claims
1. A document-based field extraction method, characterized in that: include: Get the text display properties of each text paragraph in the document; The paragraphs whose text display attributes are consistent with the preset centering attributes are determined as key paragraphs, and the remaining paragraphs are determined as normal paragraphs; Count the key paragraphs to determine the number of key points, and determine whether the number of key points is less than one; If the number of key points is not less than one, a unique use paragraph is determined in each key paragraph, and text is extracted from the use paragraph to modify the document name according to the extracted text; If the number of emphasis points is less than one, each text paragraph is divided according to two adjacent symbols to determine a comparison sentence pattern, and a comparison string of random width is determined from front to back in the comparison sentence pattern starting from any character; In all comparison statements, the number of characters in the comparison string that are the same is counted to determine the total number of comparisons, and the width of the string is determined by counting the characters in the comparison string; The selection parameters are determined by calculating the overall number of comparisons and the corresponding string width; The selection parameter with the largest value is determined according to a preset sorting rule, and the comparison string corresponding to the selection parameter is extracted to modify the document name.
2. The document-based field extraction method according to claim 1, characterized in that: If the number of key points is not less than one, the document-based field extraction method also includes: Get the overall width of each paragraph based on each key paragraph; A movable text demarcation interval is established according to the overall width of the paragraph, and the front end point of the text demarcation interval is controlled to be aligned with any text in the document; Determine the interval character string according to the text demarcation interval, and determine the interval words of the interval character string and the key words of the key paragraph according to the preset word recognition strategy; Compare the interval words with the key words to determine the overlap ratio, and define the interval character string with an overlap ratio greater than a preset benchmark ratio as a valid character string; Counting is performed based on valid character strings to determine the valid number, and key paragraphs whose valid number is less than a preset baseline required number are converted into normal paragraphs.
3. The document-based field extraction method according to claim 2, characterized in that: Word identification strategies include: Randomly determine a character in the character string of the requirement analysis as the starting character; Delimiting the recognition comparison words with a preset fixed width according to the starting characters, and matching the recognition comparison words with a preset word database to define the successfully matched recognition comparison words as valid words; Define the characters in the valid word that are not the starting characters as accompanying characters, and determine whether the accompanying characters are in another valid word; If the accompanying character is not in another valid word, the original valid word is maintained; If the accompanying character is in another valid word, the accompanying character is defined as an abnormal character, and another character in the valid word other than the abnormal character is defined as a determination character; Determine whether the character is in another valid word; If the determined character is in another valid word, the valid word formed by the determined character and the abnormal character is cancelled; If the determined character is not in another valid word, the valid word formed by the determined character and the abnormal character is retained.
4. The document-based field extraction method according to claim 2, characterized in that: After the effective number is determined, the document-based field extraction method also includes: Calculate the effective number based on the overall width of the paragraph and the effective number to correct the effective number; Determine whether there are at least two effective key paragraphs with the same maximum number; If there are not at least two key paragraphs with the same and largest effective number, the key paragraph with the largest effective number will be determined as the used paragraph; If there are at least two key paragraphs with the same and largest effective number, then count the interval words that overlap with the key words in the effective character string to determine the number of word overlaps; The overall suitability parameter is determined by calculating the number of word overlaps, and the overall suitability parameter with the largest value is determined according to the sorting rule, and the key paragraph corresponding to the overall suitability parameter is determined as the use paragraph.
5. The document-based field extraction method according to claim 1, characterized in that: After the document name is modified, the document-based field extraction method also includes: Get document header information; Get the header text information when the document header information is inconsistent with the preset empty header information; Determine whether the text information of each header is consistent; If the text information of each header is consistent, the text corresponding to the header text information is extracted, and the extracted text is added to the document name as a suffix; If the header text information is not consistent, the original document name will be maintained.
6. A document-based field extraction method according to claim 5, characterized in that: If the text information of each header is not consistent, the document-based field extraction method also includes: Get the document creation address; Forming a header text combination according to different header text information; Determine the search scope according to the document creation address, and obtain the header text combination of each document within the search scope; Determine whether there is a document within the search range with a header text combination that is consistent with the header text combination of the currently determined document; If there is no document in the search range whose header text combination is consistent with the header text combination of the currently determined document, the original document name is maintained; If there is a document in the search range whose header character combination is consistent with the header character combination of the currently determined document, the corresponding document in the search range is defined as a similar document, and the similar name of the similar document is obtained; Counting similar documents to determine the number of similarities, and extracting characters based on similar names to determine the number of identical characters; The character proportion is determined by counting the number of characters and the number of similarities, and characters whose character proportion is greater than a preset required value are determined as extracted characters, and the extracted characters are combined to be added to the document name as a suffix.
7. A document-based field extraction system, characterized in that: include: An acquisition module is used to acquire the text display attributes of each text paragraph in the document; A processing module, connected to the acquisition module and the judgment module, for storing and processing information; A judgment module, connected with the acquisition module and the processing module, for judging the information; The processing module determines the paragraphs whose text display attributes are consistent with the preset centering attribute as key paragraphs, and determines the remaining paragraphs as normal paragraphs; The processing module counts the key paragraphs to determine the number of key points, and enables the judging module to judge whether the number of key points is less than one; If the determination module determines that the number of key points is not less than one, the processing module determines a unique use paragraph in each key paragraph, and extracts text from the use paragraph to modify the document name according to the extracted text; If the judging module judges that the number of key points is less than one, the processing module divides each text paragraph according to two adjacent symbols to determine a comparison sentence pattern, and determines a comparison string of random width from front to back in the comparison sentence pattern starting from any character; The processing module counts the comparison strings with the same characters in all comparison sentences to determine the total number of comparisons, and counts the characters in the comparison strings to determine the string width; The processing module performs calculations based on the overall number of comparisons and the corresponding string widths to determine the selection parameters; The processing module determines the selection parameter with the largest value according to a preset sorting rule, and extracts text from the comparison string corresponding to the selection parameter to modify the document name.
8. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Document Processing Apparatus And Document Processing Method
CN104050211A
Information extraction method based on semantic comprehension
CN112528665A