CN111062186B - Text processing method, device, computer equipment and storage medium - Google Patents

Text processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111062186B
CN111062186B CN201911254200.9A CN201911254200A CN111062186B CN 111062186 B CN111062186 B CN 111062186B CN 201911254200 A CN201911254200 A CN 201911254200A CN 111062186 B CN111062186 B CN 111062186B
Authority
CN
China
Prior art keywords
character string
character
information
current
text information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911254200.9A
Other languages
Chinese (zh)
Other versions
CN111062186A (en
Inventor
姚俊松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN201911254200.9A priority Critical patent/CN111062186B/en
Publication of CN111062186A publication Critical patent/CN111062186A/en
Application granted granted Critical
Publication of CN111062186B publication Critical patent/CN111062186B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • G06F3/1208Improving or facilitating administration, e.g. print management resulting in improved quality of the output result, e.g. print layout, colours, workflows, print preview
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/1244Job translation or job parsing, e.g. page banding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/1253Configuration of print job parameters, e.g. using UI at the client
    • G06F3/1256User feedback, e.g. print preview, test print, proofing, pre-flight checks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Document Processing Apparatus (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application relates to a text processing method, a text processing device, computer equipment and a storage medium, wherein the text information is segmented according to the type and the character position information of each character in the text information by acquiring the text information and the character position information of each character, so as to obtain a character string set formed by each character string; further, acquiring character string position information and width information corresponding to each character string in the text information, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display. The method can display the character strings with complete semantics into the same row, fully utilize the width of the displayed page, improve the aesthetic property and the utilization rate of the page, print the page processed by the processing method, and avoid the waste of paper.

Description

Text processing method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a text processing method, apparatus, computer device, and storage medium.
Background
Due to the limitation of the width of the displayed page, when the text information is too long, the text information is automatically divided into a plurality of lines to be displayed in the page with fixed width. Without any constraint, a semantically complete character string is split into multiple rows for presentation in a page with a high probability.
In the traditional scheme, text information is processed by using a Windows platform default algorithm, and a character string with complete semantics is displayed in the same row. However, when the text information contains Chinese and English and digital symbols, the traditional processing method has calculation errors, cannot fully utilize the page width, not only affects page typesetting, but also occupies more page typesetting when the page text information is printed later, and needs more paper to print, so that resource waste is caused.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a text processing method, apparatus, computer device, and storage medium capable of page width utilization.
A text processing method, the method comprising:
acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
Acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
acquiring character string position information corresponding to each character string in the character string set in the updated text information;
acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the obtaining the character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character, so as to obtain a character string set formed by each character string includes:
acquiring character position information of each character in the updated text information, and identifying the type of each character according to the sequence of the character positions;
When the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string;
when the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
In one embodiment, the set of strings includes numeric strings, after the character string position information corresponding to each character string in the character string set in the updated text information is obtained, the method further comprises the steps of:
reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string;
reading the character string positions of the character strings according to the sequence of the character string positions, and comparing the character string positions of the character strings with the starting position and the ending position of the current digital character string;
when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved;
The character string position of the current character string is obtained after comparison and is used as updated character string position information of the current character string;
and when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
In one embodiment, the method further comprises:
when the same position information exists in the updated character string position information of each character string, deleting the same position information, and reserving one of the same position information to obtain the target character string position information of each character string.
In one embodiment, the obtaining the width information of each character string, taking the character string as a unit, and counting the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string includes:
reading character strings from the character string set according to the sequence of the character string positions;
when the current character string is one of a digital character string and an English character string, acquiring a starting position and a stopping position of the current character string, and determining width information of the current character string according to the starting position and the stopping position;
And adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the obtaining the width information of each character string, taking the character string as a unit, and counting the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string includes:
reading character strings from the character string set according to the sequence of the character string positions;
when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, when the accumulated width information is greater than a preset line width threshold, the replacing the last character string corresponding to the accumulated width information to the next line for display includes:
when the accumulated width statistical value is larger than a preset line width threshold value, recording last bit information corresponding to the accumulated width statistical value;
and determining the insertion position of the line feed symbol according to the last bit information, and replacing the last bit character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the method further comprises:
generating a page after text processing;
and receiving a page printing request, and printing the page after text processing.
A text processing apparatus, the apparatus comprising:
the updated text information acquisition module is used for acquiring the text information to be displayed and the historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
the text information segmentation module is used for acquiring character position information of each character in the updated text information, and segmenting the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
the position information acquisition module is used for acquiring character string position information corresponding to each character string in the character string set in the updated text information;
the accumulated width information statistics module is used for acquiring the width information of each character string, and counting the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
and the line feed module is used for feeding the last character string corresponding to the accumulated width information to the next line for display when the accumulated width information is larger than a preset line width threshold value.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of:
acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
acquiring character string position information corresponding to each character string in the character string set in the updated text information;
acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
acquiring character string position information corresponding to each character string in the character string set in the updated text information;
acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display.
The text processing method, the device, the computer equipment and the storage medium are used for combining the text information to be displayed and the historical displayed text information into updated text information by acquiring the text information to be displayed and the historical displayed text information; acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string; further, acquiring character string position information and width information corresponding to each character string in the updated text information, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display. Compared with the traditional text information processing method, when the text information contains Chinese and English and digital symbols, the method divides the text information into character strings with complete semantics according to different character types and positions of the characters in the text information, calculates the accumulated width information of the character strings with complete semantics according to the position sequence, and when the accumulated width information is larger than a line width threshold value, changes the last character string corresponding to the accumulated width information into the next line for display, so that the character strings with complete semantics can be displayed in the same line, the line changing position can be accurately calculated, the width of a display page can be fully utilized, the attractiveness and the utilization rate of the page can be improved, paper can be saved, and resource waste can be avoided when the page text information is printed later.
Drawings
FIG. 1 is an application scenario diagram of a text processing method in one embodiment;
FIG. 2 is a flow diagram of a text processing method in one embodiment;
FIG. 3 is a schematic diagram of an interface for text message wrapping in one embodiment;
FIG. 4 is a flow diagram of generating updated string location information in one embodiment;
FIG. 5 is a flow chart of generating target string location information in one embodiment;
FIG. 6 is a flow chart of a text processing method according to another embodiment;
FIG. 7 is a diagram of a text wrap display effect obtained by a conventional method in one embodiment;
FIG. 8 is a diagram of a text wrap display effect obtained by the method in one embodiment;
FIG. 9 is a block diagram of a text processing device in one embodiment;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The text processing method provided by the application can be applied to an application environment shown in fig. 1. Wherein the user 102 interacts with a terminal 104, the terminal 104 is connected to a printer 106. Specifically, the terminal 104 obtains text information input by the user 102 in the current display page, and combines the text information currently input by the user 102 and the text information input by the history into updated text information; and acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string. Further, the terminal 104 obtains the corresponding character string position information and width information of each character string in the updated text information, counts the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit, and when the accumulated width information is greater than a preset line width threshold value, changes the last character string corresponding to the accumulated width information to the next line for display, and generates the page after text processing. The user 102 initiates a page print request to the terminal 104. The terminal 104 receives the page print request and controls the printer 106 to print the text-processed page. Wherein, the liquid crystal display device comprises a liquid crystal display device, the terminal 104 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
In one embodiment, as shown in fig. 2, a text processing method is provided, and the method is applied to the terminal in fig. 1 for illustration, and includes the following steps:
step 202, obtaining the text information to be displayed and the historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information.
The text information to be displayed is text information which is currently input by a user on a display page and is not processed by the text processing method. The historical displayed text information is the text information which is input by a user on a display page and is processed by the text processing method. The updated text information is formed by combining the text information to be displayed and the historical displayed text information, and is all text information input by a user on a display page, and the text information is required to be processed and displayed by the text processing method.
Specifically, the terminal acquires text information to be displayed which is currently input by the user, and combines the text information to be displayed which is currently input by the user and historical displayed text information which is input by the user on the same display page into updated text information.
In one embodiment, the user may input the text information to be displayed at a termination location of the historically displayed text information. The terminal acquires text information operation of a user on a current display page, and the text information to be processed on the current display page is used as updated text information. At this time, the character position information of each character in the history displayed text information does not change in the updated text information.
In one embodiment, the user may input the text information to be displayed at a starting location or an intermediate location of the historically displayed text information. The terminal acquires text information operation of a user on a current display page, and the text information to be processed on the current display page is used as updated text information. At this time, the character positions of the respective characters in the history displayed text information after the text information to be displayed in the updated text information may change.
In one embodiment, the user may delete one or more characters from the historical displayed text information. Further, the terminal acquires text information operation of the user on the current display page, and the text information to be processed on the current display page is used as updated text information.
Step 204, obtaining character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string.
Wherein the character position information of each character is the position of each character in the updated text information. For example, the updated text information is "text processing", and then the character position of the character "text" in the updated text information is 0 to 1; the character position of the book in the updated text information is 1 to 2; and so on. The types of each character include characters that need to form a complete semantic string with adjacent characters, as well as independent characters that do not need to be combined with adjacent characters. For example, the updated text information is "ten hours: the two characters 10hours ","1 "and" 0 "need to be combined together to make up the semantic" ten "; similarly, the characters "h", "0", "u", "r" and "s" need to be combined together to form the word "hours".
Specifically, to update the text information as "ten hours: 10hours "as an example, the terminal acquires character position information of each character in the updated text information, as shown in table 1. Wherein the character position information of the character "ten" is 0 to 1, the character position information of the character "small" is 1 to 2, and the like, and the character position information of the character "s" is 10 to 11.
TABLE 1 updating schematic table of character position information of each character in text information
Figure BDA0002307291300000081
Further, the terminal will update the text information for "ten hours" according to the type of each character and the character position information: 10hours "split into" ten "," small "," hour ",": the six characters "," 10 "and" hours "result in a string set consisting of the six strings.
Step 206, obtaining the corresponding character string position information of each character string in the character string set in the updated text information.
Specifically, to update the text information as "ten hours: 10hours "for example, when the terminal divides it into" ten "," small "," hour ",": after the six characters of "," 10 "and" hours ", the corresponding character string position information of the six characters in the updated text information is acquired, as shown in table 2.
TABLE 2 updating a schematic representation of string position information for each string in a text message
Figure BDA0002307291300000082
Wherein, the character string position information of the character string '10' in the updated text information is 4 to 6, and the character string position information of the character string 'hours' in the updated text information is 6 to 11.
Step 208, acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit.
The width information of each character string refers to the width occupied by each character string in the display page, and is determined by the font, the word size and the length of the character string.
Specifically, the width of each character string is calculated according to the font, the font size and the number of characters of each character string. To update the text information to "ten hours: 10hours "for example, assume that the strings" ten "," small "," hour "are calculated: the width of "and" 10 "are both 1, and the width of the character string" hours "is 3. Counting the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string, and when the current character string is ten, the accumulated width information of the current character string is 1; when the current character string is "10", the cumulative width information of the current character string is 5, and so on.
And 210, when the accumulated width information is greater than a preset line width threshold, changing the last character string corresponding to the accumulated width information to the next line for display.
The line width threshold is used for limiting the width of each line of the current updated text information in the display page, so that the current updated text information can be completely displayed in the display page.
Specifically, to update the text information as "ten hours: 10hours "for example, assume that the strings" ten "," small "," hour "are calculated: the width of "and" 10 "are both 1, the width of the character string" hours "is 3, and the line width threshold is 4. Then, when the current string is ": when "the current cumulative width information is 4, that is, not greater than the preset line width threshold (for example, the preset line width threshold is 4), the character string" is not required to be: "change to display in the next row; and continuously counting the accumulated width information of the next character string 10 according to the sequence of the character string positions to obtain the current accumulated width information of 5, wherein the accumulated width information is larger than the preset line width threshold value, so that the current last character string, namely the character string 10, is required to be replaced into the next line for display. The final display result is shown in fig. 3, wherein the first line in the display page displays "ten hours: the second row shows "10hours". All characters in the updated text information may be displayed in the display page under the restriction of the line width threshold.
In the text processing method, the text information to be displayed and the historical displayed text information are combined into updated text information by acquiring the text information to be displayed and the historical displayed text information; acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string; further, acquiring character string position information and width information corresponding to each character string in the updated text information, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display. Compared with the traditional text information processing method, when the text information contains Chinese and English and digital symbols, the method divides the text information into character strings with complete semantics according to different character types and positions of the characters in the text information, calculates the accumulated width information of the character strings with complete semantics according to the position sequence, and when the accumulated width information is larger than a line width threshold value, changes the last character string corresponding to the accumulated width information into the next line for display, so that the character strings with complete semantics can be displayed in the same line, the line changing position can be accurately calculated, the width of a display page is fully utilized, the attractiveness and the utilization rate of the page are improved, page typesetting can be reduced, paper is saved, and resource waste is avoided when the page text information is printed later.
In one embodiment, step 204 includes obtaining character position information of each character in the updated text information, and identifying a type of each character according to a sequence of the character positions; when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string; when the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
Wherein the types of characters include characters that need to form a complete semantic string with adjacent characters, and independent characters that do not need to be combined with adjacent characters. The character types that need to form a complete semantic string with adjacent characters include numeric characters and english characters. Independent characters that need not be combined with adjacent characters include chinese characters, punctuation marks, and the like.
Specifically, when the current character type is a numeric character or an english character, it is required to determine whether the current character and the adjacent character of the current character are the same type of character, and when the current character type is the same as the adjacent character type, the current character and the adjacent character of the current character are divided into the same character string, otherwise, the current character is used as a character string. For example, the updated text information is "21 word6 book", and when the current character is "1", its adjacent characters are "2" and "text", wherein the adjacent character "2" and the current character "1" both belong to numeric characters, and the character "text" and "1" do not belong to the same type of character, and thus, the characters "2" and "1" are divided into one character string. When the current character is "6", its adjacent characters are "d" and "book", and none of the characters belongs to the same type as the current character "6", and therefore, the current character "6" is taken as one character string. When the current character type is not a numeric character or an English character, the current character is used as a character string, such as a character 'text' and a character 'book'.
In the embodiment, by utilizing the type and the character position information of the characters, adjacent characters of the same type in the updated text information are combined into a character string with complete semantics, and then the character string is segmented, so that the character string with complete semantics is not split into different rows to be displayed when the updated text information is in line feed, and the rationality of displaying the text information is improved.
In one embodiment, the set of strings includes numeric strings, and after step 206, the method further includes: the starting position and the ending position of each digital character string are read according to the sequence of the character string positions, obtaining a starting position NS and a terminating position NE of the current digital character string; reading the character string position CP of each character string according to the sequence of the character string positions, and comparing the character string position CP of each character string with the starting position NS and the ending position NE of the current digital character string; when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved, and the character string position of the current character string obtained after comparison is used as updated character string position information of the current character string; when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
When the character type and character position information are utilized to divide the updated text information, when the digital character string contains decimal points, negative signs and other special symbols, the character type is different, so that the digital character string with complete semantics is divided into a plurality of character strings, and the division precision is lower. Therefore, the character strings obtained by original segmentation are compared with the digital character strings with complete semantics, and the character string position information of each character string is updated.
Specifically, assuming that the updated text information is "time 5.641 searches", when the updated text information is divided by the type of character and the character position information, "5.641" is divided into "5", "641", and therefore, the program shown in fig. 4 needs to be executed to further process the updated text information. In step 402, the start position NS and the end position NE of the first digital string "5.641" are extracted from the updated text message "time 5.641 sends 87" according to the position sequence of the digital strings. According to step 206, the start position NS of the numeric string "5.641" in the updated text message is 2 and the end position NE is 7. Proceeding to step 404, extracting the character string position CP of the first character string "when" according to the character string position sequence, obtaining the position of the current character string as 0 to 1, proceeding to step 406, determining whether the current CP is in the current NS and NE. Since 0 and 1 are not between 2 and 7, the process proceeds to step 410, where the CP of the next string "between" is read, resulting in the current CP being 1 to 2. Step 412 is then performed to determine whether the current string is the last string in the updated text message, and if the string "between" is not the last string in the updated text message, step 406 is performed back to determine whether the current CP is in the current NS and NE. With this loop, by the time string "5" is extracted, the CP of string "5" is 2 to 3, and since 3 is between 2 and 7, step 408 is performed, assigning 3 to 7, resulting in updated string positions of 2 to 7 for string 5. Similarly, the string positions of the strings "," and "641" are updated to 7 as shown in table 3.
TABLE 3 comparison schematic form of string position information before and after update
Character string Time of day Interval (C) 5 . 641 secends 87
Character string position information 0 1 2 3 4 7 14 16
Updating string position information 0 1 2 7 7 7 14 16
In this embodiment, the initial position and the final position of the numeric string are used to update the string position information of each string obtained by original segmentation, and the position information of the strings with complete semantics is combined, so that the string segmentation precision of the updated text information is improved, and the reasonability of line feed of the updated text information is improved.
In one embodiment, when the same position information exists in the updated character string position information of each character string, deleting the same position information, and reserving one of the same position information to obtain the target character string position information of each character string.
Specifically, taking the updated string position information of each string shown in table 3 as an example, the updated string position information has the same position information, so that the updated string position information is further processed to combine the semantically complete numeric strings together.
In one embodiment, a program as shown in fig. 5 may be executed on the updated string position information, deleting the same updated string position information in each string. Step 502, reading updated character string position information CP corresponding to each character string and updated character string position information CNP of the next character string according to the sequence of the character string positions. Step 504, when the current CP is equal to the current CNP, proceeding to step 506, deleting the current CNP; otherwise, step 508 is entered. After step 506 is performed, step 508 is also entered after the current CNP is deleted. Step 508, judging whether the current CNP is the last updated character string position information, if so, generating target character string position information; otherwise, returning to step 502, the updated string position information CP and the corresponding CNP of the next string are continuously read according to the sequence of the string positions. Taking the updated string position information of each string shown in table 3 as an example, when the current string is "," both the current CP and CNP are 7; similarly, when the current string is "641", both the current CP and CNP are 7, so that the corresponding CNP needs to be deleted to obtain the target string position information, as shown in table 4. It is understood that the character strings "5", "" and "641" are combined into "5.641" after the flow process shown in fig. 5.
TABLE 4 schematic table of target string position information
Character string Time of day Interval (C) 5.641 secends 87
Target string position information 0 1 2 7 14 16
In this embodiment, the position information of the updated character string of each character string is deleted, and the position information of the character strings of the same position information is combined, so that the character strings which are split originally are combined into a character string with complete semantics, the character string segmentation precision of the updated text information is improved, and the line feed of the updated text information is more reasonable.
In one embodiment, step 208 includes: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is one of a digital character string and an English character string, acquiring a starting position and a termination position of the current character string, and determining width information of the current character string according to the starting position and the termination position; and adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
Specifically, when the current character string is a data character string and an english character string, it is necessary to calculate width information of the current character string according to the number of characters of the character string. The length of the character string is determined by the starting position and the ending position, and the number of characters of the current character string is obtained by subtracting the starting position from the ending position. Assuming that the current string is the digital string "1234", each digital character occupies a width of 0.5, then the current digital string has a width of 2. Further, the width information of the current digital character string is added with the last accumulated width statistical value to obtain the current accumulated width statistical value.
In this embodiment, by identifying the type of the current string, when the current string is a digital string and an english string, the width information of the current string is calculated by using the start position and the end position of the current string, so as to avoid gradually accumulating the width information of each character when calculating the accumulated width statistics value, and improve the efficiency of calculating the current accumulated width statistics value.
In one embodiment, step 208 includes: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
The measurement unit refers to width information occupied by one character in the current display page.
Specifically, when the current character string is not a numeric character string or an English character string, the current character string is an independent character which does not need to form complete semantics with adjacent characters, so that when the current accumulated width statistical value is calculated, the current width which is added with one character only needs to be calculated according to the starting position and the ending position of the character string is not needed.
In this embodiment, when the current character string is not a numeric character string or an english character string, the last cumulative width statistic is directly added to the width of a character, so that the efficiency of calculating the current cumulative width statistic is improved.
In one embodiment, step 210 includes: when the accumulated width statistical value is larger than a preset line width threshold value, recording last bit information corresponding to the accumulated width statistical value; and determining the insertion position of the line feeding symbol according to the last bit information, and switching the last bit character string corresponding to the accumulated width information to the next line for display.
Wherein, the line connector is used for displaying the content after the line connector in the next line.
Specifically, when the current accumulated width statistic value is greater than a preset line width threshold value, recording character string position information of a current character string corresponding to the current accumulated width statistic value. Inserting a line-feed character before the character string position of the current character string, and switching the current character string and other character strings after updating the current character string in the text information to the next line for display.
In this embodiment, by inserting the line feed symbol before the string position of the current string corresponding to the current cumulative width statistic value greater than the preset line width threshold value, the current string and other strings after updating the current string in the text information can be replaced to be displayed in the next line, so that the situation that the updated text information cannot be completely displayed in the current display page is avoided, and the rationality of text information display is improved.
In one embodiment, after processing the page text information, the method further comprises: generating a page after text processing; and receiving a page printing request, and printing the page after text processing.
Wherein the page print request may be initiated by the user clicking a print button on the text information page.
Specifically, after generating the text-processed page, the user may operate the terminal to initiate a page print request. After receiving the page printing request, the terminal controls the printer to print the page after text processing through USB connection.
In one embodiment, the text processing method described above may be applied in ERP (Enterprise Resources Planning, enterprise management System). The ERP system integrates resources such as material resources, human resources, financial resources, information resources and the like, and achieves enterprise management integration. In the actual working process, enterprise staff often need to print text information in the ERP system, such as material order data, enterprise trade and the like. By adopting the text processing method, the text line feed position can be accurately calculated, the typesetting of the text information page can be adjusted, paper can be saved during printing, and resource waste is avoided.
In the embodiment, the page after text processing is generated, and the page is printed, so that page typesetting can be reduced, paper is saved, and resource waste is avoided.
In one embodiment, as shown in fig. 6, a text processing method is provided, and the method is applied to the terminal in fig. 1 for illustration, and includes the following steps:
step 602, obtaining text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
step 604, obtaining character position information of each character in the updated text information, and identifying the type of each character according to the sequence of the character positions;
step 606, when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string;
step 608, when the type of the current character is not a numeric character or an English character, the current character is used as a character string;
Step 610, obtaining the corresponding character string position information of each character string in the character string set in the updated text information;
step 612, reading the starting position and the ending position of each digital character string according to the sequence of the character string positions, and obtaining the starting position and the ending position of the current digital character string;
step 614, reading the character string positions of each character string according to the sequence of the character string positions, and comparing the character string positions of each character string with the starting position and the ending position of the current digital character string;
step 616, when the current string position is located between the start position and the end position of the current digital string, assigning the end position of the current digital string to the string position corresponding to the current string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved;
step 618, the character string position of the current character string obtained after comparison is used as the updated character string position information of the current character string;
step 620, when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string;
Step 622, deleting the same position information when the same position information exists in the updated character string position information of each character string, and reserving one of the same position information to obtain the target character string position information of each character string;
step 624, reading the character strings in the character string set according to the sequence of the target character string positions;
step 626, when the current character string is one of a digital character string and an English character string, acquiring a target starting position and a target ending position of the current character string, and determining width information of the current character string according to the target starting position and the target ending position;
step 628, adding the width information of the current string to the last cumulative width statistic to obtain a current cumulative width statistic;
step 630, when the current character string is not the numeric character string or the English character string, adding a measurement unit to the last cumulative width statistic value to obtain the current cumulative width statistic value;
step 632, recording last bit information corresponding to the accumulated width statistic when the accumulated width statistic is greater than a preset line width threshold;
step 634, determining the insertion position of the line feed character according to the last bit information, and changing the last bit character string corresponding to the accumulated width information to the next line for display, so as to generate a page after text processing;
In step 636, a page print request is received, and the text-processed page is printed.
In one embodiment, the current display page has a width of 151px (pixels), the updated text information is "AG-1K2121 (62740)/GT/0.45/white/yellow/500", the font is Song Ti, and the font size is No. 12. Processing the updated text information using conventional methods to obtain a text display effect map as shown in fig. 7; the updated text information is processed by the method, and a text display effect diagram shown in fig. 8 is obtained. Wherein the underline next to the character in fig. 7 is used to mark the wasted line area when the updated text information is line fed. By comparing fig. 7 and fig. 8, it can be known that the method can be used for processing the updated text information, so that the line-feeding position can be calculated more accurately, the line area of each line can be utilized more effectively, the occupied line number is less, the aesthetic property and the utilization rate of the page are improved, and the page typesetting is reduced and the paper is saved when a large amount of text information is printed subsequently.
In the embodiment, the text information to be displayed and the historical displayed text information are combined into updated text information by acquiring the text information to be displayed and the historical displayed text information; acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string; further, acquiring character string position information and width information corresponding to each character string in the updated text information, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display. Compared with the traditional text information processing method, when the text information contains Chinese and English and digital symbols, the method divides the text information into character strings with complete semantics according to different character types and positions of the characters in the text information, calculates the accumulated width information of the character strings with complete semantics according to the position sequence, and when the accumulated width information is larger than a line width threshold value, changes the last character string corresponding to the accumulated width information into the next line to be displayed, generates a page after the text processing, and prints the page after the text processing after receiving a page printing request, so that the character strings with complete semantics can be displayed in the same line, the line changing position can be accurately calculated, the width of the displayed page can be fully utilized, the aesthetic property and the utilization rate of the page can be improved, the page typesetting can be reduced, the paper can be saved, and the resource waste can be avoided when the page text information is printed later.
It should be understood that, although the steps in the flowcharts of fig. 2 and 4-6 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps of fig. 2, 4-6 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily occur in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 9, there is provided a text processing apparatus 900 comprising: an update text information acquisition module 901, a text information segmentation module 902, a location information acquisition module 903, an accumulated width information statistics module 904, and a line feed module 905, wherein:
the updated text information obtaining module 901 is configured to obtain text information to be displayed and historical displayed text information, and combine the text information to be displayed and the historical displayed text information into updated text information;
The text information segmentation module 902 is configured to obtain character position information of each character in the updated text information, segment the updated text information according to the type and the character position information of each character, and obtain a character string set formed by each character string;
a position information obtaining module 903, configured to obtain character string position information corresponding to each character string in the character string set in the updated text information;
the accumulated width information statistics module 904 is configured to obtain width information of each string, and count accumulated width information of each string according to an order of string positions corresponding to each string in units of strings;
and a line feed module 905, configured to feed the last character string corresponding to the accumulated width information to the next line for display when the accumulated width information is greater than a preset line width threshold.
In one embodiment, the text information segmentation module 902 is further configured to obtain character position information of each character in the updated text information, and identify a type of each character according to a sequence of the character positions; when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string; when the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
In one embodiment, the text processing device 900 further includes a string position information updating module 906, configured to read a start position and an end position of each digital string according to a sequence of the string positions, to obtain a start position and an end position of the current digital string; reading the character string positions of the character strings according to the sequence of the character string positions, and comparing the character string positions of the character strings with the starting position and the ending position of the current digital character string; when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved; the character string position of the current character string is obtained after comparison and is used as updated character string position information of the current character string; when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
In one embodiment, the string location information updating module 906 is further configured to delete the same location information when the same location information exists in the updated string location information of each string, and reserve one of the same location information to obtain the target string location information of each string.
In one embodiment, the cumulative width information statistics module 904 is further configured to read the strings from the string set according to the sequence of the string positions; when the current character string is one of a digital character string and an English character string, acquiring a starting position and a termination position of the current character string, and determining width information of the current character string according to the starting position and the termination position; and adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the cumulative width information statistics module 904 is further configured to read the strings from the string set according to the sequence of the string positions; when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the line feed module 905 is further configured to record last bit information corresponding to the accumulated width statistics when the accumulated width statistics is greater than a preset line width threshold; and determining the insertion position of the line feeding symbol according to the last bit information, and switching the last bit character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the text processing apparatus 900 further includes a print module 907 for generating a text processed page; and receiving a page printing request, and printing the page after text processing.
For specific limitations of the text processing apparatus, reference may be made to the above limitations of the text processing method, and no further description is given here. The respective modules in the above-described text processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and an internal structure diagram thereof may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a text processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information; acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string; acquiring character string position information corresponding to each character string in the character string set in the updated text information; acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring character position information of each character in the updated text information, and identifying the type of each character according to the sequence of the character positions; when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string; when the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
In one embodiment, the processor when executing the computer program further performs the steps of: the character string set comprises digital character strings, after the character string position information corresponding to each character string in the character string set in the updated text information is obtained, the starting position and the ending position of each digital character string are read according to the sequence of the character string positions, and the starting position and the ending position of the current digital character string are obtained; reading the character string positions of the character strings according to the sequence of the character string positions, and comparing the character string positions of the character strings with the starting position and the ending position of the current digital character string; when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved; the character string position of the current character string is obtained after comparison and is used as updated character string position information of the current character string; when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
In one embodiment, the processor when executing the computer program further performs the steps of: when the same position information exists in the updated character string position information of each character string, deleting the same position information, and reserving one of the same position information to obtain the target character string position information of each character string.
In one embodiment, the processor when executing the computer program further performs the steps of: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is one of a digital character string and an English character string, acquiring a starting position and a termination position of the current character string, and determining width information of the current character string according to the starting position and the termination position; and adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the processor when executing the computer program further performs the steps of: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the processor when executing the computer program further performs the steps of: when the accumulated width statistical value is larger than a preset line width threshold value, recording last bit information corresponding to the accumulated width statistical value; and determining the insertion position of the line feeding symbol according to the last bit information, and switching the last bit character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the processor when executing the computer program further performs the steps of: generating a page after text processing; and receiving a page printing request, and printing the page after text processing.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information; acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string; acquiring character string position information corresponding to each character string in the character string set in the updated text information; acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit; and when the accumulated width information is larger than a preset line width threshold value, changing the last character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring character position information of each character in the updated text information, and identifying the type of each character according to the sequence of the character positions; when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string; when the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
In one embodiment, the processor when executing the computer program further performs the steps of: the character string set comprises digital character strings, after the character string position information corresponding to each character string in the character string set in the updated text information is obtained, the starting position and the ending position of each digital character string are read according to the sequence of the character string positions, and the starting position and the ending position of the current digital character string are obtained; reading the character string positions of the character strings according to the sequence of the character string positions, and comparing the character string positions of the character strings with the starting position and the ending position of the current digital character string; when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved; the character string position of the current character string is obtained after comparison and is used as updated character string position information of the current character string; when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
In one embodiment, the processor when executing the computer program further performs the steps of: when the same position information exists in the updated character string position information of each character string, deleting the same position information, and reserving one of the same position information to obtain the target character string position information of each character string.
In one embodiment, the processor when executing the computer program further performs the steps of: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is one of a digital character string and an English character string, acquiring a starting position and a termination position of the current character string, and determining width information of the current character string according to the starting position and the termination position; and adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the processor when executing the computer program further performs the steps of: reading the character strings in the character string set according to the sequence of the character string positions; when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
In one embodiment, the processor when executing the computer program further performs the steps of: when the cumulative width statistic is greater than the preset line width threshold, recording last bit information corresponding to the accumulated width statistical value; and determining the insertion position of the line feeding symbol according to the last bit information, and switching the last bit character string corresponding to the accumulated width information to the next line for display.
In one embodiment, the processor when executing the computer program further performs the steps of: generating a page after text processing; and receiving a page printing request, and printing the page after text processing.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (11)

1. A text processing method, the method comprising:
acquiring text information to be displayed and historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
acquiring character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
Acquiring character string position information corresponding to each character string in the character string set in the updated text information;
acquiring width information of each character string, and counting accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
when the accumulated width statistical value is larger than a preset line width threshold value, recording last bit information corresponding to the accumulated width statistical value;
and determining the insertion position of the line feed symbol according to the last bit information, and replacing the last bit character string corresponding to the accumulated width information to the next line for display.
2. The method of claim 1, wherein the obtaining the character position information of each character in the updated text information, and dividing the updated text information according to the type and the character position information of each character, to obtain the character string set composed of each character string comprises:
acquiring character position information of each character in the updated text information, and identifying the type of each character according to the sequence of the character positions;
when the type of the current character is one of a digital character and an English character, extracting adjacent characters of the current character from the updated text information according to the character position information of the current character; when the type of the current character is the same as the type of the adjacent character of the current character, dividing the current character and the adjacent character of the current character into the same character string;
When the type of the current character is not a numeric character or an English character, the current character is taken as a character string.
3. The method of claim 1, wherein the set of strings includes numeric strings, and further comprising, after the obtaining the string position information corresponding to each string in the set of strings in the updated text information:
reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string;
reading the character string positions of the character strings according to the sequence of the character string positions, and comparing the character string positions of the character strings with the starting position and the ending position of the current digital character string;
when the current character string position is located between the starting position and the ending position of the current digital character string, the ending position of the current digital character string is endowed with the character string position corresponding to the current character string; when the current character string position is not located between the starting position and the ending position of the current digital character string, the character string position of the current character string is reserved;
the character string position of the current character string is obtained after comparison and is used as updated character string position information of the current character string;
And when the current character string is the last character string of the updated text information, executing the step of reading the starting position and the ending position of each digital character string according to the sequence of the character string positions to obtain the starting position and the ending position of the current digital character string.
4. A method according to claim 3, characterized in that the method further comprises:
when the same position information exists in the updated character string position information of each character string, deleting the same position information, and reserving one of the same position information to obtain the target character string position information of each character string.
5. The method of claim 1, wherein the obtaining the width information of each of the strings, and counting the cumulative width information of each of the strings by the sequence of the string positions corresponding to each of the strings in units of strings, comprises:
reading character strings from the character string set according to the sequence of the character string positions;
when the current character string is one of a digital character string and an English character string, acquiring a starting position and a stopping position of the current character string, and determining width information of the current character string according to the starting position and the stopping position;
And adding the width information of the current character string with the last accumulated width statistical value to obtain the current accumulated width statistical value.
6. The method of claim 1, wherein the obtaining the width information of each of the strings, and counting the cumulative width information of each of the strings by the sequence of the string positions corresponding to each of the strings in units of strings, comprises:
reading character strings from the character string set according to the sequence of the character string positions;
when the current character string is not the numeric character string and the English character string, adding one measurement unit to the last accumulated width statistical value to obtain the current accumulated width statistical value.
7. The method of claim 1, wherein the obtaining the width information of the respective character strings comprises:
and calculating the width information corresponding to each character string according to the fonts, the word sizes and the number of the characters corresponding to the same character string.
8. The method according to claim 1, wherein the method further comprises:
generating a page after text processing;
and receiving a page printing request, and printing the page after text processing.
9. A text processing apparatus, the apparatus comprising:
the updated text information acquisition module is used for acquiring the text information to be displayed and the historical displayed text information, and combining the text information to be displayed and the historical displayed text information into updated text information;
the text information segmentation module is used for acquiring character position information of each character in the updated text information, and segmenting the updated text information according to the type and the character position information of each character to obtain a character string set formed by each character string;
the position information acquisition module is used for acquiring character string position information corresponding to each character string in the character string set in the updated text information;
the accumulated width information statistics module is used for acquiring the width information of each character string, and counting the accumulated width information of each character string according to the sequence of the character string positions corresponding to each character string by taking the character string as a unit;
the line feed module is used for recording last bit information corresponding to the accumulated width statistical value when the accumulated width statistical value is larger than a preset line width threshold value;
and the line feed module is also used for determining the insertion position of the line feed symbol according to the last bit information and converting the last bit character string corresponding to the accumulated width information into the next line for display.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 8 when the computer program is executed by the processor.
11. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 8.
CN201911254200.9A 2019-12-06 2019-12-06 Text processing method, device, computer equipment and storage medium Active CN111062186B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911254200.9A CN111062186B (en) 2019-12-06 2019-12-06 Text processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911254200.9A CN111062186B (en) 2019-12-06 2019-12-06 Text processing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111062186A CN111062186A (en) 2020-04-24
CN111062186B true CN111062186B (en) 2023-07-07

Family

ID=70300253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911254200.9A Active CN111062186B (en) 2019-12-06 2019-12-06 Text processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111062186B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111626037A (en) * 2020-05-25 2020-09-04 北京达佳互联信息技术有限公司 Font typesetting method and device, electronic equipment and storage medium
CN112258594A (en) * 2020-10-23 2021-01-22 北京字节跳动网络技术有限公司 Character display method and device, electronic equipment and computer readable storage medium
CN112596692A (en) * 2020-12-16 2021-04-02 湖南新云网科技有限公司 Character display method, device and equipment and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109308146A (en) * 2017-07-27 2019-02-05 株洲中车时代电气股份有限公司 A kind of character string adaptivenon-uniform sampling display methods and system based on control property
CN110135429A (en) * 2019-04-18 2019-08-16 深圳壹账通智能科技有限公司 Scan text segmentation method, device, computer equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786308A (en) * 2014-12-26 2016-07-20 阿里巴巴集团控股有限公司 Character string display method and apparatus
CN106873925A (en) * 2015-12-10 2017-06-20 北京国双科技有限公司 The display methods and device of label text
CN109545183A (en) * 2018-11-23 2019-03-29 北京羽扇智信息科技有限公司 Text handling method, device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109308146A (en) * 2017-07-27 2019-02-05 株洲中车时代电气股份有限公司 A kind of character string adaptivenon-uniform sampling display methods and system based on control property
CN110135429A (en) * 2019-04-18 2019-08-16 深圳壹账通智能科技有限公司 Scan text segmentation method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111062186A (en) 2020-04-24

Similar Documents

Publication Publication Date Title
CN111062186B (en) Text processing method, device, computer equipment and storage medium
TWI663553B (en) Method and device for generating contract
CN101984419B (en) Method and device for reforming paragraphs of webpage picture content
CN103455475B (en) Composition method, equipment and system
CN109815452B (en) Text comparison method and device, storage medium and electronic equipment
CN109597571B (en) Data storage method, data reading method, data storage device, data reading device and computer equipment
CN102081594B (en) Equipment and method for extracting enclosing rectangles of characters from portable electronic documents
CN109933751B (en) Image-text drawing method and device, computer-readable storage medium and computer equipment
CN110188337B (en) Revision labeling method, device, equipment and computer readable storage medium
CN113076731A (en) Report file generation method and device, computer equipment and storage medium
CN113033165B (en) Method, device and computer readable storage medium for analyzing electronic form file
JP2019169137A (en) Title inferencer
CN110245570B (en) Scanned text segmentation method and device, computer equipment and storage medium
CN116644729A (en) Table file processing method, apparatus, computer device and storage medium
EP2637109A1 (en) Method for improving rendering speed of browser page
CN104536947A (en) Layout document processing method and device
CN112949290A (en) Text error correction method and device and communication equipment
CN115577683B (en) HTML rich text content conversion method, device, equipment and medium
JP5715172B2 (en) Document display device, document display method, and document display program
CN110135429A (en) Scan text segmentation method, device, computer equipment and storage medium
CN111414728B (en) Numerical data display method, device, computer equipment and storage medium
CN106294431A (en) The automatic intercept method of a kind of field and device
JP5885956B2 (en) Font matching
CN113095047A (en) Experiment report generation method and device, computer equipment and storage medium
CN109446055B (en) Printing program testing method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant