CN114692592A - Word information processing method and device - Google Patents

Word information processing method and device Download PDF

Info

Publication number
CN114692592A
CN114692592A CN202210359485.8A CN202210359485A CN114692592A CN 114692592 A CN114692592 A CN 114692592A CN 202210359485 A CN202210359485 A CN 202210359485A CN 114692592 A CN114692592 A CN 114692592A
Authority
CN
China
Prior art keywords
word
line
current line
bytes
accommodated
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.)
Pending
Application number
CN202210359485.8A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202210359485.8A priority Critical patent/CN114692592A/en
Publication of CN114692592A publication Critical patent/CN114692592A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/191Automatic line break hyphenation
    • 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • G06F3/0482Interaction with lists of selectable items, e.g. menus
    • 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/04847Interaction techniques to control parameter settings, e.g. interaction with sliders or dials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/109Font handling; Temporal or kinetic typography
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/117Tagging; Marking up; Designating a block; Setting of attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention discloses a word information processing method and device, and relates to the technical field of computers. One embodiment of the method comprises: receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line; subtracting the occupied byte number from the maximum byte number which can be accommodated by the current line to obtain the byte number which can be accommodated by the remaining space of the current line, and acquiring the byte demand number of the next word to be displayed in the current line; and responding to the fact that the required number of bytes is larger than the number of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute or not, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for displaying. The implementation mode determines the corresponding line feed processing mode according to the length of the remaining space of the current line and the word attribute, and solves the problem of poor typesetting caused by forced line feed of the existing words.

Description

