File search method and related device
By determining index words related to the similarity and frequency of search terms input by the user in the terminal device, the problem of the user entering irregular search terms is solved, and the file cannot be searched is not output, which is achieved and the user's intention is improved, thus improving the user experience .
Patent Information
- Application Number
- CN202410188725.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-01
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-08-01
AI Technical Summary
In the terminal device, the search terms entered by the user are not standardized, semantic errors or typos make it impossible to search for matching files, resulting in poor user experience.
By determining N index words that satisfy the similarity to the search terms entered by the user in the M index words stored locally in the terminal device, and determining the target index words to output according to the word frequency and the search history of the file type of these index words, the target index words are determined to output according to the word frequency and search history of the file type of these index words. The corresponding index file.
It realizes that when the user enters a search term without search results, it can output an index file that meets the user's search intention, which improves the user experience.
Smart Images

Figure CN118295968B_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202210920196.0, and the original application date is August 1, 2022. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of terminal technology, and in particular to a file search method and related devices. Background Art
[0003] A terminal device can store a large number of files, such as images, videos, audios, etc. A user can search for the required files in the terminal device. For example, a user can enter a search term in a search box corresponding to the terminal device, so that the terminal device searches for the corresponding target file based on the search term entered by the user and outputs the target file.
[0004] When searching for files, there may be problems such as non-standard search terms, semantic errors or typos entered by the user, which may result in the terminal device being unable to search for matching files based on the search terms entered by the user. In the prior art, a fuzzy search can usually be performed on the search terms entered by the user, for example, searching for files based on a certain word in the search terms, so that the terminal device can output a target file corresponding to the search terms.
[0005] However, the files searched by the fuzzy search method may not be the files the user needs, or even contrary to the user's search intent, resulting in a poor user experience. Summary of the invention
[0006] The embodiments of the present application provide a file search method and related devices, which can output index files that meet the user's search intent, thereby improving the user experience.
[0007] In a first aspect, an embodiment of the present application provides a file search method, which is applied to a terminal device, and the method includes:
[0008] Obtain a search term input by a user; use the search term to search in M index terms; the M index terms are index terms stored locally on a terminal device; when search results cannot be found in the M index terms using the search term, determine N index terms in the M index terms whose similarity to the search term meets a first preset condition; N is less than or equal to M, and N is an integer greater than 1; determine a target index term in the N index terms that meets a second preset condition; wherein any of the index terms corresponds to at least one index file, and the second preset condition is related to the word frequency of each of the N index terms, and for the word frequency of a first index term in the N index terms, the word frequency of the first index term is related to one or more of the following contents of the Q index files corresponding to the first index term: the file type of each of the Q index files, and the number of times each of the file types has been searched in the search history; and output the index file corresponding to the target index term. In this way, when the search term entered by the user cannot find search results, the terminal device can use the search term to determine the target index term whose term frequency meets the second preset condition, and the term frequency is related to the file type and / or the number of times the file type is searched, thereby realizing the use of the search term entered by the user to predict the user's search intention, thereby outputting an index file that meets the user's search intention, and improving the user experience.
[0009] In a possible implementation, the Q index files correspond to L file types, and the word frequency is specifically related to L first ratios and / or L second ratios, wherein the L file types correspond to the first ratio and / or the second ratio respectively; for the first file type among the L file types: the first ratio of the first file type is positively correlated with the number of index files of the first file type stored in the terminal device, and negatively correlated with the total number of index files stored in the terminal device; the second ratio of the first file type is positively correlated with the number of times the index files of the first file type are searched within a preset time length, and negatively correlated with the number of times other types of index files in the terminal device except the first file type are searched within the preset time length. In this way, the terminal device can determine the word frequency of the index word according to the number of index files stored and / or the number of times the index files are searched, so that the index file output by the terminal device is more in line with the user's search intention.
[0010] In a possible implementation, the first ratio of the first file type is the ratio of the first value to the total number of index files stored in the terminal device, the first value being the number of index files of the first file type stored in the terminal device; the second ratio of the first file type is the ratio of the second value to the third value, the second value being the number of times the index files of the first file type are searched within a preset time period, and the third value being related to the number of times index files of other types except the first file type in the terminal device are searched within the preset time period. In this way, the target index term related to the search term input by the user determined by the terminal device is more accurate.
[0011] In a possible implementation, the third value is the sum of a dynamic parameter and the number of times that index files of other types except the first file type in the terminal device are searched within the preset time period, and the dynamic parameter changes with the change of the first proportion of the first file type, so that the difference between the first proportion of the first file type and the second proportion of the first file type is less than a preset threshold. In this way, the difference between the first proportion and the second proportion is controlled by using a dynamic parameter, so that the weights of the first proportion and the second proportion in the frequency of the index words are equal, further improving the fit between the index file output by the terminal device and the user's search intent.
[0012] In a possible implementation, the second ratio of the first file type satisfies the following formula:
[0013]
[0014] The x is the number of times the index file of the first file type is searched within the preset time length, y is the number of times the index files of other types except the first file type in the terminal device are searched within the preset time length, and λ is a dynamic parameter. In this way, the second ratio of file types is represented by the sigmoid function, so that the value interval of the function corresponding to the second ratio of file types is [0, 1), which is the same as the value interval of the function corresponding to the first ratio, thereby improving the accuracy of the frequency of index terms.
[0015] In a possible implementation, the word frequency of the first index word satisfies the following formula:
[0016]
[0017] The X i is the number of index files corresponding to the i-th file type in the L file types in the Q index files, and the p i is the first proportion of the i-th file type among the L file types, and the h iis the second proportion of the i-th file type in the L file types. In this way, the terminal device can determine the frequency of the index term according to the user's search preference for different file types, which can effectively improve the accuracy of the target index term determined according to the search term input by the user.
[0018] In a possible implementation, the terminal device pre-maintains one or more of the following items of the Q index files: the first ratio corresponding to each of the L file types, the second ratio corresponding to each of the L file types, and the number of index files corresponding to each of the L file types in the Q index files. In this way, the terminal device can quickly determine the frequency of the index word, thereby improving the speed at which the terminal device outputs the index file corresponding to the target index word.
[0019] In a possible implementation, before obtaining the search term input by the user, the method further includes: displaying a negative one screen interface or a memo search interface; the negative one screen interface or the memo search interface includes a search box; and receiving the search term input by the user in the search box. In this way, the terminal device can quickly and accurately obtain the index file in the negative one screen interface and the memo interface.
[0020] In a possible implementation, when the terminal device uses the first search term to search for files, the file types of the index files include one or more of the following: images, videos, audios, documents, memos, and text messages; the first search term is the search term entered by the user in the search box of the negative one screen display interface; when the terminal device uses the second search term to search for files, the file types of the index files include one or more of the following: text, images, and voices; the second search term is the search term entered by the user in the search box of the memo search interface. In this way, the terminal device can accurately output index files corresponding to different display interfaces according to the search term entered by the user.
[0021] In a possible implementation, determining the target index words that meet the second preset condition from the N index words includes: determining W target index words from the N index words, where W is less than or equal to N, W is an integer greater than or equal to 1, and the W target index words are the first W index words in descending order of frequency. In this way, the number of index files output by the terminal device can be controlled, and the index files output by the terminal device are more in line with the user's search intent.
[0022] In a possible implementation, determining N index words whose similarity to the search word satisfies a first preset condition among the M index words includes: determining N index words whose similarity is greater than or equal to a similarity threshold among the M index words. In this way, the N index words determined by the terminal device are related to the search word input by the user.
[0023] In a second aspect, an embodiment of the present application provides a file search device. An embodiment of the present application provides a file search device, which may be a terminal device or a chip or chip system in a terminal device. The file search device may include a display unit and a processing unit. When the file search device is a terminal device, the display unit may be a display screen. The display unit is used to perform the display step so that the terminal device implements the display-related method described in the first aspect or any possible implementation of the first aspect, and the processing unit is used to implement any method related to processing in the first aspect or any possible implementation of the first aspect. When the file search device is a terminal device, the processing unit may be a processor. The file search device may also include a storage unit, which may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit so that the terminal device implements a method described in the first aspect or any possible implementation of the first aspect. When the video processing device is a chip or chip system in a terminal device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit so that the terminal device implements a method described in the first aspect or any possible implementation of the first aspect. The storage unit may be a storage unit within the chip (eg, a register, a cache, etc.), or a storage unit within the terminal device that is located outside the chip (eg, a read-only memory, a random access memory, etc.).
[0024] Exemplarily, a processing unit is used to obtain a search term input by a user; and is also used to use the search term to search in M index terms; the M index terms are index terms stored locally on a terminal device; and is also used to determine, when search results cannot be found in the M index terms using the search term, N index terms whose similarity with the search term meets a first preset condition among the M index terms; N is less than or equal to M, and N is an integer greater than 1; and is also used to determine a target index term that meets a second preset condition among the N index terms; wherein any one of the index terms corresponds to at least one index file, and the second preset condition is related to the word frequency of each of the N index terms, and for the word frequency of the first index term among the N index terms, the word frequency of the first index term is related to one or more of the following contents of the Q index files corresponding to the first index term: the file type of each of the Q index files, and the number of times each of the file types has been searched in the search history; and is also used to output the index file corresponding to the target index term.
[0025] In a possible implementation, the Q index files correspond to L file types, and the word frequency is specifically related to L first ratios and / or L second ratios, wherein the L file types correspond to first ratios and / or second ratios, respectively; for the first file type among the L file types: the first ratio of the first file type is positively correlated with the number of index files of the first file type stored in the terminal device, and negatively correlated with the total number of index files stored in the terminal device; the second ratio of the first file type is positively correlated with the number of times the index files of the first file type are searched within a preset time length, and negatively correlated with the number of times index files of other types except the first file type in the terminal device are searched within the preset time length.
[0026] In one possible implementation, the first ratio of the first file type is the ratio of a first value to the total number of index files stored in the terminal device, the first value being the number of index files of the first file type stored in the terminal device; the second ratio of the first file type is the ratio of a second value to a third value, the second value being the number of times index files of the first file type are searched within a preset time length, and the third value is related to the number of times index files of other types except the first file type in the terminal device are searched within the preset time length.
[0027] In one possible implementation, the third value is the sum of a dynamic parameter and the number of times index files of other types except the first file type in the terminal device are searched within the preset time length, and the dynamic parameter changes with the change of the first proportion of the first file type so that the difference between the first proportion of the first file type and the second proportion of the first file type is less than a preset threshold.
[0028] In a possible implementation, the second ratio of the first file type satisfies the following formula:
[0029]
[0030] The x is the number of times the index file of the first file type is searched within a preset time length, y is the number of times the index files of other types except the first file type in the terminal device are searched within the preset time length, and λ is a dynamic parameter.
[0031] In a possible implementation, the word frequency of the first index word satisfies the following formula:
[0032]
[0033] The X iis the number of index files corresponding to the i-th file type in the L file types in the Q index files, and the p i is the first proportion of the i-th file type among the L file types, and the h i is the second proportion of the i-th file type among the L file types.
[0034] In one possible implementation, the terminal device pre-maintains one or more of the following items of the Q index files: a first ratio corresponding to each of the L file types, a second ratio corresponding to each of the L file types, and the number of index files corresponding to each of the L file types in the Q index files.
[0035] In one possible implementation, the display unit is used to display a negative one screen interface or a memo search interface; the negative one screen interface or the memo search interface includes a search box; and the processing unit is further used to receive the search term entered by the user in the search box.
[0036] In a possible implementation, when the terminal device uses the first search term to search for files, the file types of the index files include one or more of the following: images, videos, audios, documents, memos, and text messages; the first search term is the search term entered by the user in the search box of the negative one screen display interface; when the terminal device uses the second search term to search for files, the file types of the index files include one or more of the following: text, images, and voices; the second search term is the search term entered by the user in the search box of the memo search interface. In this way, the terminal device can accurately output index files corresponding to different display interfaces according to the search term entered by the user.
[0037] In a possible implementation, the processing unit is specifically used to determine W target index words from the N index words, where W is less than or equal to N, W is an integer greater than or equal to 1, and the W target index words are the first W index words in descending order of frequency.
[0038] In a possible implementation, the processing unit is specifically configured to determine, among the M index words, N index words whose similarity is greater than or equal to a similarity threshold.
[0039] In a third aspect, an embodiment of the present application provides a terminal device, including a processor and a memory, the memory being used to store code instructions; the processor being used to run the code instructions so that the electronic device executes the file search method described in the first aspect or any one of the implementations of the first aspect.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed, the computer executes the file search method described in the first aspect or any implementation of the first aspect.
[0041] In a fifth aspect, a computer program product includes a computer program. When the computer program is executed, the computer executes the file search method described in the first aspect or any one of the implementations of the first aspect.
[0042] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A scenario diagram provided for an embodiment of the present application Figure 1 ;
[0044] Figure 2 Scenario diagram provided for the embodiment of the present application Figure 2 ;
[0045] Figure 3 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;
[0046] Figure 4 A software structure block diagram of a terminal device provided in an embodiment of the present application;
[0047] Figure 5 A flowchart of a file search method provided in an embodiment of the present application;
[0048] Figure 6 A schematic diagram of an interface for outputting an index file provided in an embodiment of the present application Figure 1 ;
[0049] Figure 7 A schematic diagram of an interface for outputting an index file provided in an embodiment of the present application Figure 2 ;
[0050] Figure 8 A schematic diagram of a functional relationship between a first ratio and the number of files provided in an embodiment of the present application;
[0051] Fig. 9 A schematic diagram of a functional relationship between a second ratio and the number of searches provided in an embodiment of the present application;
[0052] Fig.10 A flowchart of another file search method provided in an embodiment of the present application;
[0053] Fig.11 A schematic diagram of an interface for obtaining search terms provided in an embodiment of the present application;
[0054] Fig.12 A schematic flow chart of a method for a terminal device to maintain basic information of an index file provided in an embodiment of the present application;
[0055] Fig.13 A schematic diagram of a method for maintaining search history records on a terminal device provided in an embodiment of the present application;
[0056] Fig.14 A schematic diagram of the hardware structure of a control device provided in an embodiment of the present application;
[0057] Fig.15 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The following is an explanation of the vocabulary described in the embodiments of the present application. It is understood that the explanation is for a clearer explanation of the embodiments of the present application and does not necessarily constitute a limitation on the embodiments of the present application.
[0059] Index files: files stored locally on the terminal device, including document files, image files, video files, audio files, memo files, etc.
[0060] Index word: corresponds to an index file, and an index file can include multiple index words, which can be used to describe the content, format and other information of the index file.
[0061] Term frequency: used to characterize the user's search intent, and is related to the file type of the index file corresponding to the index term and / or the number of times the file type has been searched in the search history.
[0062] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish between the same items or similar items with substantially the same functions and effects. For example, the interface of the first target function and the interface of the second target function are to distinguish between different response interfaces, and their order is not limited. Those skilled in the art can understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit them to be different.
[0063] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0064] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.
[0065] Terminal devices often store a variety of files, and as the storage capacity of terminal devices increases, the number of files that can be stored is also increasing. Users can search for stored files in terminal devices to quickly find target files.
[0066] For example, Figure 1 A scenario diagram provided for an embodiment of the present application Figure 1 The terminal device displays Figure 1 The negative one screen interface shown in the figure may include: weather information, a search box for searching local files, a quick tool control, a display box for users to display dynamic information, a display box for displaying news information, etc. Among them, the quick tool control includes a ride code control, a scan control, a payment code control, and a control for displaying more quick tools.
[0067] It is understandable that users can Figure 1 A search word is entered in the search box on the interface shown, so that the terminal device uses the search word to search for a target file in the local files stored in the terminal device. For example, a user enters the search word "seaside" in the search box, and when the user clicks the start search icon, the terminal device will display the searched files related to "seaside", and the displayed files may be one or more of images, videos, audios, etc.
[0068] However, when using the above Figure 1When searching for files in the interface shown, during the process of entering the search term, special characters, typos, etc. may appear in the entered search term due to accidental touch or typos, making it impossible for the terminal device to find files that match the search term entered by the user, that is, search results cannot be returned for the search term entered by the user, affecting the user experience.
[0069] In view of this, an embodiment of the present application provides a file search method, when a terminal device cannot search for search results using a search term input by a user, the terminal device determines N index terms whose similarity with the search term input by the user meets a first preset condition among the stored M index terms, and outputs an index file corresponding to a target index term whose word frequency meets a second preset condition among the N index terms, so that the terminal device can return search results, and the search results returned have a certain correlation with the search term input by the user. Considering that users have different search preferences for different file types, the word frequency of an index term is related to each file type of the corresponding index file and the number of times each file type has been searched in the search history, so that the index file output for the word frequency of the index term is more in line with the user's search intention, effectively improving the user experience.
[0070] Exemplarily, the file search method provided in the embodiment of the present application can also be applied to the following Figure 2 In the scene shown. Figure 2 Scenario diagram provided for the embodiment of the present application Figure 2 When the terminal device receives the user's operation of opening the memo application, it can display the following Figure 2 The interface shown in a in the figure includes a control for switching the display mode of the memo file, a search box corresponding to the memo file search, multiple memo files, a control for creating a new memo file, a control for displaying notes, and a control for displaying to-do items. The multiple memo files include: memo content 1, memo content 2, memo content 3, memo content 4, memo content 5, memo content 6, etc. The creation time of each memo file is displayed around the memo file.
[0071] like Figure 2 In the interface shown in a of FIG. 1 , when the terminal device obtains the search word “circuit diagram” entered by the user in the search box corresponding to the memo file search, the terminal device searches for the search word in the index words of all memo files stored in the terminal device, and when an index word matching “circuit diagram” is found, the target memo file corresponding to the index word is output, that is, the following is displayed: Figure 2The interface shown in b in FIG. The interface may include: a control for switching the display mode of the memo file, a search box corresponding to the search memo file, two memo files, a control for displaying notes, and a control for displaying to-do items. Among them, the two memo files displayed in the interface are memo content 5 and memo content 3, and the creation time of memo content 5 is earlier than that of memo content 3. It can be understood that the index terms of memo content 5 and memo content 3 are respectively related to the search term "circuit diagram", and the relevance of memo content 5 is greater than the relevance of memo content 3. For example, memo content 5 can be a memo file of circuit diagram (trial), and memo content 3 can be a memo file of circuit schematic diagram.
[0072] It is understandable that the index words corresponding to the memo file may be related to the content of the memo file, and one memo file may correspond to multiple index words. The embodiment of the present application does not specifically limit the content and number of index words corresponding to the memo file. Figure 2 On the interface shown in b, select the required circuit to view, modify, and perform other operations.
[0073] It is understandable that in the above Figure 1 and Figure 2 In the corresponding scenario embodiments, a mobile phone as the terminal device is used as an example for illustration, and this example does not constitute a limitation of the embodiments of the present application.
[0074] It is understandable that the above terminal devices may also be referred to as terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. The terminal devices may be mobile phones with MIC, smart TVs, wearable devices, tablet computers (Pad), computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of the present application do not limit the specific technology and specific device form used by the terminal devices.
[0075] Therefore, in order to better understand the embodiment of the present application, the structure of the terminal device of the embodiment of the present application is introduced below. Figure 3 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application.
[0076] The terminal device may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, an indicator 192, a camera 193, and a display screen 194, etc.
[0077] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the terminal device. In other embodiments of the present application, the terminal device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0078] The processor 110 may include one or more processing units. Different processing units may be independent devices or integrated into one or more processors. The processor 110 may also be provided with a memory for storing instructions and data.
[0079] The USB interface 130 is an interface that complies with the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the terminal device, and can also be used to transfer data between the terminal device and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0080] The charging management module 140 is used to receive charging input from a charger, which may be a wireless charger or a wired charger. The power management module 141 is used to connect the charging management module 140 to the processor 110 .
[0081] The wireless communication function of the terminal device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0082] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. The antenna in the terminal device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna.
[0083] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to terminal devices. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
[0084] The wireless communication module 160 can provide wireless communication solutions applied to terminal devices, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), etc.
[0085] The terminal device realizes the display function through the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering.
[0086] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the terminal device may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0087] The terminal device can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0088] The camera 193 is used to capture static images or videos. In some embodiments, the terminal device may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0089] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
[0090] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 can include a program storage area and a data storage area.
[0091] The terminal device can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.
[0092] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The speaker 170A, also known as the "speaker", is used to convert audio electrical signals into sound signals. The terminal device can listen to music or listen to hands-free calls through the speaker 170A. The receiver 170B, also known as the "earpiece", is used to convert audio electrical signals into sound signals. When the terminal device answers a call or voice message, the voice can be answered by placing the receiver 170B close to the human ear. The headphone interface 170D is used to connect wired headphones.
[0093] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. In the embodiment of the present application, the terminal device can receive a sound signal for waking up the terminal device based on microphone 170C, and convert the sound signal into an electrical signal that can be subsequently processed. The terminal device can have at least one microphone 170C.
[0094] The sensor module 180 may include one or more of the following sensors, for example: a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, or a bone conduction sensor, etc. ( Figure 3 not shown).
[0095] The button 190 includes a power button, a volume button, etc. The button 190 may be a mechanical button. It may also be a touch button. The terminal device may receive the button input and generate a key signal input related to the user settings and function control of the terminal device. The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, message, missed call, notification, etc.
[0096] The software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture, etc. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the terminal device 100.
[0097] Figure 4A software structure block diagram of a terminal device provided in an embodiment of the present application.
[0098] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime and system library, hardware abstraction layer, and kernel layer.
[0099] The application layer can include a series of application packages. Figure 4 As shown, the application package may include applications such as phone, email, calendar, camera, etc.
[0100] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0101] like Figure 4 As shown, the application framework layer may include a window manager, an activity manager, a location manager, a package manager, a notification manager, a resource manager, a phone manager, a view system, and a frame rate decision manager, etc.
[0102] The window manager service (WMS) is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0103] The activity manager is used to manage the life cycle of each application and the navigation back function. It is responsible for creating the Android main thread and maintaining the life cycle of each application.
[0104] The location manager is used to provide location services to applications, including querying the last known location, registering and unregistering from a periodic location update, etc.
[0105] The package manager is used for program management within the system, such as application installation, uninstallation, and upgrades.
[0106] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, the terminal device vibrates, the indicator light flashes, etc.
[0107] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0108] The phone manager is used to manage mobile device functions, including: mobile phone call status, obtaining phone information (device, SIM card, network information), monitoring phone status, and calling the phone dialer to make calls
[0109] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0110] The frame rate decision manager is used to determine the screen refresh frame rate of the terminal device and select the switching method of the screen refresh frame rate.
[0111] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0112] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0113] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection. The virtual machine also runs a display synthesis process (for example, surfaceflinger). The display synthesis process is used to control the synthesis of images.
[0114] The system library can include multiple functional modules, such as image drawing module, image rendering module, image synthesis module, function library and media library.
[0115] The image drawing module is used for drawing two-dimensional or three-dimensional images. The image rendering module is used for rendering two-dimensional or three-dimensional images. The image synthesis module is used for synthesizing two-dimensional or three-dimensional images.
[0116] In a possible implementation, the application draws the image through the image drawing module, and then the application renders the drawn image through the image rendering module, and then the application sends the rendered image to the cache queue of the display synthesis process. Whenever Vsync arrives, the display synthesis process (for example, surface flinger) sequentially obtains a frame of image to be synthesized from the cache queue, and then synthesizes the image through the image synthesis module.
[0117] The function library provides macros, type definitions, string manipulation functions, mathematical calculation functions, and input and output functions used in the C language.
[0118] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0119] The hardware abstraction layer can contain multiple library modules, such as the hardware configuration module (hwcomposer, HWC), the camera library module, etc. The Android system can load the corresponding library module for the device hardware, thereby enabling the application framework layer to access the device hardware. Device hardware can include LCD screens, cameras, etc. in electronic devices.
[0120] The kernel layer is the layer between hardware and software. The kernel layer is used to drive the hardware to make it work. The kernel layer includes at least LCD / LED driver, display driver, audio driver, camera driver and sensor driver.
[0121] Hardware can be audio devices, Bluetooth devices, camera devices, sensor devices, etc.
[0122] For example, Figure 5 A flowchart of a file search method provided in an embodiment of the present application. Figure 5 As shown, the file search method includes the following steps:
[0123] S501: The terminal device obtains a search term input by a user.
[0124] In the embodiment of the present application, the search term entered by the user can be used to search for local files of the terminal device, and the search term can be a term related to the file that the user needs to search. For example, if the user wants to search for photos of puppies, the search term entered can be "puppy". If the user wants to search for memo notes recorded on a certain day, the search term entered can be the date when the memo file was created. The embodiment of the present application does not specifically limit the search term entered by the user.
[0125] Exemplarily, the search term obtained by the terminal device is input by the user in the search box of the negative one screen interface, or the user enters the search box of the memo search interface. The scenario in which the terminal device obtains the search term in the search box of the negative one screen interface can be referred to above. Figure 1 As shown, the scenario in which the terminal device obtains the search word in the search box of the memo search interface can be referred to above Figure 2 shown.
[0126] S502: The terminal device searches M index words using the search word.
[0127] In an embodiment of the present application, M index words are index words stored locally on a terminal device, and the index words may correspond to a local index file stored on the terminal device, and one index file may correspond to multiple index words. Index words include, but are not limited to, the name of the index file, the content of the index file, keywords of the index file, and an abstract representation of the index file. Among them, the abstract representation of the index file may be based on keywords abstracted from the content of the index file. For example, if the index file is a photo of a road, the corresponding index words may include "road", "vehicle", etc. The embodiment of the present application is only illustrated by taking the above-mentioned index words as an example, and the example does not constitute a limitation on the embodiment of the present application.
[0128] Exemplarily, when the terminal device uses a search word to search among M index words, the search word can be compared with the M index words to search for a corresponding index file.
[0129] It is understandable that if the search term input by the user has a typo or semantic error, the terminal device cannot search for search results according to the search term. In this case, the terminal device may perform the following step S503:
[0130] S503. When no search results can be found using the search term in the M index terms, the terminal device determines N index terms in the M index terms whose similarity with the search term meets a first preset condition; N is less than or equal to M, and N is an integer greater than 1.
[0131] Exemplarily, the similarity between the indexed word and the search word can be determined by the pinyin of the indexed word and the search word, or can be determined by the glyphs of the indexed word and the search word, or the edit distance between the two words. For example, if the search word is "没丽" and the indexed word is "美丽", if the similarity between the two is determined by glyphs, the similarity can be about 50%; if the similarity between the two is determined by pinyin, the similarity can be more than 90%. The embodiments of the present application do not specifically limit the method for determining the similarity between the indexed word and the search word.
[0132] Exemplarily, the first preset condition can be related to one or more of the following: the number of indexed words stored locally in the terminal device, the number of index files stored locally in the terminal device, and the storage space of the terminal device. The embodiments of the present application only take the above as an example for illustration, and this example does not constitute a limitation on the embodiments of the present application.
[0133] S504. The terminal device determines a target indexed word that meets the second preset condition among the N indexed words.
[0134] In the embodiments of the present application, any indexed word corresponds to at least one index file. The second preset condition is related to the word frequency of each of the N indexed words. For the word frequency of the first indexed word among the N indexed words, the word frequency of the first indexed word is related to one or more of the following contents of the Q index files corresponding to the first indexed word: the file type of each of the Q index files, and the number of times each file type has been searched in the search history.
[0135] It can be understood that the file type can be understood as the format of the file. For example, the file type can include types such as images, audio, and text. Different users have different search preferences for different file types, and the word frequency of the first indexed word is related to the file type of each of the Q index files corresponding to the first indexed word, and / or the number of times each file type has been searched in the search history. Therefore, the word frequency of the indexed word can represent the user's search intention.
[0136] The number of target indexed words determined by the terminal device is an integer greater than or equal to 1 and less than or equal to N. The embodiments of the present application do not specifically limit the number of target indexed words of the terminal device.
[0137] S505. The terminal device outputs the index file corresponding to the target indexed word.
[0138] It can be understood that based on the above step S504, any indexed word corresponds to at least one index file, then the terminal device outputs at least one index file. Taking Figure 1 the scenario shown as an example, different numbers of index files output by the terminal device can have different output methods. Taking the number of target indexed words equal to 1 as an example, the specific method for the terminal device to output the index file can be referred to Figure 6 and Figure 7 as shown Figure 6 The figure is a schematic diagram of an interface for outputting an index file provided by an embodiment of the present application Figure 1 . Figure 7 The figure is a schematic diagram of an interface for outputting an index file provided by an embodiment of the present application Figure 2 .
[0139] In a possible implementation, when there is 1 index file corresponding to the target index term, the interface of the terminal device for outputting the index file can be seen in Figure 6 as shown. The terminal device uses the search term "Research 9 High High" in the search box in the interface shown in Figure 6 a to determine that the target index term is "Research Report", and the number of index files corresponding to this target index term is 1. When the terminal device outputs the index file corresponding to this target index term, it can display the interface shown in Figure 6 b or Figure 6 the interface shown in c. Among them, Figure 6 the interface shown in b includes weather information, a search box for searching local storage files, and a control for the index file corresponding to the target index term. This index file includes the file type and the file name, that is, this index file is a word file with the file name of Research Report Figure 6 The interface shown in c includes the content of the index file corresponding to the target index term. It can be understood that when there is 1 index file corresponding to the target index term, the control corresponding to this index file can be displayed, or the content of the index file can be directly displayed
[0140] In a possible implementation, when the number of index files corresponding to the target index term output by the terminal device is an integer greater than or equal to 2, the interface of the terminal device for outputting the index file can be seen in Figure 7 as shown. The terminal device uses the search term "Key ahi" in the search box in the interface shown in Figure 7 a to determine that the target index term is "Key", and the index files corresponding to this target index term include 3 image files and 2 document files. When the terminal device outputs the index files corresponding to this target index term, the terminal device can display the interface shown in Figure 7 b or Figure 7 the interface shown in c. Among them, Figure 7 the interface shown in b and Figure 7 the interface shown in C both include weather information, a search box for searching local storage files, and a control for the index file corresponding to the target index term
[0141] In Figure 7In the interface shown in b, index files are displayed in order of their file types, and document files are displayed below image files. It is understandable that the total number of index files contained in image files is greater than the total number of index files contained in document files, or the number of times image files are searched in the search history is greater than the number of times document files are searched in the search history. Among them, the arrangement of the three image files from left to right can be sorted according to the size of the image files, creation date, etc., for example, in order from large to small files, or in order from early to late creation time of the files. Figure 7 In the interface shown in c, the index files can be sorted by creation time regardless of file type.
[0142] In an embodiment of the present application, the number of target index terms may be an integer greater than 1. When the terminal device outputs index files corresponding to multiple target index terms, the terminal device may display the corresponding index files in descending order according to the word frequencies corresponding to the multiple target index terms. For example, the terminal device determines target index term 1 and target index term 2, and the word frequency of target index term 1 is greater than the word frequency of target index term 2. When the terminal device outputs index files corresponding to two target index terms, the file corresponding to target index term 1 may be displayed first and the file corresponding to target index term 2 may be displayed later, wherein the display method of the index file corresponding to each target index term may refer to the above description. Figure 7 The interface shown in b or Figure 7 The interface shown in c.
[0143] In a possible implementation, when the terminal device outputs index files corresponding to multiple target index words, the terminal device can classify the output index files according to the files and display multiple file types on the interface. The index words contained in each file type may correspond to the same index word or may correspond to different index words. Figure 6 The interface shown in b in . Among them, in each file type, the index files are arranged in descending order according to the frequency of their index terms. For example, the terminal device determines three target index terms, which are target index term A, target index term B and target index term C in descending order of frequency, and the index file corresponding to target index term A includes document 1 and document 2, the index file corresponding to target index term B includes document 3, image 1 and image 2, and the index file corresponding to target index term C includes audio 1 and document 4. When the terminal device outputs the index file corresponding to the target index term, the interface of the terminal device can be arranged in the order of document, image, audio, wherein the documents are arranged in the order of document 1, document 2, document 3, document 4, and the images are arranged in the order of image 1, image 2.
[0144] Based on this, the terminal device determines the target index word based on the similarity between the M index words stored locally and the search word and the frequency of the index word, and the frequency of the index word is related to the file type of the corresponding index file and / or the number of times each file type has been searched in the search history. The terminal device can search for the target index word as a new index word and output the index file corresponding to the target index word, so that the terminal device can predict the user's search intention based on the search word entered by the user, and output an index file that is more in line with the user's search intention, thereby improving the user experience.
[0145] In the embodiment of the present application, different search scenarios correspond to different file types. When the terminal device uses the first search term to search for files, the file types of the indexed files include images, videos, audios, documents, memos, text messages, etc. The first search term is the search term entered by the user in the search box of the negative one screen display interface, that is, the user enters the search term in the search box. Figure 1 When the terminal device uses the second search term to search for files, the file types of the index files include one or more of the following: text, image, voice, etc. The second search term is the search term entered by the user in the search box of the memo search interface, that is, the user enters the search term in the search box of the memo search interface. Figure 2 The memo search interface shown in a in the figure is used to search for memo files. It is understandable that the text content in the image file can be recognized by OCR (Optical Character Recognition) to create index words corresponding to the image according to the recognized text content.
[0146] Optional, in Figure 5 On the basis of the corresponding embodiment, when determining N index words, the terminal device may determine N index words whose similarity is greater than or equal to the similarity threshold among the M index words. The similarity threshold may be set according to actual conditions.
[0147] Exemplarily, the terminal device may store a correspondence between a similarity threshold and a terminal device parameter, so that the similarity threshold can change with changes in the terminal device parameter. The correspondence may be a correspondence between multiple specific similarity thresholds and terminal device parameters, or a functional relationship between the similarity threshold and the terminal device parameter. The terminal device parameter may include one or more of the number of index words stored locally on the terminal device, the number of index files stored locally on the terminal device, and the storage space of the terminal device.
[0148] It is understandable that the terminal device pre-stores a functional relationship between the similarity threshold and the terminal device parameters, and the similarity threshold can be dynamically changed. For example, the similarity threshold is negatively correlated with the number of index words stored locally on the terminal device or the number of index files stored locally on the terminal device. When the number of index words stored locally on the terminal device or the number of index files stored locally on the terminal device increases, the similarity threshold can be controlled to decrease, and vice versa, the similarity threshold can be controlled to increase.
[0149] Optional, in Figure 5 On the basis of the corresponding embodiments, when determining the target index words, the terminal device can determine W target index words from N index words in the embodiments of the present application, where W is less than or equal to N, W is an integer greater than or equal to 1, and the W target index words are the first W index words in descending order of frequency.
[0150] In a possible implementation, when W is equal to 1, the target index word is the first index word in the descending order of frequency, that is, the index word with the highest frequency. The terminal device determines the index word with the highest frequency as the target index word, which effectively controls the number of output index files, helps users quickly find the required index files, and reduces the display pressure of the terminal device.
[0151] In a possible implementation, W is an integer greater than or equal to 2. The index files output by the terminal device are index files corresponding to the W target index words, respectively, and can display as many index files that meet the user's search intent as possible, so that the user can still find the required index file when the search word entered is wrong.
[0152] In an embodiment of the present application, the terminal device can output an index file of W index words with higher word frequency, so that the output index file is more in line with the user's search intention, and can accurately output the index file required by the user even if there are typos in the search words entered by the user.
[0153] In order to facilitate understanding of the relationship between the frequency of index words and the file type in the embodiment of the present application, the relationship between the frequency of index words and each file type is described in detail below with reference to specific examples.
[0154] Exemplarily, Q index files correspond to L file types, and the word frequency is specifically related to L first proportions and / or L second proportions, wherein the L file types correspond to the first proportions and / or the second proportions respectively. For the first file type among the L file types:
[0155] The first ratio of the first file type is positively correlated with the number of index files of the first file type stored in the terminal device, and negatively correlated with the total number of index files stored in the terminal device; the second ratio of the first file type is positively correlated with the number of times the index files of the first file type are searched within a preset time length, and negatively correlated with the number of times index files of other types except the first file type in the terminal device are searched within the preset time length.
[0156] For example, the file types of index files stored in the terminal device include memos, images, and audios. There are a memo files, b image files, and c audio files stored in the terminal device. In the search history, the number of times the memo file is searched within the preset time length is d, the number of times the image file is searched within the preset time length is e, and the number of times the audio file is searched within the preset time length is f. Assuming that Q index files correspond to the above three file types, for the first file type memo, its first ratio is positively correlated with the number of index files a, and negatively correlated with the total number of index files a+b+c; the second ratio corresponding to the memo is positively correlated with the number of times d it is searched within the preset time length, and negatively correlated with the number of times e+f other types of index files other than the memo are searched within the preset time length.
[0157] Further, the first ratio of the first file type is the ratio of the first value to the total number of index files stored in the terminal device, and the first value is the number of index files of the first file type stored in the terminal device. The second ratio of the first file type is the ratio of the second value to the third value, and the second value is the number of times the index files of the first file type are searched within a preset time length, and the third value is related to the number of times the index files of other types except the first file type in the terminal device are searched within a preset time length. The ratio of the number of index files of each file type to the total number of index files can characterize the relationship between the number of index files and the word frequency to a certain extent, and fully considers that the file type with a larger first ratio value may be a file type with a stronger user search intention. In addition, the number of times the index files of each file type are searched within a preset time length can reflect the user's search preference for different file types. Therefore, the terminal device determines the word frequency using the first ratio and the second ratio of each file type, so that the index file output according to the word frequency is more in line with the user's search intention, thereby improving the user experience.
[0158] It is understandable that the preset duration can be one week, one month, one year, or the duration that the user has used the terminal device until the current moment. The specific setting can be based on actual conditions. The embodiment of the present application does not specifically limit the preset duration.
[0159] Exemplarily, the third value in the second ratio can be the sum of the dynamic parameter and the number of times that index files of other types except the first file type in the terminal device are searched within a preset time length, and the dynamic parameter changes with the change of the first ratio of the first file type, so that the difference between the first ratio of the first file type and the second ratio of the first file type is less than the preset threshold. It can be understood that the dynamic parameters corresponding to different file types can be the same or different, and can be set according to actual conditions. The embodiment of the present application does not specifically limit the dynamic parameters. The preset threshold can be set according to actual conditions.
[0160] For example, the file types of the index files stored in the terminal device include memos, images, and audios, and the terminal device stores a memo files, b image files, and c audio files. In the search history, the number of times the memo files are searched within the preset time length is d, the number of times the image files are searched within the preset time length is e, and the number of times the audio files are searched within the preset time length is f. The dynamic parameters corresponding to each file type are λ. The first ratio of the memo can be expressed as p 1 =a / (a+b+c), the first ratio of the image can be expressed as p 2 =b / (a+b+c), the first ratio of the audio can be expressed as p 3 =c / (a+b+c). The second ratio of the memorandum can be expressed as h 1 =d / (e+f+λ), the second ratio of the image can be expressed as h 2 =e / (d+f+λ), the second ratio of the audio can be expressed as h 3 =f / (d+e+λ).
[0161] In a possible implementation, in order to map the second proportion value of the first file type into the interval [0, 1], a sigmoid function may be introduced so that the second proportion of the first file type satisfies the following formula (1):
[0162]
[0163] Wherein, x is the number of times the index file of the first file type is searched within the preset time length, y is the number of times the index files of other types except the first file type in the terminal device are searched within the preset time length, and λ is a dynamic parameter. By introducing the sigmoid function, the function corresponding to the second ratio can be monotonically increasing, and the value range corresponding to the function is [0, 1).
[0164] It can be understood that in the above example, the second proportions of each file type after the introduction of the sigmoid function are:
[0165]
[0166] The embodiments of the present application can explain the dynamic parameters in detail through specific examples. For example, the sum of the number of image files and audio files stored in the terminal device is 5, the sum of the number of times the image files and audio files are searched in the search history is 5, and the sum of the number of image files and audio files and the sum of the number of times they are searched are fixed. The number of memo files and the number of times they are searched are dynamically changing. Under the above conditions, the relationship between the first ratio of the memo and the number of memo files can be seen in Figure 8 As shown, Figure 8 The following is a schematic diagram of a functional relationship between a first ratio and the number of files provided in an embodiment of the present application. The dynamic parameter λ corresponding to the memo is set to 5. The relationship between the second ratio of the memo and the number of times the memo is searched in the search history can be found in Fig. 9 As shown, Fig. 9 A schematic diagram of the functional relationship between a second ratio and the number of searches provided in an embodiment of the present application.
[0167] like Figure 8 As shown, the first ratio of the memo is positively correlated with the number of memo files, and the functional relationship between the first ratio of the memo and the number of memo files is not a positive proportional functional relationship. Fig. 9 As shown, the second ratio of the memo is positively correlated with the number of times the memo is searched in the search history, and the functional relationship between the second ratio of the memo and the number of times the memo is searched in the search history is not a positive proportional functional relationship. By setting the dynamic parameter λ = 5, Figure 8 The slope of the function curve shown is Fig. 9 The slopes of the function curves shown are almost the same, that is, the difference between the two slopes is less than a specific value, so that the difference between the first scale of the memo and the second scale of the memo is less than a preset threshold.
[0168] It can be understood that the main purpose of setting dynamic parameters is to make the changing trends of the function corresponding to the first proportion of file types and the function corresponding to the second proportion of file types almost consistent, so as to ensure that the number of index files and the number of times the index files are searched maintain a similar proportion in the frequency of index terms.
[0169] In a possible implementation, the word frequency of the first index word is related to the file type of each of the Q index files corresponding to it, that is, the word frequency of the first index word is related to the first ratio of the above L file types.
[0170] In a possible implementation, the word frequency of the first index word is related to the number of times each file type of the Q index files corresponding to it is searched in the search history, that is, the word frequency of the first index word is related to the second ratio of the above L file types. The terminal device can use the above formula (2) to determine the second ratio of each file type, and determine the word frequency of the first index word through the L second ratios. For example, the sum or product of the L second ratios can be determined as the word frequency of the first index word.
[0171] In a possible implementation, the frequency of the first index term is related to the file types of the Q index files corresponding to it and the number of times each file type has been searched in the search history. The terminal device can determine the frequency of the first index term according to the following formula (2):
[0172]
[0173] Among them, X i is the number of index files corresponding to the i-th file type in the L file types in the Q index files, p i is the first proportion of the i-th file type among L file types, h i is the second proportion of the i-th file type among the L file types.
[0174] For example, the terminal device stores 1 memo file, 2 image files, and 2 audio files, and the number of memo searches in the search history is 2, the number of images searches in the search history is 1, and the number of audio searches in the search history is 0. The dynamic parameter λ=1. According to the above formula (2), the frequency of any index word corresponding to the memo file is
[0175] In an embodiment of the present application, the frequency of an index term is determined by the proportion of the number of index files in each file type corresponding to the index term and the proportion of the number of searches in historical searches, thereby predicting the user's search intent based on the user's search preferences for different file types. When the user enters a search term for which there is no search result, the terminal device can output the index file that the user may need predicted by using the search term, thereby effectively improving the user's experience of searching for files.
[0176] For example, Fig.10 A flowchart of another file search method provided in an embodiment of the present application. Fig.10 In the corresponding embodiment, an example is given in which a terminal device can calculate the frequency of index words in real time, and this example does not constitute a limitation on the embodiments of the present application.
[0177] like Fig.10 As shown, the file search method may include the following steps:
[0178] S1001. The terminal device obtains a search term input by a user.
[0179] In the embodiment of the present application, when the terminal device displays the negative one screen interface, the search term entered by the user in the search box in the negative one screen interface can be received. For details, see the above Figure 1 Alternatively, when the terminal device displays the memo search interface, the search term entered by the user in the search box in the memo search interface may be received. For details, see the above Figure 2 shown.
[0180] For example, when the terminal device is a computer, the terminal device obtains the search term input by the user, which can be seen in Fig.11 As shown, Fig.11 A schematic diagram of an interface for obtaining search terms provided in an embodiment of the present application. Fig.11 The interface shown in FIG. 1 may include: a search box, the name of the currently displayed file, and the files included in the current file. Fig.11 As shown, the interface currently displayed by the computer is the interface of the file AAA, and the file AAA includes the file 111 and the file 222. The computer can obtain the user's Fig.11 Enter the search term in the search box in the interface shown.
[0181] S1002: The terminal device pre-processes the search term.
[0182] In the embodiment of the present application, the purpose of preprocessing the search words is to remove invalid characters such as special characters or garbled characters in the search words. The terminal device can obtain valid words in the search words through screening processing, and the embodiment of the present application does not specifically limit the preprocessing of the search words.
[0183] S1003: The terminal device determines whether search results can be obtained using the pre-processed search terms.
[0184] Exemplarily, the terminal device may use the preprocessed search terms and M index terms stored locally on the terminal device to perform a search, and determine whether a search result can be obtained based on whether the preprocessed search terms are found.
[0185] In a possible implementation, if the preprocessed search term exists in the M index terms, the terminal device can obtain search results using the preprocessed search term, and the following step S1007 can be executed.
[0186] In a possible implementation, if the preprocessed search term does not exist in the M index terms, and the terminal device cannot obtain search results using the preprocessed search term, the following step S1004 can be executed.
[0187] S1004. The terminal device determines N index words among the M index words stored locally, whose similarity with the processed search word is greater than or equal to a similarity threshold.
[0188] In the embodiment of the present application, the terminal device can calculate the similarity between the M index words and the processed search words, and select N index words whose similarity is greater than or equal to the similarity threshold. For details, please refer to the above embodiment, which will not be repeated in the embodiment of the present application.
[0189] S1005. The terminal device determines the frequency of each of the N index words, and determines the index word with the largest frequency as the target index word.
[0190] In the embodiment of the present application, when the terminal device determines the target index word by using the word frequency of the index word, the word frequency of the index word may be calculated in real time or may be pre-calculated and stored in the terminal device.
[0191] In a possible implementation, when the terminal device calculates the word frequency of each of the N index words in real time, it can obtain one or more of the following items of Q and index files pre-maintained in the terminal device: a first ratio corresponding to each of the L file types, a second ratio corresponding to each of the L file types, and the number of index files corresponding to each of the L file types in the Q index files, and calculate the word frequency of the N index words based on the relationship between the above-mentioned word frequency and file type.
[0192] For example, the terminal device obtains the first ratio corresponding to each of the L file types maintained in advance, the second ratio corresponding to each of the L file types, and the number of index files corresponding to each of the L file types in the Q index files, and uses the above formula (2) to calculate the word frequency of each of the N index words.
[0193] In a possible implementation, the terminal device may directly obtain the word frequencies of N index words stored locally in the terminal device, and the word frequencies of the N index words may be pre-maintained by the terminal device.
[0194] It is understandable that information determining the frequency of index terms may be pre-maintained in the terminal device, for example, the file types corresponding to the index terms, the number of index files in each file type, the number of times each file type has been searched in the search history, the first ratio of each file type, the second ratio of each file type, etc.
[0195] Exemplarily, the terminal device may determine the index word with the highest frequency as the target index word, so that the determined target index word is closer to the search word that the user wants to input, thereby predicting the user's search word and outputting an index file that meets the user's search intent.
[0196] S1006. The terminal device searches for files using the target index term.
[0197] Exemplarily, the terminal device may use the target index word as a new search word to search for the index file corresponding to the target index word, or the terminal device may directly obtain the index file corresponding to the target index word according to the correspondence between the index word and the index file.
[0198] S1007. The terminal device outputs the search results.
[0199] In a possible implementation, the terminal device searches for a corresponding index file using the preprocessed search term, and then the terminal device outputs the index file.
[0200] In a possible implementation, if the terminal device fails to find a corresponding index file using the preprocessed search term, the terminal device outputs the index file corresponding to the target index term.
[0201] The method for the terminal device to output the search results is the same as the method corresponding to step S505 in the above embodiment, and the embodiment of the present application will not be repeated here.
[0202] In summary, when the search terms entered by the user cannot find search results, the terminal device can determine the target index terms by determining the frequency of the local index terms stored in the terminal device, and output the index file corresponding to the target index terms. This solves the problem that the search results cannot be output due to the irregular search terms entered by the user, and effectively improves the user experience.
[0203] According to the above embodiment, the terminal device maintains the information of the index file in advance. It is understandable that the terminal device can maintain the basic information of the index file (such as Fig.12 Corresponding embodiments), and the terminal device can maintain the number of times the index file is searched in the search history (such as Fig.13 Corresponding embodiments). It can be understood that the basic information of the index file may include the first ratio of each file type, the corresponding relationship between the index file and the index word, etc.
[0204] For example, Fig.12 A flowchart of a method for maintaining basic information of an index file by a terminal device provided in an embodiment of the present application.
[0205] like Fig.12 As shown, the method for a terminal device to maintain basic information of an index file may include the following steps:
[0206] S1201. The terminal device obtains a changed target index file stored locally.
[0207] Exemplarily, the change of the target index file includes at least one of addition, deletion, and content change.
[0208] It is understandable that the changed target index file obtained by the terminal device may be obtained by receiving the user's operation on the target index file. For example, if the user adds a new target index file on the display interface of the terminal device, the terminal device may obtain the newly added target index file.
[0209] S1202: The terminal device maintains a first ratio corresponding to the target file type according to a change in the target index file.
[0210] In a possible implementation, the target index file is a newly added index file. The terminal device obtains the target file type corresponding to the target index file, updates the number of index files in the target file type and the total number of files in the terminal device, for example, subtracts 1 from the number of index files and the total number of files in the terminal device, thereby updating the first ratio corresponding to the target file type.
[0211] In a possible implementation, the target index file is a deleted index file. The terminal device obtains the target file type corresponding to the target index file, updates the number of index files in the target file type and the total number of files in the terminal device, for example, adds 1 to the number of index files and the total number of files in the terminal device, thereby updating the first ratio corresponding to the target file type.
[0212] In a possible implementation, the target index file is an index file after content change, that is, the number of index files in the terminal device has not changed, and the terminal device does not need to update the second ratio of the target file type.
[0213] S1203: The terminal device maintains the index dictionary according to the changes of the target index file.
[0214] In an embodiment of the present application, the index dictionary may include the correspondence between index words and index files, and the number of index files corresponding to the index words in each file type. For example, the index dictionary stores {"a": [2, 3, 0], "apple": [1, 2, 3]}, where a and apple are both index words, and "a": [2, 3, 0] means that the number of index files of the first file type of the index word a is 2, the number of index files of the second file type is 3, and the number of index files of the third file type is 0. "apple": [1, 2, 3] means that the number of index files of the first file type of the index word apple is 1, the number of index files of the second file type is 2, and the number of index files of the third file type is 3. According to the method described in the above embodiment, the term frequency of index word a is 2×(1+p 1 )×(1+h 1 )+3×(1+p 2 )×(1+h 2 ).
[0215] In a possible implementation, the target index file is a newly added index file. The terminal device obtains the index word of the target index file and updates the index dictionary according to the index word. For example, if the index word of the target index file is an index word that has been stored in the terminal device, the terminal device can increase the number of index files corresponding to the index word. If one index file is added, the number of index files corresponding to the index word increases by one.
[0216] In a possible implementation, the target index file is a deleted index file. The terminal device obtains the index word of the target index file, clears the index word in the index dictionary, that is, clears the correspondence between the index word and the target index file, and updates the number of index files corresponding to the index word. For example, if the index word corresponding to the deleted index file is dog, and the index word corresponds to only one index file, the terminal device deletes the index word in the index dictionary.
[0217] In a possible implementation, the target index file is an index file after content change, and the terminal device determines newly added index words and deleted index words according to changes in index words of the target index file before and after content change to update the index dictionary.
[0218] For example, Fig.13 A flowchart of a method for maintaining search history records on a terminal device provided in an embodiment of the present application.
[0219] like Fig.13 As shown, the method for a terminal device to maintain a search history record may include the following steps:
[0220] S1301. The terminal device obtains the search result clicked by the user.
[0221] It is understandable that the user can click on the search results on the terminal device to view them. For example, when the user clicks on any of the multiple search results in the terminal device display interface, the terminal device displays an interface including the search result content.
[0222] S1302. The terminal device maintains the search history according to the search results clicked by the user.
[0223] Exemplarily, the terminal device determines the file type corresponding to the index file in the search result clicked by the user, and adds 1 to the number of searches corresponding to the index file and the file type, so as to maintain the search history record.
[0224] In an embodiment of the present application, the terminal device can use the decompiled code to verify or adjust the method for determining the frequency of the index words. Exemplarily, the terminal device can use the decompiled code to obtain the first frequency of each index word, and when the index file stored in the terminal device is added, deleted, checked, modified, etc., the decompiled code is used again to obtain the second frequency of each index word, and determine whether the parameters used in the frequency calculation need to be adjusted based on the difference between the first frequency and the second frequency.
[0225] In an embodiment of the present application, the terminal device can verify the relationship between the search term and the number of index files or the number of times searched. Exemplarily, the multimedia files of the terminal device store multiple files of type a with a specified tag and multiple multimedia files of type b with another specified tag, so that the edit distance between the user-input search term and the two tags is 1. Other tag files of type a are stored, and the search term is used to perform a query operation to determine whether the search results are related to the number of index files and / or the query history.
[0226] Combined with the above Figure 1-Figure 2 as well as Figure 5-Figure 13 , the method provided in the embodiment of the present application is described, and in order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the method steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0227] The embodiment of the present application can divide the device of the file search method into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division.
[0228] Fig.14 A schematic diagram of the hardware structure of a control device provided in an embodiment of the present application is shown in FIG. Fig.14 As shown, the control device includes a processor 1401, a communication line 1404 and at least one communication interface ( Fig.14 The communication interface 1403 is used as an example for explanation).
[0229] The processor 1401 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0230] Communications link 1404 may include circuitry to transmit information between the above-described components.
[0231] The communication interface 1403 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0232] Possibly, the control device may further include a memory 1402 .
[0233] The memory 1402 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a communication line 1404. The memory may also be integrated with the processor.
[0234] The memory 1402 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 1401. The processor 1401 is used to execute the computer-executable instructions stored in the memory 1402, thereby realizing the video processing method provided in the embodiment of the present application.
[0235] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.
[0236] In a specific implementation, as an embodiment, the processor 1401 may include one or more CPUs, such as Fig.14 CPU0 and CPU1 in.
[0237] In a specific implementation, as an embodiment, the control device may include multiple processors, such as Fig.14 1401 and 1405 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0238] For example, Fig.15 A schematic diagram of a chip structure provided in an embodiment of the present application. The chip 150 includes one or more (including two) processors 1520 and a communication interface 1530 .
[0239] In some embodiments, the memory 1540 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0240] In the embodiment of the present application, the memory 1540 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1520. A portion of the memory 1540 may also include a non-volatile random access memory (NVRAM).
[0241] In the embodiment of the present application, the memory 1540, the communication interface 1530 and the memory 1540 are coupled together through the bus system 1510. The bus system 1510 may include a power bus, a control bus and a status signal bus in addition to a data bus. Fig.15 Various buses are labeled as bus system 1510.
[0242] The method described in the above embodiment of the present application can be applied to the processor 1520, or implemented by the processor 1520. The processor 1520 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware or software instructions in the processor 1520. The above-mentioned processor 1520 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 1520 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present invention.
[0243] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 1540, and the processor 1520 reads the information in the memory 1540 and completes the steps of the above method in combination with its hardware.
[0244] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.
[0245] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. 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 computer-readable storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatiledisc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0246] The embodiments of the present application also provide a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.
[0247] As a possible design, the computer readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line may also be appropriately referred to as a computer readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while optical discs reproduce data optically using lasers.
[0248] The above combinations should also be included in the scope of computer-readable media. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A file search method, characterized in that: Applied to a terminal device, the method comprises: Obtaining a search term input by a user, and searching in index terms using the search term; wherein the index terms are stored locally on the terminal device; When search results cannot be found in the index terms using the search terms input by the user, optional index terms whose similarity to the search terms meets a first preset condition are determined in the index terms, the optional index terms include N index terms whose similarity to the search terms meets the first preset condition, where N is an integer greater than 1; Determine the target index term from the optional index terms according to the word frequency of the optional index terms; the word frequency is related to the number of files in different file types corresponding to each of the optional index terms and the number of times the different file types are searched within a preset time period; Output the index file corresponding to the target index word; The step of determining the target index word from the optional index words according to the word frequencies of the optional index words comprises: Determine a target index term that satisfies a second preset condition from among the N index terms; wherein any of the index terms corresponds to at least one index file, and the second preset condition is related to the term frequency of each of the N index terms; for a first index term, the term frequency of the first index term is related to a first proportion of an i-th file type among L file types corresponding to the first index term and a second proportion of the i-th file type, and the first index term is any one of the N index terms; and a dynamic parameter of the i-th file type changes with the change of the first proportion of the i-th file type, so that a difference between the first proportion of the i-th file type and the second proportion of the i-th file type is less than a preset threshold; The first ratio of the i-th file type is a ratio of the number of files corresponding to the i-th file type in the index file stored in the terminal device to the number of files in the index file stored in the terminal device; The second proportion of the i-th file type is obtained by processing the number of times the index files of the i-th file type are searched within the preset time length, the number of times the index files whose file types are not the i-th file type are searched within the preset time length, and the dynamic parameters of the i-th file type using an S-type sigmoid function. The larger the dynamic parameters of the i-th file type, the smaller the second proportion of the i-th file type.
2. The method according to claim 1, characterized in that The L file types corresponding to the first index term are the L file types corresponding to the Q index files associated with the first index term; the word frequency of the first index term is also related to the number of files corresponding to the i-th file type in the Q index files.
3. The method according to claim 2, characterized in that The word frequency of the first index word satisfies the following formula: Among them, the X i is the number of files corresponding to the i-th file type in the L file types in the Q index files, and the p i is the first ratio of the i-th file type in the L file types, and the h i is the second proportion of the i-th file type among the L file types.
4. The method according to any one of claims 1 to 3, characterized in that The L file types corresponding to the first index word are the L file types corresponding to the Q index files associated with the first index word; the terminal device pre-maintains one or more of the following items for the Q index files: a first ratio corresponding to each of the L file types, a second ratio corresponding to each of the L file types, and the number of index files corresponding to each of the L file types in the Q index files.
5. The method according to any one of claims 1 to 3, characterized in that: The number W of the target index words is greater than or equal to 1, and the target index words are the first W index words among the N index words sorted from large to small in terms of word frequency.
6. The method according to claim 5, characterized in that The number W of the target index words is greater than 1; and the outputting the index file corresponding to the target index word includes: The index files corresponding to the W target index words are displayed in descending order according to the word frequencies corresponding to the W target index words.
7. The method according to any one of claims 1 to 3 and 6, characterized in that: The determining, among the index words, the optional index words whose similarity with the search word satisfies a first preset condition includes: The optional index words whose similarity with the search words is greater than or equal to a similarity threshold are determined among the index words.
8. The method according to any one of claims 1 to 3 and 6, characterized in that: The similarity between the index term in the optional index term and the search term is determined based on at least one of the following: The pinyin of the index word and the pinyin of the search word; or, The glyphs of the index term and the glyphs of the search term; or, The edit distance of the index term is equal to the edit distance of the search term.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the terminal device executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed, enable a computer to perform the method according to any one of claims 1 to 8.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Desktop search method, mobile terminal and computer readable storage medium
CN107633051A
Text importance calculation method and device and equipment and storage medium
CN109670183A