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

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

Info

Publication number
CN116776838A
CN116776838A CN202310748340.1A CN202310748340A CN116776838A CN 116776838 A CN116776838 A CN 116776838A CN 202310748340 A CN202310748340 A CN 202310748340A CN 116776838 A CN116776838 A CN 116776838A
Authority
CN
China
Prior art keywords
text
data display
display mode
character string
target character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310748340.1A
Other languages
Chinese (zh)
Inventor
俞悦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN202310748340.1A priority Critical patent/CN116776838A/en
Publication of CN116776838A publication Critical patent/CN116776838A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the application belongs to the field of big data, and relates to a text processing method, which comprises the following steps: receiving text content input by a user in a text input box in the constructed rich text editor; performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a first object; displaying first selection information of a data display mode, and receiving the data display mode selected by a user from the first selection information; acquiring a second object corresponding to the data display mode from the first object based on the data display mode; converting the second object to obtain a target character string; and displaying the target character string. The application also provides a text processing device, computer equipment and a storage medium. In addition, the application also relates to a blockchain technology, and the target character string can be stored in the blockchain. The application can rapidly and accurately process the input text content according to the use of the constructed rich text editor so as to generate the target character string to be displayed.

Description

Text processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a text processing method, a device, a computer device, and a storage medium.
Background
With the rapid development of technology, modern communication tools such as smartphones, notebook computers and the like are increasingly popular in current life, and basically, various communication tools comprise a text editor for editing texts, so that diversified text contents are presented. The presently preferred rich text editors include draft. Js (act); slave.js; quill.js; tinycce; kendoReact; tipTap, etc., but the content acquired by the edit boxes of the rich text editors is a character string comprising html tags, when a user inputs text content in the rich text editors, the rich text editors need to check the sensitive words and the maximum length in the text content, and the tag characters are required to be excluded for verification at this time, however, the tags are not uniform and cannot appear in pairs, for example, the 'n' and the < br/>, and the special tags need to be additionally processed, so that the processing process of the rich text editors is complex and complicated, and the data processing efficiency of the rich text editors is low.
Disclosure of Invention
The embodiment of the application aims to provide a text processing method, a device, computer equipment and a storage medium, which are used for solving the technical problems that when a user inputs text content in the existing rich text editor, the rich text editor needs to check the sensitive word and the maximum length in the text content, so that the processing process of the rich text editor is complex and complicated, and the data processing efficiency of the rich text editor is low.
In order to solve the above technical problems, the embodiment of the present application provides a text processing method, which adopts the following technical scheme:
receiving text content input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
displaying first selection information of a data display mode, and receiving the data display mode selected by the user from the first selection information;
acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
Converting the second object to obtain a corresponding target character string;
and displaying the target character string.
Further, the step of obtaining, based on the data display manner, a second object corresponding to the data display manner from the first object specifically includes:
judging whether the data display mode is an attribute display mode or not;
if yes, calling a first acquisition method corresponding to the attribute display mode;
and acquiring an object corresponding to the attribute display mode from the first object based on the first acquisition method to obtain the second object.
Further, the step of obtaining, based on the data display manner, a second object corresponding to the data display manner from the first object specifically includes:
judging whether the data display mode is a style display mode or not;
if yes, a second acquisition method corresponding to the style display mode is called;
and acquiring an object corresponding to the style display mode from the first object based on the second acquisition method to obtain a second object.
Further, the step of displaying the target character string specifically includes:
Displaying second selection information of the data display medium; wherein the data display medium comprises a rich text editing box and a plain text editing box;
receiving a target data display medium selected by the user in the second selection information;
and displaying the target character string in an editing area in the target data display medium.
Further, the step of displaying the target character string in the editing area in the target data display medium specifically includes the steps of:
acquiring position information of an editing area in the target data display medium;
and displaying the target character string in an editing area in the target data display medium based on the position information.
Further, after the step of displaying the target character string in the editing area in the target data display medium based on the position information, the method further includes:
judging whether an editing operation triggered by the user in the target data display medium and corresponding to the target character string is received or not;
if yes, responding to the editing operation;
and executing the command corresponding to the editing operation to obtain the corresponding edited target character string.
Further, the step of receiving text content input by a user in a text input box in a pre-built rich text editor specifically includes:
monitoring text input operation of the user based on a preset script;
acquiring initial text data corresponding to the text input operation;
formatting the initial text data to obtain the text content;
and filling the text content into the rich text editor.
In order to solve the above technical problems, the embodiment of the present application further provides a text processing device, which adopts the following technical scheme:
the first receiving module is used for receiving text contents input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
the first processing module is used for performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
the second receiving module is used for displaying first selection information of a data display mode and receiving the data display mode selected by the user from the first selection information;
The acquisition module is used for acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
the second processing module is used for converting the second object to obtain a corresponding target character string;
and the display module is used for displaying the target character string.
In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical schemes:
receiving text content input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
displaying first selection information of a data display mode, and receiving the data display mode selected by the user from the first selection information;
acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
converting the second object to obtain a corresponding target character string;
And displaying the target character string.
In order to solve the above technical problems, an embodiment of the present application further provides a computer readable storage medium, which adopts the following technical schemes:
receiving text content input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
displaying first selection information of a data display mode, and receiving the data display mode selected by the user from the first selection information;
acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
converting the second object to obtain a corresponding target character string;
and displaying the target character string.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
firstly, receiving text content input by a user in a text input box in a pre-constructed rich text editor; then, label disassembly and style disassembly are carried out on the text content based on the rich text editor, and a corresponding first object is generated; then, first selection information of a data display mode is displayed, and the data display mode selected by the user from the first selection information is received; further based on the data display mode, acquiring a second object corresponding to the data display mode from the first object; subsequently, converting the second object to obtain a corresponding target character string; and finally, displaying the target character string. According to the embodiment of the application, the text content input by a user is processed by using the rich text editor constructed based on the virtual dom, and the constructed rich text editor realizes a data structure based on the virtual dom, so that the label verification process of the existing rich text editor can be optimized, the label verification process is reduced, the target character string required to be displayed can be quickly and accurately generated, the data processing efficiency of the rich text editor is effectively improved, convenience is provided for the operation of processing data by developers, and development efficiency is improved. And the display of the target character string can be determined according to the selection of the user, so that the intelligence of data display is improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for the description of the embodiments of the present application, it being apparent that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without the exercise of inventive effort for a person of ordinary skill in the art.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow chart of one embodiment of a text processing method according to the present application;
FIG. 3 is a schematic diagram of an embodiment of a text processing device according to the present application;
FIG. 4 is a schematic structural diagram of one embodiment of a computer device in accordance with the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to make the person skilled in the art better understand the solution of the present application, the technical solution of the embodiment of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the text processing method provided by the embodiment of the present application is generally executed by a server/terminal device, and accordingly, the text processing apparatus is generally disposed in the server/terminal device.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow chart of one embodiment of a text processing method according to the present application is shown. The text processing method comprises the following steps:
Step S201, receiving text content input by a user in a text input box in a pre-built rich text editor.
In this embodiment, the electronic device (e.g., the server/terminal device shown in fig. 1) on which the text processing method operates may acquire the text content through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection may include, but is not limited to, 3G/4G/5G connection, wiFi connection, bluetooth connection, wiMAX connection, zigbee connection, UWB (ultra wideband) connection, and other now known or later developed wireless connection. Wherein the rich text editor is built by a developer based on virtual dom. Virtual dom is a tree structure that describes data points on a page to be displayed using script editing objects. The script editing object may be a javascript object, for example. The rich text editor constructed based on the virtual dom transmits rich text content not in the form of character strings but in the form of one object, so that the verification process of labels of the rich text content can be reduced/avoided. The rich text is normally displayed on the page, but the content acquired in the script is an object, and the object resembles a virtual dom structure, and the data structure is specifically:
Wherein the type attribute is a tag; value is the value of the text within the specified element tag, which is obtained or set from the beginning of the element tag to the end of the element tag (excluding the HTML tag). Acquiring the content of the element: element. Element setting: an element. innertext = realization string; style is a style, which is also stored in the form of a string; child is an array, since a paragraph may have multiple clauses, there are many different labels and contents in a paragraph (inside a p label), the data structure of child element is the same as the data structure of the outer layer, and there is no circumstance that child is nested child, since a clause in a paragraph can be represented by one object completely, and no clause can be used anymore, since a clause of a clause can also be a clause of the outermost paragraph. In addition, the rich text editor constructed based on the virtual dom is convenient for the back-end personnel to process the rich text content, reduces the process of checking labels, ensures that the data has a structure and a rule and is circulated, reduces the specificity of the data, improves the uniformity of the data, simplifies the method for storing the content, processes the data more conveniently and visually, and accords with humanized processing logic.
Step S202, performing label disassembling and style disassembling processing on the text content based on the rich text editor, and generating a corresponding first object.
In this embodiment, the user inputs rich text in the rich text editor, the rich text editor can automatically disassemble the tag and the style to generate the object, then the data is transmitted in the form of the object, and the object is automatically converted into a character string to be displayed in the editing area when the content is displayed by using the rich text editor.
Step S203, displaying first selection information of the data display mode, and receiving the data display mode selected by the user from the first selection information.
In this embodiment, the first selection information is generated to remind the user to perform selection information for the data display mode. The data display modes at least comprise an attribute display mode and a style display mode.
Step S204, based on the data display mode, obtaining a second object corresponding to the data display mode from the first objects.
In this embodiment, the above-mentioned implementation process of obtaining, based on the data display manner, the second object corresponding to the data display manner from the first object will be described in further detail in the following embodiments, which will not be described herein.
Step S205, performing conversion processing on the second object to obtain a corresponding target string.
In this embodiment, when the content is displayed using the rich text editor, the rich text editor automatically converts the object into a character string to be displayed in the editing area.
And step S206, displaying the target character string.
In this embodiment, the specific implementation process of displaying the target string will be described in further detail in the following specific embodiments, which are not described herein.
Firstly, receiving text content input by a user in a text input box in a pre-constructed rich text editor; then, label disassembly and style disassembly are carried out on the text content based on the rich text editor, and a corresponding first object is generated; then, first selection information of a data display mode is displayed, and the data display mode selected by the user from the first selection information is received; further based on the data display mode, acquiring a second object corresponding to the data display mode from the first object; subsequently, converting the second object to obtain a corresponding target character string; and finally, displaying the target character string. According to the application, the text content input by a user is processed by using the rich text editor constructed based on the virtual dom, and the constructed rich text editor realizes a data structure based on the virtual dom, so that the processing of label verification of the existing rich text editor can be optimized, the label verification process is reduced, the target character string required to be displayed can be quickly and accurately generated, the data processing efficiency of the rich text editor is effectively improved, convenience is provided for the operation of processing data by developers, and the development efficiency is improved. And the display of the target character string can be determined according to the selection of the user, so that the intelligence of data display is improved, and the user experience is improved.
In some alternative implementations, step S204 includes the steps of:
and judging whether the data display mode is an attribute display mode or not.
In this embodiment, the data display modes may at least include an attribute display mode and a style display mode. The style display mode refers to a mode in which only an attribute (value) is displayed.
If yes, a first acquisition method corresponding to the attribute display mode is called.
In this embodiment, the first acquisition method is specifically a content.
And acquiring an object corresponding to the attribute display mode from the first object based on the first acquisition method to obtain the second object.
In this embodiment, by executing the content value method, an object corresponding to the attribute display mode can be automatically acquired from the first object, and the second object can be further obtained.
Judging whether the data display mode is an attribute display mode or not; if yes, calling a first acquisition method corresponding to the attribute display mode; and acquiring the object corresponding to the attribute display mode from the first object based on the first acquisition method to obtain the second object. According to the application, after the corresponding target character string is generated based on the rich text editor, the target character string can be subjected to data selection display processing according to the personal requirements of the user, namely, the user can selectively display the style or the attribute, so that the intelligence of data display of the target character string is improved, and the improvement of the working physical examination of the user is facilitated.
In some alternative implementations of the present embodiment, step S204 includes the steps of:
and judging whether the data display mode is a style display mode or not.
In this embodiment, the data display modes may at least include an attribute display mode and a style display mode. The style display mode refers to a mode in which only a style is displayed.
If yes, a second acquisition method corresponding to the style display mode is called.
In this embodiment, the second acquisition method is specifically a content method,
and acquiring an object corresponding to the style display mode from the first object based on the second acquisition method to obtain a second object.
In this embodiment, by executing the content method, the rich text editor automatically traverses the first object, and joins the attributes of the first object to obtain the second object. The specific content method corresponds to the following execution code:
judging whether the data display mode is a style display mode or not; if yes, a second acquisition method corresponding to the style display mode is called; and acquiring an object corresponding to the style display mode from the first object based on the second acquisition method to obtain a second object. According to the application, after the corresponding target character string is generated based on the rich text editor, the target character string can be subjected to data selection display processing according to the personal requirements of the user, namely, the user can selectively display the style or the attribute, so that the intelligence of data display of the target character string is improved, and the improvement of the working physical examination of the user is facilitated.
In some alternative implementations, step S206 includes the steps of:
displaying second selection information of the data display medium; the data display medium comprises a rich text editing box and a plain text editing box.
In this embodiment, the second selection information is generated selection information for reminding the user to perform selection on the data display medium of the generated target character string.
And receiving a target data display medium selected by the user in the second selection information.
In this embodiment, the user may select, through a hook or click operation, a corresponding target data display medium required for displaying the target character string from the second selection information.
And displaying the target character string in an editing area in the target data display medium.
In this embodiment, the above specific implementation process of displaying the target character string in the editing area of the target data display medium will be described in further detail in the following specific embodiments, which will not be described herein.
The existing rich text editor can only display the data obtained after processing the text content input by the user in the rich text editor, and if the data is displayed in a common input box or content area, labels and style codes are displayed, and the situation of messy codes exists and has limitations.
The application displays the second selection information of the data display medium; then receiving a target data display medium selected by the user in the second selection information; and displaying the target character string in an editing area in the target data display medium. When the generated target character string is displayed, the target data display medium selected in the second selection information can be displayed in the rich text editing box or the plain text editing box according to the personal requirement of the user, so that the display of the target character string is more diversified, and the configurability of the display of the target character string is improved.
In some alternative implementations, the target character string is presented in an edit area in the target data display medium, including the steps of:
position information of an editing area in the target data display medium is acquired.
In the present embodiment, the above-described position information may include coordinate information of the editing area in the target data display medium.
And displaying the target character string in an editing area in the target data display medium based on the position information.
In this embodiment, the area where the editing area in the target data display medium is located may be determined based on the location information, and then the editing area of the target character string in the target data display medium may be displayed.
The application obtains the position information of the editing area in the target data display medium; and then displaying the target character string in an editing area in the target data display medium based on the position information, so that the target character string can be accurately displayed in the target data display medium.
In some optional implementations of this embodiment, after the step of presenting the target character string in the editing area in the target data display medium based on the location information, the electronic device may further perform the following steps:
and judging whether an editing operation triggered by the user in the target data display medium and corresponding to the target character string is received or not.
In the present embodiment, the above editing operation may include a delete object operation, an insert object operation, and the like.
If yes, responding to the editing operation.
And executing the command corresponding to the editing operation to obtain the corresponding edited target character string.
In this embodiment, the command corresponding to the editing operation is executed to accept the editing operation triggered by the user and corresponding to the target string, so as to generate and display the edited target string.
The application judges whether the editing operation corresponding to the target character string triggered by the user in the target data display medium is received or not; if yes, responding to the editing operation; and executing the command corresponding to the editing operation to obtain the corresponding edited target character string. After the corresponding target character string is generated based on the rich text editor, the target character string can be edited according to the personal requirement of the user, so that the target character string can be modified and edited, the editing intelligence and convenience of the target character string are improved, and the work physical examination of the user is improved.
In some alternative implementations of the present embodiment, step S201 includes the steps of:
and monitoring text input operation of the user based on a preset script.
In this embodiment, the preset script may be a js script that is pre-built to monitor the input operation. The text input operation may include keyboard input or text pasting.
And acquiring initial text data corresponding to the text input operation.
And formatting the initial text data to obtain the text content.
In this embodiment, the formatting process refers to performing formatting filtering on the initial text data to obtain pure text content.
And filling the text content into the rich text editor.
According to the method, text input operation of the user is monitored based on a preset script; then acquiring initial text data corresponding to the text input operation; formatting the initial text data to obtain the text content; and filling the text content into the rich text editor. According to the method and the device, the initial text data input by the user can be rapidly obtained based on the use of the preset script, and further the initial text data can be intelligently formatted to obtain the text data without format, so that the abnormal typesetting of the interface contents can be effectively prevented, and the display normalization and accuracy of the text contents are improved.
It should be emphasized that, to further ensure the privacy and security of the target string, the target string may also be stored in a blockchain node.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by computer readable instructions stored in a computer readable storage medium that, when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
With further reference to fig. 3, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a text processing apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus is particularly applicable to various electronic devices.
As shown in fig. 3, the text processing apparatus 300 according to the present embodiment includes: a first receiving module 301, a first processing module 302, a second receiving module 303, an obtaining module 304, a second processing module 305, and a display module 306. Wherein:
A first receiving module 301, configured to receive text content input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
the first processing module 302 is configured to perform label disassembly and style disassembly processing on the text content based on the rich text editor, so as to generate a corresponding first object;
the second receiving module 303 is configured to display first selection information of a data display manner, and receive a data display manner selected by the user from the first selection information;
an obtaining module 304, configured to obtain, based on the data display manner, a second object corresponding to the data display manner from the first object;
a second processing module 305, configured to perform conversion processing on the second object to obtain a corresponding target string;
and the display module 306 is configured to display the target character string.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In some alternative implementations of the present embodiment, the obtaining module 304 includes:
The first judging submodule is used for judging whether the data display mode is an attribute display mode or not;
the first calling sub-module is used for calling a first acquisition method corresponding to the attribute display mode if yes;
and the first acquisition sub-module is used for acquiring the object corresponding to the attribute display mode from the first object based on the first acquisition method to obtain the second object.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In some alternative implementations of the present embodiment, the obtaining module 304 includes:
the second judging submodule is used for judging whether the data display mode is a style display mode or not;
the second calling sub-module is used for calling a second acquisition method corresponding to the style display mode if yes;
and the second acquisition sub-module is used for acquiring the object corresponding to the style display mode from the first object based on the second acquisition method to obtain a second object.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, and are not described herein again.
In some alternative implementations of the present embodiment, the presentation module 306 includes:
the first display sub-module is used for displaying second selection information of the data display medium; wherein the data display medium comprises a rich text editing box and a plain text editing box;
the receiving sub-module is used for receiving a target data display medium selected by the user in the second selection information;
and the second display sub-module is used for displaying the target character string in an editing area in the target data display medium.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In some optional implementations of this embodiment, the second presentation submodule includes:
a third obtaining sub-module, configured to obtain position information of an editing area in the target data display medium;
and the third display sub-module is used for displaying the target character string in an editing area in the target data display medium based on the position information.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In some optional implementations of this embodiment, the presentation module 306 further includes:
a third judging sub-module, configured to judge whether an editing operation triggered by the user in the target data display medium and corresponding to the target character string is received;
a response sub-module, configured to respond to the editing operation if yes;
and the execution sub-module is used for executing the command corresponding to the editing operation to obtain the corresponding edited target character string.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In some optional implementations of this embodiment, the first receiving module includes:
the monitoring sub-module is used for monitoring the text input operation of the user based on a preset script;
a fourth obtaining sub-module, configured to obtain initial text data corresponding to the text input operation;
the processing sub-module is used for formatting the initial text data to obtain the text content;
and the filling sub-module is used for filling the text content into the rich text editor.
In this embodiment, the operations performed by the modules or units respectively correspond to the steps of the text processing method in the foregoing embodiment one by one, which is not described herein again.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 4, fig. 4 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It should be noted that only computer device 4 having components 41-43 is shown in the figures, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), 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 memory, magnetic disk, optical disk, etc. In some embodiments, the storage 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 4. Of course, the memory 41 may also comprise both an internal memory unit of the computer device 4 and an external memory device. In this embodiment, the memory 41 is typically used to store an operating system and various application software installed on the computer device 4, such as computer readable instructions of a text processing method, and the like. Further, the memory 41 may be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or process data, such as computer readable instructions for executing the text processing method.
The network interface 43 may comprise a wireless network interface or a wired network interface, which network interface 43 is typically used for establishing a communication connection between the computer device 4 and other electronic devices.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
in the embodiment of the application, firstly, text content input by a user in a text input box in a pre-constructed rich text editor is received; then, label disassembly and style disassembly are carried out on the text content based on the rich text editor, and a corresponding first object is generated; then, first selection information of a data display mode is displayed, and the data display mode selected by the user from the first selection information is received; further based on the data display mode, acquiring a second object corresponding to the data display mode from the first object; subsequently, converting the second object to obtain a corresponding target character string; and finally, displaying the target character string. According to the embodiment of the application, the text content input by a user is processed by using the rich text editor constructed based on the virtual dom, and the constructed rich text editor realizes a data structure based on the virtual dom, so that the label verification process of the existing rich text editor can be optimized, the label verification process is reduced, the target character string required to be displayed can be quickly and accurately generated, the data processing efficiency of the rich text editor is effectively improved, convenience is provided for the operation of processing data by developers, and development efficiency is improved. And the display of the target character string can be determined according to the selection of the user, so that the intelligence of data display is improved, and the user experience is improved.
The present application also provides another embodiment, namely, a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the text processing method as described above.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
in the embodiment of the application, firstly, text content input by a user in a text input box in a pre-constructed rich text editor is received; then, label disassembly and style disassembly are carried out on the text content based on the rich text editor, and a corresponding first object is generated; then, first selection information of a data display mode is displayed, and the data display mode selected by the user from the first selection information is received; further based on the data display mode, acquiring a second object corresponding to the data display mode from the first object; subsequently, converting the second object to obtain a corresponding target character string; and finally, displaying the target character string. According to the embodiment of the application, the text content input by a user is processed by using the rich text editor constructed based on the virtual dom, and the constructed rich text editor realizes a data structure based on the virtual dom, so that the label verification process of the existing rich text editor can be optimized, the label verification process is reduced, the target character string required to be displayed can be quickly and accurately generated, the data processing efficiency of the rich text editor is effectively improved, convenience is provided for the operation of processing data by developers, and development efficiency is improved. And the display of the target character string can be determined according to the selection of the user, so that the intelligence of data display is improved, and the user experience is improved.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
It is apparent that the above-described embodiments are only some embodiments of the present application, but not all embodiments, and the preferred embodiments of the present application are shown in the drawings, which do not limit the scope of the patent claims. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a thorough and complete understanding of the present disclosure. Although the application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing description, or equivalents may be substituted for elements thereof. All equivalent structures made by the content of the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the scope of the application.

