CN114970459A - Text processing method and device and electronic equipment - Google Patents

Text processing method and device and electronic equipment Download PDF

Info

Publication number
CN114970459A
CN114970459A CN202110220088.8A CN202110220088A CN114970459A CN 114970459 A CN114970459 A CN 114970459A CN 202110220088 A CN202110220088 A CN 202110220088A CN 114970459 A CN114970459 A CN 114970459A
Authority
CN
China
Prior art keywords
text
selector
processed
line
converted
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110220088.8A
Other languages
Chinese (zh)
Inventor
秦小龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202110220088.8A priority Critical patent/CN114970459A/en
Priority to PCT/CN2022/071823 priority patent/WO2022179330A1/en
Publication of CN114970459A publication Critical patent/CN114970459A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/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

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

The embodiment of the application discloses a text processing method and device and electronic equipment. The method comprises the following steps: when the selector stops moving, acquiring a to-be-processed divided area corresponding to the position of the selector after the movement is stopped; taking the text in the partitioned area to be processed as a text to be processed; converting the text to be processed to obtain a converted text; and outputting the converted text. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and the convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved.

Description

Text processing method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a text processing method and apparatus, and an electronic device.
Background
With the increasing amount of information displayed in electronic devices, it appears that some information needs to be converted before being easily recognized by a user. For example, some text may need to be translated before it can be recognized by the user. However, the related information conversion method has a problem of inconvenience.
Disclosure of Invention
In view of the foregoing problems, the present application provides a text processing method, a text processing apparatus, and an electronic device to improve the foregoing problems.
In a first aspect, the present application provides a text processing method, which is applied to an electronic device, and the method includes: when the selector stops moving, acquiring a to-be-processed divided area corresponding to the position of the selector after the movement is stopped; taking the text in the partitioned area to be processed as a text to be processed;
converting the text to be processed to obtain a converted text; and outputting the converted text.
In a second aspect, the present application provides a text processing apparatus, which is operable on an electronic device, and includes: the device comprises an area acquisition unit, a processing unit and a processing unit, wherein the area acquisition unit is used for acquiring a to-be-processed divided area corresponding to the position of a selector after the selector stops moving; a text acquisition unit, configured to take the text in the partitioned area to be processed as a text to be processed; the text conversion unit is used for converting the text to be processed to obtain a converted text; and the text output unit is used for outputting the converted text.
In a third aspect, the present application provides an electronic device comprising 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 methods described above.
In a fourth aspect, the present application provides a computer readable storage medium having program code stored therein, wherein the method described above is performed when the program code is executed by a processor.
According to the text processing method, the text processing device and the electronic equipment, the movement condition of the selector is detected, then after the selector stops moving, the to-be-processed divided area corresponding to the position of the selector after the movement is stopped is obtained, then the text in the to-be-processed divided area is used as the to-be-processed text, the to-be-processed text is converted to obtain the converted text, and the converted text is output. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and the convenience of text conversion is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating an application scenario of a text processing method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a text processing method according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating movement of a selector in a text processing method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating a tool bar displayed in a floating manner in a text processing method according to an embodiment of the present application;
FIG. 5 is a diagram illustrating another tool bar displayed in a floating manner in a text processing method according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating a reduced toolbar of a floating display in a text processing method according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating a floating toolbar called in a text processing method according to an embodiment of the present application;
fig. 8 is a schematic diagram illustrating a result display interface in a text processing method according to an embodiment of the present application;
fig. 9 is a schematic diagram illustrating another result display interface in a text processing method according to an embodiment of the present application;
FIG. 10 is a diagram illustrating a language selection interface in a text processing method according to an embodiment of the present application;
FIG. 11 is a flow chart illustrating another method of text processing as set forth in an embodiment of the present application;
FIG. 12 shows a schematic diagram of the line spacing in an embodiment of the present application;
FIG. 13 is a schematic illustration of a plurality of divided regions identified in an embodiment of the present application;
FIG. 14 is a schematic view showing another plurality of divided regions determined in the embodiment of the present application;
FIG. 15 is a schematic diagram illustrating text conversion mode change according to a pressing parameter in the embodiment of the present application;
fig. 16 is a flowchart illustrating still another text processing method according to an embodiment of the present application;
FIG. 17 is a schematic diagram illustrating an exit transition mode proposed by an embodiment of the present application;
fig. 18 is a block diagram showing a structure of a text processing apparatus according to another embodiment of the present application;
fig. 19 is a block diagram showing a structure of a document processing apparatus according to still another embodiment of the present application;
fig. 20 is a block diagram showing a configuration of an electronic device of the present application for executing a text processing method according to an embodiment of the present application;
fig. 21 is a storage unit according to an embodiment of the present application, configured to store or carry program code for implementing a text processing method according to an embodiment of the present application.
Detailed Description
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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the increasing functions that can be realized by electronic equipment, information in the electronic equipment is also increasing, and some information in the electronic equipment may need to be converted to some extent before being recognized by a user. For example, there may be text recorded by foreign language in the electronic device, and in order to facilitate the user to recognize the semantic meaning of the text, the electronic device may need to be operated to convert the text recorded by the foreign language into the native language.
However, after the inventor researches the related conversion mode, the related conversion mode has the problems of inconvenience and flexibility. For example, in a related manner, the text to be converted needs to be copied to a dedicated conversion interface for conversion by the dedicated conversion interface. Still alternatively, in another related manner, the current interface may be directly subjected to screen capture, and then the content of the screen capture is converted, however, in this manner, all the content in the screen capture is directly converted, which may cause that the content that is not needed by the user is also converted, so that the conversion process is not flexible enough.
Therefore, the inventor proposes a text processing method, a text processing device and an electronic device in the present application, which can improve the above problems, in the solution provided by the present application, by detecting the movement of the selector, and further acquiring the to-be-processed divided region corresponding to the position where the movement of the selector is stopped after the movement of the selector is stopped, then taking the text in the to-be-processed divided region as the to-be-processed text, converting the to-be-processed text to obtain a converted text, and then outputting the converted text. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and convenience and flexibility in text conversion are improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all the texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved.
It should be noted that the text processing method provided in the embodiment of the present application may be executed in an electronic device such as a mobile phone and a tablet computer, or may be executed by the electronic device and a server in a coordinated manner. The server may be a single physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, cloud computing, cloud storage, CDN (Content Delivery Network), and an artificial intelligence platform.
In the case that the text processing method provided in the embodiment of the present application is completed by an electronic device and a server in cooperation, as shown in fig. 1, after a selector stops moving, obtaining a to-be-processed divided area corresponding to a position where the selector stops moving and taking a text in the to-be-processed divided area as a to-be-processed text may be completed by a client 110 in the electronic device, and then converting the to-be-processed text, so that the converted text may be executed by a server 120, and then subsequently outputting the converted text may be executed by the client 110 in the electronic device, or may be executed by the server 120.
Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Referring to fig. 2, a text processing method provided in the embodiment of the present application is applied to an electronic device, and the method includes:
s110: and when the selector stops moving, acquiring the to-be-processed divided area corresponding to the position of the selector after the movement is stopped.
The divided areas to be processed in the embodiment of the present application may be understood as areas where included texts are to be converted, and the divided areas to be processed in the embodiment of the present application are determined according to the arrangement format of texts in the interface. Alternatively, the text in the interface may be determined in advance as a plurality of divided regions according to the arrangement format of the text in the interface, and then one divided region may be selected from the plurality of divided regions as the divided region to be processed according to the position of the selector after the movement is stopped. Furthermore, the position of the selector after the movement is stopped can be used as a starting point, and the divided area to be processed is determined towards the specified direction based on the arrangement format of the text. The arrangement format may include a line spacing or a position of a designated punctuation mark. The designated punctuation may be a period or a dot.
And the selector is used for selecting the division areas to be processed. Optionally, the selector is a movable control. In one approach, the selector may be moved in response to a drag operation by the user. For example, as shown in fig. 3, when the selector 10 is called up and displayed on the interface, it may be located at a position shown in the left image in fig. 3, and if there is a drag operation applied to the selector 10 and the drag operation moves in a direction shown by a dotted arrow in fig. 3, the selector 10 may be dragged and moved in a direction shown by the dotted arrow, and thus may move to a position shown in the right image in fig. 3.
In the embodiment of the present application, there may be various ways to call out the selector. And after the selector is called up, prompt information may be displayed beside the selector so as to prompt the user to select an area to be subjected to the text conversion process by dragging the selector.
As one approach, the selector may be invoked by hovering the display toolbar. In this way, at least one field may be provided in the tool bar of the floating display, and a first trigger may be provided in the field, and the first trigger is used to trigger the calling out or canceling of the display of the selector. Optionally, in a case that the selector has not been called, if a touch operation acting on the first trigger is detected, the selector is displayed. Optionally, after the selector is called out, the toolbar may always maintain the display state, and thus it may be implemented that, if the selector is in the display state, the display of the selector is cancelled when the touch operation acting on the first trigger is detected.
Illustratively, as shown in fig. 4, in the toolbar 11 of the floating display shown in fig. 4, a first trigger 12 is displayed. If in the state shown in fig. 4, it is detected that there is a touch operation on the first trigger 12, the selector 10 is displayed in the interface as shown in fig. 3. The display of the toolbar 11 can be canceled in synchronization after the selector is called out, so as not to interfere with subsequent viewing by the user.
It should be noted that the toolbar shown in fig. 4 may include more triggers besides the first trigger shown in fig. 4. Optionally, a second trigger and a third trigger may also be included, where the second trigger 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 to be displayed without triggering the application program to which the current interface belongs to start first. For example, the current interface may be a friend detail interface corresponding to the application a, and then a general process of starting the friend detail interface is to click an icon of the application a on a desktop to trigger the application a to start, display the friend list interface after the application a starts, and then select from the friend list interface to trigger the friend detail interface. If the current friend detail interface is marked through the second trigger mark in the toolbar, the friend detail interface can be directly called from the outside of the application program A to be displayed, the friend list interface does not need to be triggered and displayed, and then the operation path for calling the designated interface can be shortened. The third trigger may be an identifier for calling the corresponding application program to start. Under the condition that a third trigger mark is arranged in a tool bar displayed in a floating mode, another application program can be started without exiting from a current interface to a desktop, and the third trigger mark can be directly operated to trigger the other application program to be started.
Illustratively, as shown in fig. 5, the identifier 13 named "new note" is a second trigger identifier, and by triggering the identifier 13 named "new note", it is possible to implement the effect of storing the current interface separately so as to implement the aforementioned quick call-out. And the identifier 14 named "navigation" is a third trigger. If a touch operation on the identifier 14 named "navigation" is detected, the start of the navigation application can be directly invoked.
Optionally, if the touch operation acting on the toolbar is not detected within the specified time period, the toolbar may be hidden or reduced. For example, as shown in fig. 6, if no touch operation acting on the toolbar is detected within a specified time period, the toolbar may be reduced to the state shown in fig. 6, the reduced toolbar may be displayed as a bar 15 in fig. 6, and the bar 15 may be located at the boundary of the display screen. After the toolbar is reduced to the bar 15, the user may bring up the toolbar again in floating display by dragging the bar 15 a specified distance in the direction indicated by the dotted arrow in fig. 7, and after the toolbar is brought up, the bar 15 may cancel the display.
Alternatively, if a touch operation acting on an area other than the toolbar is detected, the toolbar may be narrowed down to the state of the bar 15 shown in fig. 6.
Alternatively, the display and cancellation of the display of the selector may be controlled through the shortcut interface of the electronic device itself. Optionally, the shortcut interface may be triggered to be displayed by performing a sliding operation from the top of the display screen towards the bottom of the screen, and the management control of the selector may be displayed in the shortcut interface. If the selector is not yet displayed, if a touch operation on the management control is detected, the call-out selector may be triggered, and if the selector is already called out, if a touch operation on the management control is detected, the display of the selector may be cancelled.
Still further, as yet another alternative, the display selector may be triggered by voice control. In this way, after the voice assistant of the electronic device is started, the call-out selector may be triggered if the specified voice content is acquired. Alternatively, the specified speech content may be a text conversion, or may be a text translation, or the like. Alternatively, the designated voice content may be set by the user according to the user's own habits. In this manner, the deselect of the selector may be controlled in the manner previously described, or may continue to be caused by the voice assistant to be deselected.
S120: and taking the text in the partitioned area to be processed as the text to be processed.
The text to be processed can be understood as the text to be converted subsequently.
S130: and converting the text to be processed to obtain a converted text.
In the embodiment of the present application, there may be a plurality of ways for converting 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; switching the font style of the text; and switching font sizes of the text. The language translation may include translating a text of any one language into a text of another language, for example, translating an english text into a chinese text, or translating a chinese text into an english text. Switching the font style of text may be understood as switching the font of the text itself. For example, the text of the song style may be switched to the text of the regular style, and for example, the text of the regular style may be switched to the text of the simplified style.
S140: and outputting the converted text.
In the embodiment of the application, after the converted text is obtained, the converted text can be output. In the embodiment of the present application, the converted text may be output in various ways.
The converted text may be displayed as an output. It should be noted that the purpose of the user triggering the conversion of the text in the interface may be to enable the user to better recognize the content of the text. For example, if the text in the interface is english text, but the user may not be familiar with english, the user may wish to convert the text in the interface to familiar chinese, and the converted text may be displayed after it is obtained. For example, as shown in fig. 7, after the to-be-processed divided area is determined, the display selector may be canceled and the frame 16 shown in fig. 8 may be displayed to identify the to-be-processed divided area. The area enclosed by the frame 16 is the divided area to be processed. Moreover, the frame 16 may be changed in size in response to the dragging operation of the user, so that the user may further adjust the actually obtained text to be processed according to the need of the user.
The converted text may be presented via the results display interface 17. The display position of the result display interface can be determined according to the actual situation. For example, if the to-be-processed divided region is located at an upper position in the interface, the result display interface may be displayed at a lower position in the interface, and correspondingly, if the to-be-processed divided region is located at a lower position in the interface, the result display interface may be displayed at a higher position in the interface, thereby preventing the result display interface and the to-be-processed divided region from occupying the display position with each other. Furthermore, if the area to be processed occupies most of the display screen, the result display interface can be displayed in a floating manner in the middle of the display screen.
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. Illustratively, as shown in fig. 9, in the result display interface 17 shown in fig. 9, a copy control 18 and a translation conversion control 19 may be included. If an operation acting on the copy control 18 is detected, the converted text displayed in the result display interface 17 may be copied, so that the user may quickly paste the converted text into another area. Here, if an operation acting on the translation conversion control 19 is detected, a language selection interface 20 shown in fig. 10 may be displayed, and in this language selection interface 20, a text in which the text in which language is translated (the translation target language) may be selected.
It should be noted that, after the translation target language is switched through the language selection interface 20, the electronic device may automatically and synchronously update the converted text displayed in the result display interface 17.
As another output manner, the converted text may be output to a designated information communication interface so that the converted text can be transmitted through the information communication interface. It should be noted that, in some cases, a user may expect that a text in a current interface can be directly sent to other users after being converted, and then the electronic device may trigger and display a specified information communication interface according to a selection of the user after obtaining the converted text, and output the converted text to an information to-be-sent area in the specified information communication interface.
It should be noted that, in a case where there are multiple output modes, the electronic device may determine which output mode is specifically adopted according to the running time of the application program to which the specified information communication interface belongs. As one mode, if it is detected that an application program is started after the selector is called out and the started application program includes a specified information communication interface, it is determined to output the converted text to an information to-be-sent area in the specified information communication interface in the application program started after the selector is called out. Correspondingly, if the application program which does not comprise the specified information communication interface is detected to be started in the period from the calling of the selector to the obtaining of the converted text, the converted text is output in a display mode.
For example, 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.
According to the text processing method, the moving condition of the selector is detected, then after the selector stops moving, the to-be-processed divided area corresponding to the position of the selector after the movement is stopped is obtained, then the text in the to-be-processed divided area is used as the to-be-processed text, the to-be-processed text is converted to obtain the converted text, and then the converted text is output. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and the convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all the texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved. In addition, in the embodiment of the application, the to-be-processed divided area corresponding to the selector after the movement is stopped is determined by the electronic equipment, so that a user does not need to manually select the to-be-processed divided area, and the intelligent degree of the whole process is improved.
Referring to fig. 11, a text processing method provided in an embodiment of the present application is applied to an electronic device, and the method includes:
s210: and when the selector stops moving, matching the position of the selector after the movement is stopped 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 mode, the method provided in the embodiment of the present application further includes: acquiring a text in the interface and the arrangement format of the text; and dividing the text in the interface based on the arrangement format to obtain at least one divided area.
Optionally, the arrangement format includes a line spacing. Wherein the electronic device can determine the line spacing based on a color transformation between text in the current interface. It should be noted that colors between the text and the background in the interface may be different, and then it may be determined by color detection which regions in the interface are blank positions between the text and which regions are blank positions between the text, and correspondingly, after the blank positions between the texts are obtained, the line spacing between adjacent lines of text may be further determined according to the height of the blank positions.
The dividing the text in the interface based on the arrangement format to obtain at least one divided region comprises: in the current dividing process, the line spacing between texts in adjacent lines is sequentially compared with a first specified threshold value from the starting point of the current dividing; if the first reference adjacent line is obtained, taking the previous line in the first reference adjacent line, the starting point and the area between the previous line and the starting point in the first reference adjacent line as a division area obtained in the current division process, and taking the next line in the first reference adjacent line as the starting point of the next division until the detection of the line space between the texts of the last adjacent line in the interface is finished; if the first reference adjacent line is not acquired, determining the starting point of the current division and the area behind the starting point of the current division as a divided area; wherein a line spacing between text of the first reference adjacent line is greater than the first specified threshold.
For example, as shown in fig. 12, in the dividing process of the divided region, the division may be performed with the first line as a starting point. Where the text of the first line includes "Chengdu, or" Rong "for short," and the text of the second line includes "also known as Rongcheng and," then the line spacing for the first adjacent line is h1 as shown in FIG. 12. If the line spacing h2 between the seventh and eighth lines is greater than the first specified threshold, as determined based on the foregoing, then the seventh and eighth lines are determined to be the first reference adjacent line. Wherein, the text included in the seventh line is "city environmental circle", and the text included in the eighth line is "It is an import center". The seventh line refers to the previous line in the adjacent lines, and the text between the first line and the seventh line is taken as a divided area, so that the text shown in fig. 12 can be divided into the divided area 21 and the divided area 22 shown in fig. 13.
It should be noted that, in the process of determining the divided regions, the electronic device may obtain the text and the arrangement format of the text in the current interface by capturing a screen of the current interface and then by means of an OCR (Optical Character Recognition), so that even if there is a picture in the current interface, the text included in the picture may still be obtained, so that in the process of determining the divided regions, the text included in the picture in the current interface may also be divided. As shown in fig. 14, in the case where there is text in the picture included in the current interface, it may still be determined into the divided area and determined as the divided area 23.
Optionally, the arrangement format includes punctuation marks. In this manner, the electronic device may perform punctuation recognition starting with the first character in the current interface and perform the determination of the division area based on the recognized designated punctuation. In this way, in the current region division process, if a specified punctuation is recognized to coincide with the start point of the current region division, the text between the recognized specified punctuation and the start point of the current region division is taken as a divided region. And the text after the appointed punctuation acquired in the current region division process is used as the starting point of the next region division process. For example, if the designated punctuation mark is a dot number, taking the interface shown in fig. 13 as an example, the divided region 21 and the divided region 22 shown in fig. 13 can still be determined.
S220: and taking the division area of which the corresponding position is matched with the position of the selector after stopping moving as the division area to be processed.
And each determined divided area corresponds to a 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 is stopped may be matched with the position of each divided region, and the divided region whose corresponding position matches with the position of the selector may be used as the divided region to be processed.
As one approach, the selector may occupy one surface instead of one point for interface reasons. Then the position of the center of the selector may be taken as the position of the selector in order to facilitate the acquisition of the position of the selector. The divided region where the center of the selector is located may be regarded as the divided region to be processed in matching the position of the selector with the positions of the divided regions.
S230: and taking the text in the partitioned area to be processed as the text to be processed.
S240: and converting the text to be processed to obtain a converted text.
As described above, in the embodiment of the present application, the conversion of the text may include language translation of the text, switching of a font style of the text, switching of a font size of the text, and the like. In this embodiment, the electronic device may determine which conversion manner is specifically adopted according to the touch operation of the user.
As one way, after the selector stops moving, the electronic device may further detect an operation parameter acting on the selector, and determine a specific switching manner according to the operation parameter.
Alternatively, the operating parameter may be a degree of compression. In this way, after the user finishes dragging the selector, the pressing operation can be continuously applied to the selector, and the electronic device can detect the current pressing degree in real time and display the conversion mode corresponding to the current pressing degree in real time.
Alternatively, the operating parameter may be a press duration. In this way, after the user finishes dragging the selector, the pressing operation can be continuously applied to the selector, and the electronic device can detect the current pressing time length in real time and display the conversion mode corresponding to the current pressing time length in real time.
For example, as shown in fig. 15, after the selector is dragged to the position shown in fig. 15, if the pressing operation to continue acting on the selector is detected, the pressing force of the pressing operation may be continuously detected, after the pressing force satisfies the force to perform translation, a prompt to perform translation is displayed as shown in the leftmost diagram of fig. 15, and if the pressing operation to act on the selector is detected to disappear while the translation is displayed, the text to be processed is translated. If the user continues to apply a greater degree of pressing force and detects that the force satisfies the font size conversion, the prompt content is changed to the font size conversion shown in the intermediate image in fig. 15, and correspondingly, if the pressing operation applied to the selector is detected to disappear in the process of displaying the font size conversion, the font size conversion is performed on the text to be processed. If the user continues to apply a greater degree of pressing force and detects that the force satisfies the requirement for font-style conversion, the prompt content is changed to the font-style conversion shown in the right image in fig. 15, and correspondingly, if the pressing operation on the selector is detected to disappear during the process of displaying the font-style conversion, the font-style conversion is performed on the text to be processed. Optionally, if the user decreases the pressing force, the switching mode may be switched to the corresponding switching mode when the previous pressing force is smaller.
Similarly, after the selector is dragged to the position shown in fig. 15, if a pressing operation to continue acting on the selector is detected, the pressing duration of the pressing operation may be continuously detected, and after the pressing duration satisfies the translation strength, a prompt for translation may be displayed as shown in the leftmost diagram of fig. 15, and if it is detected that the pressing operation acting on the selector disappears while the translation is displayed, the text to be processed may be translated. If the user continues to hold the pressing operation and detects that the pressing duration satisfies the font size conversion, the prompt content is changed to the font size conversion shown in the middle image in fig. 15, and correspondingly, if the pressing operation acting on the selector is detected to disappear in the process of displaying the font size conversion, the font size conversion is performed on the text to be processed. If the user continues to keep the pressing operation and detects that the pressing duration meets the requirement for font style conversion, the prompt content is replaced by the font style conversion shown in the right image of fig. 15, and correspondingly, if the pressing operation acting on the selector is detected to disappear in the process of displaying the font style conversion, the font style conversion is carried out on the text to be processed.
S250: and outputting the converted text.
According to the text processing method, the mobile condition of the selector is detected, the to-be-processed divided area corresponding to the position of the selector after the selector stops is obtained, the text to be converted can be flexibly obtained, and convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all the texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved. Furthermore, in this embodiment, the text in the current interface may be divided to obtain at least one divided region, and then the position of the selector may be compared with the position of the at least one divided region, so as to determine the divided region to be processed.
Referring to fig. 16, a text processing method provided in the embodiment of the present application is applied to an electronic device, and the method includes:
s310: and when the selector stops moving, acquiring a first text, wherein the first text is a text of a line where the position of the selector stops moving.
It should be noted that, in this embodiment, the determination of the to-be-processed divided region may be started after the stop of the movement of the selector is detected, and in this embodiment, the determination of the divided region may not be performed for all the texts in the interface.
S320: and acquiring a second text along the specified direction by taking the first text as a starting point and based on the arrangement format of the text.
Alternatively, the designated direction may be a text reading direction recognized by the electronic device. The text reading direction may be understood as a sequential direction of the user when reading the text.
S330: and taking 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 mode, the obtaining the second text along the specified direction with the first text as a starting point and based on the layout format of the text includes: sequentially comparing the line spacing between the texts in adjacent lines with a second specified threshold value by taking the first text as a starting point; acquiring a second reference adjacent row, wherein the second reference adjacent row is an adjacent row which is acquired for the first time and has a row spacing larger than the second specified threshold; and taking the text of the previous line in the second reference adjacent line as the second text.
S340: and taking the text in the partitioned area to be processed as the text to be processed.
S350: and converting the text to be processed to obtain a converted text.
S360: and outputting the converted text.
It should be noted that the transition mode may be understood as having been currently entered after the selector is invoked. As shown in fig. 17, if the click operation on the selector 10 is detected, the closing control 24 shown in fig. 17 may be triggered to be displayed, and if the click operation on the closing control 24 is detected, the current conversion mode is exited and the selector 10 is cancelled. Alternatively, the close control 24 may be moved gradually from the back of the selector 10 to the position shown in FIG. 17 during display.
Note that, unlike the pressing operation for triggering switching of the switching manner in the foregoing embodiment, the clicking operation for triggering display of the close control 24 needs to be continuously performed with the dragging operation of the selector in the foregoing embodiment. Alternatively, it may be understood that, in the foregoing embodiment, the foregoing switching manner may be triggered only when the dragging operation of the selector is detected, and the contact of the selector is maintained after the dragging operation is completed and the pressing operation is continuously applied.
According to the text processing method, the mobile condition of the selector is detected, the to-be-processed divided area corresponding to the position of the selector after the selector stops is obtained, the text to be converted can be flexibly obtained, and convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all the texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved. Furthermore, in this embodiment, the to-be-processed divided region may be obtained along the specified direction based on the arrangement format of the text with the position of the selector after stopping moving as the starting point, so as to further improve the flexibility of determining the to-be-processed divided region.
Referring to fig. 18, in an electronic device, a text processing apparatus provided in an embodiment of the present application is an apparatus 400, including:
the area acquiring unit 410 is configured to acquire the to-be-processed divided areas corresponding to the positions where the selectors stop moving after the selectors stop moving.
As one mode, the area obtaining unit 410 is specifically configured to match the position of the selector after stopping moving with at least one divided area; and taking the divided area of which the corresponding position is matched with the position of the selector after the movement is stopped as the divided area to be processed.
Optionally, the area obtaining unit 410 is further configured to obtain a text in the interface and an arrangement format of the text; and dividing the text in the interface based on the arrangement format to obtain at least one divided area. The region obtaining unit 410 is specifically configured to, in the current dividing process, sequentially compare line intervals between texts in adjacent lines with a first specified threshold at a starting point of the current dividing; if the first reference adjacent line is obtained, taking the previous line in the first reference adjacent line, the starting point and the area between the previous line and the starting point in the first reference adjacent line as a division area obtained in the current division process, and taking the next line in the first reference adjacent line as the starting point of the next division until the detection of the line space between the texts of the last adjacent line in the interface is finished; if the first reference adjacent line is not acquired, determining the starting point of the current division and the area behind the starting point of the current division as a divided area; wherein a line spacing between text of the first reference adjacent line is greater than the first specified threshold.
Alternatively, the area obtaining unit 410 is specifically configured to obtain a first text, where the first text is a text of a line where the selector stops moving; acquiring a second text along a specified direction by taking the first text as a starting point and based on the arrangement format of the text; and taking 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.
Optionally, the area obtaining unit 410 is specifically configured to take the first text as a starting point, and sequentially compare a line spacing between texts in adjacent lines with a second specified threshold; acquiring a second reference adjacent row, wherein the second reference adjacent row is an adjacent row which is acquired for the first time and has a row spacing larger than the second specified threshold; and taking the text of the previous line in the second reference adjacent line as the second text.
A text obtaining unit 420, configured to take the text in the divided areas to be processed as the text to be processed.
A text conversion unit 430, configured to convert the to-be-processed text to obtain a converted text.
As one mode, the conversion includes at least one of the following processing modes: performing language translation on the text; switching the font style of the text; and switching font sizes of the text.
A text output unit 440, configured to output the converted text.
As shown in fig. 19, the apparatus further includes:
the selector management unit 450 is configured to hover and display a toolbar at a specified position, where the toolbar includes a first trigger; and if the touch operation acting on the first trigger mark is detected, displaying the selector.
The text processing device provided by the application detects the movement condition of the selector, and then obtains the to-be-processed divided regions corresponding to the positions of the selector after the selector stops moving when the selector stops moving, then takes the texts in the to-be-processed divided regions as the to-be-processed texts, converts the to-be-processed texts to obtain the converted texts, and outputs the converted texts. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and the convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved.
It should be noted that the device embodiment and the method embodiment in the present application correspond to each other, and specific principles in the device embodiment may refer to the contents in the method embodiment, which is not described herein again.
An electronic device provided by the present application will be described below with reference to fig. 20.
Referring to fig. 20, based on the text processing method and apparatus, another electronic device 200 capable of executing the text processing method is further provided in the embodiment of the present application. The electronic device 200 includes one or more processors 102 (only one shown), memory 104, and network module 106 coupled to each other. The memory 104 stores programs that can execute the content of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104.
Processor 102 may include one or more cores for processing data, among other things. The processor 102 interfaces with various components throughout the electronic device 200 using various interfaces and circuitry to perform various functions of the electronic device 200 and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 104 and invoking data stored in the memory 104. Alternatively, the processor 102 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 102 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 102, but may be implemented by a communication chip.
The Memory 104 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 104 may be used to store instructions, programs, code, 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 an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data created by the terminal 100 in use, such as a phonebook, audio-video data, chat log data, and the like.
The network module 106 is configured to receive and transmit electromagnetic waves, and implement interconversion between the electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices, for example, an audio playing device. The network module 106 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The network module 106 may communicate with various networks, such as the internet, an intranet, a wireless network, or with other devices via a wireless network. The wireless network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network. For example, the network module 106 may interact with a base station.
Referring to fig. 21, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer readable medium 1100 has stored therein program code that can be called by a processor to perform the method described in the method embodiments above.
The computer-readable storage medium 1100 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 1100 includes a non-volatile computer-readable storage medium. The computer readable storage medium 1100 has storage space for program code 1110 for performing any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 1110 may be compressed, for example, in a suitable form.
In summary, the text processing method, the text processing device and the electronic device provided by the application detect the movement condition of the selector, and then obtain the to-be-processed divided region corresponding to the position of the selector after the movement of the selector is stopped, then take the text in the to-be-processed divided region as the to-be-processed text, convert the to-be-processed text to obtain the converted text, and output the converted text. Therefore, by the mode, the converted text can be flexibly obtained by detecting the movement condition of the selector and obtaining the to-be-processed divided area corresponding to the position of the stopped selector, and the convenience of text conversion is improved. In addition, in the embodiment, only the texts in the to-be-processed divided regions corresponding to the selector can be converted, and all the texts in the interface are not required to be converted, so that the efficiency of outputting the conversion result is improved. In addition, in the embodiment of the application, the to-be-processed divided area corresponding to the selector after the movement is stopped is determined by the electronic equipment, so that a user does not need to manually select the to-be-processed divided area, and the intelligent degree of the whole process is improved.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical feature diagrams may be equivalently replaced; such modifications and substitutions do not necessarily depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (11)

