Text processing method, system, electronic device and storage medium

By parsing and modifying the text paragraph data of the native page, and using the preset style data group to perform unified style conversion, the problem that the native page cannot effectively display the selected text is solved, and the unity and aesthetics of the design language are improved.

CN114327209BActive Publication Date: 2024-08-30SUZHOU LANGDONG NET TEC CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111596137.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-08-30
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

In the existing technology, the native page cannot effectively obtain text information, resulting in the inability to clearly understand the selected text paragraphs, and the design language is not unified and unsightly, which affects the dissemination of data information and the system usage experience.

Method used

By receiving the starting selection signal of the native page, parsing the selection position, obtaining text paragraph information, judging the data type, generating and modifying text paragraph data, using the preset style data group for unified style conversion and display, solving the text data of different types of pages Planning requirements.

Benefits of technology

It realizes the special display of the selection operation on the native page, unifies the design language, and improves the overall aesthetics and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114327209B
    Figure CN114327209B
Patent Text Reader

Abstract

The present invention discloses a text processing method, system, electronic device and storage medium, wherein the text processing method includes: receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, obtaining a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information; determining the data type of the first text paragraph information and parsing it, and generating first text paragraph data; monitoring a continuation selection signal of the native page, parsing a continuation selection position represented by the continuation selection signal, and modifying at least part of the first text paragraph data according to a preset style data group, and obtaining second text paragraph data; replacing the first text paragraph data with the second text paragraph data and outputting it for display. The text processing method provided by the present invention can perform special display on the swiping operation of the native page, can cope with the swiping requirements of text data of different pages, and unify the design language to improve the overall aesthetics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a text processing method, system, electronic equipment and storage medium. Background Art

[0002] With the popularization of mobile digital terminals, how to make the data information in the terminal more convenient to query and disseminate is the development trend of the technology in this field. In the prior art, the operating system provides different processing paths for different pages, and enables the text information in different pages to be selected and other operations to be performed by opening different degrees of permissions. However, the display effects formed after performing the selection operation on different pages are not consistent. In particular, when selecting a native page, there is often a problem of not being able to obtain at least part of the information of the native page. Even if the data is obtained through the API (Application Programming Interface) provided by the system, the corresponding data information on the native page will not be transformed in style. Users usually cannot intuitively understand the situation of the selected paragraph, which hinders the dissemination of data information and also leads to problems such as inconsistent design language and unsightly display effects during system use. Summary of the invention

[0003] The purpose of the present invention is to provide a text processing method to solve the technical problems in the prior art that text information on the native page cannot be obtained, the selected text paragraph cannot be clearly understood, and the design language is inconsistent and unsightly.

[0004] One of the objectives of the present invention is to provide a text processing system.

[0005] One of the objectives of the present invention is to provide an electronic device.

[0006] One of the objectives of the present invention is to provide a storage medium.

[0007] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides a text processing method, including: receiving a starting selection signal of a native page, parsing a starting selection position represented by the starting selection signal, obtaining a text paragraph in the native page where the starting selection position is located, and obtaining first text paragraph information; determining a data type of the first text paragraph information and parsing it to generate first text paragraph data; monitoring a subsequent selection signal of the native page, parsing a subsequent selection position represented by the subsequent selection signal, and modifying at least part of the first text paragraph data according to a preset style data group to obtain second text paragraph data; replacing the first text paragraph data with the second text paragraph data and outputting it for display.

[0008] As a further improvement of an embodiment of the present invention, the method specifically includes: traversing the first text paragraph information and determining the data type of the first text paragraph information; if the first text paragraph information contains at least one preset tag information, determining that the first text paragraph information is tag-carrying text information, calling a preset retrieval engine to establish a mapping relationship between the preset tag information and the preset style data group, and parsing to obtain the first text paragraph data.

[0009] As a further improvement of an embodiment of the present invention, the method specifically includes: parsing to obtain the first tag information in the first text paragraph information; calling the preset dictionary tree in the preset retrieval engine, and searching for the corresponding first style object information according to the first tag information; modifying the corresponding first tag information according to the first style object information; iterating until all tag information in the first text paragraph information is modified to generate the first text paragraph data; wherein the preset style data group includes at least the first style object information.

[0010] As a further improvement of an embodiment of the present invention, the first tag information includes first tag prefix information and first tag content information, and the first style object information includes first style type information and first style content information; the method specifically includes: modifying the first tag prefix information to the corresponding first style type information, and modifying the first tag content information to the corresponding first style content information.

[0011] As a further improvement of an embodiment of the present invention, the preset style data group includes at least one preset style data, and the method specifically includes: calling a preset style modification tool, using at least one of the preset style data as an indication parameter, using the start selection signal and the continuation selection signal as the start parameter and the end parameter respectively, modifying at least part of the first text paragraph, and obtaining the second text paragraph data.

[0012] As a further improvement of an embodiment of the present invention, the method specifically includes: modifying the part between the starting selection position and the continuing selection position in the first text paragraph data according to a preset style data group to obtain second text paragraph data; the method also includes: receiving a stop selection signal of a native page, parsing the stop selection position represented by the stop selection signal, obtaining a text paragraph between the starting selection position and the stop selection position in the native page, and obtaining text selected data; dividing the text selected data into temporary storage partitions in the memory according to the length of the text selected data, and copying the text selected data to the temporary storage partition; wherein the temporary storage partition is configured to receive a paste operation signal and output the data stored therein to display on the native page.

