E-book typesetting processing method, electronic device and storage medium
By analyzing and matching the layout documents of e-books, splitting and adding spaces to generate streaming documents, the problem of missing spaces during layout documents is solved, and the user's reading experience is improved.
Patent Information
- Application Number
- CN202210102461.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-01-27
AI Technical Summary
When the prior art converts layout documents into streaming documents, it is easy to cause missing spaces, affecting the user's reading experience, especially when including English, it is difficult for users to distinguish individual words.
By parsing the original text in the e-book layout document, matching words in the preset vocabulary, splitting the target string into a substring, and adding spaces between every two adjacent strings or substrings to generate a streaming document.
It effectively solves the problem of missing spaces when converting layout documents to streaming documents, improves the user's reading experience, especially when processing English text, clarifying the word spacing.
Smart Images

Figure CN114492303B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to an electronic book typesetting processing method, an electronic device, and a storage medium. Background Art
[0002] The layout document format is an electronic document format with a fixed layout presentation effect. The presentation of the layout document is independent of the device. Therefore, the layout document is mainly used for the publication, dissemination and archiving of the document after it is written. When you want to flexibly edit the content in the layout document, you need to convert the layout document into a streaming document.
[0003] Currently, layout documents can be converted into streaming documents after being parsed. However, the lack of spaces in streaming documents causes inconsistencies in user reading, especially when the layout document includes English, it is difficult for users to distinguish each word, resulting in reading difficulties. Therefore, a method for adding spaces is urgently needed. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an e-book typesetting processing method, an electronic device and a storage medium.
[0005] In a first aspect, the present disclosure provides a typesetting processing method for an electronic book, comprising:
[0006] Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text;
[0007] For a target character string in at least one character string, matching the target character string with a preset vocabulary;
[0008] When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination;
[0009] A space is added between every two adjacent strings and every two adjacent substrings to obtain a streaming document of the e-book.
[0010] In a second aspect, the present disclosure provides an electronic device, including a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations:
[0011] Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text;
[0012] For a target character string in at least one character string, matching the target character string with a preset vocabulary;
[0013] When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination;
[0014] A space is added between every two adjacent strings and every two adjacent substrings to obtain a streaming document of the e-book.
[0015] In a third aspect, the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the electronic book typesetting processing method of the first aspect.
[0016] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0017] The typesetting processing method, electronic device and storage medium of the electronic book of the embodiment of the present disclosure can parse the original text contained in the layout document of the electronic book to obtain at least one string contained in the original text, and for the target string in the at least one string, match the target string with a preset vocabulary, and when it is determined that the target string has a first character combination that successfully matches a word in the preset vocabulary, split the target string into multiple substrings according to the first character combination, and add a space between every two adjacent strings and every two adjacent substrings to obtain the streaming document of the electronic book. It can be seen that according to the embodiment of the present disclosure, at least one string can be used as the target string, and the target string can be split into multiple substrings based on the matching result between the target string and the preset vocabulary, and a space is added between every two adjacent strings and every two adjacent substrings, so that the multiple characters contained in the original text are split into multiple words, which is convenient for users to read and improves the reading experience of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0019] Figure 1 A schematic diagram showing a flow chart of a typesetting processing method for an e-book provided by an embodiment of the present disclosure;
[0020] Figure 2 A schematic diagram showing a flow chart of another e-book typesetting processing method provided by an embodiment of the present disclosure;
[0021] Figure 3 A schematic diagram showing a flow chart of another e-book typesetting processing method provided by an embodiment of the present disclosure;
[0022] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0024] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0025] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0026] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0027] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0029] The embodiments of the present disclosure provide an electronic book typesetting processing method, an electronic device, and a storage medium capable of splitting a plurality of characters contained in an original text into a plurality of words.
[0030] Let's first combine Figure 1-3 The typesetting processing method of the electronic book provided by the embodiment of the present disclosure is described.
[0031] The typesetting processing method of an e-book provided in the embodiment of the present disclosure can be executed by an electronic device capable of providing the typesetting processing function of an e-book. The electronic device may include but is not limited to mobile terminals such as smart phones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc.
[0032] Figure 1 A schematic flow chart of a method for typesetting an e-book provided in an embodiment of the present disclosure is shown.
[0033] like Figure 1 As shown, the typesetting processing method of the electronic book may include the following steps.
[0034] S110: Parse the original text contained in the electronic book layout document to obtain at least one character string contained in the original text.
[0035] In the embodiment of the present disclosure, the electronic device may parse the original text contained in the layout document of the electronic book to obtain at least one character string contained in the original text, each of which includes at least one character.
[0036] Specifically, the electronic book may be any electronic book containing words.
[0037] Specifically, the layout document may include various format documents such as a portable document format (PDF) without an editing function, a picture format document, etc., but is not limited thereto.
[0038] Specifically, the original text refers to the text in the layout document of the electronic book.
[0039] In some embodiments, S110 may include: S111, parsing the original text to obtain multiple characters contained in the original text and position information of each character; S112, dividing the multiple characters into at least one character string based on the position information.
[0040] Specifically, by parsing the original text in the layout document of the electronic book, each character contained in the original text and the position information of each character can be obtained. The characters obtained by parsing can be arranged in the streaming document of the electronic book in the parsing order. Under the premise that the parsing result is correct, the number and arrangement order of the characters contained in the streaming document of the electronic book correspond to the number and arrangement order of the characters contained in the layout document of the electronic book.
[0041] Specifically, the position information may include the page coordinates of the characters in the page of the layout document of the electronic book, but is not limited thereto.
[0042] Optionally, S112 may include: determining the character spacing between every two adjacent characters based on the position information; and grouping two adjacent characters whose character spacing is less than a first character spacing threshold into the same character string.
[0043] In some embodiments, the first character spacing threshold may be a fixed value set by those skilled in the art.
[0044] In some other embodiments, the electronic device may determine the first character spacing threshold corresponding to the style information according to the style information of the original text, that is, different first character spacing thresholds need to be set for different style information.
[0045] The style information is used to describe the style of the characters, including, but not limited to, font, font size, font shape and / or color.
[0046] Specifically, the specific implementation steps of setting different first character spacing thresholds for different style information can be as follows: first, cluster the characters contained in the layout document of the electronic book according to the style information to obtain character sets corresponding to each style information. Then, for each character set corresponding to the style information, set the first character spacing threshold corresponding to the style information according to the statistical distribution data of the character spacing between each two adjacent characters in the character set.
[0047] In one example, for each character set corresponding to the style information, the character spacing between each adjacent character in the character set and the frequency of occurrence of each character spacing can be counted; according to the frequency of occurrence of each character spacing, the first character spacing threshold corresponding to the style information is set. Generally, the statistical distribution of character spacing should have two spacing dense intervals, one is the approximate distribution interval corresponding to the character spacing between two adjacent characters in the same word (i.e., the first spacing dense interval), and the other is the approximate distribution interval corresponding to the word spacing between two adjacent words with spaces inserted (i.e., the second spacing dense interval). The first character spacing threshold corresponding to the style information can be determined based on the first spacing dense interval and the second spacing dense interval. For example, the first character spacing threshold corresponding to the style information can be determined based on the middle value between the first spacing dense interval and the second spacing dense interval. The middle value can specifically be the value of the midpoint between the center point of the first interval of the first spacing dense interval and the center point of the second interval of the second spacing dense interval, but is not limited to this.
[0048] It is understandable that, usually, the styles of characters corresponding to different parts of an e-book, such as the title, text, appendix, different chapters, and different paragraphs, are different. Therefore, in the embodiments of the present disclosure, different first character spacing thresholds are set for different style information, which can make the probability that the final divided character string matches a word higher, thereby improving the accuracy of adding a space exactly between two words.
[0049] Specifically, the character spacing between two adjacent characters is compared with the first character spacing threshold corresponding to the style information thereof, and it is determined whether to divide the two characters into the same character string according to the comparison result. For example, if the character spacing between two adjacent characters is greater than or equal to the first character spacing threshold corresponding to the style information thereof, it is determined that the two adjacent characters are divided into different character strings; if the character spacing between two adjacent characters is less than the first character spacing threshold corresponding to the style information thereof, it is determined that the two adjacent characters are divided into the same character string.
[0050] S120 . For a target character string in at least one character string, match the target character string with a preset vocabulary.
[0051] In the embodiment of the present disclosure, for the character string obtained based on S110, the electronic device may use at least one character string as a target character string, and match the target character string with a preset vocabulary.
[0052] Specifically, the preset vocabulary includes a plurality of words.
[0053] In some embodiments, each character string may be used as a target character string.
[0054] In some other embodiments, a character string that meets a preset condition may be used as a target character string.
[0055] Optionally, before S120, the method further includes: S101, determining the total number of characters in each character string; S102, taking a character string whose total number of characters is greater than a preset number threshold as a target character string.
[0056] Specifically, the total number of characters is the total number of characters included in the character string. For example, the character string "love" includes four characters, and the total number of characters in the character string is four.
[0057] Specifically, the specific value of the preset quantity threshold can be set by those skilled in the art according to actual conditions and is not limited here.
[0058] Optionally, the total number of characters of the word with the largest number of characters (ie, the longest word) in the preset vocabulary is used as the preset number threshold.
[0059] It is understandable that when the total number of characters in a string is greater than the total number of characters in the longest word in the preset vocabulary, it indicates that the string as a whole cannot be successfully matched with any word in the preset vocabulary, and the string needs to be split and then matched with the preset vocabulary. When the total number of characters in a string is less than or equal to the total number of characters in the longest word in the preset vocabulary, it indicates that the probability that the string as a whole successfully matches a word in the preset vocabulary is high, that is, the probability that the string is a word is high, and the string can be directly matched with the preset vocabulary as a whole to verify whether the string is a word, or it can be directly assumed to be a word without verification, which is not limited here.
[0060] In one example, for each character string whose total number of characters is less than or equal to a preset number threshold, the entire character string is matched with a preset vocabulary to verify whether the character string is a word. The specific matching methods may include the following two methods, but are not limited thereto.
[0061] The first matching method may be specifically as follows: according to the word arrangement order of the preset vocabulary, the words in the preset vocabulary are compared with the character string one by one until a word that is exactly the same as the character string is matched or the preset vocabulary is traversed.
[0062] Specifically, for the string being matched, the first word in the preset vocabulary is compared with it. If the first word in the preset vocabulary is exactly the same as the string, the match is successful; if the first word in the preset vocabulary is not exactly the same as the string, the second word in the preset vocabulary is compared with it. If the second word in the preset vocabulary is exactly the same as the string, the match is successful; if the second word in the preset vocabulary is not exactly the same as the string, the third word in the preset vocabulary is compared with it, and so on, until a word that is exactly the same as the string is matched or the preset vocabulary is traversed.
[0063] The second matching method can be specifically as follows: for the string being matched, in the preset vocabulary, the words matching each character are filtered in turn according to the character arrangement order of the string, until a word that is exactly the same as the character combination is matched or there is no word to filter.
[0064] Specifically, for the string being matched, words whose first character is the same as the first character of the string are screened out from the preset vocabulary to obtain a candidate word list; from the candidate word list, words whose second character is the same as the second character of the string are screened out to obtain a new candidate word list; from the new candidate word list, words whose third character is the same as the third character of the string are screened out to obtain a new candidate word list; and so on, until a word with exactly the same character combination is matched or there is no word available for screening.
[0065] It is understandable that for each character string whose total number of characters is less than or equal to the preset number threshold, it is matched with the preset vocabulary. If the match is successful, it indicates that the character string is a word. If the match fails, the character string needs to be split and then matched with the preset vocabulary. Therefore, before S120, the method may also include: S103, matching the character string whose total number of characters is less than or equal to the preset number threshold as a whole with the preset vocabulary; S104, taking the character string that failed to match as the target character string.
[0066] S130: When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination.
[0067] Specifically, each first character combination matches a word in the preset vocabulary, that is, the characters and the arrangement order of the characters included in the first character combination are the same as the characters and the arrangement order of the characters included in the word that matches it.
[0068] In some embodiments, S130 may include: splitting different first character combinations into different substrings; and splitting the target character string remaining after splitting the first character combinations into different substrings according to the characters on both sides of the first character combination.
[0069] For example, the target string is "airplayis", and by matching with the preset vocabulary, the first character combination "airplay" and the first character combination "is" are obtained. In this way, the target string "airplayis" can be split into the substring "airplay" and the substring "is".
[0070] For example, the target string is "earefami", and the first character combination "are" is obtained by matching with the preset vocabulary. In this way, the substring "are" corresponding to the first character combination "are" can be split, and the remaining "e" and "fami" are located on both sides of the first character combination "are", so they are split into different substrings respectively, that is, the target string "earefami" is split into the substring "e", the substring "are" and the substring "fami".
[0071] S140: Add a space between every two adjacent character strings and every two adjacent sub-character strings to obtain a streaming document of the electronic book.
[0072] In the embodiment of the present disclosure, the electronic device may add a space between every two adjacent character strings and add a space between every two adjacent sub-character strings, so as to obtain a streaming document of an electronic book.
[0073] Specifically, the streaming document may include documents in various formats such as epub format documents and word format documents, but is not limited thereto.
[0074] Specifically, the specific spacing occupied by the added spaces can be set by those skilled in the art according to actual conditions and is not limited here.
[0075] The typesetting processing method of the electronic book of the embodiment of the present disclosure can parse the original text contained in the layout document of the electronic book to obtain at least one string contained in the original text, and for the target string in the at least one string, match the target string with a preset vocabulary, and when it is determined that the target string has a first character combination that successfully matches a word in the preset vocabulary, split the target string into multiple substrings according to the first character combination, and add a space between every two adjacent strings and every two adjacent substrings to obtain the streaming document of the electronic book. It can be seen that according to the embodiment of the present disclosure, at least one string can be used as the target string, and the target string can be split into multiple substrings based on the matching result between the target string and the preset vocabulary, and a space is added between every two adjacent strings and every two adjacent substrings, so that the multiple characters contained in the original text are split into multiple words, which is convenient for users to read and improves the reading experience of users.
[0076] Figure 2 The flowchart of another e-book typesetting processing method provided by the embodiment of the present disclosure is shown. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0077] like Figure 2As shown, the typesetting processing method of the electronic book may include the following steps.
[0078] S210: Parse the original text contained in the electronic book layout document to obtain at least one character string contained in the original text.
[0079] Specifically, S210 is similar to S110 and will not be described in detail here.
[0080] S220 . For a target character string in at least one character string, split the target character string into multiple character combinations according to a preset splitting method.
[0081] Each character combination includes at least one character.
[0082] S230: For each character combination, match the character combination with a preset vocabulary.
[0083] In the embodiment of the present disclosure, for each target character string, the electronic device may split the target character string into multiple character combinations according to a preset splitting method, and for each character combination, the electronic device may match it with a preset vocabulary.
[0084] In some embodiments, S220 and S230 may include: performing the following operations for each target character string: determining the character spacing between each adjacent two characters in the target character string based on the position information of each character in the target character string, and determining the maximum character spacing from the multiple character spacings corresponding to the target character string, and dividing the target character string into two groups of character combinations in a manner that the adjacent two characters corresponding to the maximum character spacing are respectively divided into different character combinations; matching the two groups of character combinations obtained by the splitting with the preset vocabulary respectively; if the character combination successfully matches a word in the preset vocabulary, the character combination is the first character combination. If at least one character combination fails to match the preset vocabulary, for each character combination that fails to match, determining a new maximum character spacing from the multiple character spacings corresponding to the character combination, and dividing the character combination into two groups of new character combinations in a manner that the adjacent two characters corresponding to the new maximum character spacing value are respectively divided into different character combinations; matching each of the splitting new character combinations with the preset vocabulary respectively; if the new character combination successfully matches a word in the preset vocabulary, the new character combination is the first character combination. If at least one new character combination fails to match the preset vocabulary, return to the step of "for each character combination that fails to match, determine a new maximum character spacing from multiple character spacings corresponding to the character combination, and split the character combination into two new character combinations in a manner that two adjacent characters corresponding to the new maximum character spacing are respectively divided into different character combinations; each of the split new character combinations is treated as a character combination that includes one character combination, and is matched with the preset vocabulary respectively" until each character combination in the target string matches a word in the preset vocabulary, or the character combination that fails to match can no longer be split (that is, the character combination includes only two characters).
[0085] In some other embodiments, S220 may include: performing the following operations for each target character string: determining the character spacing between each two adjacent characters in the target character string based on the position information of each character in the target character string, and classifying the two adjacent characters whose character spacing is less than the second character spacing threshold into the same character combination. S230 may include: matching each group of character combinations with a preset vocabulary.
[0086] Specifically, the second character spacing threshold is less than the first character spacing threshold, and its specific value can be set by those skilled in the art according to actual conditions, and is not limited here. For example, the second character spacing threshold can be greater than the value of the center point of the first interval located in the first spacing dense interval, or the second character spacing threshold can be greater than the upper limit value of the interval located in the first spacing dense interval, but is not limited thereto.
[0087] In some embodiments, matching the character combination with a preset vocabulary includes: comparing the words in the preset vocabulary with the character combination one by one according to the word arrangement order of the preset vocabulary until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
[0088] Specifically, for the character combination being matched, the first word in the preset vocabulary is compared with it. If the first word in the preset vocabulary is exactly the same as the character combination, the match is successful; if the first word in the preset vocabulary is not exactly the same as the character combination, the second word in the preset vocabulary is compared with it. If the second word in the preset vocabulary is exactly the same as the character combination, the match is successful; if the second word in the preset vocabulary is not exactly the same as the character combination, the third word in the preset vocabulary is compared with it, and so on, until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
[0089] In other embodiments, character combinations are matched with a preset vocabulary, including: for each character combination in the character combination, in the preset vocabulary, words that match each character are filtered in turn according to the character arrangement order of the character combination until a word that is exactly the same as the character combination is matched or there are no words to filter.
[0090] Specifically, for the character combination being matched, words whose first character is the same as the first character of the character combination are screened out from the preset vocabulary to obtain a candidate word list; from the candidate word list, words whose second character is the same as the second character of the character combination are screened out to obtain a new candidate word list; from the new candidate word list, words whose third character is the same as the third character of the character combination are screened out to obtain a new candidate word list; and so on, until a word that is exactly the same as the character combination is matched or there is no word to be screened.
[0091] S240: When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination.
[0092] Specifically, for multiple character combinations in each target character string, if at least one character combination successfully matches the preset vocabulary, each character combination that successfully matches the preset vocabulary (i.e., the first character combination) is split into a substring, and each character combination that fails to successfully match the preset vocabulary (i.e., the second character combination) is split into a substring.
[0093] Specifically, for multiple character combinations in each target character string, if each character combination fails to match the preset vocabulary, the target character string may not be split, or each character combination may be split into a substring, which is not limited here.
[0094] S250: Add a space between every two adjacent character strings and every two adjacent sub-character strings to obtain a streaming document of the electronic book.
[0095] Specifically, S250 is similar to S140 and will not be described in detail here.
[0096] In the disclosed embodiment, by splitting the target character string according to a preset splitting method and then matching it with a preset vocabulary, the probability of successful matching of each character combination in the target character string with the preset vocabulary can be increased, thereby increasing the probability that each substring split from the target character string is exactly one word, which is beneficial to improving the accuracy of inserting spaces between two adjacent words.
[0097] Figure 3 A flow chart of another e-book typesetting processing method provided by an embodiment of the present disclosure is shown. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0098] like Figure 3 As shown, the typesetting processing method of the electronic book may include the following steps.
[0099] S310: Parse the original text contained in the electronic book layout document to obtain at least one character string contained in the original text.
[0100] S320 . For a target character string in at least one character string, match the target character string with a preset vocabulary according to a maximum matching method or a minimum matching method.
[0101] In the disclosed embodiment, for each target character string, the electronic device may match the target character string with a preset vocabulary according to a maximum matching method or a minimum matching method to determine whether there is a first character combination in the target character string that successfully matches a word in the preset vocabulary.
[0102] Specifically, the maximum matching method may include a forward maximum matching method or a reverse maximum matching method.
[0103] The process of the forward maximum matching method is as follows: first, a maximum character length is set, and the length of the maximum character length needs to be no greater than the length of the target string to be processed. Generally speaking, the length of the maximum character length can be set based on experience. For example, if the maximum character length is set to n, then n characters can be taken from the target string to be processed from left to right and matched with the preset vocabulary. If the n characters exist in the preset vocabulary, the match is successful, and the n characters are cut out from the target string. The n characters are the first character combination, and n characters are continued to be taken from the remaining target string to be processed from left to right for matching until the target string to be processed is processed; if one of the n characters is not successfully matched, the last character is removed from the n characters, and then matched with the preset vocabulary. If the match is still unsuccessful, the last character is removed from the n-1 characters, and then matched with the preset vocabulary, and the process is repeated. Wherein, assuming that the length of the target string to be processed is m, n should be a natural number greater than 1 and not greater than m.
[0104] The basic principle of the reverse maximum matching method is the same as that of the forward maximum matching method. The difference is that the direction of word segmentation is opposite to that of the forward maximum matching method. The matching scan can start from the end of the target string to be processed, and each time the characters of the maximum character length at the end are taken as the field to be matched. If the match fails, the first character of the field to be matched is removed and the matching continues.
[0105] The following example illustrates the forward maximum matching method.
[0106] For example, the target string is: "Let us go to have dinner".
[0107] For example, the maximum character length is set to 6. First, 6 characters are taken from left to right, and the segmented "Letusg" is obtained. "Letusg" is matched with the preset vocabulary. If the match fails, the last character is removed to obtain "Letus". "Letus" is matched with the preset vocabulary. If the match fails, the last character is removed to obtain "Letu". "Letu" is matched with the preset vocabulary. If the match fails, the last character is removed to obtain "Let". "Let" is matched with the preset vocabulary. If the match succeeds, "Let" is the first character combination. Take the remaining 6 characters from left to right of "usgotohavedinner" to split "usgoto", match "usgoto" with the preset vocabulary, the match fails, remove the last character, get "usgoto", match "usgoto" with the preset vocabulary, the match fails, remove the last character, get "usgot", match "usgot" with the preset vocabulary, the match fails, remove the last character again, get "usgo", match "usgo" with the preset vocabulary, the match fails, remove the last character again, get "usg", match "usg" with the preset vocabulary, the match fails, remove the last character again, get "us", match "us" with the preset vocabulary, the match succeeds, and "Let" is the first character combination. By analogy, the target string has the following six first character combinations that successfully match the word: "Let", "us", "go", "to", "have", "dinner".
[0108] Specifically, the minimum matching method may include a forward minimum matching method or a reverse minimum matching method.
[0109] The process of the forward minimum matching method is as follows: first, a minimum character length is set, and the length of the minimum character length needs to be no greater than the length of the target string to be processed. Generally speaking, the length of the minimum character length can be set based on experience. For example, if the maximum character length is set to p, then p characters can be taken from the target string to be processed from left to right, and matched with the preset vocabulary. If the p characters exist in the preset vocabulary, the match is successful, and the p characters are cut out from the target string. The p characters are the first character combination, and p characters are continued to be taken from the remaining target string to be processed from left to right for matching until the target string to be processed is processed; if one of the p character matches is unsuccessful, a character adjacent to the p characters is taken from the remaining target string to be processed to obtain p+1 characters, and then matched with the preset vocabulary. If the match is still unsuccessful, a character adjacent to the p+1 characters is taken from the remaining target string to be processed to obtain p+2 characters, and the process is repeated. Wherein, assuming that the length of the target string to be processed is q, p should be a natural number greater than 1 and not greater than q.
[0110] The basic principle of the reverse minimum matching method is the same as that of the forward minimum matching method. The difference is that the direction of word segmentation is opposite to that of the forward minimum matching method. The matching scan can start from the end of the target string to be processed, and each time the characters with the minimum character length at the end are taken as the field to be matched. If the match fails, a character is taken from the end of the remaining target string to be processed and added to the field to be matched, and the matching continues.
[0111] The following example illustrates the forward minimum matching method.
[0112] For example, the target string is: "Let us go to have dinner".
[0113] For example, the minimum character length is set to 2. First, take 2 characters from left to right, split "Le", match "Le" with the preset vocabulary, and the match fails. Take "t" from the remaining "tus go to have dinner" and add it to "Le" to get "Let". Match "Let" with the preset vocabulary, and the match is successful. "Let" is the first character combination. Take 2 characters from the remaining "usgotohavedinner" from left to right, split "us", and match "us" with the preset vocabulary. The match is successful, and "us" is the first character combination. Take 2 characters from the remaining "gotohavedinner" from left to right, split "go", and match "go" with the preset vocabulary. The match is successful, and "go" is the first character combination. By analogy, the target string has the following six first character combinations that successfully match the word: "Let", "us", "go", "to", "have", and "dinner".
[0114] S330: When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination.
[0115] Specifically, S230 is similar to S130 and will not be described in detail here.
[0116] S340: Add a space between every two adjacent character strings and every two adjacent sub-character strings to obtain a streaming document of the electronic book.
[0117] Specifically, S240 is similar to S140 and will not be described in detail here.
[0118] In the disclosed embodiment, the maximum matching method or the minimum matching method is used to match the target character string with the preset vocabulary, which can make the matching method simple and easy to operate. In addition, the probability of successful matching of each character combination in the target character string with the preset vocabulary can be increased, thereby increasing the probability that each character string split from the target character string is exactly one word, which is conducive to improving the accuracy of inserting spaces between two adjacent words.
[0119] In another embodiment of the present disclosure, the method further includes: if there is a second character combination in the target character string that fails to match a word in the preset vocabulary, concatenating the second character combination with an adjacent character string to obtain a concatenated character string; using the concatenated character string as a new target character string, and returning to execute the step of matching the target character string with the preset vocabulary.
[0120] Specifically, the second character combination can be concatenated with the right adjacent and / or left adjacent character string (substring) to obtain a concatenated character string. The concatenated character string is used as a new target character string and matched with a preset vocabulary. When it is determined that the concatenated character string has a first character combination that successfully matches a word in the preset vocabulary, the concatenated character string is split into multiple substrings according to the first character combination; and a space is added between every two adjacent substrings of the concatenated character string. It should be noted that the specific implementation method of matching the concatenated character string with the preset vocabulary can be found in the specific implementation method of matching the target character string with the preset vocabulary mentioned above, which is not limited here.
[0121] It is understandable that when splitting multiple characters contained in the original text into strings, or splitting the target string into multiple character combinations, the same word may be split into different character combinations or different strings. Therefore, you can try to concatenate it with adjacent strings (substrings) and then match it with the preset vocabulary to improve the accuracy of inserting spaces between two adjacent words.
[0122] In another embodiment of the present disclosure, the method further includes: after at least one character string is matched with a preset vocabulary, detecting whether there is a target substring in the split substrings that fails to match a word in the preset vocabulary; if there is a target substring, saving the target substring in an unmatched list.
[0123] Specifically, the target substring does not match any word in the preset vocabulary, that is, there is no word in the preset vocabulary that contains the same characters and the same order of characters as the target substring.
[0124] Specifically, the unmatched list may be a list in any form, for example, a vertical or horizontal list, but is not limited thereto.
[0125] It is understandable that the target sub-characters that are not successfully matched are saved in the unmatched list to facilitate subsequent manual inspection of the target sub-string so as to modify the target sub-string or modify the space attached to the target sub-string.
[0126] In another embodiment of the present disclosure, the method further includes: displaying an unmatched list and a streaming document; in response to a selection operation on the unmatched list, determining a marker string selected by the selection operation; updating display content of the streaming document according to a display position of the marker string; and displaying the updated display content according to a preset display mode.
[0127] Specifically, the electronic device can display the unmatched list and the streaming document in any display area, for example, displaying the streaming document in the main display area and displaying the unmatched list in the left column or the right column, but is not limited thereto.
[0128] Specifically, the selection operation on the unmatched list may include gesture operations such as single-clicking or double-clicking on any target character string in the unmatched list, but is not limited thereto.
[0129] Specifically, the marked character string is a target character string selected by the selection operation for the unmatched list.
[0130] Specifically, the display position is the position of the mark character string in the display page when the mark character string is displayed in the display area.
[0131] Specifically, the preset display manner may include highlighting the marked character string, or displaying the marked character string in a style different from other character strings, such as bolding or italicizing the marked character string, etc., but is not limited thereto.
[0132] Specifically, the electronic device can determine a marker string in response to a selection operation on the unmatched list, and determine the display content containing the marker string to be displayed according to the display position of the marker string, so as to replace the current display content with the display content containing the marker string to display the marker string.
[0133] Optionally, the method may further include: displaying the layout document, so that the user can easily proofread and modify the streaming document according to the layout document.
[0134] It can be understood that by displaying the unmatched list and the streaming document, the user can select any target string (i.e., the marked string) in the unmatched list through a selection operation, so that the electronic device displays the marked string in a preset display mode, which is convenient for the user to quickly locate the marked string and then manually change the spaces or characters directly in the streaming document.
[0135] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0136] The electronic device provided by the embodiments of the present disclosure may include an electronic device supporting the typesetting processing function of an electronic book. The electronic device may include, but is not limited to, mobile terminals such as smart phones, laptop computers, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc.
[0137] It should be noted that Figure 4 The electronic device 400 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0138] The electronic device 400 conventionally includes a processor 410 and a computer program product or computer-readable medium in the form of a memory 420. The memory 420 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 420 has a storage space 421 for executable instructions (or program codes) 4211 for executing any method steps in the above-mentioned e-book typesetting processing method. For example, the storage space 421 for executable instructions may include individual executable instructions 4211 respectively used to implement various steps in the above-mentioned e-book typesetting processing method. These executable instructions can be read from or written to one or more computer program products. These computer program products include program code carriers such as a hard disk, a compact disk (CD), a memory card or a floppy disk. Such a computer program product is typically a portable or fixed storage unit. The storage unit may have a storage device 4211 having a storage device 4212 configured to store and store the executable instructions. Figure 4 The memory 420 in the electronic device 400 is similarly arranged as a storage segment or storage space. The executable instructions may be compressed, for example, in an appropriate form. Generally, the storage unit includes executable instructions for executing the steps of the typesetting processing method for an electronic book according to the present disclosure, that is, codes that can be read by a processor such as the processor 410, and when these codes are executed by the electronic device 400, the electronic device 400 executes the various steps in the typesetting processing method for an electronic book described above.
[0139] Of course, to simplify, Figure 4 Only some of the components related to the present disclosure in the electronic device 400 are shown, and components such as a bus, an input / output interface, an input device, an output device, etc. are omitted. In addition, according to specific application situations, the electronic device 400 may also include any other appropriate components.
[0140] The embodiments of the present disclosure also provide a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the typesetting processing method of the e-book provided by each embodiment of the present disclosure.
[0141] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0142] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0143] In the embodiments of the present disclosure, the program code for performing the operations of the present disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0144] This application discloses:
[0145] 1A. A typesetting method for an electronic book, wherein the method comprises:
[0146] Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text;
[0147] For a target character string in the at least one character string, matching the target character string with a preset vocabulary;
[0148] When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination;
[0149] A space is added between every two adjacent character strings and every two adjacent sub-character strings to obtain a streaming document of the electronic book.
[0150] 2A. The method according to 1A, wherein the parsing of the original text contained in the electronic book layout document to obtain at least one string contained in the original text comprises:
[0151] Parsing the original text to obtain multiple characters contained in the original text and position information of each character;
[0152] Based on the position information, the plurality of characters are divided into the at least one character string.
[0153] 3A. The method according to 2A, wherein the dividing the plurality of characters into the at least one string based on the position information comprises:
[0154] Based on the position information, determine the character spacing between every two adjacent characters;
[0155] Two adjacent characters whose character spacing is less than a first character spacing threshold are grouped into the same character string.
[0156] 4A. The method according to 1A, wherein before matching the target character string in the at least one character string with a preset vocabulary, the method further comprises:
[0157] determining the total number of characters in each of said strings;
[0158] A character string whose total number of characters is greater than a preset number threshold is used as the target character string.
[0159] 5A. The method according to any one of items 1A to 4A, wherein matching the target character string with a preset vocabulary comprises:
[0160] Splitting the target character string into multiple character combinations according to a preset splitting method;
[0161] For each group of the character combinations, the character combinations are matched with the preset vocabulary.
[0162] 6A. The method of 5A, wherein matching the character combination with the preset vocabulary comprises:
[0163] According to the word arrangement order of the preset vocabulary, the words in the preset vocabulary are compared with the character combination one by one until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
[0164] 7A. The method according to 5A, wherein the matching the character combination with the preset vocabulary respectively comprises:
[0165] In the preset vocabulary, the words matching each character are screened in turn according to the character arrangement order of the character combination until a word that is exactly the same as the character combination is matched or there is no word available for screening.
[0166] 8A. The method according to 5A, wherein matching the target string with a preset vocabulary comprises:
[0167] The target character string is matched with the preset vocabulary according to the maximum matching method or the minimum matching method.
[0168] 9A. The method according to 1A, wherein the method further comprises:
[0169] If there is a second character combination in the target character string that fails to match a word in the preset vocabulary, concatenate the second character combination with an adjacent character string to obtain a concatenated character string;
[0170] The concatenated character string is used as a new target character string, and the process returns to the step of matching the target character string with a preset vocabulary.
[0171] 10A. The method according to 9A, wherein the method further comprises:
[0172] After the at least one character string is matched with the preset vocabulary, detecting whether there is a target sub-character string that fails to match a word in the preset vocabulary in the split sub-character string;
[0173] If the target substring exists, the target substring is saved in an unmatched list.
[0174] 11A. The method according to 10A, wherein the method further comprises:
[0175] Display the unmatched success list and the streaming document;
[0176] In response to a selection operation on the unmatched list, determining a tag string selected by the selection operation;
[0177] updating the displayed content of the streaming document according to the displayed position of the marked character string;
[0178] The updated display content is displayed according to a preset display mode.
[0179] 12B. An electronic device, comprising a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations:
[0180] Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text;
[0181] For a target character string in the at least one character string, matching the target character string with a preset vocabulary;
[0182] When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination;
[0183] A space is added between every two adjacent character strings and every two adjacent sub-character strings to obtain a streaming document of the electronic book.
[0184] 13B. The electronic device according to 12B, wherein when the processor executes the parsing of the original text contained in the layout document of the electronic book to obtain at least one string contained in the original text, the executable instruction specifically causes the processor to execute:
[0185] Parsing the original text to obtain multiple characters contained in the original text and position information of each character;
[0186] Based on the position information, the plurality of characters are divided into the at least one character string.
[0187] 14B. The method according to 13B, wherein when the processor executes the step of dividing the plurality of characters into the at least one string based on the position information, the executable instruction specifically causes the processor to execute:
[0188] Based on the position information, determine the character spacing between every two adjacent characters;
[0189] Two adjacent characters whose character spacing is less than a first character spacing threshold are grouped into the same character string.
[0190] 15B. The electronic device according to 12B, wherein before the processor performs the matching of the target string in the at least one string with a preset vocabulary, the executable instructions further cause the processor to execute:
[0191] determining the total number of characters in each of said strings;
[0192] A character string whose total number of characters is greater than a preset number threshold is used as the target character string.
[0193] 16B. The electronic device according to any one of 12B to 15B, wherein when the processor performs the matching of the target character string with a preset vocabulary, the executable instruction specifically causes the processor to perform:
[0194] Splitting the target character string into multiple character combinations according to a preset splitting method;
[0195] For each group of the character combinations, the character combinations are matched with the preset vocabulary.
[0196] 17B. The electronic device according to 16B, wherein when the processor performs the matching of the character combination with the preset vocabulary, the executable instructions specifically cause the processor to perform:
[0197] According to the word arrangement order of the preset vocabulary, the words in the preset vocabulary are compared with the character combination one by one until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
[0198] 18B. The electronic device according to 16B, wherein when the processor performs the matching of the character combination with the preset vocabulary respectively, the executable instructions specifically cause the processor to perform:
[0199] In the preset vocabulary, the words matching each character are screened in turn according to the character arrangement order of the character combination until a word that is exactly the same as the character combination is matched or there is no word available for screening.
[0200] 19B. The electronic device according to 16B, wherein when the processor performs the matching of the target string with a preset vocabulary, the executable instructions specifically cause the processor to perform:
[0201] The target character string is matched with the preset vocabulary according to the maximum matching method or the minimum matching method.
[0202] 20B. The electronic device according to 12B, wherein the executable instructions further cause the processor to execute:
[0203] If there is a second character combination in the target character string that fails to match a word in the preset vocabulary, concatenate the second character combination with an adjacent character string to obtain a concatenated character string;
[0204] The concatenated character string is used as a new target character string, and the process returns to the step of matching the target character string with a preset vocabulary.
[0205] 21B. The electronic device according to 20B, wherein the executable instructions further cause the processor to execute:
[0206] After the at least one character string is matched with the preset vocabulary, detecting whether there is a target sub-character string that fails to match a word in the preset vocabulary in the split sub-character string;
[0207] If the target substring exists, the target substring is saved in an unmatched list.
[0208] 22B. The electronic device according to 21B, wherein the executable instructions further cause the processor to execute:
[0209] Display the unmatched success list and the streaming document;
[0210] In response to a selection operation on the unmatched list, determining a tag string selected by the selection operation;
[0211] updating the displayed content of the streaming document according to the displayed position of the marked character string;
[0212] The updated display content is displayed according to a preset display mode.
[0213] 23C. A computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the typesetting processing method of an electronic book described in any one of 1A-11A above.
[0214] The various component embodiments of the present disclosure can be implemented in hardware in all or part of the steps, or implemented in software modules running on one or more processors, or implemented in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiments of the present disclosure. The present disclosure can also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present disclosure can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0215] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0216] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0217] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A typesetting method for an electronic book, characterized in that: The method comprises: Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text; For a target character string in the at least one character string, matching the target character string with a preset vocabulary; When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination; Adding spaces between every two adjacent strings and every two adjacent substrings to obtain a streaming document of the electronic book; The parsing of the original text contained in the electronic book layout document to obtain at least one string contained in the original text includes: Parsing the original text to obtain multiple characters contained in the original text and position information of each character; Based on the position information, determine the character spacing between every two adjacent characters; Two adjacent characters whose character spacing is less than a first character spacing threshold are grouped into the same character string, wherein different first character spacing thresholds correspond to different style information of the original text.
2. The method according to claim 1, characterized in that Before matching the target character string in the at least one character string with a preset vocabulary, the method further includes: determining the total number of characters in each of said strings; A character string whose total number of characters is greater than a preset number threshold is used as the target character string.
3. The method according to claim 1 or 2, characterized in that: The matching of the target character string with a preset vocabulary includes: Splitting the target character string into multiple character combinations according to a preset splitting method; For each group of the character combinations, the character combinations are matched with the preset vocabulary.
4. The method according to claim 3, characterized in that The matching of the character combination with the preset vocabulary includes: According to the word arrangement order of the preset vocabulary, the words in the preset vocabulary are compared with the character combination one by one until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
5. The method according to claim 3, characterized in that: The matching of the character combination with the preset vocabulary respectively includes: In the preset vocabulary, the words matching each character are screened in turn according to the character arrangement order of the character combination until a word that is exactly the same as the character combination is matched or there is no word available for screening.
6. The method according to claim 3, characterized in that: The matching of the target character string with a preset vocabulary includes: The target character string is matched with the preset vocabulary according to the maximum matching method or the minimum matching method.
7. The method according to claim 1, characterized in that The method further comprises: If there is a second character combination in the target character string that fails to match a word in the preset vocabulary, concatenate the second character combination with an adjacent character string to obtain a concatenated character string; The concatenated character string is used as a new target character string, and the process returns to the step of matching the target character string with a preset vocabulary.
8. The method according to claim 7, characterized in that The method further comprises: After the at least one character string is matched with the preset vocabulary, detecting whether there is a target sub-character string that fails to match a word in the preset vocabulary in the split sub-character string; If the target substring exists, the target substring is saved in an unmatched list.
9. The method according to claim 8, characterized in that The method further comprises: Display the unmatched success list and the streaming document; In response to a selection operation on the unmatched list, determining a tag string selected by the selection operation; updating the displayed content of the streaming document according to the displayed position of the marked character string; The updated display content is displayed according to a preset display mode.
10. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory is used to store executable instructions, and the executable instructions enable the processor to perform the following operations: Parsing the original text contained in the electronic book layout document to obtain at least one character string contained in the original text; For a target character string in the at least one character string, matching the target character string with a preset vocabulary; When it is determined that the target character string has a first character combination that successfully matches a word in the preset vocabulary, split the target character string into a plurality of sub-character strings according to the first character combination; Adding spaces between every two adjacent strings and every two adjacent substrings to obtain a streaming document of the electronic book; When the processor executes the parsing of the original text contained in the electronic book layout document to obtain at least one character string contained in the original text, the executable instruction specifically causes the processor to execute: Parsing the original text to obtain multiple characters contained in the original text and position information of each character; Based on the position information, determine the character spacing between every two adjacent characters; Two adjacent characters whose character spacing is less than a first character spacing threshold are grouped into the same character string, wherein different first character spacing thresholds correspond to different style information of the original text.
11. The electronic device according to claim 10, characterized in that: Before the processor performs the step of matching the target character string in the at least one character string with a preset vocabulary, the executable instructions further cause the processor to execute: determining the total number of characters in each of said strings; A character string whose total number of characters is greater than a preset number threshold is used as the target character string.
12. The electronic device according to claim 10 or 11, characterized in that: When the processor performs the matching of the target character string with a preset vocabulary, the executable instruction specifically causes the processor to execute: Splitting the target character string into multiple character combinations according to a preset splitting method; For each group of the character combinations, the character combinations are matched with the preset vocabulary.
13. The electronic device according to claim 12, characterized in that: When the processor performs the matching of the character combination with the preset vocabulary, the executable instruction specifically causes the processor to execute: According to the word arrangement order of the preset vocabulary, the words in the preset vocabulary are compared with the character combination one by one until a word that is exactly the same as the character combination is matched or the preset vocabulary is traversed.
14. The electronic device according to claim 12, characterized in that: When the processor executes the matching of the character combination with the preset vocabulary respectively, the executable instruction specifically causes the processor to execute: In the preset vocabulary, the words matching each character are screened in turn according to the character arrangement order of the character combination until a word that is exactly the same as the character combination is matched or there is no word available for screening.
15. The electronic device according to claim 12, characterized in that: When the processor performs the matching of the target character string with a preset vocabulary, the executable instruction specifically causes the processor to execute: The target character string is matched with the preset vocabulary according to the maximum matching method or the minimum matching method.
16. The electronic device according to claim 10, characterized in that: The executable instructions further cause the processor to execute: If there is a second character combination in the target character string that fails to match a word in the preset vocabulary, concatenate the second character combination with an adjacent character string to obtain a concatenated character string; The concatenated character string is used as a new target character string, and the process returns to the step of matching the target character string with a preset vocabulary.
17. The electronic device according to claim 16, characterized in that: The executable instructions further cause the processor to execute: After the at least one character string is matched with the preset vocabulary, detecting whether there is a target sub-character string that fails to match a word in the preset vocabulary in the split sub-character string; If the target substring exists, the target substring is saved in an unmatched list.
18. The electronic device according to claim 17, characterized in that: The executable instructions further cause the processor to execute: Display the unmatched success list and the streaming document; In response to a selection operation on the unmatched list, determining a tag string selected by the selection operation; updating the displayed content of the streaming document according to the displayed position of the marked character string; The updated display content is displayed according to a preset display mode.
19. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the processor implements the typesetting processing method of the electronic book described in any one of claims 1 to 9.
Citation Information
Patent Citations
Document format transforming method and device
CN103186510A
Layout analyzing method and system
CN104516891A