1. A text processing method applied to an electronic device, the method comprising:
when the selector stops moving, acquiring a to-be-processed divided area corresponding to the position of the selector after the movement is stopped;
taking the text in the partitioned area to be processed as a text to be processed;
converting the text to be processed to obtain a converted text;
and outputting the converted text.
2. The method according to claim 1, wherein said obtaining the to-be-processed divided region corresponding to the position where the selector stops moving comprises:
matching the position of the selector after stopping moving with at least one divided region;
and taking the division area of which the corresponding position is matched with the position of the selector after stopping moving as the division area to be processed.
3. The method of claim 2, further comprising:
acquiring a text in the interface and the arrangement format of the text;
and dividing the text in the interface based on the arrangement format to obtain at least one divided region.
4. The method of claim 3, wherein the layout format includes a line spacing, and wherein dividing the text in the interface based on the layout format into at least one divided region comprises:
in the current dividing process, the line spacing between texts in adjacent lines is sequentially compared with a first specified threshold value from the starting point of the current dividing;
if the first reference adjacent line is obtained, taking a previous line in the first reference adjacent line, the starting point and an area between the previous line in the first reference adjacent line and the starting point as a division area obtained in the current division process, and taking a next line in the first reference adjacent line as a starting point of next division until the detection of the line spacing between the texts of the last adjacent line in the interface is finished;
if the first reference adjacent line is not acquired, determining the starting point of the current division and the area behind the starting point of the current division as a divided area;
wherein a line spacing between text of the first reference adjacent line is greater than the first specified threshold.
5. The method according to claim 1, wherein said obtaining the to-be-processed divided region corresponding to the position where the selector stops moving comprises:
acquiring a first text, wherein the first text is a text of a line where the selector stops moving;
acquiring a second text along a specified direction by taking the first text as a starting point and based on the arrangement format of the text;
and taking 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.
6. The method of claim 5, wherein the layout format comprises a line spacing, and wherein obtaining the second text along the specified direction and based on the layout format of the text starting from the first text comprises:
sequentially comparing the line spacing between the texts in adjacent lines with a second specified threshold value by taking the first text as a starting point;
acquiring a second reference adjacent row, wherein the second reference adjacent row is an adjacent row which is acquired for the first time and has a row spacing larger than the second specified threshold;
and taking the text of the previous line in the second reference adjacent line as the second text.
7. The method according to any one of claims 1 to 6, wherein after the selector stops moving, before acquiring the to-be-processed divided region corresponding to the position where the selector stops moving, the method further comprises:
displaying a toolbar in a suspension mode at a designated position, wherein the toolbar comprises a first trigger mark;
and if the touch operation acting on the first trigger mark is detected, displaying the selector.
8. The method according to any of claims 1-6, wherein the converting comprises at least one of:
performing language translation on the text;
switching the font style of the text; and
the font size of the text is switched.
9. A text processing apparatus, operable on an electronic device, the apparatus comprising:
the device comprises an area acquisition unit, a processing unit and a processing unit, wherein the area acquisition unit is used for acquiring a to-be-processed divided area corresponding to the position of a selector after the selector stops moving;
a text acquisition unit, configured to take the text in the partitioned area to be processed as a text to be processed;
the text conversion unit is used for converting the text to be processed to obtain a converted text;
and the text output unit is used for outputting the converted text.
10. An electronic device comprising a processor and a memory;
one or more programs stored in the memory and configured to be executed by the processor to implement the method of any of claims 1-8.
11. A computer-readable storage medium, characterized in that a program code is stored in the computer-readable storage medium, wherein the program code when executed by a processor performs the method of any of claims 1-8.
CN202110220088.8A 2021-02-26 2021-02-26 Text processing method and device and electronic equipment Pending CN114970459A (en)

