WO2022179330A1 - Text processing method and apparatus, and electronic device and storage medium - Google Patents

Text processing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2022179330A1
WO2022179330A1 PCT/CN2022/071823 CN2022071823W WO2022179330A1 WO 2022179330 A1 WO2022179330 A1 WO 2022179330A1 CN 2022071823 W CN2022071823 W CN 2022071823W WO 2022179330 A1 WO2022179330 A1 WO 2022179330A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
selector
processed
divided area
interface
Prior art date
Application number
PCT/CN2022/071823
Other languages
French (fr)
Chinese (zh)
Inventor
秦小龙
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2022179330A1 publication Critical patent/WO2022179330A1/en

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0481Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing

Definitions

  • the present application relates to the field of computer technology, and more particularly, to a text processing method, apparatus, electronic device, and storage medium.
  • the present application proposes a text processing method, apparatus, electronic device and storage medium to improve the above problems.
  • the present application provides a text processing method, which is applied to an electronic device, and the method includes: after a selector stops moving, acquiring a to-be-processed divided area corresponding to a position where the selector stops moving; Taking the text in the to-be-processed divided area as the to-be-processed text;
  • the present application provides a text processing apparatus, which runs on an electronic device, the apparatus includes: an area acquisition unit, configured to acquire, after the selector stops moving, the waiting area corresponding to the position where the selector stops moving. processing the divided area; a text acquisition unit, used for taking the text in the to-be-processed divided area as the text to be processed; a text conversion unit, used for converting the to-be-processed text to obtain the converted text; a text output unit, for outputting the converted text.
  • the present application provides an electronic device including a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.
  • the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, wherein the above-mentioned method is executed when the program code is executed by a processor.
  • FIG. 1 shows a schematic diagram of an application scenario of a text processing method proposed by an embodiment of the present application
  • FIG. 2 shows a flowchart of a text processing method proposed by an embodiment of the present application
  • FIG. 3 shows a schematic diagram of a selector moving in a text processing method proposed by an embodiment of the present application
  • FIG. 4 shows a schematic diagram of a suspended display toolbar in a text processing method proposed by an embodiment of the present application
  • FIG. 5 shows a schematic diagram of another toolbar displayed in suspension in a text processing method proposed by an embodiment of the present application
  • FIG. 6 shows a reduced schematic diagram of a toolbar displayed in suspension in a text processing method proposed by an embodiment of the present application
  • FIG. 7 shows a schematic diagram of calling out a floating toolbar in a text processing method proposed by an embodiment of the present application
  • FIG. 8 shows a schematic diagram of a result display interface in a text processing method proposed by an embodiment of the present application
  • FIG. 9 shows a schematic diagram of another result display interface in a text processing method proposed by an embodiment of the present application.
  • FIG. 10 shows a schematic diagram of a language selection interface in a text processing method proposed by an embodiment of the present application
  • FIG. 11 shows a flowchart of another text processing method proposed by an embodiment of the present application.
  • FIG. 12 shows a schematic diagram of the line spacing in the embodiment of the present application.
  • FIG. 13 shows a schematic diagram of a plurality of divided regions determined in an embodiment of the present application
  • FIG. 14 shows a schematic diagram of another plurality of divided regions determined in the embodiment of the present application.
  • FIG. 15 shows a schematic diagram of changing a text conversion mode according to a pressing parameter in an embodiment of the present application
  • FIG. 16 shows a flowchart of still another text processing method proposed by an embodiment of the present application.
  • FIG. 17 shows a schematic diagram of an exit conversion mode proposed by an embodiment of the present application.
  • FIG. 18 shows a structural block diagram of a text processing apparatus proposed by another embodiment of the present application.
  • FIG. 19 shows a structural block diagram of a text processing apparatus proposed by still another embodiment of the present application.
  • FIG. 20 shows a structural block diagram of an electronic device of the present application for executing the text processing method according to an embodiment of the present application
  • FIG. 21 is a storage unit for storing or carrying a program code for implementing the text processing method according to the embodiment of the present application according to the embodiment of the present application.
  • the related conversion methods still have the problems of inconvenience and inflexibility.
  • the text to be converted needs to be copied into a dedicated conversion interface so as to be converted in the dedicated conversion interface.
  • all the content in the screenshot is directly converted, which will cause The content that the user does not need is also converted, so that the conversion process is not flexible enough.
  • the inventor proposes a text processing method, device, electronic device and storage medium that can improve the above-mentioned problems in this application.
  • the movement of the selector is detected, and then when the selector stops moving Then, obtain the to-be-processed divided area corresponding to the position where the selector stops moving, then use the text in the to-be-processed divided area as the to-be-processed text, and convert the to-be-processed text to obtain the converted text, The converted text is then output.
  • the converted text can be flexibly obtained by the above method, which improves the convenience and flexibility of the text conversion.
  • only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • the method provided in this embodiment may further include the following process: matching the position after the selector stops moving with at least one divided area; matching the corresponding position with the position after the selector stops moving The divided areas whose positions are matched are used as the divided areas to be processed.
  • the method provided in this embodiment may further include the following process: acquiring the text in the interface and the arrangement format of the text; dividing the text in the interface based on the arrangement format , to obtain at least one partitioned region.
  • the method provided in this embodiment may further include the following process: in the current division process, starting from the starting point of the current division, the line spacing between the texts of adjacent lines and the first specified threshold are sequentially divided Compare; if the first reference adjacent row is obtained, compare the first reference adjacent row, the starting point, and the first reference adjacent row between the previous row and the starting point As the division area obtained by the current division process, the next row in the first reference adjacent row is used as the starting point of the next division, until the line between the text of the last adjacent row in the interface is completed.
  • the method provided in this embodiment may further include the following process: obtaining a first text, where the first text is the text of the row where the selector stops moving; and using the first text Obtain the second text for the starting point along the specified direction and based on the text-based arrangement format; take the area where the first text, the second text and the text between the first text and the second text are located as pending processing Divide the area.
  • the method provided in this embodiment may further include the following process: starting from the first text, sequentially comparing the line spacing between texts in adjacent lines with a second specified threshold; obtaining The second reference adjacent line, the adjacent line obtained by the second reference adjacent line for the first time whose line spacing is greater than the second specified threshold; the text of the previous line in the second reference adjacent line is taken as Second text.
  • the method provided in this embodiment may further include the following process: floating a toolbar at a specified position, and the toolbar includes a first trigger identifier; if a first trigger is detected that acts on the first trigger The identified touch operation displays the selector.
  • the conversion includes at least one of the following processing methods: performing language translation on the text; switching the font style of the text; and switching the font size of the text.
  • the method provided in this embodiment may further include the following process: in the current division process, starting from the starting point of the current division, if a specified punctuation mark is identified, the identified specified The text between the punctuation mark and the starting point of the current division is used as a division area, and the text after the specified punctuation mark obtained in the current division process is used as the starting point of the next division process.
  • the method provided in this embodiment may further include the following process: when the selector is in a display state, detecting a touch operation acting on the first trigger mark, canceling the display of the selection device.
  • the method provided in this embodiment may further include the following process: if no touch operation acting on the toolbar is detected within a specified period of time, hiding the toolbar or The toolbar is reduced.
  • the toolbar further includes a second trigger identifier and a third trigger identifier; the second trigger identifier is an identifier for marking the current interface; the third trigger identifier is to invoke a corresponding application to start 's identification.
  • the method provided in this embodiment may further include the following process: if the third trigger mark is set in the toolbar displayed in the floating display, directly operating the third trigger mark to trigger another application program to start.
  • the method provided in this embodiment may further include the following process: triggering the display of a shortcut tool interface by performing a sliding operation from the top of the display screen of the electronic device toward the bottom of the display screen, the shortcut
  • the tool interface includes the management control of the selector; if a touch operation acting on the management control is detected, the selector is displayed; when the selector is in the display state, it is detected that the selector is in the display state. Manages the touch operation of the control and cancels the display of the selector.
  • the method provided in this embodiment may further include the following process: after starting the voice assistant of the electronic device, if the specified voice content is acquired, the selector is displayed.
  • the method provided in this embodiment may further include the following process: outputting the converted text to a designated information communication interface, so that the converted text can be processed through the information communication interface. send.
  • the method provided by this embodiment may further include the following process: if it is detected that an application program is started after the selector is called up, and the started application program includes a specified information communication In the case of the interface, output the converted text to the information to be sent area in the specified information communication interface in the application program started after the selector is called up; if it is detected that the After the selector is called up until the converted text is obtained, no application program including the specified information communication interface is started, and the converted text is displayed.
  • the text processing method provided by the embodiments of the present application may be executed in electronic devices such as mobile phones and tablet computers, and may also be cooperatively executed by the electronic device and the server.
  • the server can be a single physical server, or a server cluster or distributed system composed of multiple physical servers, and can also provide cloud services, cloud computing, cloud storage, CDN (Content Delivery Network, Content Delivery Network), And cloud servers for basic cloud computing services such as artificial intelligence platforms.
  • the text processing method provided by the embodiment of the present application is completed by an electronic device and a server, as shown in FIG. 1 , when the selector stops moving, the position of the selector after the movement stops is obtained.
  • the corresponding to-be-processed divided area and the text in the to-be-processed divided area as the to-be-processed text can be completed by the client 110 in the electronic device, and the subsequent conversion of the to-be-processed text is performed to obtain the converted text It can be executed by the server 120 , and the subsequent output of the converted text can be executed by the client 110 in the electronic device, and can also be executed by the server 120 .
  • a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
  • the to-be-processed divided area in the embodiment of the present application can be understood as an area where the included text will be converted, and in the embodiment of the present application, the to-be-processed divided area is determined according to the layout format of the text in the interface.
  • the text in the interface can be determined into multiple divided areas, and then one divided area can be selected from the multiple divided areas according to the position of the selector after stopping moving. Area to be processed.
  • the position of the selector after the movement stops can also be used as the starting point, and the divided area to be processed can be determined based on the layout format of the text toward the specified direction.
  • the layout format may include line spacing or the location of specified punctuation marks.
  • the specified punctuation can be a period or a period.
  • the selector therein is used to select the divided area to be processed.
  • the selector is a control that can be moved.
  • the selector can move in response to a user's drag operation.
  • FIG. 3 when the selector 10 is called up and displayed on the interface, it can be located at the position shown in the image on the left in FIG. 3 . If there is a drag operation acting on the selector 10 , And the drag operation moves in the direction indicated by the dotted arrow in FIG. 3 , the selector 10 can be dragged and moved in the direction of the dotted arrow at the same time, and then can be moved to the position shown in the right image in FIG. 3 .
  • prompt information can be displayed beside the selector, so as to prompt the user to select the area for text conversion processing by dragging the selector.
  • the selector can be invoked by floating the toolbar.
  • at least one field may be configured in the toolbar displayed in the floating display, and a first trigger mark may be set in the field, and the first trigger mark is used to trigger the calling or cancellation of the selector.
  • the selector is displayed.
  • the toolbar can be kept in the displayed state, and further, if the selector is in the displayed state, a touch operation that acts on the first trigger mark is detected, then cancels the display of the selector.
  • a first trigger mark 12 is displayed in the toolbar 11 of the floating display shown in FIG. 4 . If in the state shown in FIG. 4 , a touch operation acting on the first trigger mark 12 is detected, the selector 10 will be displayed in the interface as shown in FIG. 3 . Moreover, after the selector is called up, the display of the toolbar 11 can be canceled synchronously, so as not to interfere with the user's subsequent reading.
  • the toolbar shown in FIG. 4 may include more trigger identifiers in addition to the first trigger identifier shown in FIG. 4 .
  • a second trigger identifier and a third trigger identifier may also be included, where the second trigger identifier is an identifier for marking the current interface. Marking the current interface can be understood as storing the current interface separately, so that the current interface can be directly called for display without first triggering the application program to which the current interface belongs to start.
  • the current interface can be the friend details interface corresponding to application A, then the usual process of starting the friend details interface is to click the icon of application A on the desktop to trigger application A to start, and display the friend list interface after application A is started , and then select it in the friend list interface to trigger the friend details interface. Then, if the current friend details interface is marked by the second trigger in the toolbar, the friend details interface can be called directly from outside of application A to display, instead of having to trigger the display of the friend list interface first, then you can Shorten the operation path for calling out the specified interface.
  • the third trigger identifier may be an identifier for invoking the startup of the corresponding application program. In the case where a third trigger mark is set in the toolbar displayed in the floating display, another application program can be started without exiting from the current interface to the desktop. Instead, another application program can be triggered by directly operating the third trigger mark. start up.
  • the identifier 13 named “Newly-created Note” is a second trigger marker, and the current interface can be separated by triggering the marker 13 named “Newly-created Note”. Stored to achieve the aforementioned Quick Recall effect.
  • the identifier 14 named "navigation” is a third trigger identifier. If a touch operation acting on the identifier 14 named "navigation" is detected, the startup of the navigation application can be directly invoked.
  • the toolbar may be hidden or reduced.
  • the toolbar can be reduced to the state shown in FIG. 6 , and the reduced toolbar can be displayed as The strip 15 in FIG. 6, and the strip 15 may be located at the border of the display screen.
  • the user can call up the floating toolbar again by dragging the bar 15 along the direction indicated by the dotted arrow in FIG. 7 for a specified distance, and the toolbar is called up After that, the bar 15 will be undisplayed.
  • the toolbar can be reduced to the state of the bar 15 shown in FIG. 6 .
  • the display and cancellation of the selector can also be controlled through the shortcut tool interface of the electronic device itself.
  • the display of the shortcut tool interface may be triggered by performing a sliding operation from the top of the display screen toward the bottom of the display screen, and the management control with the selector may be displayed in the shortcut tool interface. Then in the case where the selector has not been displayed, if a touch operation acting on the management control is detected, the selector can be called up.
  • the selector has The touch operation of the management control can cancel the display of the selector.
  • the display selector can also be triggered by means of voice control.
  • the selector can be triggered to call up.
  • the specified voice content may be text conversion, or may be text translation, or the like.
  • the specified voice content may be set by the user according to his own habits. In this manner, the selector can be controlled to cancel the display in the aforementioned manner, or the selector can be canceled from the display by continuing to use the voice assistant.
  • S120 Use the text in the to-be-processed divided area as the to-be-processed text.
  • the to-be-processed text can be understood as the text to be converted later.
  • the conversion includes at least one of the following processing ways: performing language translation on the text;
  • the language translation may include translating texts in any one language into texts in another language. For example, English texts may be translated into Chinese texts, and Chinese texts may also be translated into English texts.
  • Switching the font style of the text can be understood as switching the font of the text itself. For example, it is possible to switch the text in the Song typeface to the text in the italics, and for another example, switch the text in the traditional type to the text in the simplified type.
  • the converted text after the converted text is obtained, the converted text can be output.
  • the converted text may be output in various ways.
  • the converted text can be displayed.
  • the purpose of triggering the conversion of the text in the interface by the user may be to enable the user to better recognize the content of the text. For example, if the text in the interface is in English, but the user may not be familiar with English, then the user may want to convert the text in the interface into familiar Chinese, then after obtaining the converted text, you can Display the converted text.
  • the display selector can be cancelled and the frame 16 shown in FIG. 8 is displayed to identify the division area to be processed.
  • the area enclosed by the frame 16 is the to-be-processed divided area.
  • the size of the frame 16 can be changed in response to the user's drag operation, so that the user can further adjust the actually obtained text to be processed according to his own needs.
  • the converted text can be displayed through the result display interface 17 .
  • the display position of the result display interface can be determined according to the actual situation. For example, if the divided area to be processed is at the upper position in the interface, the result display interface can be displayed at the relatively lower position in the interface. Correspondingly, if the divided area to be processed is at the lower position in the interface, then The result display interface can be displayed at a relatively upper position in the interface, and in this way, it is avoided that the result display interface and the divided area to be processed occupy each other's display positions. Furthermore, if the area to be processed occupies most of the area of the display screen, the result display interface can be suspended and displayed in the middle of the display screen.
  • the result display interface 17 shown in FIG. 9 may include a copy control 18 and a translation conversion control 19 .
  • the converted text displayed in the result display interface 17 can be copied, so that the user can quickly paste the converted text into another area.
  • the language selection interface 20 shown in FIG. 10 can be displayed, and in the language selection interface 20, it is possible to select which language to translate the text into which language ( translation target language).
  • the electronic device can automatically update the converted text displayed in the result display interface 17 .
  • the converted text can be output to a designated information communication interface, so that the converted text can be sent through the information communication interface.
  • the electronic device can trigger the display designation according to the user's selection after obtaining the converted text. the information communication interface, and output the converted text to the information to-be-sent area in the designated information communication interface.
  • the electronic device may determine which output mode to use according to the running time of the application to which the specified information communication interface belongs. In one way, if it is detected that an application program is activated after the selector is called up, and the activated application program includes a designated information communication interface, then it is determined to output the converted text to the In the information to-be-sent area in the designated information communication interface in the application program started after the selector is called up. Correspondingly, if it is detected that the application program that includes the specified information communication interface is not started during the period after the selector is called up to the time when the converted text is obtained, then the conversion is performed by displaying the converted text. output.
  • the application program including the designated information communication interface may be a short message sending program, and the designated information communication interface included in the short message sending program may be a short message sending interface.
  • a text processing method provided by the present application, by detecting the movement of the selector, after the selector stops moving, the to-be-processed divided area corresponding to the position where the selector stops moving is obtained, and then the The text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion.
  • the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • the to-be-processed divided area corresponding to the selector after it stops moving is determined by the electronic device itself, and manual selection by the user is not required, which improves the intelligence of the entire process.
  • a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
  • the text in the interface may be divided into regions in advance, so as to obtain at least one divided region.
  • the method provided by the embodiment of the present application further includes: acquiring the text in the interface and the arrangement format of the text; dividing the text in the interface based on the arrangement format to obtain at least one Divide the area.
  • the arrangement format includes line spacing.
  • the electronic device may determine the line spacing according to the color transformation between the texts in the current interface. It should be noted that the color between the text and the background in the interface can usually be different, and then the color detection can be used to determine which areas in the interface are text and which areas are the blank positions between the texts. Correspondingly, in the acquisition After reaching the blank position between the texts, you can further use the height of the blank position as the line spacing between adjacent lines of text.
  • the dividing the text in the interface based on the arrangement format to obtain at least one divided area includes: in the current division process, starting from the starting point of the current division, sequentially dividing the text between adjacent lines of text.
  • the line spacing is compared with the first specified threshold; if the first reference adjacent line is obtained, the first reference adjacent line, the starting point, and the first reference adjacent line are compared.
  • the area between one row and the starting point is used as the division area obtained by the current division process, and the next row in the first reference adjacent row is used as the starting point of the next division, until the last adjacent row in the interface is completed.
  • the division may be performed at the starting point of the first row.
  • the text in the first line includes "Chengdu,or"Rong"for short,"
  • the text in the second line includes "also known as Rongcheng and”
  • the line spacing of the first adjacent line is as shown in Figure 12 out of h1. If the row spacing h2 of the seventh row and the eighth row obtained based on the foregoing method is greater than the first specified threshold, then the seventh row and the eighth row will be determined as the first reference adjacent row.
  • the text included in the seventh line is "city economic circle.”
  • the text included in the eighth line is "It is an important central”.
  • the seventh row is the previous row in the first reference adjacent row, and then the first row, the seventh row and the text between the first row and the seventh row are used as a divided area, and then the The text shown is divided into a divided area 21 and a divided area 22 shown in FIG. 13 .
  • the electronic device can obtain the text in the current interface and the layout format of the text by taking a screenshot of the current interface and then using OCR (Optical Character Recognition, Optical Character Recognition). Therefore, even if there is a picture in the current interface, the text included in the picture can still be obtained, so that the text included in the picture in the current interface can also be divided during the process of determining the divided area. As shown in FIG. 14 , in the case that there is text in the picture included in the current interface, it can still be determined into the divided area and determined as the divided area 23 .
  • the arrangement format includes punctuation.
  • the electronic device can recognize the punctuation from the first character in the current interface, and determine the divided area based on the recognized designated punctuation.
  • the current area division process starting from the starting point of the current area division, if a designated punctuation mark is identified, the distance between the identified designated punctuation mark and the starting point of the current area division text as a divided area.
  • the text after the specified punctuation mark acquired in the current sub-area division process is used as the starting point of the next area division process.
  • the specified punctuation symbol is a dot, then taking the interface shown in FIG. 13 as an example, it can still be determined to obtain the divided area 21 and the divided area 22 shown in FIG. 13 .
  • S220 Use the divided area whose corresponding position matches the position after the selector stops moving as the divided area to be processed.
  • each determined divided area has a corresponding position
  • the position of each divided area represents the range covered by each divided area. Then, after the selector stops moving, the position of the selector after the movement stops can be matched with the position of each divided area, and then the divided area whose corresponding position matches the position of the selector can be used as the divided area to be processed.
  • the selector is not a point for interface reasons but will occupy a surface. Then, in order to easily obtain the position of the selector, the position of the center of the selector can be used as the position of the selector. Then, in the process of matching the position of the selector and the position of the divided area, the divided area where the center of the selector is located may be used as the divided area to be processed.
  • S230 Use the text in the to-be-processed divided area as the to-be-processed text.
  • the conversion of the text in this embodiment of the present application may include language translation of the text, switching of the font style of the text, and switching of the font size of the text, and the like.
  • the electronic device may determine the specific conversion mode to be adopted according to the user's touch operation.
  • the electronic device can further detect the operation parameters acting on the selector, and then determine the specific conversion mode according to the operation parameters.
  • the operation parameter may be pressing force.
  • the electronic device can detect the current pressing force in real time, and display the corresponding pressing force in real time. conversion method.
  • the operation parameter may be the pressing duration.
  • the electronic device can detect the current pressing time in real time, and display the corresponding pressing time in real time. conversion method.
  • FIG. 15 after the selector is dragged to the position shown in FIG. 15 , if a pressing operation that continues to act on the selector is detected, the strength of the pressing operation can be continuously detected. After the pressing force meets the force for translation, a prompt for translation will be displayed as shown in the leftmost figure in Figure 15. If it is detected that the pressing operation acting on the selector disappears when the translation is displayed, the text to be processed will be processed. translate. If the user continues to apply a larger pressing force, and it is detected that the force is sufficient for font size conversion, the prompt content will be replaced with the font size conversion shown in the middle image in Figure 15.
  • the font size conversion is displayed in the During the process, it is detected that the pressing operation acting on the selector disappears, and the font size of the text to be processed will be converted. If the user continues to apply a larger pressing force, and it is detected that the force is sufficient for font style conversion, the prompt content will be replaced with the font style conversion shown in the image on the right side of Figure 15.
  • the font style conversion is displayed in the display During the process of detecting the disappearance of the pressing operation acting on the selector, the font style conversion of the text to be processed will be performed.
  • the user reduces the pressing force, the user can switch to the conversion mode corresponding to the previous pressing force when the pressing force is smaller.
  • the pressing duration of the pressing operation can continue to be detected.
  • a prompt for translation will be displayed as shown in the leftmost figure in Figure 15. If the pressing operation on the selector disappears when the translation is displayed, the text to be processed will be translated. If the user continues to hold the pressing operation, and it is detected that the pressing time is sufficient to perform the font size conversion, the prompt content will be replaced with the font size conversion shown in the middle image in Figure 15.
  • the font size conversion is displayed during the process of displaying the font size conversion , it detects that the pressing operation acting on the selector disappears, and the font size of the text to be processed is converted. If the user continues to hold the pressing operation, and it is detected that the pressing time is sufficient for font style conversion, the prompt content will be replaced with the font style conversion shown in the image on the right side of Figure 15. Correspondingly, if the font style conversion process is displayed , the disappearance of the pressing operation acting on the selector is detected, and the font style conversion of the text to be processed will be performed.
  • the present application provides a text processing method, so that the text to be converted can be obtained flexibly by detecting the movement of the selector and obtaining the to-be-processed divided area corresponding to the position after the selector is stopped by the above method, which improves the processing efficiency.
  • the convenience of text conversion only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • the text in the current interface can be divided first to obtain at least one divided area, and then the position of the selector is compared with the position of the at least one divided area, and then the divided area to be processed is determined. .
  • a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
  • the determination of the to-be-processed divided area may be started after it is detected that the selector stops moving, and in this embodiment, all texts in the interface may not be divided into areas. ok.
  • S320 Obtain the second text along a specified direction with the first text as a starting point and based on the arrangement format of the text.
  • the specified direction may be a text reading direction recognized by the electronic device.
  • the text reading direction can be understood as the sequential direction of the user when reading the text.
  • S330 Use the first text, the second text, and the region where the text between the first text and the second text is located as a to-be-processed divided region.
  • the arrangement format includes line spacing
  • the obtaining the second text in a specified direction and based on the text-based arrangement format with the first text as a starting point includes: taking the first text as a starting point, Comparing the line spacing between the texts of adjacent lines with the second specified threshold in turn; obtaining a second reference adjacent line, where the line spacing obtained for the first time by the second reference adjacent behavior is greater than the second specified threshold the adjacent line of ; take the text of the previous line in the second reference adjacent line as the second text.
  • S340 Use the text in the to-be-processed divided area as the to-be-processed text.
  • the conversion mode has been entered.
  • the closing control 24 shown in FIG. 17 can be triggered to display, and if a click operation acting on the closing control 24 is detected, the current conversion mode will be exited, And the selector 10 is canceled.
  • the close control 24 may be gradually moved from the back of the selector 10 to the position shown in FIG. 17 during the display process.
  • the click operation that triggers the display of the close control 24 is different from the pressing operation that triggers the switching of the conversion mode in the foregoing embodiment. Active operation is continuous.
  • the foregoing conversion mode switching will only be triggered if a drag operation on the selector is detected and the selector is kept in contact and the pressing operation is continued after the drag operation is completed.
  • the present application provides a text processing method, so that the text to be converted can be obtained flexibly by detecting the movement of the selector and obtaining the to-be-processed divided area corresponding to the position after the selector is stopped by the above method, which improves the processing efficiency.
  • the convenience of text conversion Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • the position after the selector stops moving can be used as the starting point, and then the to-be-processed divided area can be obtained along the specified direction and based on the text arrangement format, thereby further improving the determination of the to-be-processed division.
  • a text processing apparatus provided by an embodiment of the present application operates on an electronic device, and the apparatus 400 includes:
  • the area acquiring unit 410 is configured to acquire, after the selector stops moving, the to-be-processed divided area corresponding to the position where the selector stops moving.
  • the area acquisition unit 410 is specifically configured to match the position after the selector stops moving with at least one divided area; the divided area whose corresponding position matches the position after the selector stops moving is used as Area to be processed.
  • the area acquisition unit 410 is further configured to acquire the text in the interface and the arrangement format of the text; divide the text in the interface based on the arrangement format to obtain at least one divided area.
  • the area acquisition unit 410 is specifically configured to compare the line spacing between the texts of adjacent lines with the first specified threshold in turn from the starting point of the current division in the current division process; if the first reference phase is obtained. Adjacent row, take the preceding row in the first reference adjacent row, the starting point, and the area between the preceding row in the first reference adjacent row and the starting point as the division area obtained by the current division process , and use the next row in the first reference adjacent row as the starting point of the next division until the detection of the line spacing between the texts of the last adjacent row in the interface is completed; 1. With reference to an adjacent line, the starting point of the current division and the area after the starting point of the current division are determined as a division area; wherein, the line spacing between the texts of the first reference adjacent line is greater than the first specified threshold.
  • the area obtaining unit 410 is specifically configured to obtain the first text, where the first text is the text of the line where the selector stops moving; and the first text is used as a starting point along a specified direction. and acquiring the second text based on the arrangement format of the text; using the first text, the second text, and the region where the text between the first text and the second text is located as a to-be-processed divided region.
  • the area obtaining unit 410 is specifically configured to take the first text as a starting point, and sequentially compare the line spacing between the texts of adjacent lines with the second specified threshold; obtain the second reference adjacent line, The second reference adjacent line first obtains the adjacent line whose line spacing is greater than the second specified threshold; the text of the previous line in the second reference adjacent line is used as the second text.
  • the area acquisition unit 410 is specifically configured to, in the current division process, start from the starting point of the current division, and if a specified punctuation mark is identified, then compare the identified specified punctuation mark with the current division.
  • the text between the starting points is used as a division area, and the text after the specified punctuation mark obtained in the current division process is used as the starting point of the next division process.
  • the text obtaining unit 420 is configured to use the text in the to-be-processed divided area as the to-be-processed text.
  • the text conversion unit 430 is configured to convert the to-be-processed text to obtain the converted text.
  • the conversion includes at least one of the following processing methods: performing language translation on the text; switching the font style of the text; and switching the font size of the text.
  • the text output unit 440 is configured to output the converted text.
  • the text output unit 440 is specifically configured to output the converted text to a designated information communication interface, so as to send the converted text through the information communication interface.
  • the text output unit 440 is specifically configured to, if it is detected that an application program is started after the selector is called up, and the started application program includes a specified information communication interface, send the The converted text is output to the information to be sent area in the specified information communication interface in the application program started after the selector is called up; if it is detected that after the selector is called up, the The application program that does not include the specified information communication interface is started within the time of obtaining the converted text, and the converted text is displayed.
  • the device further includes:
  • the selector management unit 450 is configured to display a toolbar at a designated position in a floating manner, and the toolbar includes a first trigger mark; if a touch operation acting on the first trigger mark is detected, the selector is displayed .
  • the selector management unit 450 is specifically configured to, when the selector is in a display state, detect a touch operation acting on the first trigger identifier, and cancel the display of the selector.
  • the selector management unit 450 is specifically configured to hide the toolbar or shrink the toolbar if no touch operation acting on the toolbar is detected within a specified time period.
  • the selector management unit 450 is specifically configured to directly operate the third trigger identifier to trigger another application to start if the third trigger identifier is set in the toolbar displayed in the floating display.
  • the selector management unit 450 is specifically configured to trigger the display of a shortcut tool interface by performing a sliding operation from the top of the display screen of the electronic device toward the bottom of the display screen, where the shortcut tool interface includes: The management control of the selector; if a touch operation acting on the management control is detected, the selector is displayed; when the selector is in the display state, a touch operation acting on the management control is detected , to dismiss the selector.
  • the selector management unit 450 is specifically configured to display the selector if the specified voice content is acquired after the voice assistant of the electronic device is activated.
  • a text processing device detects the movement of a selector, and then, after the selector stops moving, obtains the to-be-processed divided area corresponding to the position where the selector stops moving, and then
  • the text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • an embodiment of the present application further provides another electronic device 200 that can execute the above-mentioned text processing method.
  • the electronic device 200 includes one or more (only one shown in the figure) a processor 102, a memory 104, and a network module 106 that are coupled to each other.
  • the memory 104 stores a program that can execute the content in the foregoing embodiments, and the processor 102 can execute the program stored in the memory 104 .
  • the processor 102 may include one or more cores for processing data.
  • the processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 200, and executes by running or executing the instructions, programs, code sets or instruction sets stored in the memory 104, and calling the data stored in the memory 104.
  • the processor 102 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA programmable logic array
  • the processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a modem, and the like.
  • CPU Central Processing Unit
  • GPU Graphics Processing Unit
  • the CPU mainly handles the operating system, user interface and application programs, etc.
  • the GPU is used for rendering and drawing of the display content
  • the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 102, and is implemented by a communication chip alone.
  • the memory 104 may include a random access memory (Random Access Memory, RAM), or may include a read-only memory (Read-Only Memory, ROM). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
  • the memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing the operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like.
  • the memory 104 may store text processing means.
  • the apparatus for text processing may be the aforementioned apparatus 400 .
  • the storage data area may also store data created by the terminal 100 during use (such as phone book, audio and video data, chat record data) and the like.
  • the network module 106 is used for receiving and sending electromagnetic waves, realizing mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, for example, communicate with an audio playback device.
  • the network module 106 may include various existing circuit elements for performing these functions, eg, antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, subscriber identity module (SIM) cards, memory, etc. .
  • the network module 106 can communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices through a wireless network.
  • the aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network.
  • the network module 106 may interact with the base station for information.
  • FIG. 21 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable storage medium 1100 stores program codes, and the program codes can be invoked by the processor to execute the methods described in the above method embodiments.
  • the computer-readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 1100 has storage space for program code 1110 that performs any of the method steps in the above-described methods. These program codes can be read from or written to one or more computer program products. Program code 1110 may be compressed, for example, in a suitable form.
  • the text processing method, device, electronic device and storage medium provided by the present application detect the movement of the selector, and then obtain the information after the selector stops moving after the selector stops moving. Then, the text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion.
  • the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
  • the to-be-processed divided area corresponding to the selector after it stops moving is determined by the electronic device itself, and no manual selection by the user is required, which improves the intelligence of the entire process.