Word information processing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a word information processing method and device.
Background
Currently, for an electronic book reader or a document processor applied to a terminal in the market, for a processing scheme of an English long sentence, it is always ensured that one word is not divided into two lines, so that the readability of the word is ensured. In the process of implementing the invention, the inventor finds that the prior art has the following problems: if the length of the last word of a certain row of content exceeds the length of the remaining space, the application program can force the last word to be integrally moved to the next row, so that the overall character typesetting is uneven, and the reading experience of a user is poor.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for processing word information, which can at least solve a phenomenon in the prior art that if a length of a last word of a certain line content exceeds a length of a remaining space, the last word is forced to be rewound.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a word information processing method including:
receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line;
subtracting the occupied byte number from the maximum byte number which can be accommodated by the current line to obtain the byte number which can be accommodated by the remaining space of the current line, and acquiring the byte demand number of the next word to be displayed on the current line;
and responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for displaying.
Optionally, before subtracting the occupied number of bytes from the maximum number of bytes that can be accommodated by the current row, the method further includes:
determining the maximum number of bytes which can be accommodated in each line according to the selected word text display format; or
And determining a terminal for displaying the word text, and determining the maximum number of bytes which can be accommodated in each line according to the information of the terminal and the selected word text display format.
Optionally, the determining whether the word has a specific attribute includes:
judging whether the length of the word is larger than a preset word length threshold value or not;
if so, judging whether the word has a specific attribute; or
And if the number of the words is less than or equal to the preset number, moving the whole word to the next line for displaying.
Optionally, the method further includes: and counting the occurrence frequency of each word length in the word lexicon to obtain the word length distribution condition, and taking the word length at the peak position as the preset word length threshold.
Optionally, the determining whether the word has a specific attribute, so as to split the word into a first part and a second part according to a determination result, and move the second part to the next line for display includes:
judging whether the word has a double-consonant letter structure;
if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display; or
If the number of the bytes can be accommodated in the remaining space of the current line, splitting the word into a third part and a fourth part based on the number of the bytes which can be accommodated in the remaining space of the current line, and moving the fourth part to the next line for display.
Optionally, the moving the fourth part to the next line of display includes:
judging whether the number of letters of the fourth part is greater than or equal to a preset number of letters;
if the fourth part is larger than or equal to the first part, moving the fourth part to the next row for displaying; or
And if the word size is smaller than the preset value, moving the whole word to the next line for display.
To achieve the above object, according to another aspect of embodiments of the present invention, there is provided a word information processing apparatus including:
the positioning module is used for receiving the selection display operation of the word text and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying the words line by line;
the calculation module is used for subtracting the occupied byte quantity from the maximum byte quantity which can be accommodated by the current line to obtain the byte quantity which can be accommodated by the remaining space of the current line and acquiring the byte demand quantity of a next word to be displayed in the current line;
and the splitting module is used for responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for display.
Optionally, the calculating module is further configured to:
determining the maximum number of bytes which can be accommodated in each line according to the selected word text display format; or
And determining a terminal for displaying the word text, and determining the maximum number of bytes which can be accommodated in each line according to the information of the terminal and the selected word text display format.
Optionally, the splitting module is configured to:
judging whether the length of the word is larger than a preset word length threshold value or not;
if so, judging whether the word has a specific attribute; or
And if the number of the words is less than or equal to the preset number, moving the whole word to the next line for displaying.
Optionally, the splitting module is further configured to:
and counting the occurrence frequency of each word length in the word lexicon to obtain the word length distribution condition, and taking the word length at the peak position as the preset word length threshold.
Optionally, the splitting module is configured to:
judging whether the word has a double-consonant letter structure;
if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display; or
If the number of the bytes in the remaining space of the current line can be stored, splitting the word into a third part and a fourth part based on the number of the bytes in the remaining space of the current line, and moving the fourth part to the next line for display.
Optionally, the splitting module is configured to:
judging whether the number of letters of the fourth part is greater than or equal to a preset number of letters;
if the fourth part is larger than or equal to the first part, moving the fourth part to the next row for displaying; or
And if the word size is smaller than the preset value, moving the whole word to the next line for display.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a word information processing electronic device.
The electronic device of the embodiment of the invention comprises: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement any of the word information processing methods described above.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program implementing any of the word information processing methods described above when executed by a processor.
According to the scheme provided by the invention, one embodiment of the invention has the following advantages or beneficial effects: the remaining space length of the current line is determined according to the cursor position of the current line, and a corresponding line feed processing mode is determined by combining the attribute of the word to be displayed, so that the user is not influenced to understand English words, and the technical problem of poor character typesetting caused by forced line feed of the word is solved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic main flow chart of a word information processing method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating word length distributions in accordance with an embodiment of the present invention;
FIG. 3(a) is a diagram illustrating the line feed processing result of a word-existence double-consonant structure;
FIG. 3(b) is a diagram illustrating a line feed processing result of a word with a preset English prefix;
FIG. 3(c) is a diagram illustrating the line feed processing result of a word by the number of letters;
FIG. 4 is a flow chart diagram of a method of specifically processing word information in accordance with an embodiment of the present invention;
FIG. 5 is a schematic diagram of the main blocks of a word information processing apparatus according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 7 is a schematic block diagram of a computer system suitable for use with a mobile device or server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
It should be noted that the embodiment of the present invention is applicable to a scenario where a word needs to be displayed, such as displaying an english word at a mobile terminal. The effect of the existing display logic may cause the whole text typesetting to be uneven, for example, if the mobile terminal directly adopts an english display scheme of a PC (Personal Computer or Personal Computer) terminal, because the mobile terminal has a narrower screen than the PC terminal, the probability of forcibly changing the line of the last word is higher. According to the scheme, the length of the remaining space of the current line is determined according to the cursor position of the current line, and the corresponding line feed processing mode is determined by combining the attributes of the words to be displayed, so that the user can not be influenced to understand English words, and the technical problem of poor character typesetting caused by forced line feed of the words is solved.
Referring to fig. 1, a main flowchart of a word information processing method according to an embodiment of the present invention is shown, including the following steps:
s101: receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line;
s102: subtracting the occupied byte number from the maximum byte number which can be accommodated by the current line to obtain the byte number which can be accommodated by the remaining space of the current line, and acquiring the byte demand number of the next word to be displayed on the current line;
s103: and responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for displaying.
In the above embodiment, in step S101, both the mobile terminal and the PC terminal are provided with a typesetting function, and after a user clicks and selects a display option for a certain word text, the typesetting function starts to perform display processing on the word text. The same word text can have a plurality of display formats, specifically selected or set by the user, including font size, font format, alignment mode, indentation mode, line spacing, etc., and the maximum number of bytes that can be accommodated in each line is different for different display formats, for example, display format a-the maximum number of bytes that can be accommodated in each line is 100, and display format B-the maximum number of bytes that can be accommodated in each line is 60.
Further, the maximum number of bytes that can be accommodated in each line of the same display format is different for different terminals, for example, for the above display format a, the PC side can accommodate 100 bytes in each line, but for the mobile side such as a mobile phone, the PC side can accommodate 50 bytes in each line.
The words are displayed one after the other and are typically separated by spaces. In order to solve the defects of the prior art, in the process of displaying words line by line, the occupied byte number of the current line can be determined according to the position of the cursor, for example, after a word is displayed (other words to be displayed exist after the word), a space is automatically input, so that the cursor stays at the position adjacent to the space after the space, and the position is located at the 45 th byte of the current line, namely, the occupied byte number of the current line is 44.
In steps S102 to S103, the number of bytes that can be accommodated in each row is limited, so after the number of bytes occupied in the current row is determined, the maximum number of bytes that can be accommodated in the current row — the occupied number of bytes equals to the number of bytes that can be accommodated in the remaining space of the current row, which is, as described above, the number of bytes occupied in the current row is 44, and the maximum number of bytes that can be accommodated in each row is 50, that is, the number of bytes that can be accommodated in the remaining space of the current row is 6.
Acquiring the number of bytes required by a next word to be displayed in the current line, if amazing needs to occupy 7 bytes, judging whether the required number of bytes is greater than the number of bytes which can be accommodated in the remaining space of the current line:
1) if the number of the words is less than or equal to the preset number, the line feed processing is not carried out, and the words are directly displayed on the current line;
2) if the word length is larger than the preset value, whether a line feed processing flow needs to be started or not needs to be determined, and whether the word belongs to a long word or not is judged firstly. The scheme is provided with a preset word length threshold value which is used as a threshold value for judging whether the word can be split or not, and in order to ensure that a user can understand the word, the word which is preferably less than or equal to the preset word length threshold value cannot be split, and the line is forced to be changed all the time.
The judgment conditions of the long words and the short words are obtained according to the distribution condition of the word lengths in the whole English word bank. Counting 10 ten thousand (numerical values are merely an example) common english words by length, a good normal distribution is found, wherein the word length of 8 or 9 is at the peak position of the distribution, as shown in fig. 2, and therefore 8 is preferably set as the preset word length threshold.
When the length of the next word to be displayed in the current line is larger than the number of bytes which can be accommodated in the remaining space of the current line and the word is a long word, the line feed scheme is executed as follows:
1) first, it is determined whether a double-consonant letter structure, such as b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z, is present in the word. According to the english grammar setting, when a word includes a double consonant letter structure, consonants may be separated from each other using a connector "-".
Therefore, for English words meeting the condition, the typesetting function will add a connector "-" between consonant letters, and move the part behind the connector to the next row for display. Referring to fig. 3(a), the long single word overrake contains the double consonant letter structure "rt", so that a connector "-" is added between the two, and the take after the connector "-" is moved to the next line presentation.
2) If the word does not have a double-consonant letter structure, it is necessary to determine whether the word has a common English prefix, such as anti-, dis-, ex-, or ac-. According to the english grammar, a connector "-" may be added after the prefix. Therefore, after comparing the common english prefix, the typesetting function will add the connector "-" after the prefix, and move the part after the connector "-" to the next row for display.
Referring to the long single word accidents shown in fig. 3(b), which does not contain a double consonant letter structure but contains the english prefix "ac-", so that the accidents can be processed as ac-cadents, and the cadents after the connector "-" is moved to the next line for presentation.
It should be noted that, after the splitting of the double-consonant letters is performed while satisfying the condition of step 1, the remaining word length is not required to be split again. Considering that the judgment condition of the double consonants is simpler and more accurate, the error rate is lower, while the common English prefix may be error due to some rare prefixes, so that the step 1 is preferably performed before the step 2.
3) If the word does not have a double-consonant letter structure and a common English prefix, the typesetting function can split the word into two parts (namely a third part and a fourth part) based on the number of bytes which can be accommodated in the remaining space of the current line, and move the fourth part to the next line for display.
Referring to the long single-word velocidides shown in fig. 3(c), when the number of bytes that can be accommodated in the remaining space of the current line is 8, the velocidides is split into two parts, namely velocid and ads, a connector "-" is added between the velocidides and the ads, and the ads after the connector "-" is moved to the next line for display. In some cases, a connector does not need to be added between the two parts after the words are split, and the velocidides are directly split into two parts, namely velocidia and des.
In order to avoid that reading is affected by only 1 or 2 letters left in the next row after splitting, the typesetting function will determine whether the number of letters in the fourth split part is greater than or equal to the preset number of letters, for example, 4. If the number of the words is more than or equal to 4, moving the fourth part to the next line for displaying, and if the number of the words is less than 4, not splitting the words and forcibly exchanging the whole words.
Compared with the prior art, the method provided by the embodiment has at least the following beneficial effects:
1. setting various line-feed processing rules, for example, using English grammar capable of adding a connector in the middle of double consonant letters as a basis of line-feed positions, using English grammar capable of adding a connector after English prefix as a basis of line-feed positions, and failing to meet the split mode of the English grammar and the connector;
2. and determining a preset word length threshold according to the normal distribution condition of the length of the English word so as to determine whether the line feed processing rule needs to be used.
Referring to fig. 4, a flow chart of a specific word information processing method according to an embodiment of the invention is shown, including the following steps:
s401: receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line;
s402: subtracting the occupied byte number from the maximum byte number which can be accommodated by the current line to obtain the byte number which can be accommodated by the remaining space of the current line, and acquiring the byte demand number of the next word to be displayed on the current line;
s403: responding to the byte requirement quantity larger than the byte quantity which can be accommodated in the remaining space of the current line, and judging whether the length of the word is larger than a preset word length threshold value or not;
s404: if the word is less than or equal to the preset word, moving the whole word to the next line for display;
s405: if so, judging whether the word has a double-consonant letter structure;
s406: if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
s407: if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display;
s408: if not, splitting the word into a third part and a fourth part based on the number of bytes which can be accommodated in the remaining space of the current line, and judging whether the number of letters in the fourth part is greater than or equal to a preset number of letters;
s409: if the fourth part is larger than or equal to the first part, moving the fourth part to the next row for displaying;
s410: and if the word size is smaller than the preset value, moving the whole word to the next line for display.
Referring to fig. 5, a schematic diagram illustrating main modules of a word information processing apparatus 500 according to an embodiment of the present invention is shown, including:
a positioning module 501, configured to receive a selection display operation on a word text, and determine the number of bytes occupied by a current line by positioning a position of a cursor in the current line in a process of displaying words line by line;
a calculating module 502, configured to subtract the occupied byte number from the maximum byte number that can be accommodated by the current line to obtain the byte number that can be accommodated by the remaining space of the current line, and obtain the byte required number of the next word to be displayed in the current line;
the splitting module 503 is configured to, in response to that the required number of bytes is greater than the number of bytes that can be accommodated in the remaining space of the current line, determine whether the word has a specific attribute, split the word into a first part and a second part according to a determination result, and move the second part to a next line for display.
In the device for implementing the present invention, the calculating module 502 is further configured to:
determining the maximum number of bytes which can be accommodated in each line according to the selected word text display format; or
And determining a terminal for displaying the word text, and determining the maximum number of bytes which can be accommodated in each line according to the information of the terminal and the selected word text display format.
In the implementation apparatus of the present invention, the splitting module 503 is configured to:
judging whether the length of the word is larger than a preset word length threshold value or not;
if so, judging whether the word has a specific attribute; or
And if the number of the words is less than or equal to the preset number, moving the whole word to the next line for displaying.
In the implementation apparatus of the present invention, the splitting module 503 is further configured to:
and counting the occurrence frequency of each word length in the word lexicon to obtain the word length distribution condition, and taking the word length at the peak position as the preset word length threshold.
In the implementation apparatus of the present invention, the splitting module 503 is configured to:
judging whether the word has a double-consonant letter structure;
if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display; or
If the number of the bytes can be accommodated in the remaining space of the current line, splitting the word into a third part and a fourth part based on the number of the bytes which can be accommodated in the remaining space of the current line, and moving the fourth part to the next line for display.
In the implementation apparatus of the present invention, the splitting module 503 is configured to:
judging whether the number of letters of the fourth part is greater than or equal to a preset number of letters;
if the number of the fourth part is larger than or equal to the number of the first part, moving the fourth part to the next row for displaying; or
And if the word size is smaller than the preset value, moving the whole word to the next line for display.
In addition, the detailed implementation of the device in the embodiment of the present invention has been described in detail in the above method, so that the repeated description is not repeated here.
Fig. 6 shows an exemplary system architecture 600 in which embodiments of the invention may be applied, including terminal devices 601, 602, 603, a network 604 and a server 605 (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having display screens and supporting web browsing, and installed with various communication client applications, and users may interact with the server 605 through the network 604 using the terminal devices 601, 602, 603 to receive or transmit messages and the like.
The network 604 serves as a medium for providing communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
The server 605 may be a server providing various services, and it should be noted that the method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises a positioning module, a calculating module and a splitting module. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, a split module may also be described as a "word split module".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line;
subtracting the occupied byte quantity from the maximum byte quantity which can be accommodated in the current line to obtain the byte quantity which can be accommodated in the remaining space of the current line, and acquiring the byte required quantity of the next word to be displayed in the current line;
and responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for displaying.
According to the technical scheme of the embodiment of the invention, the length of the remaining space of the current line is determined according to the cursor position of the current line, and the corresponding line change processing mode is determined by combining the attribute of the word to be displayed, so that the user is not influenced to understand English words, and the technical problem of poor character typesetting caused by forced line change of the word is solved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A word information processing method, comprising:
receiving the selection display operation of the word text, and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying words line by line;
subtracting the occupied byte number from the maximum byte number which can be accommodated by the current line to obtain the byte number which can be accommodated by the remaining space of the current line, and acquiring the byte demand number of the next word to be displayed on the current line;
and responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for displaying.
2. The method of claim 1, further comprising, prior to subtracting the occupied number of bytes from the maximum number of bytes that the current row can accommodate:
determining the maximum number of bytes which can be accommodated in each line according to the selected word text display format; or
And determining a terminal for displaying the word text, and determining the maximum number of bytes which can be accommodated in each line according to the information of the terminal and the selected word text display format.
3. The method of claim 1, wherein said determining whether a particular attribute exists for the word comprises:
judging whether the length of the word is larger than a preset word length threshold value or not;
if so, judging whether the word has a specific attribute; or
And if the number of the words is less than or equal to the preset number, moving the whole word to the next line for displaying.
4. The method of claim 3, further comprising:
and counting the occurrence frequency of each word length in the word lexicon to obtain the word length distribution condition, and taking the word length at the peak position as the preset word length threshold.
5. The method according to any one of claims 1-4, wherein the determining whether the word has a specific attribute, splitting the word into a first part and a second part according to the determination result, and moving the second part to the next line for presentation comprises:
judging whether the word has a double-consonant letter structure;
if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display; or
If the number of the bytes in the remaining space of the current line can be stored, splitting the word into a third part and a fourth part based on the number of the bytes in the remaining space of the current line, and moving the fourth part to the next line for display.
6. The method of claim 5, wherein said moving said fourth portion to a next line of presentation comprises:
judging whether the number of letters of the fourth part is greater than or equal to a preset number of letters;
if the fourth part is larger than or equal to the first part, moving the fourth part to the next row for displaying; or
And if the number of the words is less than the preset value, moving the whole word to the next line for displaying.
7. A word information processing apparatus characterized by comprising:
the positioning module is used for receiving the selection display operation of the word text and determining the number of bytes occupied by the current line by positioning the position of a cursor in the current line in the process of displaying the words line by line;
the calculation module is used for subtracting the occupied byte quantity from the maximum byte quantity which can be accommodated by the current line to obtain the byte quantity which can be accommodated by the remaining space of the current line and acquiring the byte demand quantity of a next word to be displayed in the current line;
and the splitting module is used for responding to the fact that the byte demand quantity is larger than the quantity of bytes which can be accommodated in the remaining space of the current line, judging whether the word has a specific attribute, splitting the word into a first part and a second part according to a judgment result, and moving the second part to the next line for display.
8. The apparatus of claim 7, wherein the splitting module is configured to:
judging whether the word has a double-consonant letter structure;
if yes, adding a preset connector between consonant letters, moving the letters after the preset connector to the next row for display, and otherwise, judging whether the word has a preset prefix;
if yes, adding the preset connector after presetting the prefix, and moving the letters after the preset connector to the next row for display; or
If the number of the bytes can be accommodated in the remaining space of the current line, splitting the word into a third part and a fourth part based on the number of the bytes which can be accommodated in the remaining space of the current line, and moving the fourth part to the next line for display.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202210359485.8A 2022-04-07 2022-04-07 Word information processing method and device Pending CN114692592A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210359485.8A CN114692592A (en) 2022-04-07 2022-04-07 Word information processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210359485.8A CN114692592A (en) 2022-04-07 2022-04-07 Word information processing method and device

Publications (1)

Publication Number Publication Date
CN114692592A true CN114692592A (en) 2022-07-01

Family

ID=82142275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210359485.8A Pending CN114692592A (en) 2022-04-07 2022-04-07 Word information processing method and device

Country Status (1)

Country Link
CN (1) CN114692592A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1608258A (en) * 2001-10-29 2005-04-20 夏普株式会社 Document display device, wording method, and word display method
CN110968988A (en) * 2019-12-06 2020-04-07 歌尔科技有限公司 Display processing method and device, electronic equipment and readable storage medium
CN113536747A (en) * 2021-09-14 2021-10-22 潍坊北大青鸟华光照排有限公司 Uyghur language last-syllable-splitting processing method on mobile equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1608258A (en) * 2001-10-29 2005-04-20 夏普株式会社 Document display device, wording method, and word display method
CN110968988A (en) * 2019-12-06 2020-04-07 歌尔科技有限公司 Display processing method and device, electronic equipment and readable storage medium
CN113536747A (en) * 2021-09-14 2021-10-22 潍坊北大青鸟华光照排有限公司 Uyghur language last-syllable-splitting processing method on mobile equipment

Similar Documents

Publication Publication Date Title
US9158742B2 (en) Automatically detecting layout of bidirectional (BIDI) text
US20190065446A1 (en) Reducing text length while preserving meaning
CN113722124B (en) Content processing method, device, equipment and storage medium of cloud mobile phone
CN112965781A (en) Method and device for processing page
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN111651700A (en) Message display method and device, electronic equipment and storage medium
CN112818656A (en) Data difference comparison method, device, equipment, medium and computer program product
CN114757214B (en) Selection method and related device for sample corpora for optimizing translation model
CN110609981A (en) Text processing method and device, electronic equipment and computer readable storage medium
CN113836462A (en) Page description file generation method, device, equipment and storage medium
CN110852057A (en) Method and device for calculating text similarity
CN112487765B (en) Method and device for generating notification text
CN112527235A (en) Voice playing method, device, equipment and storage medium
CN114692592A (en) Word information processing method and device
CN113742332A (en) Data storage method, device, equipment and storage medium
JP5715172B2 (en) Document display device, document display method, and document display program
EP4195011A1 (en) Character display method and apparatus, and electronic device and computer-readable storage medium
US8577861B2 (en) Apparatus and method for searching information
CN114374686A (en) File processing method, device and equipment based on browser
CN114490990A (en) Method, device and equipment for determining text to be marked and storage medium
CN112861504A (en) Text interaction method, device, equipment, storage medium and program product
CN113268949A (en) Form display method and device based on dynamic field, computer equipment and medium
CN113296771A (en) Page display method, device, equipment and computer readable medium
CN111626045A (en) Character length calculation method and device and electronic equipment
CN114442897B (en) Text processing method and device, electronic 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