Claims (10)

1. A text processing method, comprising the steps of:
receiving text content input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
displaying first selection information of a data display mode, and receiving the data display mode selected by the user from the first selection information;
acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
converting the second object to obtain a corresponding target character string;
and displaying the target character string.
2. The text processing method according to claim 1, wherein the step of acquiring, from the first object, a second object corresponding to the data display mode based on the data display mode specifically includes:
judging whether the data display mode is an attribute display mode or not;
if yes, calling a first acquisition method corresponding to the attribute display mode;
And acquiring an object corresponding to the attribute display mode from the first object based on the first acquisition method to obtain the second object.
3. The text processing method according to claim 1, wherein the step of acquiring, from the first object, a second object corresponding to the data display mode based on the data display mode specifically includes:
judging whether the data display mode is a style display mode or not;
if yes, a second acquisition method corresponding to the style display mode is called;
and acquiring an object corresponding to the style display mode from the first object based on the second acquisition method to obtain a second object.
4. The text processing method according to claim 1, wherein the step of displaying the target character string specifically includes:
displaying second selection information of the data display medium; wherein the data display medium comprises a rich text editing box and a plain text editing box;
receiving a target data display medium selected by the user in the second selection information;
and displaying the target character string in an editing area in the target data display medium.
5. The text processing method according to claim 4, wherein the step of displaying the target character string in an editing area in the target data display medium comprises:
acquiring position information of an editing area in the target data display medium;
and displaying the target character string in an editing area in the target data display medium based on the position information.
6. The text processing method according to claim 5, further comprising, after the step of presenting the target character string in the editing area in the target data display medium based on the position information:
judging whether an editing operation triggered by the user in the target data display medium and corresponding to the target character string is received or not;
if yes, responding to the editing operation;
and executing the command corresponding to the editing operation to obtain the corresponding edited target character string.
7. The text processing method according to claim 1, wherein the step of receiving text content entered by a user in a text entry box in a pre-built rich text editor, specifically comprises:
Monitoring text input operation of the user based on a preset script;
acquiring initial text data corresponding to the text input operation;
formatting the initial text data to obtain the text content;
and filling the text content into the rich text editor.
8. A text processing apparatus, comprising:
the first receiving module is used for receiving text contents input by a user in a text input box in a pre-built rich text editor; wherein the rich text editor is constructed based on virtual dom;
the first processing module is used for performing label disassembly and style disassembly processing on the text content based on the rich text editor to generate a corresponding first object;
the second receiving module is used for displaying first selection information of a data display mode and receiving the data display mode selected by the user from the first selection information;
the acquisition module is used for acquiring a second object corresponding to the data display mode from the first object based on the data display mode;
the second processing module is used for converting the second object to obtain a corresponding target character string;
And the display module is used for displaying the target character string.
9. A computer device comprising a memory having stored therein computer readable instructions which when executed by a processor implement the steps of the text processing method of any of claims 1 to 7.
10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the text processing method according to any of claims 1 to 7.
CN202310748340.1A 2023-06-21 2023-06-21 Text processing method, device, computer equipment and storage medium Pending CN116776838A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310748340.1A CN116776838A (en) 2023-06-21 2023-06-21 Text processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310748340.1A CN116776838A (en) 2023-06-21 2023-06-21 Text processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116776838A true CN116776838A (en) 2023-09-19

Family

ID=88013001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310748340.1A Pending CN116776838A (en) 2023-06-21 2023-06-21 Text processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116776838A (en)

Similar Documents

Publication Publication Date Title
CN114996619A (en) Page display method and device, computer equipment and storage medium
CN113052262A (en) Form generation method and device, computer equipment and storage medium
CN117195886A (en) Text data processing method, device, equipment and medium based on artificial intelligence
CN116755688A (en) Component processing method, device, computer equipment and storage medium
CN117234505A (en) Interactive page generation method, device, equipment and storage medium thereof
CN112182157A (en) Training method of online sequence labeling model, online labeling method and related equipment
CN116774973A (en) Data rendering method, device, computer equipment and storage medium
CN116383787A (en) Page creation method, page creation device, computer equipment and storage medium
CN116453125A (en) Data input method, device, equipment and storage medium based on artificial intelligence
CN115756692A (en) Method for automatically combining and displaying pages based on style attributes and related equipment thereof
CN116776838A (en) Text processing method, device, computer equipment and storage medium
CN114637831A (en) Data query method based on semantic analysis and related equipment thereof
CN113239670A (en) Method and device for uploading service template, computer equipment and storage medium
CN114722787B (en) Tag matching method based on Excel cascading and related equipment thereof
CN116450948A (en) AI-based intelligent message pushing method, device, setting and storage medium thereof
CN116431149A (en) Page typesetting method, device, computer equipment and storage medium
CN116932739A (en) Data generation method, device, equipment and storage medium based on artificial intelligence
CN117217684A (en) Index data processing method and device, computer equipment and storage medium
CN116450724A (en) Data processing method, device, computer equipment and storage medium
CN117271790A (en) Method and device for expanding annotation data, computer equipment and storage medium
CN115809241A (en) Data storage method and device, computer equipment and storage medium
CN115826973A (en) List page generation method and device, computer equipment and storage medium
CN116738948A (en) Data processing method, device, computer equipment and storage medium
CN117076595A (en) Text processing method, device, equipment and storage medium based on artificial intelligence
CN117421233A (en) Annotation-based code generation method, annotation-based code generation device, computer equipment and storage medium

Legal Events

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