File sorting method and device and electronic equipment
By parsing and identifying the numeric types in file names and using a deep learning model for intelligent sorting, the problem of inaccurate file sorting is solved, improving file management efficiency and user experience.
Patent Information
- Application Number
- CN202510896700.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-14
AI Technical Summary
The existing file sorting method does not accurately handle file names containing numbers, resulting in confusing sorting results and failing to meet user expectations.
By parsing the numeric part in the file name, determining its numeric type, and performing intelligent sorting based on the numeric type, deep learning models such as convolutional neural networks, long short-term memory networks, and transformer models are used to identify the numeric type in the file name and sort by type.
It achieves more accurate file sorting, improves file management efficiency and user experience, and especially reduces search time in scenarios such as video episodes and version files.
Smart Images

Figure CN120780674A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer software technology, and in particular to the field of file sorting technology. Background Art
[0002] In modern file management systems, file sorting is a core function that allows users to quickly locate target files. Current mainstream sorting methods are mostly based on character encoding or preset rules. However, when processing file names containing numbers, inaccurate number recognition logic can lead to confusing sorting results, such as misinterpreting strings within numbers. Summary of the Invention
[0003] The present disclosure provides a file sorting method, device, and electronic device for solving at least one of the above technical problems.
[0004] According to one aspect of the present disclosure, a file sorting method is provided, wherein the method includes:
[0005] Parse the file names of the files to be sorted and obtain the numeric portion of the file names;
[0006] Determining the digital type of each of the digital parts respectively;
[0007] Based on the numeric type of the file name of each of the files to be sorted, the files to be sorted are sorted to obtain a first file sequence.
[0008] According to another aspect of the present disclosure, a file sorting device is provided, wherein the device comprises:
[0009] A parsing module is used to parse the file names of the files to be sorted and obtain the numeric part of the file names;
[0010] a classification module, for respectively determining the digital type of each of the digital parts;
[0011] The sorting module is configured to sort the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence.
[0012] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the above method.
[0016] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the above method.
[0017] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0018] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are provided to facilitate a better understanding of the present invention and do not constitute a limitation of the present disclosure.
[0020] Figure 1 This is a flowchart of a file sorting method provided by the first embodiment of the present disclosure;
[0021] Figure 2 is an exemplary flow chart of S101;
[0022] Figure 3 is an exemplary flow chart of S102;
[0023] Figure 4 is an exemplary flow chart of S1021;
[0024] Figure 5 is an exemplary flow chart of S10211;
[0025] Figure 6 is an exemplary flow chart of S103;
[0026] Figure 7 is another exemplary flow chart of S103;
[0027] Figure 8 This is a flowchart of another file sorting method provided by the first embodiment of the present disclosure;
[0028] Figure 9 is a structural diagram of a file sorting device according to the second embodiment of the present disclosure;
[0029] Figure 10 is a block diagram of an electronic device for implementing the method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0031] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0032] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0033] The terminology used herein is for describing particular embodiments only and is not intended to limit the present disclosure.As used herein, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0034] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined as such herein.
[0035] The file sorting method according to the present disclosure can be executed by an electronic device such as a terminal device or a server. The terminal device can be an in-vehicle device, a display device (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, an in-vehicle device, a wearable device, etc. The method can be implemented by a processor calling computer-readable program instructions stored in a memory. Alternatively, the file sorting method provided by the present disclosure can be executed by a server.
[0036] In the first embodiment disclosed, Figure 1 , Figure 1 A flowchart of a file sorting method provided by the first embodiment of the present disclosure is shown. The method includes:
[0037] S101, parsing the file names of the files to be sorted to obtain the numeric part of each file name.
[0038] Among them, in this step, you can first obtain a list of files to be sorted from the file storage system, and parse the file names of each file to be sorted in the file list separately, especially identify and extract the numerical part. Of course, you can also identify and extract the non-numerical part, where the non-numerical part can include at least one of the following: text part, character part, file suffix part, etc.
[0039] For example, for the file name "文1文档123.mov", the system will parse the numeric parts into "1" and "123", and the non-numeric parts into: the text part "文档" and the file suffix part "mov".
[0040] S102: Determine the number type of each number part respectively.
[0041] After obtaining the numeric portion of the file name, the system will further determine the numeric type of each numeric portion. Numeric types may include, but are not limited to, date type, version type, episode type, season type, invalid character type, etc.
[0042] Among them, the process of determining the type of numbers can be based on a variety of methods, for example: based on the format characteristics of the numbers, different types of numbers usually have specific formats, for example, the date type may conform to the format of "YYYYMMDD", "YYYY-MM-DD", etc., and the version type may conform to the format of "XY", "XYZ", etc.; for example, based on the position and context of the numbers in the file name, for example, the numbers at the beginning of the file name may be numbers, and the numbers before or after keywords such as "season" may be seasons; for example, based on a preset digital type library and matching rules, common digital types and their characteristics can be pre-stored, and the type of the digital part can be determined through a matching algorithm. Of course, other methods can also be used, which are not limited here.
[0043] In some examples, a deep learning model may be used to learn digital classification features and perform training to obtain a deep learning model for determining digital types, which is not limited here.
[0044] S103 : Sort the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence.
[0045] After determining the numeric type of the numeric portion of each file's file name, the system will sort the files based on that numeric type. Sorting rules can be customized based on different numeric types, for example: for dates, numbers are sorted by version number; for seasons or episodes, numbers are sorted by season or episode order; and numbers containing invalid characters are excluded from the sorting rules and do not participate in the sorting.
[0046] By using various sorting rules, the system can obtain an intelligent sorting result based on numerical types, namely the first file sequence. This sequence is more in line with the user's intuitive expectations of file sorting and can improve the user's efficiency in finding and managing files.
[0047] The file sorting method disclosed herein parses the numeric portion of a file name to determine its numeric type and performs intelligent sorting based on the numeric type. This method can focus on the numeric portion of a file name that is easily misidentified and more accurately identify the numeric type of the number, thereby enabling correct file sorting based on the accurate numeric type. This effectively solves the problem in the prior art that file sorting does not meet user expectations and improves file management efficiency and user experience.
[0048] For some examples, see Figure 2 , Figure 2 An exemplary flow chart of S101 is shown, where S101 includes:
[0049] S1011. Input the file names of the files to be sorted into a word segmenter, and obtain the numeric part and the non-numeric part of the file names output by the word segmenter.
[0050] This step uses a word segmenter to perform structured parsing of the file name, splitting the character sequence into numeric and non-numeric parts, providing basic data for subsequent numeric type classification and sorting. A word segmenter is a tool that can segment text into meaningful units. In this application, the focus is on the numeric portion of the file name, where the non-numeric portion can include at least one of the following: text, character, or file suffix. The file names are batched and fed into the word segmenter to obtain the segmented numeric portion and at least one of the text, character, or file suffix parts.
[0051] In some examples, the digital portion may include a digital ontology and digital-related information. The digital-related information is various types of information associated with the digital ontology, including at least one of the following: the position of the digital ontology in the file name, the prefix of the digital ontology in the file name, and the suffix of the digital ontology in the file name, where the position includes the beginning, middle, and end of the digital ontology.
[0052] For example, the file name "TV Series Season 2 20250102.avi" can be divided into the digital body "2" and "20250102" of the digital part, the text part "TV Series" and the file suffix part "avi", among which the digital association information of "2" includes: the position is in the middle, the prefix is "season", and the suffix is "season"; the digital association information of "20250102" includes: the position is at the end, there is no prefix and no suffix.
[0053] In some examples, this step may specifically employ various types of word segmenters. For example, the word segmenter may include at least one of the following:
[0054] Rule-based word segmenter, statistical learning-based word segmenter, and deep learning-based word segmenter.
[0055] Among them, the rule-based word segmenter matches the words in the text through a pre-built dictionary. For example, it can include the forward maximum matching method (FMM), which scans from the beginning of the text to the right and takes the longest possible word for matching each time; the backward maximum matching method (BMM), which scans from the end of the text to the left and takes the longest possible word for matching each time; the bidirectional maximum matching method, which uses forward and reverse matching at the same time to reduce ambiguity by comparing the results; and the minimum segmentation method, which minimizes the number of words after word segmentation while ensuring semantic correctness. Of course, the rule-based word segmenter can also adopt other methods, which are not limited here.
[0056] Furthermore, the word segmenter based on statistical learning uses a large amount of corpus training model to learn the probability of word occurrence and contextual relationship. Exemplary, for example, it can include the N-gram model, which regards the text as a sequence of N consecutive characters, calculates the frequency of occurrence of different byte fragments (grams), and selects the word segmentation combination with the highest probability; the hidden Markov model (HMM), which regards word segmentation as a state transition problem, defines four states of "beginning (B), middle (M), end (E), and single word (S)", and learns the state transition probability and emission probability through training data; the conditional random field (CRF), which considers a wider range of contextual features (such as character position, previous and next parts of speech), and obtains a conditional probability model through training. Of course, the word segmenter based on statistical learning can also adopt other methods, which are not limited here.
[0057] Furthermore, the word segmenter based on deep learning uses neural networks to automatically extract text features without the need for manually designed rules or features. Exemplary, for example, it can include a recurrent neural network (RNN), which processes sequence data through a recursive structure to capture long-distance dependencies, and is often used for character-level word segmentation; a convolutional neural network (CNN), which extracts local features of characters, such as radicals and glyph structures, through convolution kernels, combined with pooling layer compression features, and is suitable for word segmentation of pictographic characters such as Chinese; a transformer model, which uses a self-attention mechanism to capture the global dependencies of each character in the text, has high parallel computing efficiency, and has better word segmentation accuracy than traditional models. Pre-trained language models (BERT, etc.) can be fine-tuned for word segmentation tasks, and understand the semantic role of characters through context to reduce ambiguity. Of course, the word segmenter based on deep learning can also be implemented in other ways, which are not limited here.
[0058] In some examples, a hybrid segmentation approach can be used. For example, a hybrid segmenter based on rules and statistical models can first match common words with a dictionary and then use a statistical model to process out-of-scope (OOV) words. Alternatively, a hybrid segmenter based on rules and deep learning can be used to generate initial segmentation results using a deep learning model and then modify them using rules, such as by using a numeric format or a glossary.
[0059] For example, in the application, a hybrid method of rule-based and statistical learning can be used to segment file names. Specifically, regular expressions are first used to extract numbers and file suffixes, that is, a rule-based method, and then non-numeric characters are segmented using the N-gram model, that is, a statistical method.
[0060] Among them, multiple methods can be selected or mixed according to the scenario requirements.
[0061] For some examples, see Figure 3 , Figure 3 An exemplary flow chart of S102 is shown, where S102 includes:
[0062] S1021. Input each digital part into a digital classification model to obtain the digital type of each digital part output by the digital classification model.
[0063] The digital classification model is trained based on at least one of a convolutional neural network, a long short-term memory network, a transformer model, and a pre-trained language model.
[0064] The digital type may include but is not limited to: date type, version type, drama type, season type, invalid character type, etc.
[0065] In this step, the digital parts obtained by parsing are input into the digital classification model, and the corresponding digital types are output after processing by the digital classification model. The core of this process is to use the deep learning model to semantically understand the digital and its contextual features, so as to achieve accurate classification. Specifically, the digital part contains the digital ontology, such as the "3" in the file name "创3.doc", and also includes digital related information, such as the location, prefix, suffix, etc. The digital classification model determines the actual semantic type of the digital ontology in the file name by learning the combination pattern of these features.
[0066] In some examples, the digital portion includes a digital ontology and digital association information.
[0067] The digital association information includes at least one of the following: the position of the digital ontology in the file name, the prefix of the digital ontology in the file name, and the suffix of the digital ontology in the file name.
[0068] Specifically, the digital classification model is built based on a deep learning architecture and can select at least one of the following model types:
[0069] Convolutional neural networks extract local features of the digital entity and its context through convolutional layers. In some examples, convolutional neural networks can process character sequences with spatial correlation, such as the combination pattern of numbers and prefixes and suffixes.
[0070] Long Short-Term Memory (LSTM) networks use gating mechanisms to capture temporal dependencies in digital sequences. In some examples, LSTM networks are suitable for processing long-distance contexts, such as keyword associations across positions in file names.
[0071] The Transformer model uses a self-attention mechanism to model the association between numbers and all contexts. In some examples, the Transformer model is suitable for handling multi-keyword dependency scenarios, such as the cross-association between "3" and "season" and "5" and "episode" in the file name "Season 3 Episode 5".
[0072] Pre-trained language models, fine-tuned based on pre-trained models such as BERT, use the language representation capabilities learned in the pre-training phase to improve semantic understanding of numeric types, such as distinguishing the difference between "2023" in a file name as a year or version number.
[0073] During the model training phase, for example, a labeled file name dataset containing the numeric entity, numeric association information, and corresponding type labels is used. The model is optimized using a cross-entropy loss function to learn the mapping relationship between the combined features of the numeric entity, position, prefix type, and suffix type and the numeric type. For example, given the input "numeric entity = 12, position = middle, prefix type = season prefix(s), suffix type = none," the numeric classification model may output the numeric type as "season type."
[0074] The model performs key classification on the numeric portion of the file name, thereby resolving the issue of chaotic numeric sorting. After accurately identifying the numeric type, it can be sorted according to natural logic, improving the rationality of the sorting results. Furthermore, it adapts to complex naming scenarios: for file names that mix natural language and numbers, such as "2025 1st Edition Product Manual v1.0.doc", it can accurately distinguish "2025" as the date, "1" as the serial number, and "1.0" as the version number, avoiding the logical errors of traditional sorting methods. Furthermore, it can improve user search efficiency, and accurately classified sorting results allow users to locate target files more quickly, especially in scenarios such as video series and version files, reducing search time. At the same time, with strong generalization capabilities, the deep learning-based model can adapt to new naming rules through incremental training, eliminating the need to manually maintain a large number of rules and reducing system maintenance costs.
[0075] For some examples, see Figure 4 , Figure 4 An exemplary flow chart of S1021 is shown. S1021 includes:
[0076] S10211. Determine the prefix type of the prefix and the suffix type of the suffix of the digital ontology.
[0077] S10212. Input the digital ontology, the location of the digital ontology, the prefix type and the suffix type into the digital classification model to obtain the output digital type.
[0078] Among them, the prefix type includes at least one of the following: first, season, s, episode, e, id, version, etc.; the suffix type includes at least one of the following: episode, season, day, version, symbol, etc., among which the symbol, for example, includes at least one of the following: ".", ",", "," etc.
[0079] In this step, before inputting the digital ontology into the digital classification model, a pre-screening can be performed to determine the prefix type of the digital ontology's prefix and the suffix type of the suffix. Then, the determined prefix type and suffix type, together with the digital ontology and its position, are sent to the model. This can reduce the complexity of the model input, speed up the model processing, and shield interference items.
[0080] It should be noted that in some examples, the digital ontology may have no suffix or prefix, in which case an empty set is input.
[0081] It should be noted that if two numeric parts appear consecutively in a file name, the numbers are not valid as a prefix or suffix; of course, when two consecutive numeric parts appear at the head or tail of a file name, the two numeric parts are both located at the head or tail.
[0082] For some examples, see Figure 5 , Figure 5 An exemplary flow chart of S10211 is shown. S10211 includes:
[0083] S10211a. Determine the corresponding prefix type candidate list and suffix type candidate list according to the location of the digital ontology.
[0084] S10211b. Based on the prefix of the digital ontology, a match is performed in the corresponding prefix type candidate list, and the prefix type of the prefix is determined according to the matching result.
[0085] S10211c. Based on the suffix of the digital ontology, a match is performed in a corresponding suffix type candidate list, and the suffix type of the suffix is determined according to the matching result.
[0086] Before inputting the numerical part into the model, the prefix and suffix of the numerical entity must be identified first. In specific implementation, corresponding prefix type candidate lists and suffix type candidate lists can be preset according to the different positions of the number. For example, if the position is the head, the corresponding suffix candidate list is {'.', ', '}, and the prefix candidate list is empty; if the position is in the middle, the corresponding prefix type candidate list can be {the, season, s, episode, e, id, version}, and the corresponding suffix type candidate list can be {episode, season}; if the position is at the end, the corresponding prefix type candidate list can be {the}, etc. Before inputting the model, pre-matching can be performed to match the same prefix or suffix in the prefix or suffix candidate list as the matched prefix type or suffix type.
[0087] For example, for the file name "第2季.mp4", the number "2", the prefix "第", and the suffix "季" are extracted, and if they are located in the middle, the corresponding prefix type candidate list {第,season,s,episode,e,id,version} is obtained, and the matching result "第" is determined. The corresponding suffix type candidate list {集,季} is obtained, and the matching result "季" is determined. Therefore, the input features are "digital entity = 2, position = middle, prefix type = 第, suffix type = 季". The model learns the mapping between this feature combination and "season type" through architectures such as convolutional neural networks or pre-trained language models, and outputs the digital type "season type". This multi-dimensional feature input method enables the model to capture the semantic meaning of numbers in context, avoiding misjudgments caused by a single digital entity.
[0088] The classification of digital types is to improve the accuracy of digital semantic recognition through structured feature extraction. Therefore, attention is paid to the position, prefix, and suffix of the number, so that the specific type of the number can be identified more accurately. This process solves the defect of the existing technology that numbers are only treated as strings. For example, it can distinguish that the "5" in "Episode 5" is the type of drama, rather than a simple numeric character.
[0089] In the present disclosure, after obtaining the digital type, a variety of specific sorting methods can be used. Two methods are used as examples below for explanation, but they do not constitute a limitation to the sorting methods of the present disclosure.
[0090] For some examples, see Figure 6 , Figure 6 An exemplary flow chart of S103 is shown. In one embodiment, S103 includes:
[0091] S1031A: Divide the files to be sorted into multiple groups, wherein the files to be sorted in the same group have the same non-numeric part and the same numeric type in the numeric part.
[0092] S1032A: For each group of files to be sorted, sort the files according to the size of the digital part to obtain a first file sequence.
[0093] S1031A uses a grouping sorting method, grouping the files to be sorted according to the following conditions: files in the same group must have the same non-numeric portion of the file name and the same numeric type. Non-numeric portions include text in the file name, such as the TV series title, and file extensions, such as ".mp4."
[0094] Digital types refer to digital types determined by digital classification models, such as episodes, dates, and version numbers.
[0095] Specifically, the S1032A sorting rule includes sorting each group of files in ascending or descending order based on the numerical value of the numeric portion, ensuring that files of the same type are sorted in a natural and logical manner. This method is suitable for situations where files from multiple series are mixed and stored in the same folder, such as folders for different TV series.
[0096] In this way, the series can be naturally sorted by episode number, avoiding the sorting confusion caused by different episode naming formats in traditional string sorting, thereby prompting users to find specific files more efficiently.
[0097] Take a practical application example, the scenario is to sort the folders of TV series, which contains the following files:
[0098] File 1: Episode 1 of a certain drama.mp4
[0099] File 2: Episode 3 of a certain drama.mp4
[0100] File 3: Episode 5 of a certain drama.mp4
[0101] File 4: Episode 10 of a certain drama.mp4.
[0102] Among them, the grouping conditions are:
[0103] The non-numeric parts are the same: "XX drama" + ".mp4" is one group, and "XXX drama" + ".mp4" is another group;
[0104] The digital type is "episode type".
[0105] Further, sorting within the group:
[0106] X-list group: Arranged in ascending order by episode number: Episode 1 → Episode 10";
[0107] The series "XX" is arranged in ascending order of episode number: Episode 3 → Episode 5.
[0108] Finally, the first file sequence is:
[0109] Group 1:
[0110] Episode 1 of a certain drama.mp4
[0111] Episode 10 of a certain drama.mp4
[0112] Group 2:
[0113] Episode 3 of a certain drama.mp4
[0114] Episode 5 of a certain drama.mp4
[0115] For some examples, see Figure 7 , Figure 7Another exemplary flow chart of S103 is shown. In another embodiment, S103 includes:
[0116] S1031B, filter out the files to be sorted that have the same numeric type as the numeric part in the file name;
[0117] S1032B: For the files to be sorted that have the same numeric type, sort the files to be sorted according to the magnitude of the numeric parts to obtain a first file sequence.
[0118] Among them, S1031B adopts the classification method of digital type to filter out the files to be sorted whose digital parts in the file names have the same digital type, and does not require the non-digital parts to be consistent.
[0119] Specifically, in S1032B, files of the same type are sorted according to the numerical value of the digital part, so as to achieve a global aggregation arrangement of numbers of the same type.
[0120] In this way, the global sorting is aggregated by digital semantic type, and users can quickly locate files of the same digital type, such as viewing all date reports or episodes, which reduces the searching time by about 10% compared with the traditional mixed sorting method. Type aggregation in mixed scenarios, such as cross-project file management, simplifies the global sorting logic through type filtering.
[0121] Take a practical application example, the scenario is sorting mixed-type files, including the following files:
[0122] File 1: Report 20250101.docx, Number Type: Date Type
[0123] File 2: Report 20250110.docx, Number Type: Date Type
[0124] File 3: Episode 5 TV series.mp4, digital type: episode type
[0125] File 4: Episode 12 TV series.mp4, digital type: episode type
[0126] File 5: Software v2.5.exe, digital type: version type
[0127] File 6: Software v3.0.exe, digital type: version type
[0128] Among them, grouped by digital type:
[0129] Date type: file 1, 2;
[0130] Episode Type: File 3, 4;
[0131] Version type: File 5, 6.
[0132] Furthermore, sort by numeric type:
[0133] Date type in ascending order: 20230101→20230110;
[0134] Series type in ascending order by episode number: Episode 5 → Episode 12;
[0135] Version types are in ascending order of version number: v2.5 → v3.0.
[0136] Finally, the first file sequence:
[0137] Report 20230101.docx
[0138] Report 20230110.docx
[0139] Episode 5 TV series.mp4
[0140] Episode 12 TV series.mp4
[0141] Software v2.5.exe
[0142] Software v3.0.exe
[0143] For some examples, see Figure 8 , Figure 8 A flowchart of another file sorting method provided by the first embodiment of the present disclosure is shown. After S103, the method further includes:
[0144] S104, obtaining a file browsing record stack of each file in the first file sequence;
[0145] S105 : Place the first target file corresponding to the first N file browsing records in the linked list of the file browsing record stack at the top of the first file sequence to obtain a second file sequence.
[0146] Wherein, N is an integer greater than or equal to 1; the linked list of the file browsing record stack is arranged from new to old according to browsing time.
[0147] The file browsing record stack is a data structure used to store the user's file access behavior. It is used to record the files that the user has recently browsed and their order, so as to optimize the file sorting based on browsing habits.
[0148] The data structure of the file browsing record stack is implemented as a linked list, sorted from newest to oldest by the time the user browsed the files. The most recently browsed file is at the head of the linked list, and the oldest files are at the end, forming a stack-like storage logic known as last-in, first-out. The linked list is sorted in reverse order by browsing timestamp, with the most recently browsed file at the front and the oldest at the back. For example, if a user browses File A, File B, and File C, the linked list will be in the order [File C, File B, File A]. When a user browses a new file, the new record is inserted at the head of the linked list, and the existing record is moved back. A record limit can be set, such as a maximum of 10 records. When the limit is exceeded, the oldest record is automatically deleted to ensure storage efficiency.
[0149] Furthermore, each record in the linked list of the file browsing record stack contains at least the following information: a file identifier, such as a file name, file path, or unique identifier, used to locate a specific file; a browsing timestamp, which records the specific time when the user accesses the file, accurate to seconds or milliseconds; a digital type association, which associates the type of the digital part of the file, such as episode, date, version number, and numerical size, to provide a basis for subsequent sorting.
[0150] In S104 and S105, after completing the numerical sorting of the first file sequence in S103, the file display order can be further optimized based on user browsing history to improve the accessibility of frequently used files. Specifically, S104 obtains a file browsing record stack for each file in the first file sequence. This stack is arranged from newest to oldest by browsing time, with the most recently viewed file at the top of the stack. Subsequently, S105 places the first target file corresponding to the first N records in the browsing record stack linked list at the top of the sequence, forming a second file sequence.
[0151] In this way, the files that the user has recently accessed are placed at the top, reducing the time of finding commonly used files. This is especially suitable for continuous browsing scenarios, such as watching TV series, so that the most recently watched series can be directly presented at the top, improving operational efficiency.
[0152] Take a practical application example, the application scenario is a video episode folder, the first file sequence contains:
[0153] Episode 1 of a certain drama.mp4
[0154] Episode 2 of a certain drama.mp4
[0155] Episode 3 of a certain drama.mp4
[0156] Episode 4 of a certain drama.mp4
[0157] Episode 5 of a certain drama.mp4
[0158] If the user has recently browsed episodes 2 and 3, the linked list of the file browsing record stack is [episode 3, episode 2]. If N=2, the second file sequence is:
[0159] Episode 3 of a certain drama.mp4 (recently viewed)
[0160] Episode 2 of a certain drama.mp4 (recently viewed)
[0161] Episode 1 of a certain drama.mp4
[0162] Episode 4 of a certain drama.mp4
[0163] Episode 5 of a certain drama.mp4
[0164] In some examples, see Figure 8 After S105, the method further includes:
[0165] S106, determining the first target file that is last in order among the N first target files in the second file sequence;
[0166] S107: Determine a second target file based on the numerical size of the numerical portion of the last sorted first target file, wherein the numerical size of the numerical portion of the second target file is located after the numerical size of the numerical portion of the last sorted first target file;
[0167] S108 : Place the second target file in a sorting position after and immediately adjacent to the last sorted first target file, to obtain a third file sequence.
[0168] In S106-S108, based on the second file sequence, intelligent resume recommendation is further implemented through S106-S108. The specific process is as follows: first, the first target file ranked last among the N top files is determined, that is, the earliest accessed file in the browsing history. Then, based on the numerical value of the numerical portion of the earliest accessed file, a second target file with the next largest numerical value is found and placed immediately after the earliest accessed file to form a third file sequence.
[0169] In S106, the N top files in the second file sequence are sorted in reverse order by browsing time, with the last top file being the earliest accessed file in the browsing history. For example, when N = 2, the top files are [Episode 3, Episode 2], and the last file sorted is Episode 2. In S107, the numerical portion of the file is analyzed, such as the number "2" in "Episode 2," and a file with the same numerical value of "3" is searched, i.e., Episode 3. If multiple candidates exist, they are filtered according to the original sorting rules in the first file sequence. In S108, the subsequent file found, such as Episode 3, is placed after the last top file to ensure browsing continuity.
[0170] Take a practical application example, the application scenario is a video episode folder, the first file sequence contains:
[0171] The second file sequence is:
[0172] Episode 3 of a certain drama.mp4 (recently viewed)
[0173] Episode 2 of a certain drama.mp4 (recently viewed)
[0174] Episode 1 of a certain drama.mp4
[0175] Episode 4 of a certain drama.mp4
[0176] Episode 5 of a certain drama.mp4
[0177] Among them, the last pinned file is episode 2, the number part of which is "2", and the number type is the episode type;
[0178] Search for the third set of files of the same type with a numerical value of "3" and find that it is already in the top list;
[0179] Continue to search for the next file with the number "4", the fourth episode, and place it after the second episode, and finally get the third file sequence:
[0180] Episode 3 of a certain drama.mp4 (recently viewed)
[0181] Episode 2 of a certain drama.mp4 (recently viewed)
[0182] Episode 4 of a certain drama.mp4 (newly added adjacent location)
[0183] Episode 1 of a certain drama.mp4
[0184] Episode 5 of a certain drama.mp4
[0185] In summary, the file sorting method disclosed herein can be expanded and optimized based on actual needs. For example, additional numeric type recognition rules can be added to improve the accuracy of numeric type determination; user-defined sorting rules can be provided, allowing users to set sorting priorities for different numeric types based on their needs; and machine learning algorithms can be combined to automatically adjust sorting rules by learning from users' sorting habits. The file sorting method disclosed herein effectively solves the problem of file sorting not meeting user expectations in the prior art by parsing the numeric portion of a file name to determine its numeric type and then performing intelligent sorting based on the numeric type.
[0186] In disclosing the second embodiment, see Figure 9 , Figure 9 A schematic diagram of the structure of a file sorting device according to the second embodiment of the present disclosure is shown. The device includes:
[0187] Parsing module 901, used to parse the file names of the files to be sorted and obtain the numeric part of each file name;
[0188] Classification module 902, for determining the type of each digital part;
[0189] The sorting module 903 is configured to sort the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence.
[0190] In some examples, the classification module 902 is used to:
[0191] Input each digital part into the digital classification model to obtain the digital type of each digital part output by the digital classification model;
[0192] The digital classification model is trained based on at least one of a convolutional neural network, a long short-term memory network, a transformer model, and a pre-trained language model.
[0193] In some examples, the digital portion includes a digital ontology and digital association information;
[0194] The digital association information includes at least one of the following: the position of the digital ontology in the file name, the prefix of the digital ontology in the file name, and the suffix of the digital ontology in the file name.
[0195] In some examples, the classification module 902 is configured to: input each digital part into a digital classification model and obtain a digital type pair of each digital part output by the digital classification model;
[0196] Determine the prefix type of the prefix and the suffix type of the suffix of the digital ontology;
[0197] The digital ontology, the position of the digital ontology, the prefix type and the suffix type are input into the digital classification model to obtain the output digital type.
[0198] In some examples, the classification module 902, upon determining a prefix type of a prefix and a suffix type of a suffix of the digital ontology, is to:
[0199] According to the location of the digital ontology, the corresponding prefix type candidate list and suffix type candidate list are determined;
[0200] Based on the prefix of the digital ontology, a match is performed in the corresponding prefix type candidate list, and the prefix type of the prefix is determined according to the matching result;
[0201] Based on the suffix of the digital ontology, a match is performed in the corresponding suffix type candidate list, and the suffix type of the suffix is determined according to the matching result.
[0202] In some examples, parsing module 901 is used to:
[0203] The file names of the files to be sorted are input into the word segmenter, and the numeric part and the non-numeric part of the file names output by the word segmenter are obtained.
[0204] In some examples, the tokenizer includes at least one of:
[0205] Rule-based word segmenter, statistical learning-based word segmenter, and deep learning-based word segmenter.
[0206] In some examples, the sorting module 903 is used to:
[0207] Divide the files to be sorted into multiple groups, wherein the files to be sorted in the same group have the same non-numeric part and the same numeric type in the numeric part;
[0208] For each group of files to be sorted, the files to be sorted are sorted according to the size of the numbers in the numerical part to obtain a first file sequence.
[0209] In some examples, the sorting module 903 is used to:
[0210] Filter out the files to be sorted that have the same numeric type in the numeric part of the file name;
[0211] For the files to be sorted that have the same numerical type, the files to be sorted are sorted according to the magnitude of the numerical parts to obtain a first file sequence.
[0212] In some examples, the device further includes a browsing record module configured to:
[0213] Obtaining a file browsing record stack of each file in the first file sequence;
[0214] Placing the first target file corresponding to the first N file browsing records in the linked list of the file browsing record stack at the top of the first file sequence to obtain a second file sequence;
[0215] Wherein, N is an integer greater than or equal to 1; the linked list of the file browsing record stack is arranged from new to old according to browsing time.
[0216] In some examples, the apparatus further includes a sorting adjustment module configured to:
[0217] In the second file sequence, determining the first target file that is last sorted among the N first target files;
[0218] Determine a second target file according to the numerical size of the numerical portion of the first target file that is sorted last, wherein the numerical size of the numerical portion of the second target file is located after the numerical size of the numerical portion of the first target file that is sorted last;
[0219] The sorting position of the second target file is placed after the last sorted first target file and next to the last sorted first target file, to obtain a third file sequence.
[0220] In the technical solution disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure and application of user personal information involved comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.
[0221] In the technical solution disclosed herein, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0222] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0223] like Figure 10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from the storage unit 1002 into a random access memory (RAM) 1003. Various programs and data required for the operation of the device 1000 can also be stored in the RAM 1003. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0224] Various components in device 1000 are connected to I / O interface 1005, including an input unit 1006, such as a keyboard, mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a magnetic disk, optical disk, etc.; and a communication unit 1009, such as a network card, modem, wireless communication transceiver, etc. The communication unit 1009 allows device 1000 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0225] The computing unit 1001 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as the file sorting method. For example, in some embodiments, the file sorting method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the file sorting method described above can be performed. Alternatively, in other embodiments, the computing unit 1001 can be configured with the file sorting method in any other appropriate manner (e.g., by means of firmware).
[0226] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0227] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0228] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0229] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0230] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0231] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0232] It should be understood that the various forms of flow shown above can be re-ordered, steps added or removed. For example, the steps recited in the present disclosure can be performed in parallel, in series, in a different order, or any combination thereof, so long as the desired results of the present disclosure are achieved, which is not limited herein.
[0233] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A file sorting method, wherein: The method comprises: Parse the file names of the files to be sorted and obtain the numeric portion of the file names; Determining the digital type of each of the digital parts respectively; Based on the numeric type of the file name of each of the files to be sorted, the files to be sorted are sorted to obtain a first file sequence.
2. The method according to claim 1, wherein The step of respectively determining the digital type of each digital part comprises: Inputting each of the digital parts into a digital classification model to obtain a digital type of each of the digital parts output by the digital classification model; The digital classification model is trained based on at least one of a convolutional neural network, a long short-term memory network, a transformer model, and a pre-trained language model.
3. The method according to claim 2, wherein: The digital part includes a digital body and digital associated information; The digital association information includes at least one of the following: the location of the digital ontology in the file name, the prefix of the digital ontology in the file name, and the suffix of the digital ontology in the file name.
4. The method according to claim 3, wherein: Inputting each of the digital parts into a digital classification model to obtain the digital type of each of the digital parts output by the digital classification model includes: determining a prefix type of the prefix and a suffix type of the suffix of the digital ontology; The digital ontology, the location of the digital ontology, the prefix type and the suffix type are input into the digital classification model to obtain the output digital type.
5. The method according to claim 4, wherein The determining of the prefix type of the prefix and the suffix type of the suffix of the digital ontology includes: Determining, according to the location of the digital ontology, a corresponding prefix type candidate list and a corresponding suffix type candidate list; Based on the prefix of the digital ontology, matching is performed in the corresponding prefix type candidate list, and determining the prefix type of the prefix according to the matching result; Based on the suffix of the digital ontology, a match is performed in the corresponding suffix type candidate list, and the suffix type of the suffix is determined according to the matching result.
6. The method according to any one of claims 1 to 5, wherein: The step of parsing the file names of the files to be sorted to obtain the numeric portion of the file names includes: The file names of the files to be sorted are input into a word segmenter, and the numeric part and the non-numeric part of the file names output by the word segmenter are obtained.
7. The method according to claim 6, wherein: The word segmenter includes at least one of the following: Rule-based word segmenter, statistical learning-based word segmenter, and deep learning-based word segmenter.
8. The method according to any one of claims 1 to 7, wherein: The step of sorting the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence includes: Dividing the files to be sorted into multiple groups, wherein the files to be sorted in the same group have the same non-numeric part and the same numeric type in the numeric part; For each group of files to be sorted, the files to be sorted are sorted according to the magnitude of the numbers in the numerical parts to obtain the first file sequence.
9. The method according to any one of claims 1 to 8, wherein: The step of sorting the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence includes: Filter out the files to be sorted whose numeric parts in the file names have the same numeric type; For the files to be sorted that have the same numerical type, the files to be sorted are sorted according to the magnitude of the numerical parts to obtain the first file sequence.
10. The method according to any one of claims 1 to 9, wherein: After sorting the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence, the method includes: Obtaining a file browsing record stack of each file in the first file sequence; Placing the first target file corresponding to the first N file browsing records in the linked list of the file browsing record stack at the top of the first file sequence to obtain a second file sequence; Wherein, N is an integer greater than or equal to 1; the linked list of the file browsing record stack is arranged from new to old according to browsing time.
11. The method according to claim 10, wherein: After placing the first target file corresponding to the first N file browsing records in the linked list of the file browsing record stack at the top of the first file sequence to obtain the second file sequence, the method further includes: In the second file sequence, determining the first target file that is last in order among the N first target files; Determine a second target file according to the numerical size of the numerical portion of the last sorted first target file, wherein the numerical size of the numerical portion of the second target file is located after the numerical size of the numerical portion of the last sorted first target file; The sorting position of the second target file is placed after the last sorted first target file and is immediately adjacent to the last sorted first target file to obtain a third file sequence.
12. A file sorting device, wherein: The device comprises: A parsing module is used to parse the file names of the files to be sorted and obtain the numeric part of the file names; a classification module, for respectively determining the digital type of each of the digital parts; The sorting module is configured to sort the files to be sorted based on the numeric type of the file names of the files to be sorted to obtain a first file sequence.
13. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.
15. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.