Landscapes

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

Abstract

Disclosed in the embodiments of the present application are a text processing method and apparatus, and an electronic device and a storage medium. The method comprises: after a selector stops moving, acquiring a division region, which corresponds to the position of the selector after same stopped moving, to be processed; taking text in said division region as text to be processed; converting said text, so as to obtain converted text; and outputting the converted text.

Description

文本处理方法、装置、电子设备及存储介质Text processing method, device, electronic device and storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2021年2月26日提交的申请号为202110220088.8的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。This application claims priority to Chinese Application No. 202110220088.8, filed on February 26, 2021, which is hereby incorporated by reference in its entirety for all purposes.
技术领域technical field
本申请涉及计算机技术领域,更具体地,涉及一种文本处理方法、装置、电子设备及存储介质。The present application relates to the field of computer technology, and more particularly, to a text processing method, apparatus, electronic device, and storage medium.
背景技术Background technique
随着电子设备中所展示的信息越来越多,出现了一些信息需要进行转换后才有利于被用户进行识别。As more and more information is displayed in electronic devices, some information needs to be converted before being recognized by users.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,本申请提出了一种文本处理方法、装置、电子设备及存储介质,以改善上述问题。In view of the above problems, the present application proposes a text processing method, apparatus, electronic device and storage medium to improve the above problems.
第一方面,本申请提供了一种文本处理方法,其中,应用于电子设备,所述方法包括:当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域;将所述待处理划分区域中的文本作为待处理文本;In a first aspect, the present application provides a text processing method, which is applied to an electronic device, and the method includes: after a selector stops moving, acquiring a to-be-processed divided area corresponding to a position where the selector stops moving; Taking the text in the to-be-processed divided area as the to-be-processed text;
对所述待处理文本进行转换,得到转换后的文本;输出所述转换后的文本。Convert the to-be-processed text to obtain the converted text; and output the converted text.
第二方面,本申请提供了一种文本处理装置,运行于电子设备,所述装置包括:区域获取单元,用于当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域;文本获取单元,用于将所述待处理划分区域中的文本作为待处理文本;文本转换单元,用于对所述待处理文本进行转换,得到转换后的文本;文本输出单元,用于输出所述转换后的文本。In a second aspect, the present application provides a text processing apparatus, which runs on an electronic device, the apparatus includes: an area acquisition unit, configured to acquire, after the selector stops moving, the waiting area corresponding to the position where the selector stops moving. processing the divided area; a text acquisition unit, used for taking the text in the to-be-processed divided area as the text to be processed; a text conversion unit, used for converting the to-be-processed text to obtain the converted text; a text output unit, for outputting the converted text.
第三方面,本申请提供了一种电子设备,包括处理器以及存储器;一个或多个程序被存储在所述存储器中并被配置为由所述处理器执行以实现上述的方法。In a third aspect, the present application provides an electronic device including a processor and a memory; one or more programs are stored in the memory and configured to be executed by the processor to implement the above method.
第四方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行上述的方法。In a fourth aspect, the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, wherein the above-mentioned method is executed when the program code is executed by a processor.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1示出了本申请实施例提出的一种文本处理方法的应用场景的示意图;FIG. 1 shows a schematic diagram of an application scenario of a text processing method proposed by an embodiment of the present application;
图2示出了本申请实施例提出的一种文本处理方法的流程图;FIG. 2 shows a flowchart of a text processing method proposed by an embodiment of the present application;
图3示出了本申请实施例提出的一种文本处理方法中选择器进行移动的示意图;3 shows a schematic diagram of a selector moving in a text processing method proposed by an embodiment of the present application;
图4示出了本申请实施例提出的一种文本处理方法中一种悬浮显示的工具栏的示意图;FIG. 4 shows a schematic diagram of a suspended display toolbar in a text processing method proposed by an embodiment of the present application;
图5示出了本申请实施例提出的一种文本处理方法中另一种悬浮显示的工具栏的示意图;FIG. 5 shows a schematic diagram of another toolbar displayed in suspension in a text processing method proposed by an embodiment of the present application;
图6示出了本申请实施例提出的一种文本处理方法中悬浮显示的工具栏缩小后的示意图;FIG. 6 shows a reduced schematic diagram of a toolbar displayed in suspension in a text processing method proposed by an embodiment of the present application;
图7示出了本申请实施例提出的一种文本处理方法中调出悬浮工具栏的示意图;7 shows a schematic diagram of calling out a floating toolbar in a text processing method proposed by an embodiment of the present application;
图8示出了本申请实施例提出的一种文本处理方法中一种结果显示界面的示意图;FIG. 8 shows a schematic diagram of a result display interface in a text processing method proposed by an embodiment of the present application;
图9示出了本申请实施例提出的一种文本处理方法中另一种结果显示界面的示意图;FIG. 9 shows a schematic diagram of another result display interface in a text processing method proposed by an embodiment of the present application;
图10示出了本申请实施例提出的一种文本处理方法中语言选择界面的示意图;10 shows a schematic diagram of a language selection interface in a text processing method proposed by an embodiment of the present application;
图11示出了本申请实施例提出的另一种文本处理方法的流程图;FIG. 11 shows a flowchart of another text processing method proposed by an embodiment of the present application;
图12示出了本申请实施例中行间距的示意图;FIG. 12 shows a schematic diagram of the line spacing in the embodiment of the present application;
图13示出了本申请实施例中确定的一种多个划分区域的示意图;FIG. 13 shows a schematic diagram of a plurality of divided regions determined in an embodiment of the present application;
图14示出了本申请实施例中确定的另一种多个划分区域的示意图;FIG. 14 shows a schematic diagram of another plurality of divided regions determined in the embodiment of the present application;
图15示出了本申请实施例中根据按压参数进行文本转换方式更换的示意图;FIG. 15 shows a schematic diagram of changing a text conversion mode according to a pressing parameter in an embodiment of the present application;
图16示出了本申请实施例提出的再一种文本处理方法的流程图;FIG. 16 shows a flowchart of still another text processing method proposed by an embodiment of the present application;
图17示出了本申请实施例提出的一种退出转换模式的示意图;FIG. 17 shows a schematic diagram of an exit conversion mode proposed by an embodiment of the present application;
图18示出了本申请另一实施例提出的一种文本处理装置的结构框图;FIG. 18 shows a structural block diagram of a text processing apparatus proposed by another embodiment of the present application;
图19示出了本申请再一实施例提出的一种文本处理装置的结构框图;FIG. 19 shows a structural block diagram of a text processing apparatus proposed by still another embodiment of the present application;
图20示出了本申请的用于执行根据本申请实施例的文本处理方法的电子设备的结构框图;FIG. 20 shows a structural block diagram of an electronic device of the present application for executing the text processing method according to an embodiment of the present application;
图21是本申请实施例的用于保存或者携带实现根据本申请实施例的文本处理方法的程序代码的存储单元。FIG. 21 is a storage unit for storing or carrying a program code for implementing the text processing method according to the embodiment of the present application according to the embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
随着电子设备所能实现的功能越来越多,电子设备中的信息也越来越多,对于电子设备中的一些信息可能需要进行一定的转换后才有利于用户进行识别。例如,在电子设备中可能会存在由外文所记录的文本,那么为了便于用户对该文本的语义进行识别,则可能需要操作电子设备将该外文所记录的文本转换为本国语言。As more and more functions can be implemented by electronic devices, there are more and more information in electronic devices, and some information in electronic devices may need to be converted to a certain extent before it is helpful for users to identify. For example, there may be text recorded in a foreign language in an electronic device, so in order to facilitate the user to recognize the semantics of the text, it may be necessary to operate the electronic device to convert the text recorded in the foreign language into a native language.
但是,发明人在对相关的转换方式进行研究后发现,相关的转换方式还存在不够方便以及不够灵活的问题。例如,在一种相关的方式中,需要将所需要转换的文本复制到专用的转换界面中,以通过在该专用的转换界面中进行转换。再或者,在另一种相关的方式中,可以直接对当前界面进行截屏,然后对截屏的内容进行转换,然而在这种方式中,是直接对截屏中的所有内容进行转换,就会造成会将用户所不需要到的内容也进行转换,使得转换过程不够灵活。However, after researching the related conversion methods, the inventor found that the related conversion methods still have the problems of inconvenience and inflexibility. For example, in a related manner, the text to be converted needs to be copied into a dedicated conversion interface so as to be converted in the dedicated conversion interface. Or, in another related way, you can directly take a screenshot of the current interface, and then convert the content of the screenshot. However, in this way, all the content in the screenshot is directly converted, which will cause The content that the user does not need is also converted, so that the conversion process is not flexible enough.
因此,发明人提出了本申请中可以改善上述问题的文本处理方法、装置、电子设备及存储介质,在本申请提供的方案中通过对选择器的移动情况进行检测,进而在当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域,然后将所述待处理划分区域中的文本作为待处理文本,并对所述待处理文本进行转换得到转换后的文本,再输出所述转换后的文本。从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性以及灵活性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。Therefore, the inventor proposes a text processing method, device, electronic device and storage medium that can improve the above-mentioned problems in this application. In the solution provided in this application, the movement of the selector is detected, and then when the selector stops moving Then, obtain the to-be-processed divided area corresponding to the position where the selector stops moving, then use the text in the to-be-processed divided area as the to-be-processed text, and convert the to-be-processed text to obtain the converted text, The converted text is then output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be flexibly obtained by the above method, which improves the convenience and flexibility of the text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:将所述选择器停止移动后的位置与至少一个划分区域进行匹配;将对应的位置与所述选择器停止移动后的位置匹配的划分区域作为待处理划分区域。In an implementation manner, the method provided in this embodiment may further include the following process: matching the position after the selector stops moving with at least one divided area; matching the corresponding position with the position after the selector stops moving The divided areas whose positions are matched are used as the divided areas to be processed.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:获取所述界面中的文本以及所述文本的排布格式;基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域。In an implementation manner, the method provided in this embodiment may further include the following process: acquiring the text in the interface and the arrangement format of the text; dividing the text in the interface based on the arrangement format , to obtain at least one partitioned region.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:在当次划分过程中,以当次划分的起点开始依次将相邻行的文本之间的行间距与第一指定阈值进行比对;若获取到第一参考相邻行,将第一参考相邻行中在前的一行、所述起点以及所述第一参考相邻行中在前的一行与所述起点之间的区域作为当次划分过程得到的划分区域,并将所述第一参考相邻行中在后一行作为下次次划分的起点,直到完成对界面中最后的相邻行的文本之间的行间距的检测;若未获取到所述第一参考相邻行,将当次划分的起点以及当次划分的起点以后的区域确定为一个划分区域;其中,所述第一参考相邻行的文本之间的行间距大于所述第一指定阈值。In an implementation manner, the method provided in this embodiment may further include the following process: in the current division process, starting from the starting point of the current division, the line spacing between the texts of adjacent lines and the first specified threshold are sequentially divided Compare; if the first reference adjacent row is obtained, compare the first reference adjacent row, the starting point, and the first reference adjacent row between the previous row and the starting point As the division area obtained by the current division process, the next row in the first reference adjacent row is used as the starting point of the next division, until the line between the text of the last adjacent row in the interface is completed. Detection of spacing; if the first reference adjacent line is not obtained, the starting point of the current division and the area after the starting point of the current division are determined as a divided area; wherein, the text of the first reference adjacent line The line spacing between is greater than the first specified threshold.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:获取第一文本,所述第一文本为所述选择器停止移动后的位置所在行的文本;以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本;将所述第一文本、所述第二文本以及所述第一文本与所述第二文本之间的文本所在区域作为待处理划分区域。In an implementation manner, the method provided in this embodiment may further include the following process: obtaining a first text, where the first text is the text of the row where the selector stops moving; and using the first text Obtain the second text for the starting point along the specified direction and based on the text-based arrangement format; take the area where the first text, the second text and the text between the first text and the second text are located as pending processing Divide the area.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:以所述第一文本为起点,依次将相邻行的文本之间的行间距与第二指定阈值进行比对;获取第二参考相邻行,所述第二参考相邻行为首次获取得到的行间距大于所述第二指定阈值的相邻行;将所述第二参考相邻行中在前的一行的文本作为第二文本。In an implementation manner, the method provided in this embodiment may further include the following process: starting from the first text, sequentially comparing the line spacing between texts in adjacent lines with a second specified threshold; obtaining The second reference adjacent line, the adjacent line obtained by the second reference adjacent line for the first time whose line spacing is greater than the second specified threshold; the text of the previous line in the second reference adjacent line is taken as Second text.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:在指定位置悬浮显示工具栏,所述工具栏中包括有第一触发标识;若检测到有作用于所述第一触发标识的触控操作,显示所述选择器。In an implementation manner, the method provided in this embodiment may further include the following process: floating a toolbar at a specified position, and the toolbar includes a first trigger identifier; if a first trigger is detected that acts on the first trigger The identified touch operation displays the selector.
在一种实施方式中,所述转换包括一下处理方式中的至少一种:对文本进行语种翻译;切换文本的字体样式;以及切换文本的字体大小。In one embodiment, the conversion includes at least one of the following processing methods: performing language translation on the text; switching the font style of the text; and switching the font size of the text.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:在当次划分过程中,从当次划分 的起点开始,若识别到指定的标点符号,则将所述识别到的指定标点符号与当次划分的起点之间的文本作为一个划分区域,并将当次划分过程中获取到的指定标点符号以后的文本作为下次的划分过程的起点。In an implementation manner, the method provided in this embodiment may further include the following process: in the current division process, starting from the starting point of the current division, if a specified punctuation mark is identified, the identified specified The text between the punctuation mark and the starting point of the current division is used as a division area, and the text after the specified punctuation mark obtained in the current division process is used as the starting point of the next division process.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:当所述选择器处于显示状态时,检测到有作用于所述第一触发标识的触控操作,取消显示所述选择器。In an implementation manner, the method provided in this embodiment may further include the following process: when the selector is in a display state, detecting a touch operation acting on the first trigger mark, canceling the display of the selection device.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:若在指定时间段内没有检测到作用于所述工具栏的触控操作,将所述工具栏进行隐藏或者将所述工具栏进行缩小。In an implementation manner, the method provided in this embodiment may further include the following process: if no touch operation acting on the toolbar is detected within a specified period of time, hiding the toolbar or The toolbar is reduced.
在一种实施方式中,所述工具栏还包括第二触发标识以及第三触发标识;所述第二触发标识为对当前界面进行标记的标识;所述第三触发标识为调用对应应用程序启动的标识。In one embodiment, the toolbar further includes a second trigger identifier and a third trigger identifier; the second trigger identifier is an identifier for marking the current interface; the third trigger identifier is to invoke a corresponding application to start 's identification.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:若悬浮显示的所述工具栏中设置有所述第三触发标识,则直接操作所述第三触发标识触发另外的应用程序进行启动。In an implementation manner, the method provided in this embodiment may further include the following process: if the third trigger mark is set in the toolbar displayed in the floating display, directly operating the third trigger mark to trigger another application program to start.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:通过从所述电子设备的显示屏的顶部朝向所述显示屏的底部执行滑动操作来触发显示快捷工具界面,所述快捷工具界面中包括有所述选择器的管理控件;若检测到作用于所述管理控件的触控操作,显示所述选择器;当所述选择器处于显示状态时,检测到有作用于所述管理控件的触控操作,取消显示所述选择器。In an implementation manner, the method provided in this embodiment may further include the following process: triggering the display of a shortcut tool interface by performing a sliding operation from the top of the display screen of the electronic device toward the bottom of the display screen, the shortcut The tool interface includes the management control of the selector; if a touch operation acting on the management control is detected, the selector is displayed; when the selector is in the display state, it is detected that the selector is in the display state. Manages the touch operation of the control and cancels the display of the selector.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:在启动所述电子设备的语音助手后,若获取指定的语音内容,显示所述选择器。In an implementation manner, the method provided in this embodiment may further include the following process: after starting the voice assistant of the electronic device, if the specified voice content is acquired, the selector is displayed.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:将所述转换后的文本输出到指定的信息通信界面中,以便通过所述信息通信界面将所述转换后的文本进行发送。In an implementation manner, the method provided in this embodiment may further include the following process: outputting the converted text to a designated information communication interface, so that the converted text can be processed through the information communication interface. send.
在一种实施方式中,本实施例提供的方法还可以包括如下流程:若检测在所述选择器被调出后有应用程序被启动,且所述被启动的应用程序包括有指定的信息通信界面的情况下,将所述转换后的文本输出到所述在所述选择器被调出后启动的应用程序中的指定的信息通信界面中的信息待发送区域中;若检测到在所述选择器被调出后到得到所述转换后的文本的时间内并没有包括有指定的信息通信界面的应用程序启动,将所述转换后的文本进行显示。In an implementation manner, the method provided by this embodiment may further include the following process: if it is detected that an application program is started after the selector is called up, and the started application program includes a specified information communication In the case of the interface, output the converted text to the information to be sent area in the specified information communication interface in the application program started after the selector is called up; if it is detected that the After the selector is called up until the converted text is obtained, no application program including the specified information communication interface is started, and the converted text is displayed.
需要说明的是,本申请实施例所提供的文本处理方法可以运行于手机、平板电脑等电子设备中,也可以由电子设备和服务器来协同运行。其中,服务器可以是单个的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式***,还可以是提供云服务、云计算、云存储、CDN(Content Delivery Network,内容分发网络)、以及人工智能平台等基础云计算服务的云服务器。It should be noted that, the text processing method provided by the embodiments of the present application may be executed in electronic devices such as mobile phones and tablet computers, and may also be cooperatively executed by the electronic device and the server. Among them, the server can be a single physical server, or a server cluster or distributed system composed of multiple physical servers, and can also provide cloud services, cloud computing, cloud storage, CDN (Content Delivery Network, Content Delivery Network), And cloud servers for basic cloud computing services such as artificial intelligence platforms.
其中,在本申请实施例提供的文本处理方法由电子设备与服务器协同完成的这种情况下,如图1所示,其中的当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域以及将所述待处理划分区域中的文本作为待处理文本可以由电子设备中的客户端110来完成,而后续的对所述待处理文本进行转换,得到转换后的文本可以由服务器120来执行,再后续的输出所转换的文本可以由电子设备中的客户端110来执行,也可以由服务器120来执行。Wherein, in the case where the text processing method provided by the embodiment of the present application is completed by an electronic device and a server, as shown in FIG. 1 , when the selector stops moving, the position of the selector after the movement stops is obtained. The corresponding to-be-processed divided area and the text in the to-be-processed divided area as the to-be-processed text can be completed by the client 110 in the electronic device, and the subsequent conversion of the to-be-processed text is performed to obtain the converted text It can be executed by the server 120 , and the subsequent output of the converted text can be executed by the client 110 in the electronic device, and can also be executed by the server 120 .
下面将结合附图具体描述本申请的各实施例。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参阅图2,本申请实施例提供的一种文本处理方法,应用于电子设备,所述方法包括:Referring to FIG. 2, a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
S110:当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域。S110: After the selector stops moving, acquire the to-be-processed divided area corresponding to the position where the selector stops moving.
其中,在本申请实施例中待处理划分区域可以理解为所包括的文本会进行转换的区域,并且,在本申请实施例中待处理划分区域为根据界面中文本的排布格式确定得到。可选的,可以预先根据界面中的文本的排布格式,将界面中的文本确定为多个划分区域,然后根据停止移动后的选择器所在位置来从多个划分区域中选择一个划分区域作为待处理划分区域。再者,还可以以停止移动后的选择器所在位置为起点,且基于文本的排布格式朝向指定方向确定出待处理划分区域。其中,排布格式可以包括行间距或者指定的标点符号所在位置。该指定的标点符号可以为句号或者点号。Wherein, the to-be-processed divided area in the embodiment of the present application can be understood as an area where the included text will be converted, and in the embodiment of the present application, the to-be-processed divided area is determined according to the layout format of the text in the interface. Optionally, according to the layout format of the text in the interface, the text in the interface can be determined into multiple divided areas, and then one divided area can be selected from the multiple divided areas according to the position of the selector after stopping moving. Area to be processed. Furthermore, the position of the selector after the movement stops can also be used as the starting point, and the divided area to be processed can be determined based on the layout format of the text toward the specified direction. The layout format may include line spacing or the location of specified punctuation marks. The specified punctuation can be a period or a period.
而其中的选择器用于进行待处理划分区域的选择。可选的,该选择器为可以进行移动的控件。在一种方式中,选择器可以响应用户的拖动操作而进行移动。示例性的,如图3所示,选择器10在被调出显示在界面上时可以先位于图3中左侧图像中所示的位置,若有作用于该选择器10的拖动操作,且该拖动操作沿图3中虚线箭头所示方向运动,则可以同时拖拽选择器10沿虚线箭头方向移动,进而可以移动到图3中右侧图像中所示的位置。The selector therein is used to select the divided area to be processed. Optionally, the selector is a control that can be moved. In one approach, the selector can move in response to a user's drag operation. Exemplarily, as shown in FIG. 3 , when the selector 10 is called up and displayed on the interface, it can be located at the position shown in the image on the left in FIG. 3 . If there is a drag operation acting on the selector 10 , And the drag operation moves in the direction indicated by the dotted arrow in FIG. 3 , the selector 10 can be dragged and moved in the direction of the dotted arrow at the same time, and then can be moved to the position shown in the right image in FIG. 3 .
在本申请实施例中,可以有多种调出选择器的方式。并且在调出选择器以后,可以在选择器的旁边显示提示信息,以便提示用户可以通过拖动选择器来选取进行文本转换处理的区域。In this embodiment of the present application, there may be multiple ways to call the selector. And after the selector is called, prompt information can be displayed beside the selector, so as to prompt the user to select the area for text conversion processing by dragging the selector.
作为一种方式,可以通过悬浮显示工具栏的方式来调用出选择器。在这种方式中,悬浮显示的工具栏中可以配置有至少一个栏位,在该栏位中可以设置有第一触发标识,该第一触发标识用于触发选择器的调出或者取消显示。可选的,在还未调出选择器的情况下,若检测到有作用于所述第一触发标识的触控操作,显示所述选择器。其中,可选的,在选择器被调出后,工具栏可以一直保持显示状态,进而 可以实现若在选择器处于显示状态下,检测到有作用于所述第一触发标识的触控操作,则取消显示选择器。As a way, the selector can be invoked by floating the toolbar. In this way, at least one field may be configured in the toolbar displayed in the floating display, and a first trigger mark may be set in the field, and the first trigger mark is used to trigger the calling or cancellation of the selector. Optionally, in the case where the selector has not been called up, if a touch operation acting on the first trigger mark is detected, the selector is displayed. Wherein, optionally, after the selector is called up, the toolbar can be kept in the displayed state, and further, if the selector is in the displayed state, a touch operation that acts on the first trigger mark is detected, then cancels the display of the selector.
示例性的,如图4所示,在图4所示出的悬浮显示的工具栏11中,显示有第一触发标识12。若在图4所示的状态下,检测到有作用于第一触发标识12的触控操作,则会如图3所示的在界面中显示选择器10。并且,在选择器被调出后可以同步的取消工具栏11的显示,以免干扰用户后续的阅览。Exemplarily, as shown in FIG. 4 , in the toolbar 11 of the floating display shown in FIG. 4 , a first trigger mark 12 is displayed. If in the state shown in FIG. 4 , a touch operation acting on the first trigger mark 12 is detected, the selector 10 will be displayed in the interface as shown in FIG. 3 . Moreover, after the selector is called up, the display of the toolbar 11 can be canceled synchronously, so as not to interfere with the user's subsequent reading.
需要说明的是,对于图4中所示的工具栏除了可以包括有图4中所示的第一触发标识外,还可以包括更多的触发标识。可选的,还可以包括第二触发标识以及第三触发标识,其中,第二触发标识为对当前界面进行标记的标识。对当前界面进行标记可以理解为对当前界面进行单独存储,以便实现可以在不用先触发当前界面所属应用程序进行启动的情况下,可以直接调用当前界面进行显示。例如,当前界面可以为应用程序A对应的好友详情界面,那么通常的启动好友详情界面的流程为在桌面点击应用程序A的图标从而触发应用程序A启动,在应用程序A启动后显示好友列表界面,然后再在好友列表界面中进行选择,进而触发好友详情界面。那么若通过工具栏中的第二触发标识将当前的好友详情界面进行标记后,可以直接从应用程序A的外部调用好友详情界面进行显示,而不会再必须先触发显示好友列表界面,继而可以缩短调用出指定界面的操作路径。其中,第三触发标识可以为调用对应应用程序启动的标识。在悬浮显示的工具栏中设置有第三触发标识的情况下,可以不用从当前界面退出到桌面后才能启动另外的应用程序,而是可以直接操作该第三触发标识就触发另外的应用程序进行启动。It should be noted that, the toolbar shown in FIG. 4 may include more trigger identifiers in addition to the first trigger identifier shown in FIG. 4 . Optionally, a second trigger identifier and a third trigger identifier may also be included, where the second trigger identifier is an identifier for marking the current interface. Marking the current interface can be understood as storing the current interface separately, so that the current interface can be directly called for display without first triggering the application program to which the current interface belongs to start. For example, the current interface can be the friend details interface corresponding to application A, then the usual process of starting the friend details interface is to click the icon of application A on the desktop to trigger application A to start, and display the friend list interface after application A is started , and then select it in the friend list interface to trigger the friend details interface. Then, if the current friend details interface is marked by the second trigger in the toolbar, the friend details interface can be called directly from outside of application A to display, instead of having to trigger the display of the friend list interface first, then you can Shorten the operation path for calling out the specified interface. Wherein, the third trigger identifier may be an identifier for invoking the startup of the corresponding application program. In the case where a third trigger mark is set in the toolbar displayed in the floating display, another application program can be started without exiting from the current interface to the desktop. Instead, another application program can be triggered by directly operating the third trigger mark. start up.
示例性的,如图5所示,其中的名称为“新建便签”的标识13为一种第二触发标识,通过触发该名称为“新建便签”的标识13就可以实现将当前的界面进行单独存储以便实现前述的快速调出的效果。而其中名称为“导航”的标识14为一种第三触发标识。若检测到作用于该名称为“导航”的标识14的触控操作则可以直接调用导航应用程序的启动。Exemplarily, as shown in FIG. 5 , the identifier 13 named “Newly-created Note” is a second trigger marker, and the current interface can be separated by triggering the marker 13 named “Newly-created Note”. Stored to achieve the aforementioned Quick Recall effect. The identifier 14 named "navigation" is a third trigger identifier. If a touch operation acting on the identifier 14 named "navigation" is detected, the startup of the navigation application can be directly invoked.
其中,可选的,若在指定时间段内没有检测有作用于工具栏的触控操作,那么可以将工具栏进行隐藏或者将工具栏进行缩小。示例性的,如图6所示,若在指定时间段内没有检测有作用于工具栏的触控操作,可以将工具栏缩小为图6中所示的状态,缩小后的工具栏可以显示为图6中的条状15,并且该条状15可以位于显示屏的边界处。在工具栏缩小为条状15后,用户通过沿图7中虚线箭头所示的方向将条状15拖动指定距离后,可以再次调出悬浮显示的工具栏,并且,在工具栏被调出后,条状15会取消显示。Wherein, optionally, if no touch operation acting on the toolbar is detected within a specified time period, the toolbar may be hidden or reduced. Exemplarily, as shown in FIG. 6 , if no touch operation acting on the toolbar is detected within a specified period of time, the toolbar can be reduced to the state shown in FIG. 6 , and the reduced toolbar can be displayed as The strip 15 in FIG. 6, and the strip 15 may be located at the border of the display screen. After the toolbar is reduced to a bar 15, the user can call up the floating toolbar again by dragging the bar 15 along the direction indicated by the dotted arrow in FIG. 7 for a specified distance, and the toolbar is called up After that, the bar 15 will be undisplayed.
可选的,若检测有作用于工具栏以外的区域的触控操作时,可以将工具栏缩小到图6中所示的条状15的状态。Optionally, if a touch operation acting on an area other than the toolbar is detected, the toolbar can be reduced to the state of the bar 15 shown in FIG. 6 .
作为另外一种方式,还可以通过电子设备自身的快捷工具界面来对选择器的显示和取消显示进行控制。可选的,可以通过从显示屏的顶部朝向显示屏的底部执行滑动操作来触发显示该快捷工具界面,在该快捷工具界面中可以显示有选择器的管理控件。那么在还未显示选择器的情况下,若检测到作用于该管理控件的触控操作,则可以触发调出选择器,对应的,在已经调出选择器的情况下,若检测到作用于该管理控件的触控操作,则可以取消显示该选择器。As another way, the display and cancellation of the selector can also be controlled through the shortcut tool interface of the electronic device itself. Optionally, the display of the shortcut tool interface may be triggered by performing a sliding operation from the top of the display screen toward the bottom of the display screen, and the management control with the selector may be displayed in the shortcut tool interface. Then in the case where the selector has not been displayed, if a touch operation acting on the management control is detected, the selector can be called up. Correspondingly, in the case where the selector has The touch operation of the management control can cancel the display of the selector.
再者,作为再一种方式,还可以通过语音控制的方式来触发显示选择器。在这种方式下,可以在启动电子设备的语音助手后,若获取到指定的语音内容则可以触发调出选择器。可选的,该指定的语音内容可以为文本转换,或者可以为文本翻译等。可选的,该指定的语音内容可以由用户根据自己的习惯进行设定。在这种方式中,可以通过前述的方式来控制选择器取消显示,也可以继续通过语音助手来使得选择器取消显示。Furthermore, as a further way, the display selector can also be triggered by means of voice control. In this way, after starting the voice assistant of the electronic device, if the specified voice content is acquired, the selector can be triggered to call up. Optionally, the specified voice content may be text conversion, or may be text translation, or the like. Optionally, the specified voice content may be set by the user according to his own habits. In this manner, the selector can be controlled to cancel the display in the aforementioned manner, or the selector can be canceled from the display by continuing to use the voice assistant.
S120:将所述待处理划分区域中的文本作为待处理文本。S120: Use the text in the to-be-processed divided area as the to-be-processed text.
其中,待处理文本可以理解为后续会进行转换的文本。The to-be-processed text can be understood as the text to be converted later.
S130:对所述待处理文本进行转换,得到转换后的文本。S130: Convert the to-be-processed text to obtain the converted text.
其中,在本申请实施例中,对于待处理文本的转换可以有多种方式。作为一种方式,所述转换包括以下处理方式中的至少一种:对文本进行语种翻译;Among them, in the embodiment of the present application, there may be various ways for the conversion of the text to be processed. As one way, the conversion includes at least one of the following processing ways: performing language translation on the text;
切换文本的字体样式;以及切换文本的字体大小。其中,进行语种翻译可以包括将任一一个语种的文本翻译为另一个语种的文本,例如,可以将英语的文本翻译为中文的文本,也可以将中文的文本翻译为英文的文本。切换文本的字体样式可以理解为切换文本本身的字体。例如,可以将宋体的文本切换为楷体的文本,再例如,可以将繁体的文本切换为简体的文本。Toggles the font style of the text; and toggles the font size of the text. The language translation may include translating texts in any one language into texts in another language. For example, English texts may be translated into Chinese texts, and Chinese texts may also be translated into English texts. Switching the font style of the text can be understood as switching the font of the text itself. For example, it is possible to switch the text in the Song typeface to the text in the italics, and for another example, switch the text in the traditional type to the text in the simplified type.
S140:输出所述转换后的文本。S140: Output the converted text.
在本申请实施例中,在得到转换后的文本后,可以对转换后的文本进行输出。而在本申请实施例中可以有多种方式对转换后的文本进行输出。In this embodiment of the present application, after the converted text is obtained, the converted text can be output. However, in this embodiment of the present application, the converted text may be output in various ways.
作为一种输出方式,可以对转换后的文本进行显示。需要说明的是,用户触发对界面中的文本进行转换的目的可能是为了使得自己能够更好的识别文本的内容。例如,若界面的中的文本为英文的文本,但是用户可能对英文并不太熟悉,那么用户就可能希望将界面中的文本转换为熟悉的中文,那么在得到转换后的文本后,则可以将转换后的文本进行显示。示例性的,如图7所示,在确定待处理划分区域后,可以 取消显示选择器而显示图8中所示的边框16以将待处理划分区域进行标识。其中,边框16所围成的区域则为待处理划分区域。并且,其中边框16可以响应用户的拖动操作而进行尺寸改变,以便用户可以进一步的根据自己的需要调整实际所获取得到的待处理文本。As an output method, the converted text can be displayed. It should be noted that the purpose of triggering the conversion of the text in the interface by the user may be to enable the user to better recognize the content of the text. For example, if the text in the interface is in English, but the user may not be familiar with English, then the user may want to convert the text in the interface into familiar Chinese, then after obtaining the converted text, you can Display the converted text. Exemplarily, as shown in FIG. 7 , after the division area to be processed is determined, the display selector can be cancelled and the frame 16 shown in FIG. 8 is displayed to identify the division area to be processed. The area enclosed by the frame 16 is the to-be-processed divided area. Moreover, the size of the frame 16 can be changed in response to the user's drag operation, so that the user can further adjust the actually obtained text to be processed according to his own needs.
对于转换后的文本可以通过结果显示界面17进行展示。其中,结果显示界面的显示位置可以根据实际的情况进行确定。例如,若待处理划分区域本身在界面中靠上的位置,那么结果显示界面则可以显示在界面中相对靠下的位置,对应的,若待处理划分区域本身在界面中靠下的位置,那么结果显示界面则可以显示在界面中相对靠上的位置,进而通过这种方式避免结果显示界面与待处理划分区域之间相互挤占显示位置。再者,若待处理区域本身就占据了显示屏幕的大部分区域,则可以将结果显示界面悬浮显示在显示屏的中间位置。The converted text can be displayed through the result display interface 17 . Wherein, the display position of the result display interface can be determined according to the actual situation. For example, if the divided area to be processed is at the upper position in the interface, the result display interface can be displayed at the relatively lower position in the interface. Correspondingly, if the divided area to be processed is at the lower position in the interface, then The result display interface can be displayed at a relatively upper position in the interface, and in this way, it is avoided that the result display interface and the divided area to be processed occupy each other's display positions. Furthermore, if the area to be processed occupies most of the area of the display screen, the result display interface can be suspended and displayed in the middle of the display screen.
可选的,为了能够便于用户对转换后的文本进行操作,或者切换当前的文本转换方式,可以在结果显示界面中配置更多控件。示例性的,如图9所示,在图9所示的结果显示界面17中,可以包括有复制控件18以及翻译转换控件19。其中,若检测到有作用于复制控件18的操作,则可以将结果显示界面17中所显示的转换后的文本进行复制,以便于用户可以快速的将转换后的文本粘贴到另外的区域中。其中,若检测到有作用于翻译转换控件19的操作,则可以显示图10中所示的语言选择界面20,在该语言选择界面20中可以选择是将何种语言的文本翻译为何种语言(翻译目标语言)的文本。Optionally, in order to facilitate the user to operate the converted text or switch the current text conversion mode, more controls may be configured in the result display interface. Exemplarily, as shown in FIG. 9 , the result display interface 17 shown in FIG. 9 may include a copy control 18 and a translation conversion control 19 . Wherein, if an operation acting on the copy control 18 is detected, the converted text displayed in the result display interface 17 can be copied, so that the user can quickly paste the converted text into another area. Among them, if an operation acting on the translation conversion control 19 is detected, the language selection interface 20 shown in FIG. 10 can be displayed, and in the language selection interface 20, it is possible to select which language to translate the text into which language ( translation target language).
需要说明的是,在通过语言选择界面20对翻译目标语言进行切换后,电子设备可以自动同步更新结果显示界面17中所显示的转换后的文本。It should be noted that, after the translation target language is switched through the language selection interface 20 , the electronic device can automatically update the converted text displayed in the result display interface 17 .
作为另外一种输出方式,可以将转换后的文本输出到指定的信息通信界面中,以便可以通过将该信息通信界面将转换后的文本进行发送。需要说明的是,在一些情况下,用户期望能够将当前界面中的文本进行转换后就可以直接发送给其他用户,那么电子设备可以在获取到转换后的文本后,根据用户的选择触发显示指定的信息通信界面,并将该转换后的文本输出到该指定的信息通信界面中的信息待发送区域中。As another output method, the converted text can be output to a designated information communication interface, so that the converted text can be sent through the information communication interface. It should be noted that, in some cases, the user expects to be able to directly send the text in the current interface to other users after being converted, then the electronic device can trigger the display designation according to the user's selection after obtaining the converted text. the information communication interface, and output the converted text to the information to-be-sent area in the designated information communication interface.
需要说明的是,在输出方式有多种的情况下,电子设备可以根据该指定的信息通信界面所属应用程序的运行时刻来确定具体采用那种输出方式。作为一种方式,若检测到在选择器被调出后有应用程序被启动,且该被启动的应用程序包括有指定的信息通信界面的情况下,那么则确定将转换后的文本输出到该在选择器被调出后启动的应用程序中的指定的信息通信界面中的信息待发送区域中。对应的,若检测到在选择器被调出后到得到转换后的文本这段时间内并没有包括有指定的信息通信界面的应用程序启动,那么则通过将转换后的文本进行显示的方式进行输出。It should be noted that, when there are multiple output modes, the electronic device may determine which output mode to use according to the running time of the application to which the specified information communication interface belongs. In one way, if it is detected that an application program is activated after the selector is called up, and the activated application program includes a designated information communication interface, then it is determined to output the converted text to the In the information to-be-sent area in the designated information communication interface in the application program started after the selector is called up. Correspondingly, if it is detected that the application program that includes the specified information communication interface is not started during the period after the selector is called up to the time when the converted text is obtained, then the conversion is performed by displaying the converted text. output.
示例性的,该包括有指定信息通信界面的应用程序可以为短信发送程序,该短信发送程序所包括的指定信息通信界面可以为短信发送界面。Exemplarily, the application program including the designated information communication interface may be a short message sending program, and the designated information communication interface included in the short message sending program may be a short message sending interface.
本申请提供的一种文本处理方法,通过对选择器的移动情况进行检测,进而在当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域,然后将所述待处理划分区域中的文本作为待处理文本,并对所述待处理文本进行转换得到转换后的文本,再输出所述转换后的文本。从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。再者,在本申请实施例中选择器在停止移动后所对应的待处理划分区域是由电子设备自行确定的,不用用户进行手动的选择,提升了整个过程的智能化程度。In a text processing method provided by the present application, by detecting the movement of the selector, after the selector stops moving, the to-be-processed divided area corresponding to the position where the selector stops moving is obtained, and then the The text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result. Furthermore, in the embodiment of the present application, the to-be-processed divided area corresponding to the selector after it stops moving is determined by the electronic device itself, and manual selection by the user is not required, which improves the intelligence of the entire process.
请参阅图11,本申请实施例提供的一种文本处理方法,应用于电子设备,所述方法包括:Referring to FIG. 11 , a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
S210:当选择器停止移动后,将所述选择器停止移动后的位置与至少一个划分区域进行匹配。S210: After the selector stops moving, match the position where the selector stops moving with at least one divided area.
需要说明的是,在实施例中可以预先将界面中的文本进行区域划分,进而得到至少一个划分区域。It should be noted that, in the embodiment, the text in the interface may be divided into regions in advance, so as to obtain at least one divided region.
作为一种方式,本申请实施例提供的方法还包括:获取所述界面中的文本以及所述文本的排布格式;基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域。As a method, the method provided by the embodiment of the present application further includes: acquiring the text in the interface and the arrangement format of the text; dividing the text in the interface based on the arrangement format to obtain at least one Divide the area.
可选的,所述排布格式包括行间距。其中,电子设备可以根据对当前界面中的文本之间的颜色变换来确定行间距。需要说明的是,在界面中文本与背景之间的颜色通常是可以不同的,进而可以通过颜色检测来确定出界面中哪些区域为文本哪些区域为文本之间的空白位置,对应的,在获取到文本之间的空白位置后,可以进一步的根据空白位置的高度来作为相邻行文本之间的行间距。Optionally, the arrangement format includes line spacing. The electronic device may determine the line spacing according to the color transformation between the texts in the current interface. It should be noted that the color between the text and the background in the interface can usually be different, and then the color detection can be used to determine which areas in the interface are text and which areas are the blank positions between the texts. Correspondingly, in the acquisition After reaching the blank position between the texts, you can further use the height of the blank position as the line spacing between adjacent lines of text.
所述基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域,包括:在当次划分过程中,以当次划分的起点开始依次将相邻行的文本之间的行间距与第一指定阈值进行比对;若获取到第一参考相邻行,将第一参考相邻行中在前的一行、所述起点以及所述第一参考相邻行中在前的一行与所述起点之间的区域作为当次划分过程得到的划分区域,并将所述第一参考相邻行中在后一行作为下次次划分的起点,直到完成对界面中最后的相邻行的文本之间的行间距的检测;若未获取到所述第一参考相邻行,将当次划分的起点以及当次划分的起点以后的区域确定为一个划分 区域;其中,所述第一参考相邻行的文本之间的行间距大于所述第一指定阈值。The dividing the text in the interface based on the arrangement format to obtain at least one divided area includes: in the current division process, starting from the starting point of the current division, sequentially dividing the text between adjacent lines of text. The line spacing is compared with the first specified threshold; if the first reference adjacent line is obtained, the first reference adjacent line, the starting point, and the first reference adjacent line are compared. The area between one row and the starting point is used as the division area obtained by the current division process, and the next row in the first reference adjacent row is used as the starting point of the next division, until the last adjacent row in the interface is completed. Detection of the line spacing between the texts of the lines; if the first reference adjacent line is not obtained, the starting point of the current division and the area after the starting point of the current division are determined as a division area; A line spacing between text referring to adjacent lines is greater than the first specified threshold.
示例性的,如图12所示,在划分区域的划分过程中可以是以第一行为起点进行划分。其中,第一行的文本包括“Chengdu,or"Rong"for short,”,第二行的文本包括“also known as Rongcheng and”,那么第一个相邻行的行间距为图12中所示出的h1。若基于前述方式获取到第七行和第八行的行间距h2大于第一指定阈值,那么则会将第七行和第八行确定为第一参考相邻行。其中,第七行所包括的文本为“city economic circle.”,第八行包括的文本为“It is an important central”。其中,第七行为第一参考相邻行中在前一行,进而会将第一行、第七行以及第一行到第七行之间的文本作为一个划分区域,进而可以将图12中所示的文本划分为图13中所示的划分区域21以及划分区域22。Exemplarily, as shown in FIG. 12 , in the process of dividing the area, the division may be performed at the starting point of the first row. Among them, the text in the first line includes "Chengdu,or"Rong"for short,", and the text in the second line includes "also known as Rongcheng and", then the line spacing of the first adjacent line is as shown in Figure 12 out of h1. If the row spacing h2 of the seventh row and the eighth row obtained based on the foregoing method is greater than the first specified threshold, then the seventh row and the eighth row will be determined as the first reference adjacent row. Among them, the text included in the seventh line is "city economic circle.", and the text included in the eighth line is "It is an important central". Among them, the seventh row is the previous row in the first reference adjacent row, and then the first row, the seventh row and the text between the first row and the seventh row are used as a divided area, and then the The text shown is divided into a divided area 21 and a divided area 22 shown in FIG. 13 .
需要说明的是,在确定划分区域的过程中,电子设备可以通过对当前界面进行截图然后通过OCR(Optical Character Recognition,光学字符识别)的方式获取到当前界面中的文本以及文本的排布格式,从而即使在当前界面中即使有图片的情况下,也依然可以获取到图片中所包括的文本,以便使得在确定划分区域的过程中,也可以对当前界面中图片中所包括的文本进行划分。如图14,在当前界面中所包括的图片中有文本的情况下,依然可以将其确定到划分区域中,并确定为划分区域23。It should be noted that, in the process of determining the divided area, the electronic device can obtain the text in the current interface and the layout format of the text by taking a screenshot of the current interface and then using OCR (Optical Character Recognition, Optical Character Recognition). Therefore, even if there is a picture in the current interface, the text included in the picture can still be obtained, so that the text included in the picture in the current interface can also be divided during the process of determining the divided area. As shown in FIG. 14 , in the case that there is text in the picture included in the current interface, it can still be determined into the divided area and determined as the divided area 23 .
可选的,所述排布格式包括标点符号。在这种方式中,电子设备可以从当前界面中的第一个字符开始进行标点符号的识别,并基于识别到的指定标点符号来进行划分区域的确定。在这种方式中,在当次的区域划分过程中,从当次区域划分的起点开始,若识别到指定的标点符号,则将该识别到的指定标点符号与当次区域划分的起点之间的文本作为一个划分区域。并将当次区域划分过程中获取到的指定标点符号以后的文本作为下次的区域划分过程的起点。示例性的,若指定的标点符号为点号,那么以图13中所示的界面为例,依然可以确定得到图13中所示的划分区域21以及划分区域22。Optionally, the arrangement format includes punctuation. In this manner, the electronic device can recognize the punctuation from the first character in the current interface, and determine the divided area based on the recognized designated punctuation. In this way, in the current area division process, starting from the starting point of the current area division, if a designated punctuation mark is identified, the distance between the identified designated punctuation mark and the starting point of the current area division text as a divided area. The text after the specified punctuation mark acquired in the current sub-area division process is used as the starting point of the next area division process. Exemplarily, if the specified punctuation symbol is a dot, then taking the interface shown in FIG. 13 as an example, it can still be determined to obtain the divided area 21 and the divided area 22 shown in FIG. 13 .
S220:将对应的位置与所述选择器停止移动后的位置匹配的划分区域作为待处理划分区域。S220: Use the divided area whose corresponding position matches the position after the selector stops moving as the divided area to be processed.
其中,对于每个确定的划分区域都各自对应有位置,每个划分区域的位置表征了每个划分区域所覆盖的范围。那么在当选择器停止移动后,则可以将停止移动后的选择器所在位置与每个划分区域的位置进行匹配,进而将对应的位置与选择器的位置匹配的划分区域作为待处理划分区域。Wherein, each determined divided area has a corresponding position, and the position of each divided area represents the range covered by each divided area. Then, after the selector stops moving, the position of the selector after the movement stops can be matched with the position of each divided area, and then the divided area whose corresponding position matches the position of the selector can be used as the divided area to be processed.
作为一种方式,选择器因为界面原因并不是一个点而是会占用一个面。那么为了便于获取选择器的位置,可以将选择器的中心所在的位置作为选择器的位置。那么在匹配选择器的位置与划分区域的位置的过程中,可以将选择器的中心所位于的划分区域作为待处理划分区域。As a way, the selector is not a point for interface reasons but will occupy a surface. Then, in order to easily obtain the position of the selector, the position of the center of the selector can be used as the position of the selector. Then, in the process of matching the position of the selector and the position of the divided area, the divided area where the center of the selector is located may be used as the divided area to be processed.
S230:将所述待处理划分区域中的文本作为待处理文本。S230: Use the text in the to-be-processed divided area as the to-be-processed text.
S240:对所述待处理文本进行转换,得到转换后的文本。S240: Convert the to-be-processed text to obtain the converted text.
如前述内容所示,在本申请实施例中对文本的转换可以包括有对文本进行语种翻译、切换文本的字体样式以及切换文本的字体大小等。在本实施例中,电子设备可以根据用户的触控操作来确定具体采用那种转换方式。As shown in the foregoing, the conversion of the text in this embodiment of the present application may include language translation of the text, switching of the font style of the text, and switching of the font size of the text, and the like. In this embodiment, the electronic device may determine the specific conversion mode to be adopted according to the user's touch operation.
作为一种方式,在选择器停止移动后,电子设备可以进一步的检测作用于选择器的操作参数,进而根据操作参数来确定具体的转换方式。As a method, after the selector stops moving, the electronic device can further detect the operation parameters acting on the selector, and then determine the specific conversion mode according to the operation parameters.
可选的,该操作参数可以为按压力度。在这种方式中,在用户完成对选择器的拖动后,可以继续对选择器施加按压操,而电子设备可以对当前的按压力度进行实时检测,并实时显示出当前的按压力度所对应的转换方式。Optionally, the operation parameter may be pressing force. In this way, after the user finishes dragging the selector, he can continue to apply the pressing operation to the selector, and the electronic device can detect the current pressing force in real time, and display the corresponding pressing force in real time. conversion method.
可选的,该操作参数可以为按压时长。在这种方式中,在用户完成对选择器的拖动后,可以继续对选择器施加按压操作,而电子设备可以对当前的按压时长进行实时检测,并实时显示出当前的按压时长所对应的转换方式。Optionally, the operation parameter may be the pressing duration. In this way, after the user finishes dragging the selector, he can continue to apply the pressing operation to the selector, and the electronic device can detect the current pressing time in real time, and display the corresponding pressing time in real time. conversion method.
示例性的,如图15所示,在选择器被拖动到图15中所示的位置后,若检测到继续作用于选择器的按压操作,可以对该按压操作的力度继续进行检测,在按压力度满足进行翻译的力度后,会如图15最左侧图中所示的显示进行翻译的提示,若在显示翻译的时候检测到作用于选择器的按压操作消失,则会对待处理文本进行翻译。若用户继续施加更大的按压力度,且检测到力度满足进行字体大小转换后,则会将提示内容更换为图15中间图像中所示的字体大小转换,对应的,若在显示字体大小转换的过程中,检测到作用于选择器的按压操作消失,则会对待处理文本进行字体大小转换。若用户继续施加更大的按压力度,且检测到力度满足进行字体样式转换后,则会将提示内容更换为图15右侧图像中所示的字体样式转换,对应的,若在显示字体样式转换的过程中,检测到作用于选择器的按压操作消失,则会对待处理文本进行字体样式转换。可选的,若用户减小按压的力度,则可以切换到之前按压力度更小时对应的转换方式。Exemplarily, as shown in FIG. 15 , after the selector is dragged to the position shown in FIG. 15 , if a pressing operation that continues to act on the selector is detected, the strength of the pressing operation can be continuously detected. After the pressing force meets the force for translation, a prompt for translation will be displayed as shown in the leftmost figure in Figure 15. If it is detected that the pressing operation acting on the selector disappears when the translation is displayed, the text to be processed will be processed. translate. If the user continues to apply a larger pressing force, and it is detected that the force is sufficient for font size conversion, the prompt content will be replaced with the font size conversion shown in the middle image in Figure 15. Correspondingly, if the font size conversion is displayed in the During the process, it is detected that the pressing operation acting on the selector disappears, and the font size of the text to be processed will be converted. If the user continues to apply a larger pressing force, and it is detected that the force is sufficient for font style conversion, the prompt content will be replaced with the font style conversion shown in the image on the right side of Figure 15. Correspondingly, if the font style conversion is displayed in the display During the process of detecting the disappearance of the pressing operation acting on the selector, the font style conversion of the text to be processed will be performed. Optionally, if the user reduces the pressing force, the user can switch to the conversion mode corresponding to the previous pressing force when the pressing force is smaller.
类似的,在选择器被拖动到图15中所示的位置后,若检测到继续作用于选择器的按压操作,可以对该按压操作的按压时长继续进行检测,在按压时长满足进行翻译的力度后,会如图15最左侧图中所示的显示进行翻译的提示,若在显示翻译的时候检测到作用于选择器的按压操作消失,则会对待处理文本进行翻译。若用户继续保持按压操作,且检测到按压时长满足进行字体大小转换后,则会将提示内容更换为图 15中间图像中所示的字体大小转换,对应的,若在显示字体大小转换的过程中,检测到作用于选择器的按压操作消失,则会对待处理文本进行字体大小转换。若用户继续保持按压操作,且检测到按压时长满足进行字体样式转换后,则会将提示内容更换为图15右侧图像中所示的字体样式转换,对应的,若在显示字体样式转换的过程中,检测到作用于选择器的按压操作消失,则会对待处理文本进行字体样式转换。Similarly, after the selector is dragged to the position shown in FIG. 15 , if a pressing operation that continues to act on the selector is detected, the pressing duration of the pressing operation can continue to be detected. After the force is pressed, a prompt for translation will be displayed as shown in the leftmost figure in Figure 15. If the pressing operation on the selector disappears when the translation is displayed, the text to be processed will be translated. If the user continues to hold the pressing operation, and it is detected that the pressing time is sufficient to perform the font size conversion, the prompt content will be replaced with the font size conversion shown in the middle image in Figure 15. Correspondingly, if the font size conversion is displayed during the process of displaying the font size conversion , it detects that the pressing operation acting on the selector disappears, and the font size of the text to be processed is converted. If the user continues to hold the pressing operation, and it is detected that the pressing time is sufficient for font style conversion, the prompt content will be replaced with the font style conversion shown in the image on the right side of Figure 15. Correspondingly, if the font style conversion process is displayed , the disappearance of the pressing operation acting on the selector is detected, and the font style conversion of the text to be processed will be performed.
S250:输出所述转换后的文本。S250: Output the converted text.
本申请提供的一种文本处理方法,从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。再者,在本实施例中,可以将当前界面中的文本先进行划分得到至少一个划分区域,然后再将选择器所在位置与至少一个划分区域所在位置进行比对,进而确定出待处理划分区域。The present application provides a text processing method, so that the text to be converted can be obtained flexibly by detecting the movement of the selector and obtaining the to-be-processed divided area corresponding to the position after the selector is stopped by the above method, which improves the processing efficiency. The convenience of text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result. Furthermore, in this embodiment, the text in the current interface can be divided first to obtain at least one divided area, and then the position of the selector is compared with the position of the at least one divided area, and then the divided area to be processed is determined. .
请参阅图16,本申请实施例提供的一种文本处理方法,应用于电子设备,所述方法包括:Referring to FIG. 16, a text processing method provided by an embodiment of the present application is applied to an electronic device, and the method includes:
S310:当选择器停止移动后,获取第一文本,所述第一文本为所述选择器停止移动后的位置所在行的文本。S310: After the selector stops moving, obtain first text, where the first text is the text of the row where the selector stops moving.
需要说明的是,在本实施例中,可以是在检测到选择器停止移动后再开始进行待处理划分区域的确定,并且在本实施例中,可以不用对界面中的所有文本均进行划分区域的确定。It should be noted that, in this embodiment, the determination of the to-be-processed divided area may be started after it is detected that the selector stops moving, and in this embodiment, all texts in the interface may not be divided into areas. ok.
S320:以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本。S320: Obtain the second text along a specified direction with the first text as a starting point and based on the arrangement format of the text.
可选的,该指定方向可以为电子设备识别到的文本阅读方向。该文本阅读方向可以理解为用户在阅读文本时的顺序方向。Optionally, the specified direction may be a text reading direction recognized by the electronic device. The text reading direction can be understood as the sequential direction of the user when reading the text.
S330:将所述第一文本、所述第二文本以及所述第一文本与所述第二文本之间的文本所在区域作为待处理划分区域。S330: Use the first text, the second text, and the region where the text between the first text and the second text is located as a to-be-processed divided region.
作为一种方式,所述排布格式包括行间距,所述以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本,包括:以所述第一文本为起点,依次将相邻行的文本之间的行间距与第二指定阈值进行比对;获取第二参考相邻行,所述第二参考相邻行为首次获取得到的行间距大于所述第二指定阈值的相邻行;将所述第二参考相邻行中在前的一行的文本作为第二文本。As one way, the arrangement format includes line spacing, and the obtaining the second text in a specified direction and based on the text-based arrangement format with the first text as a starting point includes: taking the first text as a starting point, Comparing the line spacing between the texts of adjacent lines with the second specified threshold in turn; obtaining a second reference adjacent line, where the line spacing obtained for the first time by the second reference adjacent behavior is greater than the second specified threshold the adjacent line of ; take the text of the previous line in the second reference adjacent line as the second text.
S340:将所述待处理划分区域中的文本作为待处理文本。S340: Use the text in the to-be-processed divided area as the to-be-processed text.
S350:对所述待处理文本进行转换,得到转换后的文本。S350: Convert the to-be-processed text to obtain the converted text.
S360:输出所述转换后的文本。S360: Output the converted text.
需要说明的是,在调用出选择器后可以理解为当前已经进入了转换模式。如图17所示,若检测有作用于选择器10的点击操作,可以触发显示图17所示的关闭控件24,若检测到作用于关闭控件24的点击操作,则会退出当前的转换模式,并且取消显示选择器10。可选的,关闭控件24在显示过程中可以是从选择器10的背后渐渐的移动到图17中所示的位置。It should be noted that after calling the selector, it can be understood that the conversion mode has been entered. As shown in FIG. 17 , if a click operation acting on the selector 10 is detected, the closing control 24 shown in FIG. 17 can be triggered to display, and if a click operation acting on the closing control 24 is detected, the current conversion mode will be exited, And the selector 10 is canceled. Optionally, the close control 24 may be gradually moved from the back of the selector 10 to the position shown in FIG. 17 during the display process.
需要说明的是,触发关闭控件24进行显示的点击操作与前述实施例中触发进行转换方式切换的按压操作不同的是,前述实施例中触发进行转换方式切换的按压操作是需要与选择器的拖动操作连续作用的。或者可以理解为,在前述实施例中,若检测到对选择器的拖动操作且在完成拖动后保持对选择器的接触并继续施加按压操作则才会触发前述的转换方式切换。It should be noted that the click operation that triggers the display of the close control 24 is different from the pressing operation that triggers the switching of the conversion mode in the foregoing embodiment. Active operation is continuous. Alternatively, it can be understood that, in the foregoing embodiment, the foregoing conversion mode switching will only be triggered if a drag operation on the selector is detected and the selector is kept in contact and the pressing operation is continued after the drag operation is completed.
本申请提供的一种文本处理方法,从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。再者,在本实施例中,可以是以选择器停止移动后的位置为起点,再沿指定方向且基于文本的排布格式来获取得到待处理划分区域,从而进一步的提升了确定待处理划分区域的灵活性。The present application provides a text processing method, so that the text to be converted can be obtained flexibly by detecting the movement of the selector and obtaining the to-be-processed divided area corresponding to the position after the selector is stopped by the above method, which improves the processing efficiency. The convenience of text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result. Furthermore, in this embodiment, the position after the selector stops moving can be used as the starting point, and then the to-be-processed divided area can be obtained along the specified direction and based on the text arrangement format, thereby further improving the determination of the to-be-processed division. Regional flexibility.
请参阅图18,本申请实施例提供的一种文本处理装置,运行于电子设备,所述装置400包括:Referring to FIG. 18 , a text processing apparatus provided by an embodiment of the present application operates on an electronic device, and the apparatus 400 includes:
区域获取单元410,用于当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域。The area acquiring unit 410 is configured to acquire, after the selector stops moving, the to-be-processed divided area corresponding to the position where the selector stops moving.
作为一种方式,区域获取单元410,具体用于将所述选择器停止移动后的位置与至少一个划分区域进行匹配;将对应的位置与所述选择器停止移动后的位置匹配的划分区域作为待处理划分区域。In one way, the area acquisition unit 410 is specifically configured to match the position after the selector stops moving with at least one divided area; the divided area whose corresponding position matches the position after the selector stops moving is used as Area to be processed.
可选的,区域获取单元410,还用于获取所述界面中的文本以及所述文本的排布格式;基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域。区域获取单元410,具体用于在当次划分过程中,以当次划分的起点开始依次将相邻行的文本之间的行间距与第一指定阈值进行比对;若获取到第一参考相邻行,将第一参考相邻行中在前的一行、所述起点以及所述第一参考相邻行中在前的一行与所述起点之间的区域作为当次划分过程得到的划分区域,并将所述第一参考相邻行中在后一行作为下次次划分的起点,直到完成对界面中最后的相邻行的文本之间的行间距的检测;若未获 取到所述第一参考相邻行,将当次划分的起点以及当次划分的起点以后的区域确定为一个划分区域;其中,所述第一参考相邻行的文本之间的行间距大于所述第一指定阈值。Optionally, the area acquisition unit 410 is further configured to acquire the text in the interface and the arrangement format of the text; divide the text in the interface based on the arrangement format to obtain at least one divided area. The area acquisition unit 410 is specifically configured to compare the line spacing between the texts of adjacent lines with the first specified threshold in turn from the starting point of the current division in the current division process; if the first reference phase is obtained. Adjacent row, take the preceding row in the first reference adjacent row, the starting point, and the area between the preceding row in the first reference adjacent row and the starting point as the division area obtained by the current division process , and use the next row in the first reference adjacent row as the starting point of the next division until the detection of the line spacing between the texts of the last adjacent row in the interface is completed; 1. With reference to an adjacent line, the starting point of the current division and the area after the starting point of the current division are determined as a division area; wherein, the line spacing between the texts of the first reference adjacent line is greater than the first specified threshold.
作为另外一种方式,区域获取单元410,具体用于获取第一文本,所述第一文本为所述选择器停止移动后的位置所在行的文本;以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本;将所述第一文本、所述第二文本以及所述第一文本与所述第二文本之间的文本所在区域作为待处理划分区域。In another way, the area obtaining unit 410 is specifically configured to obtain the first text, where the first text is the text of the line where the selector stops moving; and the first text is used as a starting point along a specified direction. and acquiring the second text based on the arrangement format of the text; using the first text, the second text, and the region where the text between the first text and the second text is located as a to-be-processed divided region.
可选的,区域获取单元410,具体用于以所述第一文本为起点,依次将相邻行的文本之间的行间距与第二指定阈值进行比对;获取第二参考相邻行,所述第二参考相邻行为首次获取得到的行间距大于所述第二指定阈值的相邻行;将所述第二参考相邻行中在前的一行的文本作为第二文本。Optionally, the area obtaining unit 410 is specifically configured to take the first text as a starting point, and sequentially compare the line spacing between the texts of adjacent lines with the second specified threshold; obtain the second reference adjacent line, The second reference adjacent line first obtains the adjacent line whose line spacing is greater than the second specified threshold; the text of the previous line in the second reference adjacent line is used as the second text.
可选的,区域获取单元410,具体用于在当次划分过程中,从当次划分的起点开始,若识别到指定的标点符号,则将所述识别到的指定标点符号与当次划分的起点之间的文本作为一个划分区域,并将当次划分过程中获取到的指定标点符号以后的文本作为下次的划分过程的起点。Optionally, the area acquisition unit 410 is specifically configured to, in the current division process, start from the starting point of the current division, and if a specified punctuation mark is identified, then compare the identified specified punctuation mark with the current division. The text between the starting points is used as a division area, and the text after the specified punctuation mark obtained in the current division process is used as the starting point of the next division process.
文本获取单元420,用于将所述待处理划分区域中的文本作为待处理文本。The text obtaining unit 420 is configured to use the text in the to-be-processed divided area as the to-be-processed text.
文本转换单元430,用于对所述待处理文本进行转换,得到转换后的文本。The text conversion unit 430 is configured to convert the to-be-processed text to obtain the converted text.
作为一种方式,所述转换包括一下处理方式中的至少一种:对文本进行语种翻译;切换文本的字体样式;以及切换文本的字体大小。In one manner, the conversion includes at least one of the following processing methods: performing language translation on the text; switching the font style of the text; and switching the font size of the text.
文本输出单元440,用于输出所述转换后的文本。The text output unit 440 is configured to output the converted text.
可选的,文本输出单元440,具体用于将所述转换后的文本输出到指定的信息通信界面中,以便通过所述信息通信界面将所述转换后的文本进行发送。Optionally, the text output unit 440 is specifically configured to output the converted text to a designated information communication interface, so as to send the converted text through the information communication interface.
可选的,文本输出单元440,具体用于若检测在所述选择器被调出后有应用程序被启动,且所述被启动的应用程序包括有指定的信息通信界面的情况下,将所述转换后的文本输出到所述在所述选择器被调出后启动的应用程序中的指定的信息通信界面中的信息待发送区域中;若检测到在所述选择器被调出后到得到所述转换后的文本的时间内并没有包括有指定的信息通信界面的应用程序启动,将所述转换后的文本进行显示。Optionally, the text output unit 440 is specifically configured to, if it is detected that an application program is started after the selector is called up, and the started application program includes a specified information communication interface, send the The converted text is output to the information to be sent area in the specified information communication interface in the application program started after the selector is called up; if it is detected that after the selector is called up, the The application program that does not include the specified information communication interface is started within the time of obtaining the converted text, and the converted text is displayed.
如图19所示,所述装置还包括:As shown in Figure 19, the device further includes:
选择器管理单元450,用于在指定位置悬浮显示工具栏,所述工具栏中包括有第一触发标识;若检测到有作用于所述第一触发标识的触控操作,显示所述选择器。The selector management unit 450 is configured to display a toolbar at a designated position in a floating manner, and the toolbar includes a first trigger mark; if a touch operation acting on the first trigger mark is detected, the selector is displayed .
可选的,选择器管理单元450,具体用于当所述选择器处于显示状态时,检测到有作用于所述第一触发标识的触控操作,取消显示所述选择器。Optionally, the selector management unit 450 is specifically configured to, when the selector is in a display state, detect a touch operation acting on the first trigger identifier, and cancel the display of the selector.
可选的,选择器管理单元450,具体用于若在指定时间段内没有检测到作用于所述工具栏的触控操作,将所述工具栏进行隐藏或者将所述工具栏进行缩小。Optionally, the selector management unit 450 is specifically configured to hide the toolbar or shrink the toolbar if no touch operation acting on the toolbar is detected within a specified time period.
可选的,选择器管理单元450,具体用于若悬浮显示的所述工具栏中设置有所述第三触发标识,则直接操作所述第三触发标识触发另外的应用程序进行启动。Optionally, the selector management unit 450 is specifically configured to directly operate the third trigger identifier to trigger another application to start if the third trigger identifier is set in the toolbar displayed in the floating display.
可选的,选择器管理单元450,具体用于通过从所述电子设备的显示屏的顶部朝向所述显示屏的底部执行滑动操作来触发显示快捷工具界面,所述快捷工具界面中包括有所述选择器的管理控件;若检测到作用于所述管理控件的触控操作,显示所述选择器;当所述选择器处于显示状态时,检测到有作用于所述管理控件的触控操作,取消显示所述选择器。Optionally, the selector management unit 450 is specifically configured to trigger the display of a shortcut tool interface by performing a sliding operation from the top of the display screen of the electronic device toward the bottom of the display screen, where the shortcut tool interface includes: The management control of the selector; if a touch operation acting on the management control is detected, the selector is displayed; when the selector is in the display state, a touch operation acting on the management control is detected , to dismiss the selector.
可选的,选择器管理单元450,具体用于在启动所述电子设备的语音助手后,若获取指定的语音内容,显示所述选择器。Optionally, the selector management unit 450 is specifically configured to display the selector if the specified voice content is acquired after the voice assistant of the electronic device is activated.
本申请提供的一种文本处理装置,通过对选择器的移动情况进行检测,进而在当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域,然后将所述待处理划分区域中的文本作为待处理文本,并对所述待处理文本进行转换得到转换后的文本,再输出所述转换后的文本。从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。A text processing device provided by the present application detects the movement of a selector, and then, after the selector stops moving, obtains the to-be-processed divided area corresponding to the position where the selector stops moving, and then The text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result.
需要说明的是,本申请中装置实施例与前述方法实施例是相互对应的,装置实施例中具体的原理可以参见前述方法实施例中的内容,此处不再赘述。It should be noted that the apparatus embodiments in the present application correspond to the foregoing method embodiments, and the specific principles in the apparatus embodiments may refer to the content in the foregoing method embodiments, which will not be repeated here.
下面将结合图20对本申请提供的一种电子设备进行说明。An electronic device provided by the present application will be described below with reference to FIG. 20 .
请参阅图20,基于上述的文本处理方法、装置,本申请实施例还提供的另一种可以执行前述文本处理方法的电子设备200。电子设备200包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及网络模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。Referring to FIG. 20 , based on the above-mentioned text processing method and apparatus, an embodiment of the present application further provides another electronic device 200 that can execute the above-mentioned text processing method. The electronic device 200 includes one or more (only one shown in the figure) a processor 102, a memory 104, and a network module 106 that are coupled to each other. Wherein, the memory 104 stores a program that can execute the content in the foregoing embodiments, and the processor 102 can execute the program stored in the memory 104 .
其中,处理器102可以包括一个或者多个用于处理数据的核。处理器102利用各种接口和线路连接整个电子设备200内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备200的各种功能和处理数据。可选地,处理器102可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作***、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。The processor 102 may include one or more cores for processing data. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 200, and executes by running or executing the instructions, programs, code sets or instruction sets stored in the memory 104, and calling the data stored in the memory 104. Various functions of the electronic device 200 and processing data. Optionally, the processor 102 may adopt at least one of digital signal processing (Digital Signal Processing, DSP), field-programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). A hardware form is implemented. The processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used for rendering and drawing of the display content; the modem is used to handle wireless communication. It can be understood that, the above-mentioned modem may not be integrated into the processor 102, and is implemented by a communication chip alone.
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory,ROM)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作***的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。例如,存储器104中可以存储有文本处理的装置。其中,该文本处理的装置可以为前述的装置400。存储数据区还可以存储终端100在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 104 may include a random access memory (Random Access Memory, RAM), or may include a read-only memory (Read-Only Memory, ROM). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 104 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing the operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like. For example, the memory 104 may store text processing means. Wherein, the apparatus for text processing may be the aforementioned apparatus 400 . The storage data area may also store data created by the terminal 100 during use (such as phone book, audio and video data, chat record data) and the like.
所述网络模块106用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯,例如和音频播放设备进行通讯。所述网络模块106可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。所述网络模块106可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。上述的无线网络可包括蜂窝式电话网、无线局域网或者城域网。例如,网络模块106可以与基站进行信息交互。The network module 106 is used for receiving and sending electromagnetic waves, realizing mutual conversion between electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, for example, communicate with an audio playback device. The network module 106 may include various existing circuit elements for performing these functions, eg, antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, subscriber identity module (SIM) cards, memory, etc. . The network module 106 can communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices through a wireless network. The aforementioned wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network. For example, the network module 106 may interact with the base station for information.
请参考图21,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质1100中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 21 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable storage medium 1100 stores program codes, and the program codes can be invoked by the processor to execute the methods described in the above method embodiments.
计算机可读存储介质1100可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质1100包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质1100具有执行上述方法中的任何方法步骤的程序代码1110的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1110可以例如以适当形式进行压缩。The computer-readable storage medium 1100 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1100 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 1100 has storage space for program code 1110 that performs any of the method steps in the above-described methods. These program codes can be read from or written to one or more computer program products. Program code 1110 may be compressed, for example, in a suitable form.
综上所述,本申请提供的一种文本处理方法、装置、电子设备及存储介质,通过对选择器的移动情况进行检测,进而在当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域,然后将所述待处理划分区域中的文本作为待处理文本,并对所述待处理文本进行转换得到转换后的文本,再输出所述转换后的文本。从而通过上述方式使得通过检测选择器的移动情况,以及获取选择器停止后位置对应的待处理划分区域就可以灵活的获取得到进行转换的文本,提升了进行文本转换的便利性。并且,在实施例中,可以仅对选择器对应的待处理划分区域中的文本进行转换,而不用对界面中所有的文本均进行转换,提升了将转换结果进行输出的效率。再者,在本申请实施例中选择器在停止移动后所对应的待处理划分区域是由电子设备自行确定的,不用用户进行手动的选择,提升了整个过程的智能化程度。To sum up, the text processing method, device, electronic device and storage medium provided by the present application detect the movement of the selector, and then obtain the information after the selector stops moving after the selector stops moving. Then, the text in the to-be-processed divided area is regarded as the to-be-processed text, and the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by detecting the movement of the selector and acquiring the to-be-processed divided area corresponding to the position after the selector stops, the converted text can be obtained flexibly by the above method, which improves the convenience of the text conversion. Moreover, in the embodiment, only the text in the to-be-processed divided area corresponding to the selector may be converted, instead of converting all the texts in the interface, which improves the efficiency of outputting the conversion result. Furthermore, in the embodiment of the present application, the to-be-processed divided area corresponding to the selector after it stops moving is determined by the electronic device itself, and no manual selection by the user is required, which improves the intelligence of the entire process.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征图进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: it can still be Modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements to some of the technical feature diagrams; and these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions in the embodiments of the present application .