Priority Applications (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
PCT/CN2022/071823 WO2022179330A1 (en) 2021-02-26 2022-01-13 Text processing method and apparatus, and electronic device and storage medium

Applications Claiming Priority (1)

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

Publications (1)

Publication Number Publication Date
CN114970459A true CN114970459A (en) 2022-08-30

Family

ID=82973091

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (1)

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

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8380487B2 (en) * 2010-06-21 2013-02-19 International Business Machines Corporation Language translation of selected content in a web conference
CN107656922B (en) * 2017-09-25 2021-07-20 广东小天才科技有限公司 Translation method, translation device, translation terminal and storage medium
CN109917988B (en) * 2017-12-13 2021-12-21 腾讯科技(深圳)有限公司 Selected content display method, device, terminal and computer readable storage medium
CN110781688B (en) * 2019-09-20 2023-11-07 华为技术有限公司 Machine translation method and electronic equipment
CN111680521A (en) * 2020-05-19 2020-09-18 北京搜狗科技发展有限公司 Translation processing method and device and translation processing device

Also Published As

Publication number Publication date
WO2022179330A1 (en) 2022-09-01

Similar Documents

Publication Publication Date Title
KR101786944B1 (en) Speaker displaying method and videophone terminal therefor
CN108804157A (en) Application program preloads method, apparatus, storage medium and terminal
CN108573306B (en) Method for outputting reply information, and training method and device for deep learning model
CN111767108A (en) Application program label generation method, application interface display method and device
CN111259907B (en) Content identification method and device and electronic equipment
CN105224302B (en) Skin processing method of input method and input method system
KR20170073543A (en) Method and device for input processing
CN111367457A (en) Content sharing method and device and electronic equipment
CN112750186A (en) Virtual image switching method and device, electronic equipment and storage medium
CN114007099A (en) Video processing method and device for video processing
CN110764627A (en) Input method and device and electronic equipment
CN111382748A (en) Image translation method, device and storage medium
CN110569008A (en) screen data processing method and device and electronic equipment
CN114970459A (en) Text processing method and device and electronic equipment
CN110619325A (en) Text recognition method and device
CN111476154A (en) Expression package generation method, device, equipment and computer readable storage medium
CN111476209A (en) Method and device for recognizing handwriting input and computer storage medium
KR20220027081A (en) Text detection method, reading support device and medium
CN106980447A (en) A kind of information processing method, device and terminal
CN110633017A (en) Input method, input device and input device
CN115696028A (en) Image direction adjusting method and device, storage medium and electronic equipment
CN110503042B (en) Image processing method and device and electronic equipment
CN112487223A (en) Image processing method and device and electronic equipment
CN111931708A (en) Form generation method and device
CN115412634B (en) Message display method and device

Legal Events

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