[0013] As a further improvement of an embodiment of the present invention, the method also includes: receiving a first continuation selection signal of the native page, parsing a first continuation selection position represented by the first continuation selection signal, obtaining the portion between the starting selection position and the first continuation selection position in the first text paragraph data, and obtaining first text selected data; traversing the first text selected data, and if the first text selected data contains a line break, outputting a first prompt signal; the method also includes: when a first confirmation signal corresponding to the first prompt signal is received, dividing the first text paragraph data in the memory according to the length of the first text paragraph data to obtain a first temporary storage partition, and copying the first text paragraph data to the first temporary storage partition; when a stop selection signal of the native page is received, dividing the text selected data in the memory according to the length of the text selected data to obtain a second temporary storage partition, and copying the first text selected data to the second temporary storage partition.

[0014] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides a text processing system configured to execute the steps of the text processing method described in any one of the above-mentioned technical solutions.

[0015] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides an electronic device, including a processor, a memory and a communication bus, wherein the processor and the memory communicate with each other through the communication bus; the memory is used to store application programs; and the processor is used to implement the steps of the text processing method described in any of the above-mentioned technical solutions when executing the application programs stored in the memory.

[0016] To achieve one of the above-mentioned purposes of the invention, an embodiment of the present invention provides a storage medium on which an application is stored. When the application is executed, the steps of the text processing method described in any of the above-mentioned technical solutions are implemented.

[0017] Compared with the prior art, the text processing method provided by the present invention locates the position of the starting selection signal and obtains the entire text paragraph at the position. In the subsequent process of monitoring the subsequent selection signal, it can quickly respond to the subsequent selection signal to perform style conversion and display, thereby solving the technical problem that the native page cannot perform special display on the swiping operation; at the same time, before the style conversion of the text paragraph, it also includes the judgment and analysis of the data type, and uses the preset style data group for unified modification during the style conversion process, thereby being able to meet the text data selection requirements of different types of pages, unify the design language, and improve the overall aesthetics. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a structural principle diagram of an electronic device in one embodiment of the present invention;

[0019] Figure 2 is a structural principle diagram of a text processing system in one embodiment of the present invention;

[0020] Figure 3 is a schematic diagram of the steps of a text processing method in one embodiment of the present invention;

[0021] Figure 4 is a schematic diagram of the steps of a first embodiment of a text processing method in one embodiment of the present invention;

[0022] Figure 5 is a step principle diagram of a specific example of step 322 of the first embodiment of the text processing method in one embodiment of the present invention;

[0023] Figure 6 is a step principle diagram of another specific example of step 322 of the first embodiment of the text processing method in one implementation mode of the present invention;

[0024] Figure 7 is a schematic diagram of steps of a text processing method in another embodiment of the present invention;

[0025] Figure 8 is a schematic diagram of steps of a text processing method in another embodiment of the present invention;

[0026] Fig. 9 It is a schematic diagram of the steps of the second embodiment of the text processing method in one embodiment of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be described in detail below in conjunction with the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on these embodiments are all within the scope of protection of the present invention.

[0028] It should be noted that the term "comprises" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In addition, the terms "first", "second", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.

[0029] There are many types of pages for mobile terminals, such as native pages, HTML (Hyper TextMarkup Language) pages (typically H5 pages) and hybrid pages. Among them, native pages are developed using JavaScript and can be used to create a complete APP. They have the advantages of fast running speed, the ability to call the underlying functions of the device, saving traffic, higher functionality, better convenience and comfort. Correspondingly, native pages need to be developed independently to adapt to different operating systems, and the content in the page is relatively complex, especially for text data, which may exist in multiple different forms or contain different tags or objects. When performing operations such as selecting or copying these texts, since data is only obtained by calling the API interface provided by the system, it is easy to have problems such as failure to provide functional options such as copying, failure to form selection style changes, and inconsistency between selection style and other pages, resulting in a poor user experience.

[0030] The above problems may exist not only on native pages, but also in any page mechanism that includes native pages. For example, hybrid pages are mixed with HTML pages and native pages, and the above style languages ​​are inconsistent, and some pages and / or areas can be copied while other pages and / or areas cannot be copied. The above problems and the derivative problems formed in different technical fields or application scenarios are technical problems that need to be solved in this field, and are also one of the purposes of the present invention.

[0031] In order to solve the above technical problems and other potential or related problems, an embodiment of the present invention provides a storage medium, which is set in a mobile terminal or other device such as a mobile phone (especially a mobile phone equipped with an Android operating system), and stores an application. The storage medium can be any available medium that can be accessed by the mobile terminal, or can be a storage device such as a server or a data center that includes one or more available media. The available medium can be a magnetic medium such as a floppy disk, a hard disk, a tape, etc., or an optical medium such as a DVD (Digital Video Disc), or a semiconductor medium such as an SSD (Solid State Disk). When the application is executed by any processor in the mobile terminal, a text processing method is implemented to at least perform: receiving a start selection signal of a native page, parsing a start selection position, obtaining first text paragraph information, determining the type of first text paragraph information, generating first text paragraph data, monitoring a continuation selection signal of a native page, parsing a continuation selection position, generating second text paragraph data, and replacing and outputting and displaying the first text paragraph data.

[0032] One embodiment of the present invention further provides a Figure 1 The electronic device 100 shown includes a processor 11, a communication interface 12, a memory 13 and a communication bus 14. The processor 11, the communication interface 12 and the memory 13 communicate with each other via the communication bus 14.