Claims (20)

  1. 一种文本处理方法,其中,应用于电子设备,所述方法包括:A text processing method, wherein, applied to an electronic device, the method comprises:
    当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域;After the selector stops moving, obtain the to-be-processed divided area corresponding to the position where the selector stops moving;
    将所述待处理划分区域中的文本作为待处理文本;Taking the text in the to-be-processed divided area as the to-be-processed text;
    对所述待处理文本进行转换,得到转换后的文本;Convert the text to be processed to obtain the converted text;
    输出所述转换后的文本。The converted text is output.
  2. 根据权利要求1所述的方法,其中,所述获取所述选择器停止移动后的位置对应的待处理划分区域,包括:The method according to claim 1, wherein the acquiring the to-be-processed divided area corresponding to the position where the selector stops moving comprises:
    将所述选择器停止移动后的位置与至少一个划分区域进行匹配;matching the position where the selector stops moving with at least one divided area;
    将对应的位置与所述选择器停止移动后的位置匹配的划分区域作为待处理划分区域。The divided area whose corresponding position matches the position after the selector stops moving is used as the divided area to be processed.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, wherein the method further comprises:
    获取界面中的文本以及所述文本的排布格式;Obtain the text in the interface and the layout format of the text;
    基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域。The text in the interface is divided based on the arrangement format to obtain at least one divided area.
  4. 根据权利要求3所述的方法,其中,所述排布格式包括行间距,所述基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域,包括:The method according to claim 3, wherein the arrangement format includes line spacing, and the dividing the text in the interface based on the arrangement format to obtain at least one divided area, comprising:
    在当次划分过程中,以当次划分的起点开始依次将相邻行的文本之间的行间距与第一指定阈值进行比对;In the current division process, starting from the starting point of the current division, the line spacing between the texts of adjacent lines is compared with the first specified threshold in turn;
    若获取到第一参考相邻行,将第一参考相邻行中在前的一行、所述起点以及所述第一参考相邻行中在前的一行与所述起点之间的区域作为当次划分过程得到的划分区域,并将所述第一参考相邻行中在后一行作为下次次划分的起点,直到完成对界面中最后的相邻行的文本之间的行间距的检测;If the first reference adjacent row is obtained, the previous row in the first reference adjacent row, the starting point, and the area between the previous row and the starting point in the first reference adjacent row are used as the current The division area obtained by the sub-division process, and the next row in the first reference adjacent row is used as the starting point of the next sub-division, until the detection of the line spacing between the texts of the last adjacent row in the interface is completed;
    若未获取到所述第一参考相邻行,将当次划分的起点以及当次划分的起点以后的区域确定为一个划分区域;If the first reference adjacent row is not obtained, the starting point of the current division and the area after the starting point of the current division are determined as a division area;
    其中,所述第一参考相邻行的文本之间的行间距大于所述第一指定阈值。Wherein, the line spacing between the texts of the first reference adjacent lines is greater than the first specified threshold.
  5. 根据权利要求3所述的方法,其中,所述排布格式包括标点符号,所述基于所述排布格式对所述界面中的文本进行划分,得到至少一个划分区域,包括:The method according to claim 3, wherein the arrangement format includes punctuation marks, and the dividing the text in the interface based on the arrangement format to obtain at least one divided area, comprising:
    在当次划分过程中,从当次划分的起点开始,若识别到指定的标点符号,则将所述识别到的指定标点符号与当次划分的起点之间的文本作为一个划分区域,并将当次划分过程中获取到的指定标点符号以后的文本作为下次的划分过程的起点。In the current division process, starting from the starting point of the current division, if a designated punctuation mark is identified, the text between the identified designated punctuation mark and the starting point of the current division is used as a division area, and the The text after the specified punctuation mark obtained in the current division process is used as the starting point of the next division process.
  6. 根据权利要求1所述的方法,其中,所述获取所述选择器停止移动后的位置对应的待处理划分区域,包括:The method according to claim 1, wherein the acquiring the to-be-processed divided area corresponding to the position where the selector stops moving comprises:
    获取第一文本,所述第一文本为所述选择器停止移动后的位置所在行的文本;Obtaining the first text, the first text is the text of the row where the selector stops moving;
    以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本;Taking the first text as a starting point, along a specified direction and based on a text-based layout format, acquiring a second text;
    将所述第一文本、所述第二文本以及所述第一文本与所述第二文本之间的文本所在区域作为待处理划分区域。The region where the first text, the second text, and the text between the first text and the second text are located is used as a to-be-processed divided region.
  7. 根据权利要求6所述的方法,其中,所述排布格式包括行间距,所述以所述第一文本为起点沿指定方向且基于文本的排布格式获取第二文本,包括:The method according to claim 6, wherein the arrangement format comprises line spacing, and the obtaining the second text based on the arrangement format of the text along a specified direction with the first text as a starting point, comprising:
    以所述第一文本为起点,依次将相邻行的文本之间的行间距与第二指定阈值进行比对;Taking the first text as a starting point, sequentially comparing the line spacing between the texts of adjacent lines with the second specified threshold;
    获取第二参考相邻行,所述第二参考相邻行为首次获取得到的行间距大于所述第二指定阈值的相邻行;Obtaining a second reference adjacent row, where the row spacing obtained by the second reference adjacent row for the first time is greater than the adjacent row of the second specified threshold;
    将所述第二参考相邻行中在前的一行的文本作为第二文本。The text of the preceding line in the second reference adjacent line is used as the second text.
  8. 根据权利要求1-7任一所述的方法,其中,所述当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域之前还包括:The method according to any one of claims 1-7, wherein, after the selector stops moving, before acquiring the divided area to be processed corresponding to the position after the selector stops moving, the method further comprises:
    在指定位置悬浮显示工具栏,所述工具栏中包括有第一触发标识;A toolbar is suspended in a designated position, and the toolbar includes a first trigger identifier;
    若检测到有作用于所述第一触发标识的触控操作,显示所述选择器。If a touch operation acting on the first trigger mark is detected, the selector is displayed.
  9. 根据权利要求8所述的方法,其中,所述方法还包括:The method of claim 8, wherein the method further comprises:
    当所述选择器处于显示状态时,检测到有作用于所述第一触发标识的触控操作,取消显示所述选择器。When the selector is in the display state, a touch operation acting on the first trigger mark is detected, and the selector is canceled.
  10. 根据权利要求8所述的方法,其中,所述方法还包括:The method of claim 8, wherein the method further comprises:
    若在指定时间段内没有检测到作用于所述工具栏的触控操作,将所述工具栏进行隐藏或者将所述工具栏进行缩小。If no touch operation acting on the toolbar is detected within a specified time period, the toolbar is hidden or the toolbar is reduced.
  11. 根据权利要求8或9所述的方法,其中,所述工具栏还包括第二触发标识以及第三触发标识;所述第二触发标识为对当前界面进行标记的标识;所述第三触发标识为调用对应应用程序启动的标识。The method according to claim 8 or 9, wherein the toolbar further comprises a second trigger identifier and a third trigger identifier; the second trigger identifier is an identifier for marking the current interface; the third trigger identifier The identity that is launched for the calling corresponding application.
  12. 根据权利要求11所述的方法,其中,所述方法还包括:The method of claim 11, wherein the method further comprises:
    若悬浮显示的所述工具栏中设置有所述第三触发标识,则直接操作所述第三触发标识触发另外的应用程序进行启动。If the third trigger identifier is set in the toolbar displayed in the floating display, the third trigger identifier is directly operated to trigger another application to start.
  13. 根据权利要求1-7任一所述的方法,其中,所述当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域之前还包括:The method according to any one of claims 1-7, wherein, after the selector stops moving, before acquiring the divided area to be processed corresponding to the position after the selector stops moving, the method further comprises:
    通过从所述电子设备的显示屏的顶部朝向所述显示屏的底部执行滑动操作来触发显示快捷工具界面,所述快捷工具界面中包括有所述选择器的管理控件;Triggering the display of a shortcut tool interface by performing a sliding operation from the top of the display screen of the electronic device toward the bottom of the display screen, the shortcut tool interface includes a management control of the selector;
    若检测到作用于所述管理控件的触控操作,显示所述选择器;If a touch operation acting on the management control is detected, displaying the selector;
    当所述选择器处于显示状态时,检测到有作用于所述管理控件的触控操作,取消显示所述选择器。When the selector is in the display state, a touch operation acting on the management control is detected, and the selector is canceled.
  14. 根据权利要求1-7任一所述的方法,其中,所述当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域之前还包括:The method according to any one of claims 1-7, wherein, after the selector stops moving, before acquiring the divided area to be processed corresponding to the position after the selector stops moving, the method further comprises:
    在启动所述电子设备的语音助手后,若获取指定的语音内容,显示所述选择器。After starting the voice assistant of the electronic device, if the specified voice content is acquired, the selector is displayed.
  15. 根据权利要求1-14任一所述的方法,其中,所述输出所述转换后的文本,包括:The method according to any one of claims 1-14, wherein the outputting the converted text comprises:
    将所述转换后的文本输出到指定的信息通信界面中,以便通过所述信息通信界面将所述转换后的文本进行发送。Outputting the converted text to a designated information communication interface, so as to send the converted text through the information communication interface.
  16. 根据权利要求1-14任一所述的方法,其中,所述输出所述转换后的文本,包括:The method according to any one of claims 1-14, wherein the outputting the converted text comprises:
    若检测在所述选择器被调出后有应用程序被启动,且所述被启动的应用程序包括有指定的信息通信界面的情况下,将所述转换后的文本输出到所述在所述选择器被调出后启动的应用程序中的指定的信息通信界面中的信息待发送区域中;If it is detected that an application program is activated after the selector is called up, and the activated application program includes a specified information communication interface, output the converted text to the In the information to be sent area in the specified information communication interface in the application program started after the selector is called up;
    若检测到在所述选择器被调出后到得到所述转换后的文本的时间内并没有包括有指定的信息通信界面的应用程序启动,将所述转换后的文本进行显示。If it is detected that the application program including the specified information communication interface is not started within the time after the selector is called up to the time when the converted text is obtained, the converted text is displayed.
  17. 根据权利要求1-16任一所述的方法,其中,所述转换包括一下处理方式中的至少一种:The method according to any one of claims 1-16, wherein the conversion includes at least one of the following processing methods:
    对文本进行语种翻译;language translation of texts;
    切换文本的字体样式;以及toggle the font style of the text; and
    切换文本的字体大小。Toggles the font size of the text.
  18. 一种文本处理装置,其中,运行于电子设备,所述装置包括:A text processing apparatus, wherein, running on an electronic device, the apparatus includes:
    区域获取单元,用于当选择器停止移动后,获取所述选择器停止移动后的位置对应的待处理划分区域;an area acquisition unit, configured to acquire the to-be-processed divided area corresponding to the position where the selector stops moving after the selector stops moving;
    文本获取单元,用于将所述待处理划分区域中的文本作为待处理文本;a text acquisition unit, used for taking the text in the to-be-processed divided area as the to-be-processed text;
    文本转换单元,用于对所述待处理文本进行转换,得到转换后的文本;a text conversion unit, for converting the text to be processed to obtain the converted text;
    文本输出单元,用于输出所述转换后的文本。A text output unit for outputting the converted text.
  19. 一种电子设备,其中,包括处理器以及存储器;An electronic device, including a processor and a memory;
    一个或多个程序被存储在所述存储器中并被配置为由所述处理器执行以实现权利要求1-8任一所述的方法。One or more programs are stored in the memory and configured to be executed by the processor to implement the method of any of claims 1-8.
  20. 一种计算机可读存储介质,其中,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码被处理器运行时执行权利要求1-8任一所述的方法。A computer-readable storage medium, wherein a program code is stored in the computer-readable storage medium, wherein the method of any one of claims 1-8 is executed when the program code is executed by a processor.
