A text selection method
By receiving closed-track gestures on the terminal device and performing semantic analysis, the target text region is identified and marked, solving the problem of users selecting too much or too little text, thus improving operational efficiency and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2018-04-12
- Publication Date
- 2026-05-08
AI Technical Summary
On terminal devices, users are prone to selecting too much or too little text, which reduces operational efficiency, especially when the font is small or the amount of text is large.
By receiving the user's closed-track gesture on the touchscreen, semantic analysis is performed to determine the target text. The most suitable text area is marked in the graphical user interface, providing selection box and cursor operations, allowing users to flexibly select text, supporting expanded selection or deselection at the word level, and preventing the cursor from not following the user's operation during dragging.
It improves the accuracy and efficiency of text selection, reduces the phenomenon of over- or under-selection, and enhances the user experience and the intelligent interaction capabilities of the terminal.
Smart Images

Figure CN118227025B_ABST
Abstract
Description
[0001] This application is a divisional application. The original application has the application number 201810327466.0 and the original application date is April 12, 2018. The entire contents of the original application are incorporated herein by reference.
[0002] This application claims priority to Chinese Patent Application No. 201810025128.1, filed with the State Intellectual Property Office of China on January 11, 2018, entitled "A Method for Processing Text on a Screen", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This invention relates to the field of communications, and more particularly to a text selection method. Background Technology
[0004] A text view is a control used to display strings. When a mobile device or other terminal displays text using a text view control, if it detects user input for editing the text (e.g., a long press), it will display the text. Figure 1 As shown, the terminal can then display the text in the text view as editable and show the editing options supported by that text (e.g., Figure 1 (Options such as copy 11, translate 12, or delete 13).
[0005] At this point, the user can drag the first cursor 14a and the second cursor 14b located at both ends of the selected text to expand or delete the selected text character by character, and then select the desired editing options to achieve the corresponding editing function. However, when the font size of the text is small or the number of characters is large, the user may select too much or too little text when dragging the first cursor 14a or the second cursor 14b, which reduces the efficiency of the terminal when selecting text. Summary of the Invention
[0006] The embodiments of the present invention provide a text selection method that can reduce the phenomenon of over- or under-selection of text and improve the operational efficiency of the terminal when selecting text.
[0007] To achieve the above objectives, this application adopts the following technical solution:
[0008] Firstly, this application provides a text selection method, comprising: a terminal displaying a graphical user interface (GUI) on a touchscreen; the terminal receiving a first gesture applied to the GUI, the first gesture generating a closed trajectory on the GUI; in response to the first gesture, the terminal determining a target area in the GUI corresponding to the closed trajectory; the terminal determining first target text contained in the target area; the terminal performing semantic analysis on the first target text to determine a second target text different from the first target text; and marking the second target text on the GUI. In other words, when a user selects target text on the GUI by performing a first gesture, the terminal can correct the first target text actually selected by the user to the second target text based on semantics, making the semantics of the second target text selected by the terminal more accurate, reducing the phenomenon of over- or under-selection of text, and improving the operational efficiency of the terminal when selecting text.
[0009] In one possible design approach, after the terminal displays the user graphical interface on the touchscreen and before the terminal receives the first gesture applied to the user graphical interface, the method further includes: the terminal displaying a first prompt in the user graphical interface, the first prompt including a selection box for selecting text information; wherein, the terminal receiving the first gesture applied to the user graphical interface specifically includes: the terminal receiving a first gesture from the user using the selection box to select the first target text in the user graphical interface. In other words, before the user selects text, the terminal can prompt the user to use the selection box provided by the terminal to select the target text, reducing the probability of over- or under-selection of text caused by the user manually sliding on the user graphical interface to draw a closed trajectory, thus improving the user experience.
[0010] In one possible design approach, after the terminal marks the second target text in the user's graphical interface, the method further includes: the terminal receiving a click operation on a first character, which is text in the user's graphical interface other than the second target text; in response to the click operation, the terminal expands the text within the closed area formed by the first target text and the row and column where the first character is located into a third target text. That is, the user can also manually expand the second target text into a third target text through a click operation, using the clicked first character as the start or end position of the third target text. This allows the terminal to conveniently and flexibly allow the user to select text, further improving the intelligent interaction capabilities between the terminal and the user.
[0011] In one possible design approach, after the terminal performs semantic analysis on the first target text and determines the second target text, the above method may further include: the terminal displays a first cursor at the start position of the second target text and a second cursor at the end position.
[0012] Users can also expand or deselect the second target text by dragging the cursor. For example, the terminal can receive a drag operation applied to the first or second cursor; in response to the drag operation, the terminal can expand the selection of the second target text into a third target text by word group; or, in response to the drag operation, the terminal can deselect the selected text in the second target text by word group. Since a word group is the smallest unit of text with complete semantics, expanding or deselecting target text by word group can reduce the occurrence of semantically incomplete text in the selected text.
[0013] In one possible design approach, after the terminal receives a drag operation applied to the first or second cursor, the method further includes: the terminal does not display the first or second cursor until it detects that the user's finger has not left the touchscreen. This avoids the problem of a degraded user experience caused by the cursor not moving accordingly with the user's drag operation when the terminal is expanding or deselecting text in phrases.
[0014] In one possible design approach, after the terminal displays the user graphical interface on the touchscreen and before the terminal receives a first gesture applied to the user graphical interface, the method further includes: the terminal receiving a second gesture applied to the user graphical interface, the second gesture being used to activate the function of selecting text.
[0015] In one possible design approach, after the terminal determines the target area corresponding to the closed trajectory in the user's graphical interface, the method further includes: the terminal displays the boundary of the target area in the user's graphical interface, and at least one control block is provided on the boundary of the target area, the control block being used to adjust the position or size of the target area; then, the terminal can receive a third gesture acting on the control block; and then adjust the position or size of the target area according to the third gesture, thereby modifying the target area selected by the user through the first gesture and the first target text in the target area.
[0016] In one possible design approach, the second target text contains the first target text, and the number of characters in the second target text is greater than the number of characters in the first target text; or the first target text contains the second target text, and the number of characters in the second target text is less than the number of characters in the first target text; or the user graphical interface is a short message interface; or the user graphical interface is an interface containing images; or the first target text or the second target text is highlighted in the user graphical interface; or the terminal is a mobile phone.
[0017] Secondly, this application provides a terminal, comprising: a display unit for displaying a first graphical user interface (GUI) on a touchscreen; an acquisition unit for receiving a first gesture applied to the GUI, the first gesture including a closed trajectory; a determination unit for determining a target area in the GUI corresponding to the closed trajectory; and determining first target text contained in the target area; a correction unit for performing semantic analysis on the first target text to determine a second target text, the second target text being different from the first target text; the display unit is further configured to mark the second target text in the GUI.
[0018] In one possible design approach, the display unit is further configured to: display a first prompt in the user's graphical interface, the first prompt including a selection box for circling text information; the acquisition unit is specifically configured to: receive a first gesture by the user in the user's graphical interface using the selection box to circle the first target text.
[0019] In one possible design approach, the acquisition unit is further configured to: receive a click operation applied to a first character, wherein the first character is text in the user's graphical interface other than the second target text; the correction unit is further configured to: expand the text within the closed area formed by the first target text and the row and column where the first character is located into a third target text.
[0020] In one possible design approach, the display unit is also used to: display the first cursor at the beginning position of the second target text and display the second cursor at the end position.
[0021] At this time, the acquisition unit is also used to: receive drag operations applied to the first cursor or the second cursor; the correction unit is also used to: expand the second target text to the third target text in units of phrases; or, deselect the selected text in the second target text in units of phrases.
[0022] In one possible design approach, the determining unit is further configured to: instruct the display unit not to display the first cursor or the second cursor before detecting that the user's finger has not left the touchscreen.
[0023] In one possible design approach, the acquisition unit is further configured to: receive a second gesture applied to the user's graphical interface, the second gesture being used to initiate the function of selecting text.
[0024] In one possible design approach, the display unit is further configured to: display the boundary of the target area in a user graphical interface, wherein at least one control block is provided on the boundary of the target area, and the control block is used to adjust the position or size of the target area; the acquisition unit is further configured to: receive a third gesture acting on the control block; and the determination unit is further configured to: adjust the position or size of the target area according to the third gesture.
[0025] Thirdly, this application provides a terminal, including: a touch screen, one or more processors, a memory, multiple applications, and one or more programs; wherein the processor is coupled to the memory, and the one or more programs are stored in the memory. When the terminal is running, the processor executes the one or more programs stored in the memory to cause the terminal to perform any of the above-mentioned text selection methods.
[0026] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed on any of the aforementioned terminals, cause the terminal to perform any of the aforementioned text selection methods.
[0027] Fifthly, this application provides a computer program product containing instructions that, when run on any of the aforementioned terminals, causes the terminal to execute any of the aforementioned text selection methods.
[0028] In this application, the names of the components in the aforementioned terminal do not limit the device itself; in actual implementation, these components may appear under other names. As long as the function of each component is similar to that of the embodiments in this application, it falls within the scope of the claims of this application and their equivalents.
[0029] Furthermore, the technical effects of any of the design methods in aspects two through five can be found in the technical effects of the different design methods in aspect one above, and will not be repeated here. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of a scenario where text is edited within a terminal in existing technologies. Figure 1 ;
[0031] Figure 2 A schematic diagram of the structure of a terminal provided in this application embodiment. Figure 1 ;
[0032] Figure 3 A schematic diagram of the structure of an operating system provided in an embodiment of this application;
[0033] Figure 4 This is a schematic diagram of a scenario where text is edited within a terminal in existing technologies. Figure 2 ;
[0034] Figure 5 This is a schematic diagram of a scenario where text is edited within a terminal in existing technologies. Figure 3 ;
[0035] Figure 6 A flowchart illustrating a text selection method provided in an embodiment of this application;
[0036] Figure 7 A scenario illustration of a text selection method provided in this application embodiment. Figure 1 ;
[0037] Figure 8 A scenario illustration of a text selection method provided in this application embodiment. Figure 2 ;
[0038] Figure 9 A scenario illustration of a text selection method provided in this application embodiment. Figure 3 ;
[0039] Figure 10 A scenario illustration of a text selection method provided in this application embodiment. Figure 4 ;
[0040] Figure 11 A scenario illustration of a text selection method provided in this application embodiment. Figure 5 ;
[0041] Figure 12A A scenario illustration of a text selection method provided in this application embodiment. Figure 6 ;
[0042] Figure 12B A scenario illustration of a text selection method provided in this application embodiment. Figure 7 ;
[0043] Figure 13A A scenario illustration of a text selection method provided in this application embodiment. Figure 8 ;
[0044] Figure 13B A scenario illustration of a text selection method provided in this application embodiment. Figure 9 ;
[0045] Figure 14 A scenario illustration of a text selection method provided in this application embodiment. Figure 10 ;
[0046] Figure 15 A scenario illustration of a text selection method provided in this application embodiment. Figure 10 one;
[0047] Figure 16 A schematic diagram of the structure of a terminal provided in this application embodiment. Figure 2 ;
[0048] Figure 17 A schematic diagram of the structure of a terminal provided in this application embodiment. Figure 3 ;
[0049] Figure 18A schematic diagram of the structure of a terminal provided in this application embodiment. Figure 4 . Detailed Implementation
[0050] To facilitate a clear understanding of the following embodiments, a brief introduction to the relevant technologies is first given:
[0051] Optical character recognition (OCR) technology refers to the technology where a terminal (such as a mobile phone) uses optical methods to convert printed characters in an image into a black-and-white dot matrix image file, and then uses recognition software to convert the text in the image into text format for further editing and processing. OCR technology can recognize text information contained in image files such as screenshots.
[0052] A control is a software component, typically contained within an application, that controls all the data processed by the application and the interactive operations related to that data. It provides users with certain operational functions or displays certain content. For controls presented in a graphical user interface (GUI), users can interact with them through direct manipulation, thereby reading or editing information related to the application. Generally, controls can include interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.
[0053] In some embodiments of this application, the property determining whether a control is visible can be referred to as the visibility property. The visibility property has three values: visible, invisible, and gone. Visible indicates visibility, invisible indicates invisibility but occupies layout space, and gone indicates invisibility and does not occupy layout space; in this case, other controls can occupy the layout space of the control with the gone property. In the embodiments of this application, controls with the visible property can be simply understood as controls that the program design intends for the user to see, while controls with the invisible and gone properties can be simply understood as controls that the program design does not intend for the user to see. Furthermore, during program development, the visibility property of some controls can be switched as needed. They can be set to invisible by default and changed to visible when required, i.e., from invisible to visible.
[0054] In some embodiments of this application, the property indicating whether a control is editable can be referred to as an editable property. The editable property can take the values of editable and non-editable. Editable means that the content displayed in the control (e.g., text information) allows the user to perform one or more editing operations, such as copy, cut, or delete. For example, a text view control is generally an editable control type. Non-editable means that the content displayed in the control does not allow the user to perform any editing operations. For example, an image view control is generally a non-editable control type.
[0055] The following describes a terminal, a GUI for such a terminal, and specific embodiments for selecting text using such a terminal. In some embodiments of this application, the terminal may be a portable terminal that also includes other functions such as a personal digital assistant or music player, such as a mobile phone, tablet computer, or wearable terminal with wireless communication capabilities (such as a smartwatch). Exemplary embodiments of the portable terminal include, but are not limited to, carrying... Alternatively, it can be a portable terminal with another operating system. The aforementioned portable terminal can also be other portable terminals, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of this application, the aforementioned terminal may not be a portable terminal, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0056] like Figure 2 As shown, the terminal in this embodiment can be a mobile phone 100. The following detailed description uses mobile phone 100 as an example. It should be understood that the illustrated mobile phone 100 is merely an example of a terminal, and mobile phone 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing or application-specific integrated circuits.
[0057] like Figure 2 As shown, the mobile phone 100 may specifically include: a processor 101, a radio frequency (RF) circuit 102, a memory 103, a touchscreen 104, a Bluetooth device 105, one or more sensors 106, a Wi-Fi device 107, a positioning device 108, an audio circuit 109, a peripheral interface 110, a power system 111, and a fingerprint reader 112, etc. These components can be connected via one or more communication buses or signal lines. Figure 2 (Not shown in the image) communicates. Those skilled in the art will understand that... Figure 2The hardware structure shown does not constitute a limitation on the mobile phone 100. The mobile phone 100 may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0058] The following is combined with Figure 2 A detailed introduction to each component of the mobile phone 100:
[0059] The processor 101 is the control center of the mobile phone 100. It connects to various parts of the mobile phone 100 via various interfaces and lines. It executes various functions and processes data by running or executing applications stored in the memory 103 and calling data and instructions stored in the memory 103. In some embodiments, the processor 101 may include one or more processing units; the processor 101 may also integrate an application processor and a modem processor; wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 101. For example, the processor 101 may be a Kirin 960 multi-core processor manufactured by Huawei Technologies Co., Ltd.
[0060] The radio frequency (RF) circuit 102 can be used for receiving and transmitting wireless signals during information transmission or calls. Specifically, the RF circuit 102 can receive downlink data from the base station and process it for the processor 101; additionally, it can transmit uplink data to the base station. Typically, the RF circuit includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. Furthermore, the RF circuit 102 can also communicate with other devices wirelessly. The wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSMO), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WDMA), Long Term Evolution (LTE), email, and SMS services.
[0061] The memory 103 is used to store applications and data. The processor 101 executes various functions and data processing of the mobile phone 100 by running the applications and data stored in the memory 103. The memory 103 mainly includes a program storage area and a data storage area. The program storage area can store the operating system and applications required for at least one function (such as sound playback function, image playback function, etc.); the data storage area can store data created when using the mobile phone 100 (such as audio data, phonebook, etc.). In addition, the memory 103 may include high-speed random access memory, and may also include non-volatile memory, such as disk storage devices, flash memory devices, or other volatile solid-state storage devices. The memory 103 can store various operating systems, such as those developed by Apple Inc. Operating system, developed by Google Operating systems, etc.
[0062] The touchscreen 104 may include a touch-sensitive surface 104-1 and a display 104-2. The touch-sensitive surface 104-1 (e.g., a touch panel) can collect touch events from the user of the mobile phone 100 on or near the touchscreen (e.g., operations performed by the user using a finger, stylus, or any suitable object on or near the touch-sensitive surface 104-1), and send the collected touch information to other devices such as the processor 101. Touch events near the touch-sensitive surface 104-1 can be termed hover touch; hover touch refers to a situation where the user does not need to directly touch the touchpad to select, move, or drag a target (e.g., an icon), but only needs to be near the terminal to perform the desired function. In hover touch applications, the terms "touch" and "contact" do not imply direct contact with the touchscreen, but rather contact near or close to it. The touch-sensitive surface 104-1 capable of hover touch can be implemented using capacitive, infrared, or ultrasonic sensors. The touch-sensitive surface 104-1 may include a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 101. The touch controller can also receive and execute instructions sent by the processor 101. Furthermore, the touch-sensitive surface 104-1 can be implemented using various types of sensors, such as resistive, capacitive, infrared, and surface acoustic waves. The display (also called a screen) 104-2 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone 100. The display 104-2 can be configured using liquid crystal displays, organic light-emitting diodes, etc. The touch-sensitive surface 104-1 can cover the display 104-2. When the touch-sensitive surface 104-1 detects a touch event on or near it, it transmits the information to the processor 101 to determine the type of touch event. Subsequently, the processor 101 provides corresponding visual output on the display 104-2 based on the type of touch event. Although... Figure 2In this embodiment, the touch-sensitive surface 104-1 and the display screen 104-2 are two independent components for realizing the input and output functions of the mobile phone 100. However, in some embodiments, the touch-sensitive surface 104-1 and the display screen 104-2 can be integrated to realize the input and output functions of the mobile phone 100. It is understood that the touch screen 104 is made of multiple layers of materials. In this embodiment, only the touch-sensitive surface (layer) and the display screen (layer) are shown; other layers are not described in this embodiment. In addition, in some other embodiments of this application, the touch-sensitive surface 104-1 can cover the display screen 104-2, and the size of the touch-sensitive surface 104-1 is larger than the size of the display screen 104-2, so that the display screen 104-2 completely covers the touch-sensitive surface 104-1. Alternatively, the touch-sensitive surface 104-1 can be configured as a full panel on the front of the mobile phone 100, that is, all touches made by the user on the front of the mobile phone 100 can be sensed by the mobile phone, thus realizing a full touch experience on the front of the mobile phone. In some other embodiments, the touch-sensitive surface 104-1 is configured as a full-screen panel on the front of the phone 100, and the display screen 104-2 can also be configured as a full-screen panel on the front of the phone 100, thus achieving a borderless structure on the front of the phone. In other embodiments of this application, the touchscreen 104 may also include one or more sensor arrays, for the touchscreen 104 to sense touch events by the user and pressure applied by the user on it.
[0063] The mobile phone 100 may also include a Bluetooth device 105 for enabling data exchange between the mobile phone 100 and other short-range terminals (such as mobile phones, smartwatches, etc.). The Bluetooth device in this embodiment may be an integrated circuit or a Bluetooth chip, etc.
[0064] The mobile phone 100 may also include at least one sensor 106, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the touchscreen 104's display according to the ambient light level, and the proximity sensor can turn off the display when the mobile phone 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes), and when stationary, it can detect the magnitude and direction of gravity. It can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that the mobile phone 100 may also be equipped with, such as a gyroscope, barometer, hygrometer, thermometer, and infrared sensor, will not be described in detail here.
[0065] In other embodiments of this application, the mobile phone 100 may also have a fingerprint recognition function. For example, a fingerprint sensor may be configured on the back of the mobile phone 100 (e.g., below the rear camera) or on the front of the mobile phone 100 (e.g., below the touchscreen 104). Alternatively, the fingerprint recognition function can be implemented by configuring a fingerprint sensor in the touchscreen 104, that is, the fingerprint sensor can be integrated with the touchscreen 104 to realize the fingerprint recognition function of the mobile phone 100. In this case, the fingerprint sensor can be configured in the touchscreen 104, can be part of the touchscreen 104, or can be configured in the touchscreen 104 in other ways. In addition, the fingerprint sensor can also be implemented as a full-screen fingerprint reader, so the touchscreen 104 can be regarded as a panel that can collect fingerprints at any location. The fingerprint sensor can send the collected fingerprint to the processor 101 so that the processor 101 can process the fingerprint (e.g., fingerprint verification). The fingerprint sensor in the embodiments of this application can adopt any type of sensing technology, including but not limited to optical, capacitive, piezoelectric, or ultrasonic sensing technologies. In addition, for the specific technical solution of integrating a fingerprint sensor in a touch screen in the embodiments of this application, please refer to PCT patent application with application number PCT / CN2017 / 084602 entitled "Input Method and Terminal", the entire contents of which are incorporated herein by reference in various embodiments.
[0066] The Wi-Fi device 107 provides network access to the mobile phone 100 in accordance with Wi-Fi related standard protocols. The mobile phone 100 can access the Wi-Fi access point through the Wi-Fi device 107, thereby enabling the user to send and receive emails, browse web pages, and access streaming media, providing wireless broadband internet access. In some other embodiments, the Wi-Fi device 107 can also function as a Wi-Fi wireless access point, providing Wi-Fi network access to other terminals.
[0067] The positioning device 108 provides the geographical location of the mobile phone 100. It is understood that the positioning device 108 can specifically be a receiver for a positioning system such as the Global Positioning System (GPS) or the BeiDou Navigation Satellite System. After receiving the geographical location sent by the aforementioned positioning system, the positioning device 108 sends the information to the processor 101 for processing or to the memory 103 for storage. In some other embodiments, the positioning device 108 can be a receiver for an Assisted Global Positioning System (AGPS). AGPS is a GPS positioning operation mode that utilizes base station signals in conjunction with GPS satellite signals, allowing the mobile phone 100 to locate itself more quickly. In an AGPS system, the positioning device 108 can obtain positioning assistance through communication with an auxiliary positioning server (e.g., a mobile phone positioning server). The AGPS system assists the positioning device 108 in completing ranging and positioning services by acting as an auxiliary server. In this case, the auxiliary positioning server provides positioning assistance by communicating with the positioning device 108 (i.e., the GPS receiver) of the terminal, such as the mobile phone 100, through a wireless communication network.
[0068] Audio circuit 109, speaker 113, and microphone 114 provide an audio interface between the user and mobile phone 100. Audio circuit 109 converts received audio data into electrical signals and transmits them to speaker 113, where speaker 113 converts them into sound signals for output. On the other hand, microphone 114 converts collected sound signals into electrical signals, which are received by audio circuit 109, converted into audio data, and then output to RF circuit 102 for transmission to, for example, another mobile phone, or to memory 103 for further processing.
[0069] Peripheral interface 110 provides various interfaces for external input / output devices (such as keyboards, mice, external displays, external storage, user identification module cards, etc.). For example, it can connect to a mouse via a universal serial bus interface, or electrically connect to a subscriber identity module (SIM) card provided by a telecommunications operator via metal contacts on the SIM card slot. Peripheral interface 110 can be used to couple the aforementioned external input / output peripheral devices to processor 101 and memory 103.
[0070] The mobile phone 100 may also include a power supply device 111 (such as a battery and a power management chip) that supplies power to various components. The battery can be logically connected to the processor 101 through the power management chip, thereby enabling the power supply device 111 to manage functions such as charging, discharging, and power consumption.
[0071] although Figure 2 As not shown, the mobile phone 100 may also include a camera, flash, miniature projection device, near field communication (NFC) device, etc., which will not be described in detail here.
[0072] For example, the memory 120 of the mobile phone 100 can store The operating system is a Linux-based mobile device operating system that, in conjunction with the aforementioned hardware in the phone 100, implements a variety of functions. The following will describe the storage in detail. The software architecture of the operating system. It should be noted that the embodiments in this application are only examples of... The operating system is used as an example to illustrate the software environment required for a terminal to implement the technical solution of this embodiment. Those skilled in the art will understand that the embodiments of this application can also be implemented using other operating systems.
[0073] For example, Figure 3 It is a type of device that can run on the aforementioned terminals. A schematic diagram of the operating system's software architecture. This software architecture can be divided into four layers: the application layer, the application framework layer, the function library layer, and the Linux kernel layer.
[0074] 1. Applications Layer
[0075] The application layer is the top layer of the operating system and includes native operating system applications such as email clients, SMS, calling, calendars, browsers, and contacts. Of course, developers can write applications and install them into this layer. Generally, applications are developed using the Java language and are implemented by calling the application programming interface (API) provided by the application framework layer.
[0076] 2. Application Framework Layer
[0077] The application framework layer primarily provides developers with access to various APIs used by their applications. Developers can use the application framework to interact with the underlying operating system (such as function libraries and the Linux kernel) to develop their own applications. This application framework mainly consists of a series of services and management systems within the Android operating system. The application framework primarily includes the following basic services:
[0078] Activity Manager: Used to manage the application lifecycle and provide common navigation and back functions;
[0079] Content providers: Used to manage data sharing and access between different applications;
[0080] Notification Manager: Used to control how applications display prompts (such as alerts and notifications) to the user in the status bar, lock screen, etc.
[0081] Resource Manager: Provides non-code resources (such as strings, graphics, and layout files) for applications to use;
[0082] Clipboard Manager: Primarily provides copy and paste functionality within or between applications;
[0083] View: A rich and extensible collection of views used to build an application. It includes various types such as lists, grids, text, buttons, and images. The primary function of an image view is to display images, typically presented in the GUI as a non-editable control. The primary function of a text view is to display strings, typically presented in the GUI as an editable control.
[0084] Location Manager: Primarily allows applications to access the geographical location of the terminal.
[0085] 3. Library layer
[0086] The library layer supports the application framework and serves as a crucial link between it and the Linux kernel layer. It comprises libraries compiled from C or C++ languages, usable by various components of the operating system. These libraries provide services to developers through the application framework layer. Specifically, libraries may include the libc library, specifically designed for embedded Linux devices; the Media Framework, which supports playback and recording of audio and video in various encoding formats, as well as still image files and common audio and video encoding formats; and the SurfaceManager library, primarily responsible for managing access to the display system. Specifically, it manages the interaction between display and access operations when multiple applications are running, and also handles the compositing of 2D and 3D graphics.
[0087] The function library layer can also include other function libraries used to implement various functions of the mobile phone, such as: SGL (Scalable Graphics Library): a 2D graphics and image processing engine based on XML (Extensible Markup Language) files; SSL (Secure Sockets Layer): located between the TVP / IP protocol and various application layer protocols, providing support for data communication; OpenGL / ES: support for 3D effects; SQLite: a relational database engine; Webkit: a web browser engine; FreeType: bitmap and vector font support; and so on.
[0088] Android Runtime is a type of... The runtime environment on the operating system is A new type of virtual machine used by the operating system. In the Android Runtime, AOT (Ahead-Of-Time) technology is used, so when an application is installed for the first time, the application's bytecode is pre-compiled into machine code, making the application a truly native application. Subsequent runs skip the compilation step, making startup and execution much faster.
[0089] In other embodiments of this application, the Android Runtime can also be replaced by core libraries and the Dalvik Virtual Machine. The core libraries provide most of the functionality in the Java language API, primarily through the Java Native Interface (JNI) to provide the application framework layer with an interface to call the underlying libraries. They also include some core APIs of the operating system, such as android.os, android.net, and android.media. The Dalvik Virtual Machine uses a Just-in-Time (JIT) runtime compilation mechanism; each time a process is started, the virtual machine needs to recompile the bytecode in the background, which can impact startup speed. Each application runs within an instance of the Dalvik Virtual Machine, and each Dalvik Virtual Machine instance is an independent process space. The Dalvik Virtual Machine is designed to efficiently run multiple virtual machines on a single device. The Dalvik Virtual Machine executable file format is .dex, a compressed format specifically designed for Dalvik, suitable for systems with limited memory and processor speed. It should be noted that the Dalvik Virtual Machine relies on the Linux kernel for basic functionality (threads, low-level memory management). It is understandable that Android Runtime and Dalvik are different types of virtual machines, and those skilled in the art can choose different types of virtual machines in different situations.
[0090] 4. Linux Kernel Layer
[0091] This layer provides core system services for the operating system, such as security, memory management, process management, network protocol stack, and driver models, all of which are based on the Linux kernel. The Linux kernel also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to mobile devices, including: display drivers; Linux-based framebuffer drivers; keyboard drivers as input devices; Flash drivers for memory-based devices; camera drivers; audio drivers; Bluetooth drivers; and Wi-Fi drivers.
[0092] In this application embodiment, the Android operating system is used as an example, such as Figure 4 As shown, the application framework layer can also include a clipboard manager, which manages the text information selected by the user in the editable control and provides functions such as copying and pasting text information.
[0093] The Clipboard Manager can be obtained through the function `getSystemService(CLIPBOARD_SERVICE)`. The terminal uses the Clipboard Manager to manage the copying and pasting of data between or within two applications. `ClipData` refers to a Clip object, which contains data description information and the data itself. Only one Clip object exists on the clipboard at a time; when another Clip object is retrieved, the previous Clip object is no longer stored in the clipboard. A Clip object can contain one or more `ClipData.Item` objects. The function `addItem(ClipData.Item item)` adds an `Item` object to a Clip object. The data type (data item) in an `Item` object can specifically include text, a Uniform Resource Identifier (URI), or an Intent. Multiple `ClipData.Item` objects can be added to a single Clip object, allowing users to copy multiple selected items into the same Clip object; for example, if a list widget allows users to select multiple options at once, the Clipboard Manager can copy all selected options to the clipboard at once.
[0094] For example, in combination Figure 4 and Figure 5 The application scenarios for text copying shown are as follows: Figure 5 As shown in (a), when WeChat is running in the foreground, it displays the chat interface with Mike. This interface includes controls 504 (back button icon), 505 (title bar), 506 (chat details button icon), 507 (avatar icon), 508 (conversation content), 511 (voice input button icon), 512 (input box), and 513 (option button icon). When the touchscreen detects a long press operation on control 508 to edit the control, the IC chip integrated in the touchscreen can report the touch parameters, such as the coordinates of the long press operation and the touch duration, to the processor running on the phone 100. operating system.
[0095] After obtaining the aforementioned touch parameters, WeChat in the operating system can determine that the user has performed a long press operation on control 508. Furthermore, WeChat can obtain the clipboard service from the system services by calling the `getSystemService(CLIPBOARD_SERVICE)` function. At this point, as... Figure 5As shown in (b), since control 508 is an editable control, the terminal can display a text selection menu 510 and a cursor for adjusting the selected text (the cursor includes a first cursor 520a located at the beginning of the selected text and a second cursor 520b located at the end of the selected text). The text selection menu 510 includes editing operations supported by control 508, such as copy 510a, forward 510b, delete 510c, etc.
[0096] The user can then select the desired text content in control 508 by dragging the first cursor 520a and the second cursor 520b. When the user clicks the copy 510a option, the clipboard service calls the addItem(ClipData.Item item) function to add the text between the first cursor 520a and the second cursor 520b as the user-selected target text to a new clip object. Then, the clipboard service places the new clip object into the clipboard using the clipManager.setPrimaryClip(clip) function. At this point, the original clip object in the clipboard is deleted. Subsequently, as... Figure 4 As shown, when a user performs a paste operation on another application or other interface, the clipboard service can be called again to copy the target text saved in the clip object in the clipboard to the location selected by the user, thereby completing the entire copy and paste operation.
[0097] However, in the process of performing the above copy and paste operation, the user needs to drag the first cursor 520a or the second cursor 520b to select the desired target text. During the dragging process, the problem of selecting too much or too little text is easy to occur, which reduces the efficiency of the terminal when extracting the target text for the user.
[0098] Therefore, the text selection method provided by the embodiments of this application will be described in detail below with reference to the accompanying drawings. The following description uses a mobile phone as the terminal. Figure 6 The diagram shown is a flowchart illustrating a text selection method provided in an embodiment of this application. The method may specifically include:
[0099] S601, The terminal displays the user's graphical interface on the touchscreen.
[0100] S602, The terminal receives a first gesture applied to the user graphical interface, the first gesture including a closed trajectory.
[0101] When a user is using a mobile phone and is interested in certain text information displayed on the user's graphical interface, and wants to perform editing operations such as copying, modifying, or sharing this text information, they need to first select this text information to be edited (which can be referred to as the target text in this embodiment). At this time, the user can input a first gesture to a first control containing the target text. This first gesture is used to instruct the mobile phone to select the target text in the user's graphical interface corresponding to the area where the first gesture is applied.
[0102] The aforementioned first gesture can be any gesture whose movement trajectory forms a closed shape, or it can refer to any gesture that can form a closed trajectory when the mobile phone responds to the first gesture. For example, the first gesture can specifically refer to a selection operation such as circling or boxing when the user slides their finger or stylus on the touchscreen, forming a closed shape. As another example, the first gesture can also refer to operations such as clicking, double-clicking, or pressing when the user touches the touchscreen, which can produce a closed trajectory. This application embodiment does not impose any limitations on this.
[0103] In some embodiments of this application, after the terminal displays a user graphical interface containing the first control (i.e., step S601), a second gesture by the user on the user graphical interface (e.g., the first control within the user graphical interface) can be received first. This second gesture is used to activate the function of selecting text in the user graphical interface. For example, the second gesture can be a long press gesture.
[0104] For example, such as Figure 7 As shown, the phone displays a chat interface with Sara, where controls 504 to 513 are all visible controls. Controls 504, 505, and 508 all contain text information. The user can then perform a long-press operation (i.e., a second gesture) on any of the controls 504, 505, and 508 (i.e., the first control). When the touchscreen detects this long-press operation, it reports the detected touch time and other touch parameters layer by layer to WeChat (the application to which the chat interface belongs) running in the application layer, instructing WeChat to activate the text selection function in the chat interface for subsequent text editing services to the user.
[0105] Still with Figure 7Taking a user's long-press action on control 508 as an example, after WeChat receives the touch event corresponding to the long-press action, it can further determine whether the affected control 508 is an editable control. For example, since the editable attributes of controls with different names or types are fixed—for instance, text view controls are editable, while image view controls are non-editable—WeChat can call relevant APIs to query the name or type of control 508, thereby determining whether control 508 is an editable control.
[0106] For example, in Figure 7 In the chat interface shown, the controls containing text information include controls 504, 505, and 508. Among them, control 508 is an editable control of type text view, while controls 504 and 505 are non-editable controls of type imageview.
[0107] If the first control selected by the user is an editable control, then when the mobile phone subsequently receives the user's first gesture (such as a selection operation) on the control 508, the mobile phone can call the Clipboard Manager in the system service to perform functions such as text selection, copy and paste, and extract the target text (i.e. the first target text) in the target area selected by the user by executing the following steps S603-S606.
[0108] Optionally, when the phone determines that the first control is an editable control, if it receives the user's first gesture of selecting text within the first control, the phone can mark the target area selected by the user's first gesture within the first control through animation, voice, or highlighting. Alternatively, the phone can also use two cursors to mark the start and end positions of the first target text selected by the user's first gesture.
[0109] Correspondingly, if the first control selected by the user is a non-editable control, the mobile phone can first convert the text information within the first control into an editable state. Then, when the mobile phone subsequently receives a first gesture (e.g., a selection operation) from the user on the aforementioned control 508, it can implement text editing functionality by executing the following steps S603-S606. In other words, this embodiment of the application can also implement text editing functionality for application scenarios where text in images or other non-editable text is not allowed, thereby improving the efficiency of text editing operations using a mobile phone.
[0110] For example, if the first control used by the user when performing the second gesture is a non-editable control, such as an image view, the phone can also extract text information from the first control using ORC technology. Thus, when the phone subsequently receives the first gesture, it can determine the first target text within the selected target area based on the text information extracted using ORC technology.
[0111] In some other embodiments of this application, for image view type controls such as images, the mobile phone can extract text information from the control based on ORC technology when generating or displaying the control, and store the text information in the content description field of the control.
[0112] Therefore, when the phone determines that the first control for the second gesture is a non-editable control, it can first call the interface View.getContentDescription() to query whether the content description field stores the text information within the first control. If the text information within the first control is stored, the phone can extract the text information included in the first control from the content description field; if the text information within the first control is not stored, the phone can identify and extract the text information included in the first control through ORC technology.
[0113] Additionally, when the phone receives a second gesture (e.g., a long press) from the user on the aforementioned graphical user interface to activate the function of selecting text within the graphical user interface, such as... Figure 8 As shown in (a) above, taking the first control 508 as an example, the mobile phone can also display one or more selection boxes 803 (e.g., the first selection box and the second selection box) for selecting text in the current chat interface. Alternatively, the mobile phone can also display a prompt 804 in the current chat interface prompting the user to select a target area.
[0114] Furthermore, such as Figure 8 As shown in (b)-(c), when the mobile phone detects a user's gesture selecting a selection box (e.g., selection box 803), the mobile phone can determine the selected selection box in response to the gesture. At this time, the selected selection box is used to select the target text desired by the user. Furthermore, the terminal can receive the user's first gesture of using selection box 803 to select the target text. In response to this first gesture, the mobile phone can form a closed trajectory in the aforementioned user graphical interface according to the shape of selection box 803. At this time, the area corresponding to this closed trajectory is the target area 901 that the user wishes to select, and the text information contained within the target area 901 is the first target text 902.
[0115] Of course, mobile phones can also be used. Figure 8 The selection box 803 is not displayed in the display interface shown in (a). The user can manually draw a closed trajectory in the display interface as the first gesture input to the touch screen of the mobile phone.
[0116] For example, such as Figure 9 As shown in (a)-(c), if the mobile phone detects that the user's finger movement trajectory in the first control (e.g., control 508) is a closed shape (i.e., the first gesture), then after the mobile phone determines that control 508 is an editable control, it can call the getSystemService(CLIPBOARD_SERVICE) function to obtain the clipboard service. The Clipboard Manager in the clipboard service will then use the closed area on the touchscreen corresponding to the aforementioned closed trajectory as the target area required by the user. Figure 9 The target region 901 is shown in (c) in the figure.
[0117] S603. In response to the first gesture, the terminal determines the target area in the user graphical interface that corresponds to the closed trajectory.
[0118] Still with Figure 8 or Figure 9 For example, after the mobile phone receives a first gesture from the user on the aforementioned graphical user interface (e.g., control 508) that contains a closed trajectory, the mobile phone can use the area in the aforementioned graphical user interface corresponding to the closed trajectory as the target area selected by the user (e.g., Figure 8 or Figure 9 (Region 901 in the middle).
[0119] like Figure 8 As shown in (c), the closed trajectory formed after the user performs the first gesture in control 508 using the selection box is the boundary line of the selection box. Therefore, the mobile phone can use the position coordinates of the selection box boundary line at this time as the position coordinates of the target area 901, thereby determining the target area 901 in the aforementioned user graphical interface that corresponds to the aforementioned closed trajectory.
[0120] In other embodiments of this application, it is still as follows Figure 8 As shown in (c), when the mobile phone displays the target area 901, at least one control block 903 can be set on the boundary of the target area 901. The control block 903 is used to adjust the position or size of the target area 901.
[0121] So, if Figure 10As shown in (a) and (b), if the terminal receives a third gesture from the user on control block 903, such as dragging control block 903, the terminal can adjust the position or size of target area 901 according to the third gesture. Taking the third gesture as the user dragging control block 903 as an example, the terminal can expand or shrink target area 901 along the direction in which the user drags control block 903, forming an adjusted target area 901'. At this time, the number of selected first target texts in target area 901' will also increase or decrease accordingly.
[0122] S604. The terminal determines the first target text contained in the above-mentioned target area.
[0123] In step S604, after the mobile phone determines the target area (e.g., target area 901) selected by the user in the first gesture, it can call the interface View.getText() or View.getContentDescription() to obtain the specific text content (i.e., the first target text) contained in the target area. For example, when the first control is a text view type control, the text field of the control stores all the text content within the control. Then, the mobile phone can extract the first target text corresponding to the target area from all the text content based on the coordinate information of the target area.
[0124] Combination Figure 8 or Figure 9 As shown, for control 508, the mobile phone can call the interface View.getText() in conjunction with the target area 901 determined in step S603 to obtain the text content of the first target text 902 within the target area 901 selected by the user:
[0125] "Prepare the necessary items for your trip. If you are traveling abroad..."
[0126] Get your passport and visa in advance.
[0127] The target area of the first target text can be marked by highlighting, bolding, etc., so that users can accurately know the specific text content selected, so as to expand or delete the selected text in the future.
[0128] Of course, the first target text within the aforementioned target area may also include text information in various language forms such as numbers, English letters, and words, and this application embodiment does not impose any restrictions on this.
[0129] S605. The terminal performs semantic analysis on the first target text to determine the second target text, which is different from the first target text.
[0130] S606. The terminal marks the second target text in the aforementioned user graphical interface.
[0131] In step S605, the terminal can expand or unselect the phrases in the first target text that are separated by the target area, to obtain a second target text that is different from the first target text. For example, the mobile phone can identify the text to be corrected with incomplete semantics / word meanings in the first target text through techniques such as semantic analysis or word segmentation. For example, the text to be corrected in the first target text 902 is: "passport, visa". Generally, the appearance of the text to be corrected with incomplete semantics / word meanings is mostly caused by the user selecting more or less when selecting the first target text by circle selection.
[0132] Therefore, the mobile phone can continue to extract the context of the text to be corrected (this context is outside the above-mentioned target area). For example, extract the following character "visa" of the characters "passport, visa". Furthermore, determine whether the text to be corrected has complete semantics / word meanings after adding the context of the text to be corrected (that is, "passport, visa"). If it has complete semantics / word meanings, then as Figure 11 shown, the mobile phone can automatically expand the context character "visa" of the text to be corrected as the selected text. At this time, the selected text is the second target text 1001 that includes the context of the text to be corrected in addition to the above-mentioned first target text.
[0133] Exemplarily, a dictionary for word segmentation can be preset in the mobile phone. The dictionary can store common Chinese words, phrases, or English words, etc. Then, after the mobile phone obtains the context character "visa" of the text to be corrected, it can search in the dictionary to see if it contains the word "visa". If it contains, it means that the user has selected less the character "visa" in the first target text selected by circle selection. Only after adding the character "visa" after the text to be corrected "passport, visa" in the first target text does it have complete word meanings. Therefore, the mobile phone can add the character "visa" to the above-mentioned first target text to obtain the second target text.
[0134] In addition, the mobile phone can also update the commonly used or user-defined words of the user to the above-mentioned dictionary according to the input habits of the user when using the input method, so as to improve the accuracy rate when the mobile phone automatically expands the selected target text for the user.
[0135] Or, the mobile phone can also send the above-mentioned first target text to the server, and request the server to identify the text to be corrected with incomplete semantics / word meanings in the first target text. Even, the mobile phone can send all the text information in the first control to the server, and request the server to determine the words to be expanded in the text to be corrected in the first control. Then, according to the feedback result of the server, expand the phrases in the first target text that are separated by the above-mentioned target area to obtain the second target text.
[0136] In some other embodiments of the present application, still taking the occurrence of the text to be corrected "passport, visa" in the first target text 902 as an example, after the mobile phone determines the text to be corrected, it can continue to extract the context "certificate" character of the text to be corrected outside the selected target area. Then, through the above dictionary, the mobile phone can determine that the "certificate" character needs to be extended to the first target text. At this time, as Figure 12A shown, the mobile phone can use the row 1101 and column 1102 where the "certificate" character is located as the boundary, and automatically extend the text within the closed area formed by the first target text and row 1101 and column 1102 as the second target text 1103. At this time, the text content of the second target text 1103 obtained after the automatic extension by the mobile phone is:
[0137] "Prepare the documents to be taken out when going out. If traveling abroad for sightseeing,
[0138] apply for a passport and visa in advance"
[0139] Exemplarily, as
[0140] shown, in combination with Figure 12B the first control 508 shown in Figure 12A , the target area 901 of the first target text circled by the user is a rectangle, and the mobile phone can obtain the coordinate values of the four vertices A, B, C, and D of the rectangle on the touch screen. When the mobile phone determines that the "certificate" character needs to be extended to the first target text, it can obtain the coordinate point E(x, y) of the "certificate" character on the touch screen. Then, the mobile phone can determine that the vertex closest to point E in the rectangle ABCD is point D. Then, the extended rectangular target area can use point E to replace point D as the vertex, and the coordinate value of vertex A on the same diagonal as point E in the extended rectangular target area remains unchanged. Then, based on point A and point E, the mobile phone can determine the other two vertices on the other diagonal of the extended rectangular target area as the intersection point B of the row where point E is located and side AB, and the intersection point F of the column where point E is located and the extension line of side AC, so as to obtain the extended rectangular target area with A, B, E, and F as vertices, and the text within this rectangular target area is the second target text 1103.
[0141] In addition, after the mobile phone extends the first target text, it can also repeat the above method to continue word segmentation or semantic analysis on the extended second target text, so as to correct the text that is overselected or underselected in the second target text.
[0142] In some other embodiments of the present application, when the mobile phone determines that there is a text to be corrected with incomplete semantics / word meanings in the first target text (such as Figure 9 "passport, visa" in it), if the text after the "visa" character is a punctuation mark or a new paragraph, the mobile phone can also automatically delete the redundant "visa" character in the text to be corrected, so as to correct the overselection error operation when the user circles the first target text.
[0143] At this point, the phone can correct any over- or under-selected text in the first target text selected by the user on the display interface using methods such as text extraction and semantic analysis, resulting in a corrected second target text. This improves the accuracy and efficiency of the user's selection of target text on the display interface. Subsequently, based on the second target text selected by the user, the phone can further perform text editing operations such as copying, deleting, and translating, thereby improving the efficiency of text editing operations.
[0144] In some other embodiments, after the mobile phone performs the above steps S601-S606, the user can also manually expand or deselect the second target text by clicking or dragging the cursor. That is, after step S606, the terminal can also perform the following steps S608-S609 or S610-S611.
[0145] S608. The terminal receives a click operation applied to a first character, which is text in the user graphical interface other than the second target text.
[0146] S609. In response to the above click operation, the terminal expands the second target text to the third target text, using the row and column where the first character is located as the boundary.
[0147] If the user needs to expand the selected text based on the second target text, as described in step S608, the user can enter a click operation at the first character outside the second target text to indicate that the user wants to expand the selected target area from the area where the second target text is located to the area containing the first character.
[0148] like Figure 13A As shown in (a), taking control 508 in the chat interface as the first control mentioned above, the mobile phone automatically expands the first target text 902 selected by the user to the second target text 1103. If the user wants to continue expanding the selection of the second target text 1103, they can continue to click on the last character / word of the target text they want in control 508. For example, if the user clicks on the word "boat ticket" 1201 in control 508, then "boat ticket" 1201 is the first character mentioned above.
[0149] Furthermore, in step S609, in response to the user's click operation on the aforementioned "ticket" 1201, the mobile phone can automatically expand the text within the closed area formed by the second target text 1101 and the row and column containing the word "ticket" 1201 to form the third target text 1202, using the row and column containing the word "ticket" 1201 as the boundary. At this time, as Figure 13AAs shown in (b), the first cursor 801 is located at the beginning position of the third target text 1204, the second cursor 802 is located at the end position of the third target text 1204, and the third target text 1202 can be highlighted to indicate that the third target text 1202 is in the selected state.
[0150] For example, such as Figure 13B As shown, combined with Figure 13A The first control 508 shown is located in a rectangle formed by four vertices A, B, E, and F, where the second target text 1103 is located. When the phone detects that the user clicks on the word "ticket" 1201 in the control 508, the phone can detect that the coordinate point of the character "ticket" in "ticket" on the touch screen is point E'. Then, the phone can calculate that the point closest to point E' among the four vertices A, B, E, and F is point E. Therefore, the phone can use point E' as a vertex to replace point E in the expanded rectangular target area. Similarly, the coordinate value of vertex A, which is on the same diagonal as point E' in the expanded rectangular target area, remains unchanged. Therefore, the phone can determine the two vertices on the other diagonal of the expanded rectangular target area, namely point B', the intersection of the row where point E' is located and the extension of line AB, and point F', the intersection of the column where point E' is located and the extension of line EF, thus obtaining the rectangular target area where the third target text 1204 is located with vertices A, B', E', and F'.
[0151] Alongside steps S608-S609, the following steps S610-S611 are another method for the user to manually expand the selection of the second target text.
[0152] S610, The terminal receives a drag operation from the user, where the cursor is located at the start or end position of the second target text.
[0153] S611. In response to the above drag operation, the terminal expands the second target text into the third target text by word group.
[0154] Specifically, such as Figure 14 As shown in (a), after the mobile phone automatically expands the selection of the segmented phrases in the first target text, it can display the first cursor 801 at the beginning position of the expanded second target text 1101 and the second cursor 802 at the end position of the second target text 1101. The user can also continue to expand the selection based on the second target text 1101 by dragging the first cursor 801 (or the second cursor 802).
[0155] Still Figure 14As shown in (a) of [Figure 0], the user starts dragging the second cursor 802 backward from the end position of the second target text 1101, i.e., the character "证", to perform a dragging operation. After the mobile phone detects this dragging operation, it can query whether the text currently extended and selected by the user is a phrase through the above-mentioned pre-set dictionary. For example, as Figure 14 shown in (b) of [Figure 0], when the user drags the second cursor 802 and the finger moves to the character "健" within the control 508, since the currently extended selected character "健" does not belong to a phrase in this dictionary, then the mobile phone does not need to extend the character "健" as the text selected by the user, and the second cursor 802 can remain unresponsive. Correspondingly, as Figure 14 shown in (c) of [Figure 0], when the user continues to drag the second cursor 802 and the finger moves to the character "康" of "健康" within the control 508, since the currently extended selected phrase "健康" belongs to a phrase in this dictionary, therefore, the mobile phone can extend the phrase "健康" as the text selected by the user, and obtain the third target text 1301 after extension. At this time, the second cursor 802 moves to the end position of the third target text 1301 (i.e., after the character "康" of "健康"), and the third target text 1301 marked between the first cursor 801 and the second cursor 802 can also be highlighted.
[0156] That is to say, in the embodiment of this application, when the mobile phone responds to the user's dragging of the cursor to manually extend and select the target text, it extends and selects in units of phrases, which can effectively reduce the phenomenon of over-selection or under-selection when the user drags the cursor to extend the selected text, and improve the operation efficiency of the mobile phone when extracting text for the user.
[0157] In addition, when the user drags the cursor to cancel the selected text, the mobile phone can also cancel the selected text in units of phrases, thereby reducing the phenomenon of over-selection or under-selection when the user drags the cursor to cancel the selected text. For example, as Figure 15 shown in (a) of [Figure 0], the user starts dragging the second cursor 802 forward from the end position of the second target text 1101, i.e., the character "证", and the finger moves behind the character "签" to perform the function of canceling the selected text. After the mobile phone detects this dragging operation, it can query whether the selected text at the current position of the second cursor 802 is a phrase through the above-mentioned pre-set dictionary. Still as Figure 15 shown in (a) of [Figure 0], the selected text "签" at the position of the second cursor 802 does not belong to a phrase in this dictionary, then the mobile phone does not need to cancel the selected character "证", and at this time the second cursor 802 remains unresponsive and is still behind the character "证". Correspondingly, as Figure 15As shown in (b), when the user continues to drag the second cursor 802 forward until it reaches the word "sign" in "visa," the selected text "passport" at the current position of the second cursor 802 is a phrase within the dictionary. Therefore, the phone can deselect the word "visa." At this time, the text highlighted between the first cursor 801 and the second cursor 802 before the word "sign" in "visa" is the updated target text.
[0158] Optionally, when the phone detects that a user is dragging the first cursor 801 or the second cursor 802, the phone can hide the dragged cursor. When the phone detects that the user has left the touchscreen and is no longer dragging, the phone can redisplay the hidden cursor. This avoids the problem of a degraded user experience caused by the cursor not moving accordingly with the user's dragging action when the phone is expanding or deselecting text in phrases.
[0159] Of course, in order to improve the accuracy of deselecting the selected text, when the user drags the cursor to deselect the selected text, the mobile phone can also deselect the selected text word by word in response to the user's drag operation. This application embodiment does not impose any restrictions on this.
[0160] It should be noted that when the mobile phone extracts the first target text within the aforementioned target area, or when the mobile phone expands the first target text to the second target text, or when the mobile phone expands the second target text to the third target text, as follows: Figure 5 As shown in (b), the mobile phone can also display a text selection menu 510 for editing the extracted text content, such as options like copy 510a, forward 510b, delete 510c, etc.
[0161] Subsequently, if the phone detects that the user clicked the copy 510a option, the ClipboardManager running on the phone can call the addItem(ClipData.Item item) function to add the extracted target text to a new clip object. Then, Clipboard Manager calls the function clipManager.setPrimaryClip(clip) to place the new clip object into the clipboard, completing the copy operation. Later, when the phone detects that the user has performed a paste operation, Clipboard Manager can retrieve the stored clip object (i.e., the target text) from the clipboard and paste it into the user-specified input box, completing the paste operation.
[0162] It is understood that, in order to achieve the aforementioned functions, the terminals and other devices described above include hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in a hardware-driven or software-driven manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0163] This application embodiment can divide the aforementioned terminal, etc., into functional modules according to the above method examples. For example, each function can be divided into its own functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0164] When dividing each function into modules according to its corresponding function. Figure 16 A possible structural diagram of a terminal involved in the above embodiments is shown. The terminal is used to implement the methods described in the above method embodiments, and specifically includes: a display unit 1601, an acquisition unit 1602, a determination unit 1603, and a correction unit 1604.
[0165] The display unit 1601 is used to support terminal execution. Figure 6 The processes S601 and S606 are shown; the acquisition unit 1602 is used to support terminal execution. Figure 6 The processes S602, S608, and S610 are shown; the determination unit 1603 is used to support terminal execution. Figure 6 The processes S604-S605 are shown; the correction unit 1604 is used to support terminal execution. Figure 6 The processes S605, S609, and S611 are shown. All relevant content regarding each step in the above method embodiments can be found in the functional descriptions of the corresponding functional modules, and will not be repeated here.
[0166] When using integrated units, the aforementioned determining unit 1603 and correcting unit 1604 can be integrated into a processing module, the aforementioned display unit 1601 can be used as an output module, and the aforementioned acquisition unit 1602 can be used as an input module. Of course, the terminal may also include a storage module and a communication module. In this case, as... Figure 17As shown, a possible structural diagram of the terminal involved in the above embodiments is illustrated, including a processing module 1701, a communication module 1702, an input / output module 1703, and a storage module 1704.
[0167] The processing module 1701 is used to control and manage the actions of the terminal. The communication module 1702 is used to support communication between the terminal and other network entities (such as servers or other terminals). The input / output module 1703 is used to receive information input by the user or output information provided to the user, as well as various menus of the terminal. The storage module 1704 is used to store the terminal's program code and data.
[0168] For example, the processing module 1701 may be a processor or controller, such as a central processing unit (CPU), GPU, general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0169] The communication module 1702 can be a transceiver, transceiver circuit, input / output device, or communication interface. For example, the communication module 1702 can specifically be a Bluetooth device, a Wi-Fi device, a peripheral interface, etc.
[0170] Storage module 1704 may be a memory, which may include high-speed random access memory (RAM) or non-volatile memory, such as disk storage devices, flash memory devices or other volatile solid-state storage devices.
[0171] The input / output module 1703 can be an input / output device such as a touchscreen, keyboard, microphone, and display. Specifically, the display can be configured as a liquid crystal display (LCD), an organic light-emitting diode (OLED), or similar device. Additionally, a touchpad can be integrated into the display to collect touch events on or near it and send the collected touch information to other devices (such as a processor).
[0172] like Figure 18As shown, some other embodiments of this application disclose a terminal, which may include: a touch screen 1801, wherein the touch screen 1801 includes a touch-sensitive surface 1806 and a display screen 1807; one or more processors 1802; a memory 1803; multiple application programs 1808; and one or more computer programs 1804. The above-mentioned devices can be connected via one or more communication buses 1805. The one or more computer programs 1804 are stored in the memory 1803 and configured to be executed by the one or more processors 1802. The one or more computer programs 1804 include instructions that can be used to perform actions such as... Figure 6 And the various steps in the corresponding embodiments.
[0173] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, it can appear, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0174] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A text selection method, the method being implemented in a terminal with a touchscreen, characterized in that, include: The terminal displays a user graphical interface on the touchscreen; The terminal receives a second gesture applied to the user's graphical interface; The terminal responds to the second gesture and displays a first selection control and a selection box on the user graphical interface, wherein the first selection control includes a first cursor and a second cursor, and the first cursor and the second cursor are used to adjust the selected text; The terminal receives a first gesture from the user in the user graphical interface, where the user selects text using the selection box. In response to the first gesture, the terminal forms a closed trajectory in the user's graphical interface and marks the text of the target area corresponding to the closed trajectory; The terminal receives a click operation on a first character in the user's graphical interface, where the first character is a character outside the target area; In response to the click operation, the terminal expands the target area using the row and column where the first character is located as the boundary.
2. The method according to claim 1, characterized in that, The method further includes: The terminal receives a third gesture; In response to the third gesture, the terminal adjusts the position or size of the target area according to the third gesture.
3. The method according to claim 2, characterized in that, The method further includes: When the terminal displays the target area, at least one control block is set on the boundary of the target area.
4. The method according to claim 3, characterized in that, The third gesture is the operation of dragging the control block.
5. The method according to claim 4, characterized in that, The terminal adjusting the size of the target area according to the third gesture includes: The terminal expands or shrinks the target area along the direction in which the control block is dragged.
6. The method according to claim 1, characterized in that, In response to the first gesture, the terminal forms a closed trajectory in the user's graphical interface and marks the text of the target area corresponding to the closed trajectory, including: In response to the first gesture, the terminal determines the target area and the first target text contained in the target area; The terminal performs semantic analysis on the first target text to determine the text to be corrected that is semantically or lexically incomplete. Based on the context of the text to be corrected, the terminal corrects the semantically incomplete text to be corrected in the first target text to obtain the second target text. The terminal marks the second target text in the user's graphical interface.
7. The method according to claim 6, characterized in that, The terminal marks the second target text in the user's graphical interface, including: The terminal displays the first cursor at the beginning position of the second target text; the terminal displays the second cursor at the end position of the second target text.
8. The method according to claim 7, characterized in that, After the terminal displays the first cursor and the second cursor at the start and end positions of the second target text, respectively, the following steps are also included: The terminal receives drag operations applied to the first cursor or the second cursor; In response to the drag operation, the terminal expands the second target text to a third target text in units of words; or, in response to the drag operation, the terminal deselects the selected text in the second target text in units of words.
9. The method according to claim 8, characterized in that, After the terminal receives a drag operation applied to the first cursor or the second cursor, the method further includes: The terminal does not display the first cursor or the second cursor until it detects that the user's finger has not left the touchscreen.
10. The method according to any one of claims 1-9, characterized in that, The second gesture includes a long press gesture.
11. The method according to any one of claims 1-9, characterized in that, The user graphical interface is a short message interface; or The user graphical interface is an interface that includes images; or The user graphical interface is an interface that includes images and text.
12. A terminal, comprising a touchscreen, a memory, one or more processors, multiple applications, and one or more programs; wherein the one or more programs are stored in the memory; characterized in that, The terminal is used to perform the text selection method as described in any one of claims 1 to 11.
13. A computer-readable storage medium storing instructions, characterized in that, When the instruction is executed on a terminal, the terminal causes the terminal to perform the text selection method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Computer-implemented method for manipulating onscreen data
CN102455863A
Cursor positioning method and touch screen device
CN104932807A
Touch Input Cursor Manipulation
CN106095215A
Intelligent document editing system
CN106874241A
Selection of characters in a string of characters
US8656296B1