[0033] The memory 13 is used to store the application program; the processor 11 is used to execute the application program stored in the memory 13, and the application program may be the application program stored in the storage medium as described above (that is, the storage medium may be configured to be at least contained in the memory 13). When executing the application program, the processor 11 may implement a text processing method, which may specifically include: receiving the starting selection signal of the native page, parsing the starting selection position, obtaining the first text paragraph information, determining the type of the first text paragraph information, generating the first text paragraph data, monitoring the subsequent selection signal of the native page, parsing the subsequent selection position, generating the second text paragraph data, and replacing and outputting the first text paragraph data.

[0034] Specifically, the communication bus 14 may be a PCI bus (Peripheral Component Interconnect) or an EISA bus (Extended Industry Standard Architecture). The communication bus 14 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 1 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0035] The communication interface 12 is used for communication between the electronic device 100 and other devices.

[0036] The memory 13 may include a RAM (Random Access Memory) or a NVM (Non-Volatile Memory), such as at least one disk memory. Optionally, the memory 13 may also be at least one storage device disposed away from the processor 11.

[0037] The processor 11 can be a general-purpose processor, including a CPU (Central Processing Unit), an NP (Network Processor), etc., and can also be a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0038] One embodiment of the present invention further provides a Figure 2 The text processing system 200 shown includes a selection signal receiving unit 21 , a position analysis processing unit 22 , a text acquisition determination unit 23 , a style modification processing unit 24 and a text replacement output unit 25 .

[0039] Among them, the selection signal receiving unit 21 is used to receive the starting selection signal of the native page, and to monitor the subsequent selection signal of the native page; the position resolution processing unit 22 is used to resolve the starting selection position represented by the starting selection signal, and to resolve the subsequent selection position represented by the subsequent selection signal; the text acquisition judgment unit 23 is used to obtain the text paragraph where the starting selection position is located in the native page, obtain the first text paragraph information, and determine the data type of the first text paragraph information and parse it to generate the first text paragraph data; the style modification processing unit 24 is used to modify at least part of the first text paragraph data to obtain the second text paragraph data; the text replacement output unit 25 is used to replace the first text paragraph data with the second text paragraph data and output it for display.

[0040] In one embodiment, the selection signal receiving unit 21 can also be used to receive the stop selection signal of the native page, the position resolution processing unit 22 can also be used to resolve the stop selection position represented by the stop selection signal, and the text acquisition judgment unit 23 can also be used to obtain the text paragraph between the starting selection position and the stop selection position in the native page to obtain text selection data.

[0041] In one embodiment, the selection signal receiving unit 21 can also be used to receive a first continuation selection signal of a native page, the position resolution processing unit 22 can also be used to resolve a first continuation selection position represented by the first continuation selection signal, and the text acquisition judgment unit 23 can also be used to acquire the portion between the starting selection position and the first continuation selection position in the first text paragraph data to obtain the first text selection data.

[0042] Preferably, the text processing system 200 may also include a text traversal prompt unit, which is used to traverse the first text selected data and output a first prompt signal when the first text selected data contains a line break. The text processing system 200 may also include a judgment partition storage unit, which is used to divide the first text paragraph data in the memory to obtain a first temporary storage partition when a first confirmation signal corresponding to the first prompt signal is received, and copy the first text paragraph data to the first temporary storage partition, and to divide the text selected data in the memory to obtain a second temporary storage partition when a stop selection signal of the native page is received, and copy the text selected data to the second temporary storage partition.

[0043] Specifically, the first confirmation signal and the stop selection signal input to the judgment division storage unit can be forwarded or generated and output to the judgment division storage unit after the selection signal receiving unit 21 receives the corresponding signal input from the outside world, or can be received by the judgment division storage unit after directly communicating with the outside world.

[0044] Continue as Figure 3 As shown, an embodiment of the present invention provides a text processing method, and the program or instruction corresponding to the method can be installed in the above storage medium and / or the above electronic device 100 and / or the text processing system 200 to achieve the technical effect of text processing. The method specifically includes:

[0045] Step 31 : receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, acquiring a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information.

[0046] The native page can be a native page based on different operating systems, such as a typical Android operating system and / or iOS operating system. Of course, the native page of any other operating system obtained by deep development based on the Lunix operating system and the Unix operating system can also be defined as the native page. In addition, the native page that has the same "Java Application layer-Framework layer-Libraries layer-Linux kernel" architecture as the Android operating system and is in the Java Application layer can also be defined as the native page. At the same time, the part of the Hybrid page involving the native page or the part developed using JavaScript as mentioned above can also be defined as the native page. In this embodiment, the native page is preferably defined as an "Android native page" or an "Android native page".

[0047] The start selection signal may be a click operation input by the user through the touch screen, or a selection operation input by the user through a device such as a mouse, keyboard, or digital tablet. The concept of "start" may be the click operation or selection operation received for the first time after a certain period of time or a certain time cycle, or a signal with a special form that is different from other click operations or selection operations. In this embodiment, the start selection signal is the selection signal received for the first time by the touch screen of the mobile terminal equipped with the Android system after the previous selection cycle ends.

[0048] The analysis of the starting selection position can be carried out by comparing the position where the starting selection signal is triggered on the touch screen with the current display of the native page, thereby determining the coordinates of the starting selection position and obtaining the text paragraph at the coordinates. Different text paragraphs are naturally divided into different data blocks or data areas in the underlying code of the native page. After determining the starting selection position, all text information in the data area can be crawled to obtain the first text paragraph information.

[0049] Step 32, determining the data type of the first text paragraph information and parsing it to generate first text paragraph data.

[0050] The text information in the native page may be text containing H5 tags, or it may be the original text written into the native page. The two types of text may have different forms when reflected in the code, especially for the definition of text style. The former is mostly described by tags, and the tags are set before or after the text content to form a tag representation of text paragraph information. The latter is usually defined by defining different Span objects that identify various style information and setting different indication parameters for the Span object, so that the text information is defined as having different styles.