PCT/CN2022/071823 2021-02-26 2022-01-13 Text processing method and apparatus, and electronic device and storage medium WO2022179330A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110220088.8A CN114970459A (en) 2021-02-26 2021-02-26 Text processing method and device and electronic equipment
CN202110220088.8 2021-02-26

Publications (1)

Publication Number Publication Date
WO2022179330A1 true WO2022179330A1 (en) 2022-09-01

Family

ID=82973091

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/071823 WO2022179330A1 (en) 2021-02-26 2022-01-13 Text processing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN114970459A (en)
WO (1) WO2022179330A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117270720A (en) * 2023-04-28 2023-12-22 荣耀终端有限公司 Page display method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110313754A1 (en) * 2010-06-21 2011-12-22 International Business Machines Corporation Language translation of selected content in a web conference
CN107656922A (en) * 2017-09-25 2018-02-02 广东小天才科技有限公司 A kind of interpretation method, device, terminal and storage medium
CN109917988A (en) * 2017-12-13 2019-06-21 腾讯科技(深圳)有限公司 Choose content display method, device, terminal and computer readable storage medium
CN110781688A (en) * 2019-09-20 2020-02-11 华为技术有限公司 Method and electronic device for machine translation
CN111680521A (en) * 2020-05-19 2020-09-18 北京搜狗科技发展有限公司 Translation processing method and device and translation processing device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110313754A1 (en) * 2010-06-21 2011-12-22 International Business Machines Corporation Language translation of selected content in a web conference
CN107656922A (en) * 2017-09-25 2018-02-02 广东小天才科技有限公司 A kind of interpretation method, device, terminal and storage medium
CN109917988A (en) * 2017-12-13 2019-06-21 腾讯科技(深圳)有限公司 Choose content display method, device, terminal and computer readable storage medium
CN110781688A (en) * 2019-09-20 2020-02-11 华为技术有限公司 Method and electronic device for machine translation
CN111680521A (en) * 2020-05-19 2020-09-18 北京搜狗科技发展有限公司 Translation processing method and device and translation processing device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117270720A (en) * 2023-04-28 2023-12-22 荣耀终端有限公司 Page display method and electronic equipment

