Method for processing copied content and related device
The copy content is processed through the target recognition and garbled conversion algorithm, which solves the problem of format mismatch when copying web page content and achieves a better user experience.
Patent Information
- Application Number
- CN202210371321.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-04-11
AI Technical Summary
In the prior art, the format mismatch often occurs when copying web page content, resulting in garbled code, spaces, blank lines and HTML tags after pasting the copied content, which requires the user to edit it twice, and the user experience is poor.
The target recognition algorithm is used to delete the target data format in the copied content, the garbled recognition algorithm is used to convert the garbled data, and the format characters are deleted, providing pasting options for target text and original formats.
It improves the readability of copy content after pasting, avoids the emergence of garbled code, spaces and characters outside HTML tags, reduces users' secondary editing needs, and improves user experience.
Smart Images

Figure CN114721872B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method for processing duplicate content and related equipment. Background Art
[0002] When users browse web pages, such as web spreadsheets (Web Excel), and encounter interesting content, they may want to save it. Currently, saving web content can be done by taking a screenshot or directly copying and pasting it. However, web content saved as a screenshot is usually not editable, so most people prefer to copy and paste to save web content.
[0003] However, when directly copying and pasting web page content, there is often a problem that the format of the copied content does not match the format of the host, resulting in garbled characters, spaces, blank lines, Hypertext Markup Language (HTML) tags, etc. when the copied content is pasted on the host, requiring users to perform secondary editing, which is a poor user experience. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to provide a method for processing duplicate content and related devices thereof to solve the problem of poor user experience.
[0005] In order to solve the above technical problems, the present application provides a method for processing duplicate content, which adopts the following technical solutions:
[0006] Acquire the copied content, and when a target recognition algorithm is used to determine that the copied content carries a target data format, delete the target data format to obtain a preliminary text; use a garbled code recognition algorithm to recognize the preliminary text, and when it is recognized that the preliminary text includes garbled code data, convert the garbled code data to obtain a converted text; delete the format characters in the converted text to obtain the target text.
[0007] Furthermore, after obtaining the target text, the processing method also includes: pasting the target text into the target to be pasted in response to a triggering operation on a text paste control; or pasting the copied content into the target to be pasted in response to a triggering operation on an original format paste control.
[0008] Furthermore, when the target data format is characters other than a closed hypertext markup language tag, the target data format is determined to be carried in the copied content using a target recognition algorithm, including: when a hypertext markup language tag is included in the copied content, determining whether the hypertext markup language tag is closed using a target recognition algorithm; when the hypertext markup language tag is closed, obtaining characters other than the closed hypertext markup language tag; and determining the characters other than the closed hypertext markup language tag as the target data format.
[0009] Furthermore, when the copied content does not include a hypertext markup language tag, or when the hypertext markup language tag is not a closed tag, it is determined that the copied content does not carry the target data format.
[0010] Furthermore, when it is recognized that the preliminary text includes garbled data, the garbled data is converted to obtain a converted text, including: when it is recognized that the preliminary text includes garbled data, the garbled data is converted using a preset conversion algorithm to obtain a conversion result; and the conversion result is used to replace the garbled data in the preliminary text to obtain the converted text.
[0011] Furthermore, the converting the garbled data using a preset conversion algorithm to obtain a conversion result includes: converting the garbled data into American Standard Code for Information Interchange using a preset conversion algorithm and printing the converted data to obtain a conversion result.
[0012] Furthermore, before deleting the format characters in the converted text, the processing method further includes: using a preset regular expression to detect whether the converted text includes format characters.
[0013] In order to solve the above technical problems, the embodiment of the present application further provides a device for processing copied content, which adopts the following technical solution:
[0014] The processing module is used to obtain the copied content and, when a target data format is determined to be carried in the copied content by using a target recognition algorithm, delete the target data format to obtain a preliminary text; the conversion module is used to identify the preliminary text by using a garbled code recognition algorithm, and when it is identified that the preliminary text includes garbled code data, convert the garbled code data to obtain a converted text; the deletion module is used to delete format characters in the converted text to obtain a target text.
[0015] Furthermore, the processing device further includes a first pasting module and a second pasting module. The first pasting module is configured to paste the target text into a target to be pasted in response to a triggering operation on a text paste control; and the second pasting module is configured to paste the copied content into the target to be pasted in response to a triggering operation on a paste control in the original format.
[0016] Furthermore, when the target data format is characters outside a closed hypertext markup language tag, the processing module includes a judgment submodule, an acquisition submodule and a determination submodule; the judgment submodule is used to judge whether the hypertext markup language tag is closed when the copied content includes a hypertext markup language tag; the acquisition submodule is used to acquire characters outside the closed hypertext markup language tag when the hypertext markup language tag is closed; and the determination submodule is used to determine the characters outside the closed hypertext markup language tag as the target data format.
[0017] Furthermore, the determining submodule is further configured to determine that the copied content does not include a hypertext markup language tag, or when the hypertext markup language tag is not a closed tag, that the copied content does not carry the target data format.
[0018] Furthermore, the conversion module includes a conversion submodule and a replacement submodule. The conversion submodule is configured to, upon determining that the preliminary text includes garbled data, convert the garbled data using a preset conversion algorithm to obtain a conversion result; and the replacement submodule is configured to replace the garbled data in the preliminary text with the conversion result to obtain the converted text.
[0019] Furthermore, the conversion submodule is specifically configured to convert the garbled data into American Standard Code for Information Interchange (ASTM) using a preset conversion algorithm and print the converted data to obtain a conversion result.
[0020] Furthermore, the processing device further includes a detection module configured to use a preset regular expression to detect whether the converted text includes format characters.
[0021] In order to solve the above technical problems, an embodiment of the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for processing copied content when executing the computer program.
[0022] In order to solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for processing copied content are implemented.
[0023] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects: obtaining copied content, and when determining that the copied content carries the target data format, deleting the target data format to obtain a preliminary text. When determining that the preliminary text includes garbled data, converting the garbled data to obtain a converted text, and deleting the format characters in the converted text to obtain the target text. Among them, the target data format includes text style, tabs, line breaks, carriage returns, and characters other than closed hypertext markup language tags; format characters are characters other than Chinese, English, and punctuation marks in the converted text. That is, unnecessary styles and symbols in the copied content are deleted, avoiding the problem of garbled characters, spaces, blank lines, and characters other than closed hypertext markup language tags when the copied content is pasted on the carrier, which requires the user to perform secondary editing, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0025] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0026] Figure 2 A flowchart of an embodiment of a method for processing duplicate content according to the present application;
[0027] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S21;
[0028] Figure 4 yes Figure 2 A flowchart of a specific implementation of step S22;
[0029] Figure 5 A flowchart of another embodiment of a method for processing duplicate content according to the present application;
[0030] Figure 6 is a structural diagram of an embodiment of a device for processing copied content according to the present application;
[0031] Figure 7 yes Figure 6 A schematic structural diagram of a specific embodiment of the processing module shown;
[0032] Figure 8 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0034] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0036] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0037] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0038] Terminal devices 101, 102, and 103 can be various electronic devices with display screens and support web browsing, including but not limited to smartphones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.
[0039] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0040] It should be noted that the method for processing duplicate content provided in the embodiments of the present application can be applied to the aforementioned terminal devices 101, 102, and 103. The terminal devices 101, 102, and 103 can be collectively referred to as electronic devices. That is, the execution subject of the method for processing duplicate content provided in the embodiments of the present application can be a duplicate content processing device, and the duplicate content processing device can be the aforementioned electronic device (such as the terminal devices 101, 102, and 103).
[0041] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0042] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for processing duplicate content according to the present application. The method for processing duplicate content includes the following steps:
[0043] Step S21 , obtaining the copied content, and when determining that the copied content carries a target data format using a target recognition algorithm, deleting the target data format to obtain a preliminary text.
[0044] Among them, the target data format includes text style, tabs, line breaks, carriage returns, and characters other than closed Hypertext Markup Language HTML tags. Specifically, text style refers to the graphic style of text data. Tabs refer to characters input through the tabulator key (Tab), which are used to form box drawing characters in the shape of table borders (box drawing characters are also called line drawing characters, pseudo-graphic characters, tabs, and are widely used in character user interface drawing frame diagrams and block diagrams). Line break (\n) means starting a new line with the cursor at the beginning of the new line. Carriage return (\r) means returning the cursor to the beginning of the current line. HTML is a standard markup language for creating web pages. HTML tags usually appear in pairs, and the first tag is the start tag and the second tag is the end tag, which is used to indicate that the HTML tag is closed, and the content of the element is between the two tags. For example, <title> This is a title< / title> , indicating a title, <title> and< / title> This is a closed tag that appears in pairs. This is a title is the content of the element. Some tags have no content and are empty elements. Such tags are usually self-closing, such as In this application, a closed hypertext markup language HTML tag is the above-mentioned closed tag.
[0045] Specifically, in response to a triggering operation on a copy control, the currently selected content is copied to obtain the copied content. Subsequently, a target recognition algorithm is used to determine whether the copied content carries the target data format. If the copied content carries the target data format, the target data format is deleted to obtain a preliminary text. The target recognition algorithm is capable of identifying whether the copied content carries the target data format. For example, the target recognition algorithm may identify the target data format by using a target regular expression to match the copied content and determine whether the target data format corresponds to the target regular expression.
[0046] In some optional implementations, such as Figure 3 As shown, when the target data format is characters other than closed hypertext markup language tags, a target recognition algorithm is used to determine a method for carrying the target data format in the copied content, including the following steps:
[0047] Step S211: When the copied content includes a hypertext markup language tag, an object recognition algorithm is used to determine whether the hypertext markup language tag is closed.
[0048] Specifically, the object recognition algorithm can be used to determine whether an HTML tag is closed by detecting a start character and an end character in the copied content. When a pair of start characters and end characters are detected, it is determined that the HTML tag corresponding to the pair of start characters and end characters is closed. If a pair of start characters and end characters is not detected, it is determined that the HTML tag corresponding to the pair of start characters and end characters is not closed.
[0049] Optionally, when the copied content does not include a hypertext markup language tag, it is determined that the copied content does not carry the target data format.
[0050] Step S212: when the HTML tag is closed, obtain characters outside the closed HTML tag.
[0051] For example, copy the content <title> This is a title< / title> When abs, <title> and< / title> It is a closed HTML tag that appears in pairs, and abs is a character outside the closed HTML tag.
[0052] Optionally, when the HTML tag is not a closed tag, it is determined that the copied content does not carry the target data format.
[0053] Step S213: determining the characters outside the closed HTML tag as the target data format.
[0054] In this embodiment, a determination is first made as to whether the copied content contains closed HTML tags. Characters outside the closed HTML tags are then retrieved to determine the target data format, facilitating subsequent deletion of the target data format. This avoids the problem of characters outside the closed HTML tags appearing when the copied content is pasted onto a carrier, requiring the user to perform secondary editing, thereby improving the user experience.
[0055] Step S22: using a garbled code recognition algorithm to recognize the preliminary text, and when it is recognized that the preliminary text includes garbled code data, converting the garbled code data to obtain a converted text.
[0056] The garbled code recognition algorithm is preset and can identify whether the preliminary text includes garbled code. For example, the process of using the garbled code recognition algorithm to identify garbled code can include determining whether there are uncommon characters in the preliminary text. If there are uncommon characters, the occupancy rate of the uncommon characters in the uncommon characters is calculated based on the number of uncommon characters in the uncommon characters and the number of characters in the uncommon characters. If the occupancy rate is greater than a preset threshold, the uncommon characters are identified as a garbled paragraph, and the data corresponding to the garbled paragraph is garbled data.
[0057] Specifically, such as Figure 4As shown, when it is recognized that the preliminary text includes garbled data, the method of converting the garbled data to obtain the converted text includes the following steps:
[0058] Step S221 : when it is recognized that the preliminary text includes garbled data, a preset conversion algorithm is used to convert the garbled data to obtain a conversion result.
[0059] Specifically, the preset conversion algorithm is used to convert the garbled data into American Standard Code for Information Interchange (ASCII) and print it. That is, the garbled data is converted into ASCII code by the preset conversion algorithm and printed out to obtain a conversion result.
[0060] Step S222: Use the conversion result to replace the garbled data in the preliminary text to obtain the converted text.
[0061] In this embodiment, when it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain converted text, thereby avoiding the problem of garbled characters appearing when the copied content is pasted on the carrier, requiring the user to perform secondary editing, thereby improving the user experience.
[0062] Step S23: Delete the format characters in the converted text to obtain the target text.
[0063] The format characters are characters in the converted text other than Chinese, English, and punctuation marks. Since, in steps S221 and S222, the garbled data is converted and the conversion result is replaced with the preliminary text, the converted text is obtained. Therefore, the replaced portion of the converted text may also contain the target data format in step 21. Therefore, the format characters may include the target data format in step 21. For example, the format characters may include a tab character, a line feed character, a carriage return character, etc. In addition, the format characters may also include other special characters, such as *, #, @, etc.
[0064] Specifically, after obtaining the converted text, a preset regular expression is used to detect whether the converted text includes formatting characters. If it is determined that the converted text includes formatting characters, the formatting characters in the converted text are deleted to obtain the target text. In this embodiment, a preset regular expression is used to detect whether the converted text includes formatting characters, and if it is determined that the converted text includes formatting characters, the formatting characters in the converted text are deleted. This avoids the problem of copied content pasted onto a carrier containing characters other than Chinese, English, and punctuation marks, requiring the user to perform secondary editing, thereby improving the user experience.
[0065] In this embodiment, the copied content is obtained, and when it is determined that the copied content carries the target data format, the target data format is deleted to obtain a preliminary text. When it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain a converted text, and the format characters in the converted text are deleted to obtain the target text. Among them, the target data format includes text style, tab, line break, carriage return, and characters other than closed Hypertext Markup Language tags; format characters are characters other than Chinese, English, and punctuation marks in the converted text. That is, unnecessary styles and symbols in the copied content are deleted, avoiding the problem of garbled characters, spaces, blank lines, and characters other than closed Hypertext Markup Language tags when the copied content is pasted on the carrier, which requires the user to perform secondary editing, thereby improving the user experience.
[0066] In some optional implementations, such as Figure 5 As shown, after step S23, the method for processing the copied content further includes the following steps:
[0067] Step S24 , in response to the triggering operation of the text paste control, the target text is pasted into the target to be pasted, or, in response to the triggering operation of the original format paste control, the copied content is pasted into the target to be pasted.
[0068] Specifically, when the user triggers the text paste control, the target text is pasted, and when the user triggers the original format paste control, the original copied content is pasted, and multiple paste options can be provided to the user.
[0069] In this embodiment, the user is provided with the modified target text and the copied content in the original format, so that the user can select the required text to paste according to his or her own situation. This avoids the inconvenience caused to the user by a single paste option and further improves the user experience.
[0070] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0071] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0072] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware via computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0073] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0074] Further references Figure 6 , as a response to the above Figure 2 The present application provides an embodiment of a device for processing copied content. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0075] like Figure 6 As shown, the apparatus 600 for processing duplicate content in this embodiment includes: a processing module 601, a conversion module 602, and a deletion module 603.
[0076] The processing module 601 is used to obtain the copied content and, when a target recognition algorithm is used to determine that the copied content carries a target data format, delete the target data format to obtain a preliminary text; the conversion module 602 is used to use a garbled code recognition algorithm to recognize the preliminary text, and when it is recognized that the preliminary text includes garbled code data, convert the garbled code data to obtain a converted text; the deletion module 603 is used to delete the format characters in the converted text to obtain the target text.
[0077] In this embodiment, the copied content is obtained, and when it is determined that the copied content carries the target data format, the target data format is deleted to obtain a preliminary text. When it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain a converted text, and the format characters in the converted text are deleted to obtain the target text. Among them, the target data format includes text style, tab, line break, carriage return, and characters other than closed Hypertext Markup Language tags; format characters are characters other than Chinese, English, and punctuation marks in the converted text. That is, unnecessary styles and symbols in the copied content are deleted, avoiding the problem of garbled characters, spaces, blank lines, and characters other than closed Hypertext Markup Language tags when the copied content is pasted on the carrier, which requires the user to perform secondary editing, thereby improving the user experience.
[0078] In some optional implementations of this embodiment, the processing device further includes a first pasting module and a second pasting module. The first pasting module is configured to paste the target text into a to-be-pasted target in response to a triggering operation on a text paste control; and the second pasting module is configured to paste the copied content into the to-be-pasted target in response to a triggering operation on a paste control in the original format.
[0079] In this embodiment, the user is provided with the modified target text and the copied content in the original format, so that the user can select the required text to paste according to his or her own situation. This avoids the inconvenience caused to the user by a single paste option and further improves the user experience.
[0080] In some optional implementations of this embodiment, see Figure 7 , is a schematic structural diagram of a specific implementation of the processing module 601. When the target data format is characters outside a closed hypertext markup language tag, the processing module 601 includes a judgment submodule 6011, an acquisition submodule 6012, and a determination submodule 6013. The judgment submodule 6011 is configured to, when the copied content includes a hypertext markup language tag, use a target recognition algorithm to determine whether the hypertext markup language tag is closed; the acquisition submodule 6012 is configured to, when the hypertext markup language tag is closed, acquire characters outside the closed hypertext markup language tag; and the determination submodule 6013 is configured to determine the characters outside the closed hypertext markup language tag as the target data format.
[0081] In some optional implementations of this embodiment, the determination submodule is further configured to determine that the copied content does not include a hypertext markup language tag, or when the hypertext markup language tag is not a closed tag, that the copied content does not carry the target data format.
[0082] In this embodiment, a determination is first made as to whether the copied content contains closed HTML tags. Characters outside the closed HTML tags are then retrieved to determine the target data format, facilitating subsequent deletion of the target data format. This avoids the problem of characters outside the closed HTML tags appearing when the copied content is pasted onto a carrier, requiring the user to perform secondary editing, thereby improving the user experience.
[0083] In some optional implementations of this embodiment, the conversion module 602 includes a conversion submodule and a replacement submodule. The conversion submodule is configured to, upon determining that the preliminary text includes garbled data, convert the garbled data using a preset conversion algorithm to obtain a conversion result; and the replacement submodule is configured to replace the garbled data in the preliminary text with the conversion result to obtain the converted text.
[0084] In some optional implementations of this embodiment, the conversion submodule is specifically configured to convert the garbled data into American Standard Code for Information Interchange (ASTM) using a preset conversion algorithm and print the converted data to obtain a conversion result.
[0085] In this embodiment, when it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain converted text, thereby avoiding the problem of garbled characters appearing when the copied content is pasted on the carrier, requiring the user to perform secondary editing, thereby improving the user experience.
[0086] In some optional implementations of this embodiment, the processing device further includes a detection module configured to use a preset regular expression to detect whether the converted text includes format characters.
[0087] In this embodiment, a preset regular expression is used to detect whether the converted text includes format characters, and when it is determined that the converted text includes format characters, the format characters in the converted text are deleted. This avoids the problem that the copied content appears with characters other than Chinese, English, and punctuation marks when pasted on the carrier, requiring the user to perform secondary editing, thereby improving the user experience.
[0088] To solve the above technical problems, the present application also provides a computer device. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0089] The computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 8 with components 81-83, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0090] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0091] The memory 81 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as the hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash memory card, etc. equipped on the computer device 8. Of course, the memory 81 may also include both the internal storage unit of the computer device 8 and its external storage device. In this embodiment, the memory 81 is generally used to store the operating system and various application software installed on the computer device 8, such as computer-readable instructions for the method for processing copied content. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or are to be output.
[0092] In some embodiments, the processor 82 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 82 is generally used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to execute computer-readable instructions or process data stored in the memory 81, such as computer-readable instructions for executing the method for processing the copied content.
[0093] The network interface 83 may include a wireless network interface or a wired network interface. The network interface 83 is generally used to establish a communication connection between the computer device 8 and other electronic devices.
[0094] In this embodiment, the copied content is obtained, and when it is determined that the copied content carries the target data format, the target data format is deleted to obtain a preliminary text. When it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain a converted text, and the format characters in the converted text are deleted to obtain the target text. Among them, the target data format includes text style, tab, line break, carriage return, and characters other than closed Hypertext Markup Language tags; format characters are characters other than Chinese, English, and punctuation marks in the converted text. That is, unnecessary styles and symbols in the copied content are deleted, avoiding the problem of garbled characters, spaces, blank lines, and characters other than closed Hypertext Markup Language tags when the copied content is pasted on the carrier, which requires the user to perform secondary editing, thereby improving the user experience.
[0095] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions. The computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned method for processing copied content.
[0096] In this embodiment, the copied content is obtained, and when it is determined that the copied content carries the target data format, the target data format is deleted to obtain a preliminary text. When it is determined that the preliminary text includes garbled data, the garbled data is converted to obtain a converted text, and the format characters in the converted text are deleted to obtain the target text. Among them, the target data format includes text style, tab, line break, carriage return, and characters other than closed Hypertext Markup Language tags; format characters are characters other than Chinese, English, and punctuation marks in the converted text. That is, unnecessary styles and symbols in the copied content are deleted, avoiding the problem of garbled characters, spaces, blank lines, and characters other than closed Hypertext Markup Language tags when the copied content is pasted on the carrier, which requires the user to perform secondary editing, thereby improving the user experience.
[0097] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0098] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A method for processing duplicate content, characterized in that: The steps include: Acquire the copied content, and when determining that the copied content carries a target data format using a target recognition algorithm, delete the target data format to obtain a preliminary text, wherein the target data format includes text styles, tabs, line breaks, carriage returns, and characters other than closed hypertext markup language tags; recognizing the preliminary text using a garbled code recognition algorithm, and when it is recognized that the preliminary text includes garbled code data, converting the garbled code data to obtain a converted text; Deleting format characters from the converted text to obtain a target text; When the target data format is characters other than closed hypertext markup language tags, the step of using a target recognition algorithm to determine the target data format carried in the copied content includes: When the copied content includes a hypertext markup language tag, determining whether the hypertext markup language tag is closed using an object recognition algorithm, wherein a start character and an end character are detected in the copied content, and when a pair of start characters and end characters are detected, determining that the hypertext markup language tag corresponding to the pair of start characters and end characters is closed; When the hypertext markup language tag is closed, obtaining characters outside the closed hypertext markup language tag; Characters outside the closed hypertext markup language tag are determined as the target data format.
2. The processing method according to claim 1, characterized in that After obtaining the target text, the processing method further includes: In response to a triggering operation on a text paste control, pasting the target text into a to-be-pasted target; Alternatively, in response to a triggering operation on the original format paste control, the copied content is pasted into a to-be-pasted target.
3. The processing method according to claim 2, characterized in that When the copied content does not include a hypertext markup language tag, or when the hypertext markup language tag is not a closed tag, it is determined that the copied content does not carry the target data format.
4. The processing method according to claim 1, characterized in that When the preliminary text is identified to include garbled data, converting the garbled data to obtain a converted text comprises: When it is recognized that the preliminary text includes garbled data, converting the garbled data using a preset conversion algorithm to obtain a conversion result; The conversion result is used to replace the garbled data in the preliminary text to obtain the converted text.
5. The processing method according to claim 4, characterized in that: The converting of the garbled data using a preset conversion algorithm to obtain a conversion result includes: The garbled data is converted into American Standard Code for Information Interchange (ASTI) using a preset conversion algorithm and printed to obtain a conversion result.
6. The processing method according to claim 1, characterized in that Before deleting the format characters in the converted text, the processing method further includes: A preset regular expression is used to detect whether the converted text includes format characters.
7. A device for processing copied content, characterized in that: include: a processing module configured to obtain the copied content and, when determining that the copied content carries a target data format using a target recognition algorithm, delete the target data format to obtain a preliminary text, wherein the target data format includes text styles, tabs, line breaks, carriage returns, and characters other than closed hypertext markup language tags; The processing module includes a judgment submodule, an acquisition submodule and a determination submodule; The judgment submodule is configured to, when the copied content includes a hypertext markup language tag, use an object recognition algorithm to determine whether the hypertext markup language tag is closed, wherein a start character and an end character are detected in the copied content, and when a pair of start characters and end characters are detected, determine that the hypertext markup language tag corresponding to the pair of start characters and end characters is closed; The acquisition submodule is configured to acquire characters outside the closed hypertext markup language tag when the hypertext markup language tag is closed; The determining submodule is used to determine characters other than closed hypertext markup language tags as the target data format; a conversion module, configured to recognize the preliminary text using a garbled code recognition algorithm, and when recognizing that the preliminary text includes garbled code data, convert the garbled code data to obtain a converted text; The deletion module is used to delete the format characters in the conversion text to obtain the target text.
8. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the method for processing duplicated content according to any one of claims 1 to 6 when executing the computer-readable instructions.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for processing copied content according to any one of claims 1 to 6.
Citation Information
Patent Citations
Copy processing method, device and equipment for webpage information on intelligent terminal
CN101996165A
Contract text data processing method and device, equipment and storage medium
CN110096626A