[0051] Based on this, after the judgment and analysis of step 32, at least the part used to define the style in the generated text paragraph data can be unified, so that the same native page style modification or definition method can be used to make at least the above two types of text information execute the same style definition.

[0052] Step 33 , monitoring the continuation selection signal of the native page, parsing the continuation selection position represented by the continuation selection signal, and modifying at least part of the first text paragraph data according to the preset style data group to obtain second text paragraph data.

[0053] The monitoring operation can be preferably configured to start after receiving the start selection signal, and continue to execute to obtain a series of selection signals after the start selection signal. This series of selection signals can be defined as a continuous selection signal in this embodiment, which can be expressed as a drag, swipe, move, etc. operation form after the user's above-mentioned tap operation or selection operation. In this embodiment, the continuous selection signal is at least one selection signal obtained by the touch screen of the mobile terminal equipped with the Android system after receiving the start selection signal.

[0054] The subsequent selection signal may be configured similarly to the initial selection signal, by comparing the position triggered by the subsequent selection signal on the touch screen with the current display status of the native page, thereby determining the coordinates of the subsequent selection position.

[0055] At least part of the first text paragraph data may be a modification of at least part of the data representing the style in all the first text paragraph data, or may be a modification of all the data representing the style in at least part of the first text paragraph data, or may be a modification of at least part of the data representing the style in at least part of the first text paragraph data. Due to the operation of step 32, the same style modification operation for the text information of the H5 tag or for the original text information can be performed on different types of text information. In addition, when the aforementioned steps are repeated, it can be ensured that the processing of the same text paragraph information at different time points, or the processing of different text paragraph information at the same time point can have the same style change form.

[0056] Step 34: Replace the first text paragraph data with the second text paragraph data and output for display.

[0057] The text paragraph data after the style modification is output in a replacement manner, and at least the currently selected text information can be clearly and specifically shown in the native page, thereby assisting the operator in subsequent operations such as copying and modifying. The above replacement process can be a direct modification and replacement of the first text paragraph data arranged in the native page, or it can be a modification and replacement of the first text paragraph data in the copy or backup generated according to the native page and then output and display, and the present invention does not limit the implementation method here.

[0058] An embodiment of the present invention provides a first embodiment of a text processing method, such as Figure 4 As shown, including:

[0059] Step 31 : receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, acquiring a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information.

[0060] Step 321, traverse the first text paragraph information, and determine the data type of the first text paragraph information.

[0061] Step 322: if the first text paragraph information contains at least one preset tag information, the first text paragraph information is determined to be tag-carrying text information, a preset search engine is called to establish a mapping relationship between the preset tag information and the preset style data group, and the first text paragraph data is parsed to obtain.

[0062] The first embodiment of this implementation mode of the present invention specifically illustrates the rules for judging the data type of the first text paragraph information. The native page usually includes the two types of text information mentioned above. For the original text information, since it has a clear Span object definition, its style adjustment can be directly solved through the corresponding Span resource. For H5 tag text information and other tag-carrying text information, its definition of style type and content is difficult to be directly read and modified by Span resources. Therefore, it is possible to establish a mapping relationship after identifying and judging it, thereby completing the parsing of the first text paragraph data.

[0063] The preset search engine stores at least the (tag) information that is common in the tag text information in the native page and represents the style type and style content, and the amount of preset tag information stored in it should be greater than or equal to the amount of style data defined in the preset style data group, and further greater than or equal to the at least one preset tag information existing in the first text paragraph information. In this way, all tag information in the first text data can be retrieved in the preset search engine and can be mapped to the preset style data group.

[0064] After the mapping relationship is established, the part of the first text paragraph information corresponding to the preset style data group can be completely replaced with the content of the preset style data group according to the mapping relationship to form the first text paragraph data; the mapping relationship can also be encapsulated with the first text paragraph information to form the first text paragraph data; of course, the mapping relationship can also be used to perform other parsing operations on the first text paragraph information, so that the tag part that is difficult to be processed by the Span resource is replaced with a style definition in the form of a Span object.

[0065] In one embodiment, the tag information used to determine the data type of the first text paragraph information may not be modified accordingly, and the modified tag information may not be used to determine the data type of the first text paragraph information. For example, during the traversal process, the first text paragraph information configured as a tag text information such as H5 tag text information will usually be detected first. , The line break characters that appear in pairs or alone can be defined as the preset tag information. When the first text paragraph information is detected to contain the above tag information, the type of the first text paragraph information is determined. For another example, the style defined in the tag text information is usually defined by <h2>,<style="color:red”> When the above style content exists in the preset style data group, such as "bold" corresponding to the previous tag and "red font" defined by the next tag, the preset search engine can be called to establish a mapping relationship, so as to parse and obtain the first text paragraph data that can be processed conventionally. It can be seen that the tag information used to determine the type of the first text paragraph information can be further defined as any tag information that may be contained in the preset tag-carrying text information, and the information used to establish a mapping relationship to jointly form the first text paragraph data can be further defined as any tag information related to the style of the first text paragraph data and having a corresponding relationship with the preset style data group.

[0066] Since the purpose of determining the data type of the first text paragraph information and parsing it to obtain the first text paragraph data is to serve the subsequent style modification operation, it is also possible to directly determine whether the first text paragraph information contains a tag that has a corresponding relationship with the preset style data group, so that the tag-carrying text information that needs to establish a mapping relationship can be screened out. Of course, it is also possible to establish a mapping relationship for the tag information for all tag-carrying text information as described above, so that the text processing process other than style modification can be facilitated by using native page idioms such as Span resources. The above-mentioned embodiments can all achieve the expected technical effects of the present invention, but have different advantages.