Also Published As

Publication number Publication date
CN114970459A (en) 2022-08-30

Similar Documents

Publication Publication Date Title
KR101786944B1 (en) Speaker displaying method and videophone terminal therefor
US11467855B2 (en) Application preloading method and device, storage medium and terminal
US20230153274A1 (en) File sharing method and apparatus, terminal, and storage medium
US8854324B2 (en) Information processing control device
CN109003194B (en) Comment sharing method, terminal and storage medium
WO2017035971A1 (en) Method and device for generating emoticon
CN111476209B (en) Handwriting input recognition method, handwriting input recognition equipment and computer storage medium
KR20130093672A (en) Method, apparatus, and computer program product for overlapped handwriting
CN117193622A (en) Interface display method, device, equipment and medium of application program
CN111767108A (en) Application program label generation method, application interface display method and device
WO2022179330A1 (en) Text processing method and apparatus, and electronic device and storage medium
CN113014987A (en) Screen recording method and device, electronic equipment and storage medium
US10469274B2 (en) Live ink presence for real-time collaboration
CN111754414B (en) Image processing method and device for image processing
CN109067944B (en) Terminal control method, device, mobile terminal and storage medium
EP4131055A1 (en) Annotation method and electronic device
CN115700461A (en) Cross-device handwriting input method and system in screen projection scene and electronic device
CN109165626A (en) Stroke writing processing method, device, equipment and the storage medium of electronic whiteboard
WO2023226422A1 (en) Content editing control method and apparatus, electronic device, and storage medium
WO2022179329A1 (en) Text processing method and apparatus, and electronic device and storage medium
CN107977089B (en) Input method and device and input device
WO2018113751A1 (en) Method for setting communication shortcut and electronic device
CN114491087A (en) Text processing method and device, electronic equipment and storage medium
WO2018194853A1 (en) Enhanced inking capabilities for content creation applications
CN114827339A (en) Message output method and device and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22758696

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22758696

Country of ref document: EP

Kind code of ref document: A1