[0067] The above describes the situation when it is determined that the first text paragraph information is tag-carrying text information. When the first text paragraph information is in a form other than tag-carrying text information and is naturally in a form that can be modified in style by native page custom tools, for example, when the first text paragraph information is original text information, step 33 can be directly entered for style modification, and the present invention will not be elaborated here.

[0068] Step 33 , monitoring the continuation selection signal of the native page, parsing the continuation selection position represented by the continuation selection signal, and modifying at least part of the first text paragraph data according to the preset style data group to obtain second text paragraph data.

[0069] Step 34: Replace the first text paragraph data with the second text paragraph data and output for display.

[0070] An embodiment of the present invention provides a specific example of step 322 of the first embodiment of the text processing method, such as Figure 5 As shown, including:

[0071] Step 3221, parsing to obtain first tag information in the first text paragraph information;

[0072] Step 3222, calling a preset dictionary tree in a preset search engine, and searching for corresponding first style object information according to the first tag information;

[0073] The first label information is at least defined as label information corresponding to at least one data in a preset style data group. Of course, the first label information can also be defined as label information used to determine the content of the first text paragraph information. The relevant principles and effects are described above and will not be repeated here.

[0074] The preset dictionary tree includes at least the correspondence between tag information and style object information, and specifically may include at least the correspondence between H5 tag information and Span form object information, so as to establish a mapping relationship by searching in the preset dictionary tree.

[0075] Since the tag information may include at least a part representing the style type and a part representing the style content, for example, it may include two parts, "color - red", the preset tag information inserted in the preset dictionary tree may include the complete content of the above two parts. When the part representing the style content can be recognized by the native page usage tools, it may also include only the part of the tag information representing the style type.

[0076] Step 3223, modifying the corresponding first label information according to the first style object information;

[0077] Step 3224, iterate until all tag information in the first text paragraph information is modified, and the first text paragraph data is generated.

[0078] The preset style data group at least includes the first style object information. Based on this, a relationship between the tag information and the preset style data group can be established through a preset dictionary tree, and the style information (i.e., the first style object information) included in the preset style data group can be selectively replaced with the corresponding tag information to achieve the expected technical effect.

[0079] It is worth noting that the specific example provided for step 322 can be implemented alternatively in the solution of the present invention including step 322 or step 32 and its derivative steps, so that the corresponding solution has the technical effects of the above steps 3221 to 3224. At the same time, the above steps 3221 to 3223 define the modification process for the first tag information, and step 3224 defines the modification process for all tag information in the first text paragraph information. It can be seen that when step 3224 is executed, the process of steps 3221 to 3223 will be repeatedly executed for all tag information in the first text paragraph information.

[0080] At the same time, for the convenience of description, the discussion in this article is all for a first text paragraph information, but it can be understood that when the user operation selection area covers multiple text paragraph information, the series of processes involved in the present invention can be implemented in different text paragraph information in an alternative manner. In the case of multiple text paragraph information, each text paragraph information can perform the above operation separately until all text paragraph information is iterated through, and of course, multiple text paragraph information can also be combined and regarded as the first text paragraph information.

[0081] An embodiment of the present invention provides another specific example of step 322 of the first embodiment of the text processing method, such as Figure 6 As shown, including:

[0082] Step 3221, parsing to obtain first tag information in the first text paragraph information;

[0083] Step 3222, calling a preset dictionary tree in a preset search engine, and searching for corresponding first style object information according to the first tag information;

[0084] Step 3223', modify the first tag prefix information to the corresponding first style type information, and modify the first tag content information to the corresponding first style content information.

[0085] Step 3224, iterate until all tag information in the first text paragraph information is modified, and the first text paragraph data is generated.

[0086] The first tag information includes first tag prefix information and first tag content information, and the first style object information includes first style type information and first style content information.

[0087] The above describes an implementation in which the first tag information and the first style object information have specific composition forms. For example, in this implementation, the first text paragraph information in the form of tag-carrying text information can be defined as:< / h2> <h2 style="color:red”> title< / h2> , parsing it can get the label information <h2>as well as<style="color:red”> , define the former as the first tag information, and define the latter as the second tag information, then execute steps 3221 to 3223' (or step 3223) for the first tag information, when the conversion target form is the original text in Span form (the data structure is the start index, the end index and the style object), and the conversion process is equipped with a SpannableString object, the first tag information can be modified to StyleSpan(Typeface.BOLD); so far, further execute step 3224 to modify the second tag information, when it is equipped with the same SpannableString object, the second tag information can be modified to ForegroundColorSpan("#ff0000").

[0088] The above example illustrates the process of generating the first text paragraph data in this embodiment, especially the data conversion of the font weight and font color (foreground color). It can be understood that the present invention is not limited to the above two forms of the conversion process of the first text paragraph information. The present invention can also use the derivative of the above process to implement the conversion of style data types such as background color, underline, and text replaced with pictures.

[0089] Another embodiment of the present invention provides a text processing method, such as Figure 7 As shown, including:

[0090] Step 31, receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, obtaining a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information;

[0091] Step 32, determining the data type of the first text paragraph information and parsing it to generate first text paragraph data;

[0092] Step 33', monitoring the continuation selection signal of the native page, parsing the continuation selection position represented by the continuation selection signal, calling the preset style modification tool, using at least one of the preset style data as an indication parameter, using the start selection signal and the continuation selection signal as a start parameter and an end parameter respectively, modifying at least part of the first text paragraph, and obtaining second text paragraph data;

[0093] Step 34: Replace the first text paragraph data with the second text paragraph data and output for display.

[0094] Wherein, the preset style data group includes at least one preset style data.

[0095] This embodiment specifically defines the style modification process of step 33' and the modification scope of the first text paragraph data, so that the effect of changing the style of the text data in real time following the user's selection can be achieved. The preset style modification tool can be the setSpan tool of SpannableStringBuilder in the SpannableString object mentioned above, or other conventional tools that are sufficient to modify the style in the native page. In the implementation of using the setSpan tool, it is necessary to define an indication parameter int flags to modify the style of an object within a certain area. For the above-mentioned object, an Object what parameter can be defined and the processed first text paragraph data can be used as the object. For the above-mentioned area, a starting parameter int start and an ending parameter int end can be defined to limit the scope of style modification.

[0096] Based on this, a modification tool of setSpan(Object what, int start, int end, int flags) will be formed, and then the starting position information and the ending position information of the area whose style needs to be modified in the first text paragraph data will be used as the starting parameter int start and the ending parameter int end respectively, and at least one of the preset style data will be used as the indication parameter int flags, so as to achieve the expected technical effect.

[0097] Of course, there is no absolute correspondence between the start selection signal and the continuation selection signal and the start parameter and the end parameter. In one embodiment, when part of the first text paragraph information is selected, the first text paragraph information as a whole can be transformed in style according to the policy adjustment. At this time, the start parameter can be the first character of the first text paragraph data, and the end parameter can be the last character of the first text paragraph. In another embodiment, when multiple text paragraph information is selected, the multiple text paragraph information can be transformed in style according to the policy adjustment. At this time, the start parameter can be the first character of the paragraph where the start selection position corresponding to the start selection signal is located, and the end parameter can be the last character of the paragraph where the continuation selection position corresponding to the continuation selection signal is located. It can be seen that this point can be adjusted according to the needs of those skilled in the art.

[0098] The preset style modification tool defined in this embodiment is not limited to the setSpan tool. This tool is a better choice for the original text in the form of Span in the native page. When the original text has other styles, or the text to be processed on the native page is other types of text, other native page customary tools can naturally be called to modify the style.

[0099] Another embodiment of the present invention provides a text processing method, such as Figure 8 As shown, including:

[0100] Step 31, receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, obtaining a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information;

[0101] Step 32, determining the data type of the first text paragraph information and parsing it to generate first text paragraph data;

[0102] Step 33", monitoring the continuation selection signal of the native page, parsing the continuation selection position represented by the continuation selection signal, modifying the portion between the start selection position and the continuation selection position in the first text paragraph data according to the preset style data group, and obtaining the second text paragraph data;

[0103] Step 34: Replace the first text paragraph data with the second text paragraph data and output for display.

[0104] In this embodiment, the modification range according to the preset style data group is specifically limited, and is defined as the part between the starting selection position and the subsequent selection position in its first text paragraph data, so that the style of the selected area can be locked and modified according to the user's operation.

[0105] At this time, in the modification tool setSpan(Object what, int start, int end, int flags), the start parameter int start is configured as the start selection position information corresponding to the start selection signal, and the end parameter int end is configured as the connection selection position information corresponding to the connection selection signal.

[0106] Of course, it should be noted that in the process of selecting and changing the style of multiple text paragraph information by the user, since the first text paragraph information is only for the starting selection position represented by the starting selection signal, when the subsequent selection position represented by the subsequent selection signal is not in the same paragraph as the first text paragraph information, the subsequent selection position can be executed: obtain the text paragraph where the subsequent selection position is located in the native page to obtain another first text paragraph information, determine the data type of the other first text paragraph information and parse it, and generate another first text paragraph data. In this way, the style modification operation can be performed on the two first text paragraph data synchronously.

[0107] Of course, multiple text paragraph information can also be spliced ​​together. In this case, the above process can be changed to: obtain the text paragraph at the subsequent selection position in the native page to obtain another text paragraph information, determine the data type of the other text paragraph information and parse it, generate another text paragraph data, and combine the other text paragraph data with the first text paragraph data to form a new first text paragraph data. In this way, the overall style modification operation can be performed on the combined new first text paragraph data. It can be understood that the above technical solution formed for the adaptive adjustment of multiple text paragraph information is not limited to Figure 8 The embodiment shown, other embodiments of the present invention can implement the above scheme alternatively.

[0108] Further, continue as Figure 8 As shown, in another embodiment of the present invention, the following steps may also be included:

[0109] Step 351, receiving a stop selection signal of the native page, parsing the stop selection position represented by the stop selection signal, acquiring the text paragraph between the start selection position and the stop selection position in the native page, and obtaining text selection data;

[0110] Step 352, divide the text selected data into temporary partitions in the memory according to the length of the text selected data, and copy the text selected data to the temporary partitions.

[0111] The temporary storage partition is configured to receive a paste operation signal and output the data stored therein to be displayed on the native page.

[0112] For mobile terminals that are controlled by touch, the start selection signal may be the user starting a tapping operation, the continued selection signal may be the continuous input of a selection signal (continuous tapping) after the start selection signal and forming a horizontal and / or vertical moving selection on the native page, and the stop selection signal may be configured to release the above tapping and selection operations. For other devices controlled by peripherals such as keyboards, mice, and digital tablets, the start selection signal may be the first selection signal received within a certain time period as defined above, such as a click event or a mousedown event, the continued selection signal may be a selection signal with a certain duration, such as a continuous mousedown event, and the stop selection signal may be configured to be the end signal of the above selection signal, such as a mouseup event.

[0113] After step 31 to step 34, the tracking style change of the user's selection operation has been realized, and after the user stops selecting, the selected text data can be extracted and saved for subsequent paste operations. In this way, not only can the selected text be highlighted during the text selection process, but the text can also be copied immediately after the selection stops, which is sufficient to meet the diverse operation requirements of the native page.

[0114] It can be understood that, at the moment of inputting the stop selection signal, the stop selection position and the continuous selection position at that moment are ideally unified. Based on this, the technical solution of defining the continuous selection signal at the last moment as the stop selection signal is also included in the present invention. Of course, those skilled in the art can also identify each selection operation as a stop selection signal, and continuously and cyclically execute the operation steps corresponding to the stop selection signal during the selection process.

[0115] Based on the above design ideas, an embodiment of the present invention provides a second embodiment of a text processing method, such as Fig. 9 As shown, including:

[0116] Step 31, receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, obtaining a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information;

[0117] Step 32, determining the data type of the first text paragraph information and parsing it to generate first text paragraph data;

[0118] Step 33, monitoring the continuation selection signal of the native page, parsing the continuation selection position represented by the continuation selection signal, and modifying at least part of the first text paragraph data according to the preset style data group to obtain second text paragraph data;

[0119] Wherein, the step 33 may further include step 331, receiving a first continuation selection signal of the native page, parsing a first continuation selection position represented by the first continuation selection signal, acquiring a portion between the start selection position and the first continuation selection position in the first text paragraph data, and obtaining first text selection data;

[0120] Step 34, replacing the first text paragraph data with the second text paragraph data and outputting and displaying;

[0121] In this embodiment, different from Figure 8 In the illustrated implementation, the first text selected data is defined as the portion between the starting selection position and the first subsequent selection position, which enables synchronous execution of style transformation and content preservation of the current selected area, and facilitates real-time tracking and calling of the content of the selected area.

[0122] Of course, the first text selection data is only an exemplary statement. Step 33 may also include other different text selection data (such as second text selection data) at other times and / or corresponding to different succession selection signals (or succession selection positions, such as the second succession selection signal / position). In order to achieve the real-time acquisition of the above-mentioned text selection data, step 331 itself should at least be configured to be continuously executed. In the case of a matching style modification process, the two steps can be configured to be executed synchronously in a loop or in sequence in a loop.

[0123] Further, continue as Fig. 9 As shown, the second embodiment of the text processing method according to one embodiment of the present invention may further include the following steps:

[0124] Step 36, traversing the first text selected data, if the first text selected data contains a line break character, outputting a first prompt signal;

[0125] Step 371, when a first confirmation signal corresponding to the first prompt signal is received, the first text paragraph data is divided in the memory according to the length to obtain a first temporary storage partition, and the first text paragraph data is copied to the first temporary storage partition;

[0126] Step 372: when a stop selection signal of the native page is received, the second temporary storage partition is obtained by dividing the selected text data in the memory according to the length of the selected text data, and the selected text data is copied to the second temporary storage partition.

[0127] It is worth noting that step 371 and step 372 refer to Fig. 9 As shown, it is preferably configured to be executed synchronously and set after step 36. At the same time, since the achievement conditions corresponding to step 371 and step 372 are different, there is also a situation in this embodiment where one of the two steps is selected for execution.

[0128] In addition, the expected technical effect of steps 36 to 372 is that by detecting the horizontal distance and vertical distance of the user's selection (which may be within a certain period of time), it is predicted whether the user wants to select and copy the entire text, and then the relevant operations are performed accordingly. Based on this, the above-mentioned technical solution provided by the present invention can make predictions through line breaks, and when it is detected that the first text selection data includes line breaks, a first prompt signal is output to confirm whether to select and / or copy the entire content, and after receiving the corresponding signal, the entire paragraph is selected or the selection continues. It can be seen that steps 36 to 372 do not have to be set after step 34, and only need to be executed after step 331, and can be executed simultaneously with other steps in step 33 or with step 34.

[0129] The first prompt signal may be displayed in the native page in the form of a pop-up window. In addition to a prompt signal for confirming whether to select a large section (such as "Select All (and Copy)"), it may also include "Copy", "Forward", "Share" and other content. This may be adjusted according to the business scenario. The first confirmation signal may be a confirmation signal corresponding to the "Select All (and Copy)" content. After detecting that the user confirms the selection of all, the first text paragraph data may be transformed in style as a whole and output for display. At the same time, a second prompt signal may be output to inquire whether to perform operations such as copying. After detecting that the user confirms the selection of all and copying, the above-mentioned operations of transforming the style of the first text paragraph data as a whole and outputting it for display may be performed, and step 371 may be directly executed to divide and copy the first temporary storage partition.

[0130] The stop selection signal can refer to the definition above. At this time, since the user has stopped selecting and has not given feedback to the first prompt signal, it can be determined that the user only needs to copy the currently selected data without copying the entire paragraph, so that the second temporary storage partition can be divided and copied according to the first text selected data. Of course, continuing the description in the previous article, the stop selection signal can of course be defined as a second continuation selection signal, that is, after detecting that the user continues to select text, it is determined that the text required by the user is not just the selected text, but also not the entire paragraph of text. At this time, the output of the first prompt signal can be canceled, and the change of the continuation selection signal can continue to be monitored. The first text selected data can be saved for standby, waiting for the generation of the second text selected data generated according to the second continuation selection signal, and the second text selected data can be used to replace the first text selected data in the memory.

[0131] Specifically, the first temporary storage partition and the second temporary storage partition are similar to the temporary storage partitions in the previous embodiment, and can be configured to receive a paste operation signal and output the data stored therein to display on the native page. The output display process can be implemented by modifying or inserting the underlying code of the native page, and the present invention does not limit the specific output display method.

[0132] In addition, the output display in step 34 involved in the full text of the present invention, since the first text paragraph data may be generated after form conversion, which is different from the first text paragraph information, during the output display process, the second text paragraph data is preferably subjected to an inverse transformation operation opposite to the "first text paragraph information-first text paragraph data" conversion process. For example, in one embodiment, the first text paragraph information is the tag-carrying text information, and the first text paragraph data is the original text in the form of a Span, and is converted according to a first mapping relationship. Then, during the output display process, the second text paragraph data of the original text in the form of a Span can be subjected to a second mapping relationship that is an inverse transformation of the first mapping relationship to obtain the second text paragraph information carrying the tag text information, so that it can be output and displayed. Of course, the above process can be performed with reference to the content of the preset dictionary tree in the previous text, or it can be replaced by other embodiments. The present invention is not limited to the embodiments herein.

[0133] In summary, the text processing method provided by the present invention locates the position of the starting selection signal and obtains the entire text paragraph at that position. In the subsequent process of monitoring the subsequent selection signal, it can quickly respond to the subsequent selection signal to perform style conversion and display, thereby solving the technical problem that the native page cannot perform special display on the swiping operation; at the same time, before the style conversion of the text paragraph, it also includes the judgment and analysis of the data type, and uses the preset style data group for unified modification during the style conversion process, thereby being able to meet the text data selection requirements of different types of pages, unify the design language, and improve the overall aesthetics.

[0134] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.

[0135] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.< / h2>

Claims

1. A text processing method, characterized in that: include: Receiving a start selection signal of a native page, parsing a start selection position represented by the start selection signal, acquiring a text paragraph where the start selection position is located in the native page, and obtaining first text paragraph information; Determine the data type of the first text paragraph information and parse it to generate first text paragraph data; monitoring a continuation selection signal of a native page, parsing a continuation selection position represented by the continuation selection signal, and modifying at least a portion of the first text paragraph data according to a preset style data group to obtain second text paragraph data; Replacing the first text paragraph data with the second text paragraph data and outputting and displaying the data; The method specifically comprises: Traversing the first text paragraph information, and determining the data type of the first text paragraph information; If the first text paragraph information contains at least one preset tag information, the first text paragraph information is determined to be tag-carrying text information, and a preset search engine is called to establish a mapping relationship between the preset tag information and the preset style data group, and the first text paragraph data is parsed to obtain.

2. The text processing method according to claim 1, characterized in that: The method specifically comprises: Parsing and obtaining first tag information in the first text paragraph information; Calling a preset dictionary tree in the preset search engine to search and obtain corresponding first style object information according to the first tag information; Modify the corresponding first label information according to the first style object information; Iterate until all tag information in the first text paragraph information is modified to generate the first text paragraph data; Wherein, the preset style data group includes at least the first style object information.

3. The text processing method according to claim 2, characterized in that: The first tag information includes first tag prefix information and first tag content information, and the first style object information includes first style type information and first style content information; The method specifically comprises: The first tag prefix information is modified to the corresponding first style type information, and the first tag content information is modified to the corresponding first style content information.

4. The text processing method according to claim 1, characterized in that: The preset style data group includes at least one preset style data, and the method specifically includes: Calling a preset style modification tool, taking at least one of the preset style data as an indication parameter, taking the start selection signal and the continuation selection signal as a start parameter and an end parameter respectively, modifying at least part of the first text paragraph, and obtaining the second text paragraph data.

5. The text processing method according to claim 1, characterized in that: The method specifically comprises: Modify the portion between the starting selection position and the subsequent selection position in the first text paragraph data according to the preset style data group to obtain second text paragraph data; The method further comprises: Receiving a stop selection signal of a native page, parsing a stop selection position represented by the stop selection signal, acquiring a text paragraph between the start selection position and the stop selection position in the native page, and obtaining text selection data; Divide the selected text data into temporary storage partitions in the memory according to the length of the selected text data, and copy the selected text data to the temporary storage partitions; The temporary storage partition is configured to receive a paste operation signal and output the data stored therein to be displayed on the native page.

6. The text processing method according to claim 1, characterized in that: The method further comprises: receiving a first continuous selection signal of the native page, parsing a first continuous selection position represented by the first continuous selection signal, acquiring a portion between the start selection position and the first continuous selection position in the first text paragraph data, and obtaining first text selected data; Traversing the first text selected data, and if the first text selected data contains a line break character, outputting a first prompt signal; The method further comprises: When a first confirmation signal corresponding to the first prompt signal is received, the first text paragraph data is divided in the memory according to the length of the first text paragraph data to obtain a first temporary storage partition, and the first text paragraph data is copied to the first temporary storage partition; When a stop selection signal of the native page is received, the second temporary storage partition is obtained by dividing the text selected data in the memory according to the length of the text selected data, and the first text selected data is copied to the second temporary storage partition.

7. A text processing system, characterized in that: The method is configured to execute the steps of the text processing method described in any one of claims 1 to 6.

8. An electronic device, characterized in that: It includes a processor, a memory and a communication bus, wherein the processor and the memory communicate with each other through the communication bus; The memory is used to store the application program; The processor is used to implement the steps of the text processing method according to any one of claims 1 to 6 when executing the application stored in the memory.

9. A storage medium having an application stored thereon, characterized in that: When the application is executed, the steps of the text processing method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • PDF document online editing method and device and electronic equipment

    CN109657220A