CN112069126A - Catalog generation method and device - Google Patents

Catalog generation method and device Download PDF

Info

Publication number
CN112069126A
CN112069126A CN201910500726.4A CN201910500726A CN112069126A CN 112069126 A CN112069126 A CN 112069126A CN 201910500726 A CN201910500726 A CN 201910500726A CN 112069126 A CN112069126 A CN 112069126A
Authority
CN
China
Prior art keywords
directory
level
entry
directory entry
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910500726.4A
Other languages
Chinese (zh)
Other versions
CN112069126B (en
Inventor
董师师
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201910500726.4A priority Critical patent/CN112069126B/en
Publication of CN112069126A publication Critical patent/CN112069126A/en
Application granted granted Critical
Publication of CN112069126B publication Critical patent/CN112069126B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • G06F16/122File system administration, e.g. details of archiving or snapshots using management policies
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供了一种目录生成方法及装置,涉及计算机文件处理技术领域,通过根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,然后根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,最后对确定目录层级后的目录项生成文件目录。应用本发明实施例提供的方案,不再需要人工查找目录项和设置目录层级,而是利用目录项的序号判断规则来查找目录项,再利用目录项的目录序号和分布位置对目录项进行分级。应用本发明实施例提供的方案生成目录时,可以提高生成文件目录的效率。

Figure 201910500726

The embodiments of the present invention provide a directory generation method and device, which relate to the technical field of computer file processing. By determining the directory items used to generate the directory from the file according to the pre-set sequence number judgment rule, and obtaining the location of each directory item in the Then, according to the directory number included in each directory entry and the distribution location of each directory entry, the directory level of each directory entry is determined, and finally a file directory is generated for the directory entry after the determined directory level. By applying the solution provided by the embodiment of the present invention, it is no longer necessary to manually search for directory items and set the directory level, but to use the sequence number judgment rule of the directory items to find the directory items, and then use the directory sequence numbers and distribution positions of the directory items to classify the directory items. . When a directory is generated by applying the solution provided by the embodiment of the present invention, the efficiency of generating a file directory can be improved.

Figure 201910500726

Description

一种目录生成方法及装置A method and device for generating a directory

技术领域technical field

本发明涉及计算机文件处理技术领域,特别是涉及一种目录生成方法及装置。The present invention relates to the technical field of computer file processing, and in particular, to a method and device for generating a directory.

背景技术Background technique

为了方便用户阅读文件的时候快速地查找信息,通常需要为文件生成目录。现有技术中,电子设备在生成文件目录时,通常需要人工查找文件中带有序号的文本,以查找到的文本为目录项,并为各目录项设置目录层级,例如,一级目录、二级目录、三级目录等,然后上述电子设备根据用户设置的目录层级生成文件目录。In order to facilitate the user to quickly find information when reading the file, it is usually necessary to generate a directory for the file. In the prior art, when an electronic device generates a file directory, it is usually necessary to manually search for the text with an ordinal number in the file, use the found text as a directory item, and set a directory level for each directory item, for example, a first-level directory, a second-level directory, and a directory level. The above-mentioned electronic device generates a file directory according to the directory level set by the user.

可见,应用现有技术虽然可以生成文件目录,但是需要人工查找目录项和设置目录层级,生成文件目录的效率低。It can be seen that although a file directory can be generated by applying the existing technology, it is necessary to manually search for directory items and set a directory level, and the efficiency of generating the file directory is low.

发明内容SUMMARY OF THE INVENTION

本发明实施例的目的在于提供一种目录生成方法及装置,以提高文件目录的生成效率。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a directory generation method and apparatus, so as to improve the generation efficiency of the file directory. The specific technical solutions are as follows:

第一方面,本发明实施例提供了一种目录生成方法,所述方法包括:In a first aspect, an embodiment of the present invention provides a method for generating a directory, the method comprising:

根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,其中,所述目录项包括:目录序号和目录内容,所述目录序号位于段落的起始位置,所述目录内容与所述目录序号位置相邻;According to the pre-set sequence number judgment rule, the directory entry for generating the directory is determined from the file, and the distribution position of each directory entry in the file is obtained, wherein the directory entry includes: the directory number and the directory content, the The table of contents sequence number is located at the starting position of the paragraph, and the content of the table of contents is adjacent to the position of the table of contents sequence number;

根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级;Determine the directory level of each directory entry according to the directory sequence number included in each directory entry and the distribution position of each directory entry;

对确定目录层级后的目录项生成文件目录。A file directory is generated for the directory item after the directory level is determined.

本发明的一个实施例中,所述根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,包括:In an embodiment of the present invention, determining the directory entry for generating the directory from the file according to the preset sequence number judgment rule includes:

根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。According to the pre-set sequence number judgment rule, the directory entries for generating the directory, arranged in paragraph order, are determined from the file.

本发明的一个实施例中,所述根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,包括:In an embodiment of the present invention, determining the directory level of each directory item according to the directory sequence number included in each directory item and the distribution position of each directory item includes:

按照预设的目录层级确定规则,确定各个目录项的目录层级;Determine the directory level of each directory item according to the preset directory level determination rules;

其中,所述目录层级确定规则为:Wherein, the directory level determination rule is:

在当前目录项为第一个目录项时,When the current directory entry is the first directory entry,

第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry;

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry,

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item;

第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item;

第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry.

本发明的一个实施例中,所述序号判断规则为:由表示序号形式的字符和序号字符串形成的正则表达式;In an embodiment of the present invention, the sequence number judgment rule is: a regular expression formed by a character in the form of a sequence number and a sequence number string;

其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type.

第二方面,本发明实施例提供了一种目录生成装置,所述装置包括:In a second aspect, an embodiment of the present invention provides an apparatus for generating a directory, and the apparatus includes:

目录项确定模块,用于根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,其中,所述目录项包括:目录序号和目录内容,所述目录序号位于段落的起始位置,所述目录内容与所述目录序号位置相邻;A directory entry determination module, configured to determine directory entries for generating directories from a file according to a preset sequence number judgment rule, and obtain the distribution positions of each directory entry in the file, wherein the directory entries include: Catalogue number and catalogue content, the catalogue sequence number is located at the starting position of the paragraph, and the catalogue content is adjacent to the catalogue sequence number position;

层级确定模块,用于根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级;The level determination module is used to determine the directory level of each directory item according to the directory serial number included in each directory item and the distribution position of each directory item;

目录生成模块,用于对确定目录层级后的目录项生成文件目录。The directory generation module is used to generate a file directory for the directory item after the directory level is determined.

本发明的一个实施例中,所述目录项确定模块,具体用于:In an embodiment of the present invention, the directory item determination module is specifically used for:

根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。According to the pre-set sequence number judgment rule, the directory entries for generating the directory, arranged in paragraph order, are determined from the file.

本发明的一个实施例中,所述层级确定模块,具体用于:In an embodiment of the present invention, the level determination module is specifically used for:

按照预设的目录层级确定规则,确定各个目录项的目录层级;Determine the directory level of each directory item according to the preset directory level determination rules;

其中,所述目录层级确定规则为:Wherein, the directory level determination rule is:

在当前目录项为第一个目录项时,When the current directory entry is the first directory entry,

第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry;

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry,

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item;

第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item;

第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry.

本发明的一个实施例中,所述序号判断规则为:由表示序号形式的字符和序号字符串形成的正则表达式;In an embodiment of the present invention, the sequence number judgment rule is: a regular expression formed by a character in the form of a sequence number and a sequence number string;

其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type.

第三方面,本发明实施例提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

存储器,用于存放计算机程序;memory for storing computer programs;

处理器,用于执行存储器上所存放的程序时,实现上述任一第一方面所述的方法步骤。The processor is configured to implement the method steps described in any one of the first aspects above when executing the program stored in the memory.

第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现第一方面任一所述的方法步骤。In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the methods described in the first aspect is implemented step.

由上述的技术方案可见,应用本发明实施例提供的方案生成目录时,根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,然后根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,最后对确定目录层级后的目录项生成文件目录。可见,应用本发明实施例提供的方案生成目录时,不再需要人工查找目录项和设置目录层级,而是利用目录项的序号判断规则来查找目录项,再利用目录项的目录序号和分布位置对目录项进行分级。It can be seen from the above technical solutions that when a directory is generated by applying the solution provided by the embodiment of the present invention, the directory entry for generating the directory is determined from the file according to the preset sequence number judgment rule, and each directory entry is obtained in the file. Then, according to the directory serial number included in each directory entry and the distribution location of each directory entry, the directory level of each directory entry is determined, and finally a file directory is generated for the directory entry after the determined directory level. It can be seen that when using the solution provided by the embodiment of the present invention to generate a catalog, it is no longer necessary to manually search for catalog items and set catalog levels, but to use the sequence number judgment rule of catalog items to search for catalog items, and then use the catalog item sequence numbers and distribution locations. Classify catalog items.

由此可见,应用本发明实施例提供的方案生成目录时,可以提高文件目录的生成效率。It can be seen that, when a directory is generated by applying the solution provided by the embodiment of the present invention, the generation efficiency of the file directory can be improved.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.

图1为本发明实施例提供的一种目录生成方法的流程示意图;1 is a schematic flowchart of a method for generating a directory according to an embodiment of the present invention;

图2为本发明实施例提供的一种目录生成装置的结构示意图;2 is a schematic structural diagram of an apparatus for generating a directory according to an embodiment of the present invention;

图3为本发明实施例提供的一种电子设备的结构示意图。FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明实施例提供了一种目录生成方法及装置,以下分别进行详细说明。Embodiments of the present invention provide a method and device for generating a directory, which will be described in detail below.

参见图1,图1为本发明实施例提供的一种目录生成方法的流程示意图,上述方法包括如下步骤。Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a method for generating a directory according to an embodiment of the present invention. The above method includes the following steps.

步骤101,根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置。Step 101 , according to a preset sequence number judgment rule, determine the directory entries for generating the directory from the file, and obtain the distribution positions of each directory entry in the file.

其中,上述目录项包括:目录序号和目录内容,上述目录序号位于段落的起始位置。Wherein, the above-mentioned directory item includes: a directory number and a directory content, and the above-mentioned directory number is located at the starting position of the paragraph.

上述目录内容与上述目录序号位置相邻,例如,上述目录内容可以是上述目录序号后面预设长度的文本,上述目录内容也可以是包含目录序号在内的预设长度的文本,其中,上述预设长度可以是预设字数,也可以是预设的标点符号内的文本。The above-mentioned directory content is adjacent to the above-mentioned directory serial number. For example, the above-mentioned directory content may be a text with a preset length behind the above-mentioned directory serial number, and the above-mentioned directory content may also be a text with a preset length including the directory number. The set length can be the preset number of words or the text within the preset punctuation marks.

本发明的一个实施例中,上述序号判断规则可以为:由表示序号形式的字符和序号字符串形成的正则表达式。In an embodiment of the present invention, the above-mentioned sequence number judgment rule may be: a regular expression formed by a character in the form of a sequence number and a sequence number string.

其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type.

具体的,上述类型为序号的类型,是由序号的表现形式确定出来的。例如,序号为1、2、3等,则可以认为这些序号的类型为罗马数字类型。序号为一、二、三等,则可以认为这些序号的类型为汉字数字类型。Specifically, the above type is the type of the serial number, which is determined by the representation of the serial number. For example, if the serial numbers are 1, 2, 3, etc., the types of these serial numbers can be considered as Roman numerals. If the serial numbers are one, two, three, etc., the types of these serial numbers can be considered as Chinese numerals.

再者,在上述序号为1、2、3……的情况下,各个序号可以分别以字符“1”、“2”、“3”……表示,相应的,上述序号字符串可以为:“123456789”。Furthermore, in the case where the above-mentioned serial numbers are 1, 2, 3... 123456789”.

在上述序号为一、二、三……的情况下,各个序号可以分别以字符“一”、“二”、“三”……表示,相应的,上述序号字符串可以为:“一二三四五六七八九”。In the case where the above serial numbers are one, two, three... Four five six seven eight nine".

本领域技术人员可以理解的是,各种序号是具有其各自的形式的,这些形式可以通过一定的字符来表示。Those skilled in the art can understand that various serial numbers have their respective forms, and these forms can be represented by certain characters.

例如,序号为:第一、第二、第三时,针对这些序号表示序号形式的字符,可以是“第”。序号为(一):、(二):、(三):时,针对这些序号表示序号形式的字符可以是“(”、“)”、“:”。For example, when the serial numbers are: first, second, and third, for these serial numbers, the characters in the form of serial numbers can be "the first". When the serial numbers are (1):, (2):, (3):, the characters in the serial number form for these serial numbers can be "(", ")", and ":".

鉴于上述情况,在上述序号字符串为“一二三四五六七八九”、表示序号形式的字符为“第”的情况下,上述正则表达式为:In view of the above situation, in the case that the above serial number string is "123456789" and the character representing the serial number form is "Number", the above regular expression is:

第[一二三四五六七八九]+first [123456789]+

本发明的一个实施例中,可以根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。In an embodiment of the present invention, the directory entries for generating the directory, arranged in the order of paragraphs, can be determined from the file according to a preset sequence number determination rule.

由于所确定的目录项是按照文件段落顺序进行排序的,则目录项中包括的目录序号也是按照文件段落顺序进行排序的,在接下来的确定目录项层级的步骤中,不再需要返回判断各个目录序号在文件中的位置顺序,可以极大地简化后续确定目录项的目录层级的过程。Since the determined directory entries are sorted according to the order of file paragraphs, the directory numbers included in the directory entries are also sorted according to the order of file paragraphs. In the next step of determining the level of directory entries, there is no need to return to determine each The position sequence of the directory serial number in the file can greatly simplify the subsequent process of determining the directory level of the directory entry.

步骤102,根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级。Step 102: Determine the directory level of each directory entry according to the directory serial number included in each directory entry and the distribution position of each directory entry.

本发明的一个实施例中,在所确定的目录项是按照段落顺序排列的情况下,可以按照预设的目录层级确定规则,确定各个目录项的目录层级。In an embodiment of the present invention, when the determined directory items are arranged in the order of paragraphs, the directory level of each directory item may be determined according to a preset directory level determination rule.

其中,上述目录层级确定规则为:Among them, the above directory level determination rules are:

在当前目录项为第一个目录项时,When the current directory entry is the first directory entry,

第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry;

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry,

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item;

第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item;

第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry.

需要说明的是,本实施例中仅仅给出了各个目录项的目录层级之间的关系,但是并没有限定确定各个目录项的目录层级时的执行流程。在具体实现过程中可以采取任何能够得到满足上述目标层级确定规则的方式,确定各个目录项的目录层级。例如,可以采用递归的方式确定各个目录项的目录层级,也就是,先确定出目录层级为第一目录层级的目录项,并为这些目录项设置目录层级,然后针对每两个相邻的第一目录层级的目录项之间的目录项,确定目录层级为第二目录层级的目录项,并为这些目录项设置目录层级,直至确定出所有目录项的目录层级。It should be noted that, in this embodiment, only the relationship between the directory levels of each directory item is given, but the execution flow when the directory level of each directory item is determined is not limited. In the specific implementation process, any method that can satisfy the above target level determination rule can be adopted to determine the directory level of each directory item. For example, the directory level of each directory item can be determined recursively, that is, first determine the directory item whose directory level is the first directory level, set the directory level for these directory items, and then set the directory level for each two adjacent For the directory items between the directory items of one directory level, it is determined that the directory level is the directory items of the second directory level, and the directory level is set for these directory items until the directory levels of all the directory items are determined.

下面通过具体实例对上述目录层级确定规则进行说明。The above directory level determination rule will be described below through a specific example.

假设,步骤101中确定出的按照段落顺序排列的目录项为:Suppose, the directory items in the order of paragraphs determined in step 101 are:

第一,水果First, the fruit

(一),香蕉(1), banana

(二),苹果(2), Apple

第二,植物Second, plants

第三,动物Third, animals

在这种情况下,“第一,水果”为第一个目录项,“第二,植物”和“第三,动物”所包括的目录序号的类型与第一个目录项包括的目录序号的类型相同,属于第一类目录项,所以目录项“第一,水果”、“第二,植物”和“第三,动物”的目录层级为同一目录层级。In this case, "First, Fruit" is the first catalog entry, and "Second, Plants" and "Third, Animals" include the types of catalog numbers that are the same as those included in the first catalog entry. They are of the same type and belong to the first category of directory items, so the directory levels of the directory items "first, fruit", "second, plant" and "third, animal" are the same directory level.

在当前目录项为第一个目录项的情况下,目录项“(一),香蕉”内包括的目录序号“(一)”为第一序号,目录项“第一,水果”内包括的目录序号“一”为第二序号,由于第一序号和第二序号类型不一致,且在目录项“第一,水果”和目录项“第二,植物”之间,目录项“(二),苹果”内包括的目录序号“(二)”与第一序号类型相同,所以目录项“(一),香蕉”和目录项“(二),苹果”的目录层级同为目录项“第一,水果”的目录层级的下一目录层级。In the case where the current directory item is the first directory item, the directory number "(one)" included in the directory item "(one), banana" is the first serial number, and the directory item "first, fruit" included in the directory The serial number "1" is the second serial number, because the types of the first serial number and the second serial number are inconsistent, and between the catalog item "first, fruit" and the catalog item "second, plant", the catalog item "(2), apple The catalog number "(2)" included in "" is of the same type as the first sequence number, so the directory level of the catalog item "(1), banana" and the catalog item "(2), apple" are the same as the catalog item "1, fruit" ” is the next directory level in the directory level.

本发明的一个实施例中,在第一序号所在的目录项之后不存在与当前目录项层级相同的目录项时,当前目录项之后、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级。In an embodiment of the present invention, when there is no directory entry with the same level as the current directory entry after the directory entry with the first serial number, the directory level of the directory entry with the directory serial number of the first type after the current directory entry is the directory level next to the directory level of the current directory entry.

本发明的一个实施例中,在第一序号的第一类型与第二序号的第二类型一致时,第一序号所在的目录项的目录层级与第二序号所在的目录项的目录层级相同。In an embodiment of the present invention, when the first type of the first serial number is consistent with the second type of the second serial number, the directory level of the directory entry where the first serial number is located is the same as the directory level of the directory entry where the second serial number is located.

步骤103,对确定目录层级后的目录项生成文件目录。In step 103, a file directory is generated for the directory item whose directory level is determined.

可见,应用本发明实施例提供的方案生成目录时,通过根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,然后根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,最后对确定目录层级后的目录项生成文件目录。应用本发明实施例提供的方案生成目录时,可以提高文件目录的生成效率。It can be seen that when the solution provided by the embodiment of the present invention is applied to generate a directory, the directory entries used to generate the directory are determined from the file according to the preset sequence number judgment rule, and the distribution position of each directory entry in the file is obtained, Then, the directory level of each directory entry is determined according to the directory serial number included in each directory entry and the distribution position of each directory entry, and finally a file directory is generated for the directory entry after the determined directory level. When a directory is generated by applying the solution provided by the embodiment of the present invention, the generation efficiency of the file directory can be improved.

对于步骤102而言,本发明的另一个实施例中,在所确定的目录项是按照段落顺序排列的情况下,可以先将各个目录项中的目录序号提取出来,再按照预设的目录层级确定规则,确定各个目录项的目录层级。For step 102, in another embodiment of the present invention, when the determined catalog items are arranged in the order of paragraphs, the catalog numbers in each catalog item can be extracted first, and then the catalog numbers can be extracted according to the preset catalog level. Determine the rules to determine the directory hierarchy of each directory entry.

例如,提取出来的各个目录项包括的目录序号如下所示:For example, the directory numbers included in each extracted directory entry are as follows:

[“一、”,“(一)”,“(1)”,“(2)”,“(二)”,“二、”,“1、”,“2、”,“三、”]["One,", "(one)", "(1)", "(2)", "(two)", "two,", "1,", "2,", "three,"]

其中,在第二序号为“一、”的情况下,第一序号为“(一)”,“二”为第三目录项包括的目录序号,由于“二、”和“三、”的序号类型与“一、”相同,所以“二、”和“三、”所在的目录项的目录层级与“一、”所在的目录项的目录层级相同,“(一)”和“(二)”所在的目录项的目录层级为“一、”所在的目录项的目录层级的下一目录层级。Wherein, in the case where the second serial number is "one,", the first serial number is "(one)", and "two" is the directory serial number included in the third directory item, because the serial numbers of "two," and "three," The type is the same as "one,", so the directory level of the directory item where "two," and "three," are located is the same as the directory level of the directory item where "one," is located, "(one)" and "(two)" The directory level of the directory entry in which it is located is the next directory level of the directory level of the directory entry in which "One," is located.

在第二序号为“(一)”的情况下,第一序号为“(1)”,“(二)”为第三目录项包括的目录序号,“(1)”和“(2)”所在的目录项的目录层级为“(一)”所在的目录项的目录层级的下一目录层级。In the case where the second sequence number is "(1)", the first sequence number is "(1)", "(2)" is the directory sequence number included in the third directory entry, "(1)" and "(2)" The directory level of the directory entry where "(1)" is located is the next directory level of the directory level of the directory entry where "(1)" is located.

本发明的一个实施例中,可以先根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项,并提取出各个目录项包括的目录序号:In one embodiment of the present invention, according to the pre-set sequence number judgment rule, the catalog items arranged in the order of paragraphs and used to generate the catalog can be determined from the file, and the catalog sequence numbers included in each catalog item can be extracted:

[“一、”,“(一)”,“(1)”,“(2)”,“(二)”,“二、”,“1、”,“2、”,“三、”]["One,", "(one)", "(1)", "(2)", "(two)", "two,", "1,", "2,", "three,"]

按照目录层级确定规则,确定上述各个目录序号所在的目录项的目录层级。According to the directory level determination rule, the directory level of the directory entry where each of the above directory serial numbers is located is determined.

由于“一、”所在的目录项为第一个目录项,“二”和“三、”的序号类型与“一、”相同,所以“一、”、“二”和“三、”所在的目录项的目录层级相同,作为第一目录层级;Since the directory item where "1," is located is the first directory item, and the serial number type of "2" and "3," is the same as that of "1,", therefore, "1,", "2" and "3." The directory level of the directory item is the same as the first directory level;

“(一)”和“(二)”的序号类型相同,且“(一)”和“(二)”位于序号“一、”、“二”之间,所以“(一)”和“(二)”所在的目录层级为第一目录层级的下一目录层级,作为第二目录层级;"(1)" and "(2)" have the same serial number type, and "(1)" and "(2)" are located between the serial numbers "1," and "2", so "(1)" and "( 2)" is located at the next directory level of the first directory level, as the second directory level;

同样的,“1、”和“2、”也为第二目录层级;Similarly, "1," and "2," are also the second directory level;

“(1)”和“(2)”的序号类型相同,且“(1)”和“(2)”位于序号“(一)”和“(二)”之间,所以“(1)”和“(2)”所在的目录层级为第二目录层级的下一目录层级,作为第三目录层级。"(1)" and "(2)" have the same sequence number type, and "(1)" and "(2)" are located between the sequence numbers "(1)" and "(2)", so "(1)" The directory level where "(2)" and "(2)" are located is the next directory level of the second directory level, as the third directory level.

对确定目录层级后的目录项生成文件目录。A file directory is generated for the directory item after the directory level is determined.

图2为本发明实施例提供的一种图形调整装置的结构示意图,该装置包括:FIG. 2 is a schematic structural diagram of a graphics adjustment device according to an embodiment of the present invention, and the device includes:

目录项确定模块201:用于根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,其中,所述目录项包括:目录序号和目录内容,所述目录序号位于段落的起始位置,所述目录内容与所述目录序号位置相邻;Directory entry determination module 201: used to determine directory entries for generating a directory from a file according to a preset sequence number judgment rule, and obtain the distribution position of each directory entry in the file, wherein the directory entry includes : catalog number and catalog content, the catalog sequence number is located at the start position of the paragraph, and the catalog content is adjacent to the catalog sequence number position;

层级确定模块202:用于根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级;Level determination module 202: used to determine the directory level of each directory item according to the directory sequence number included in each directory item and the distribution position of each directory item;

目录生成模块203:用于对确定目录层级后的目录项生成文件目录。Directory generation module 203: used to generate a file directory for the directory item whose directory level is determined.

本发明的一个实施例中,上述目录项确定模块201,具体用于:In an embodiment of the present invention, the above-mentioned directory item determination module 201 is specifically used for:

根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。According to the pre-set sequence number judgment rule, the directory entries for generating the directory, arranged in paragraph order, are determined from the file.

本发明的一个实施例中,上述层级确定模块202,具体用于:In an embodiment of the present invention, the above-mentioned level determination module 202 is specifically configured to:

按照预设的目录层级确定规则,确定各个目录项的目录层级;Determine the directory level of each directory item according to the preset directory level determination rules;

其中,所述目录层级确定规则为:Wherein, the directory level determination rule is:

在当前目录项为第一个目录项时,When the current directory entry is the first directory entry,

第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry;

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry,

在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy;

第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item;

第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item;

第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry.

本发明的一个实施例中,上述序号判断规则为:由表示序号形式的字符和序号字符串形成的正则表达式;In one embodiment of the present invention, the above-mentioned sequence number judgment rule is: a regular expression formed by a character in the form of a sequence number and a sequence number string;

其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type.

可见,应用本发明实施例提供的方案生成目录时,通过根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,然后根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,最后对确定目录层级后的目录项生成文件目录。应用本发明实施例提供的装置生成目录时,可以提高文件目录的生成效率。It can be seen that when the solution provided by the embodiment of the present invention is applied to generate a directory, the directory entries used to generate the directory are determined from the file according to the preset sequence number judgment rule, and the distribution position of each directory entry in the file is obtained, Then, the directory level of each directory entry is determined according to the directory serial number included in each directory entry and the distribution position of each directory entry, and finally a file directory is generated for the directory entry after the determined directory level. When the device provided by the embodiment of the present invention is used to generate a directory, the generation efficiency of the file directory can be improved.

本发明实施例还提供了一种电子设备,如图3所示,包括处理器301、通信接口302、存储器303和通信总线304,其中,处理器301,通信接口302,存储器303通过通信总线304完成相互间的通信,An embodiment of the present invention further provides an electronic device, as shown in FIG. 3 , including a processor 301 , a communication interface 302 , a memory 303 and a communication bus 304 , wherein the processor 301 , the communication interface 302 , and the memory 303 pass through the communication bus 304 complete communication with each other,

存储器303,用于存放计算机程序;a memory 303 for storing computer programs;

处理器301,用于执行存储器303上所存放的程序时,实现本发明实施例提供的目录生成方法。The processor 301 is configured to implement the directory generation method provided by the embodiment of the present invention when executing the program stored in the memory 303 .

上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above electronic device may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.

存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital SignalProcessing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; may also be a digital signal processor (Digital Signal Processing, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

在本发明提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一目录生成方法的步骤。In yet another embodiment provided by the present invention, a computer-readable storage medium is also provided, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any one of the above directory generation methods is implemented A step of.

在本发明提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任一目录生成方法。In yet another embodiment provided by the present invention, there is also provided a computer program product containing instructions, which, when run on a computer, cause the computer to execute any of the directory generation methods in the foregoing embodiments.

可见,应用上述实施例提供的电子设备进行目录生成时、执行上述实施例提供的计算机可读存储介质中存储的计算机程序进行目录生成时以及在计算机上运行上述实施例提供的计算机程序产品而进行目录生成时,通过根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,然后根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,最后对确定目录层级后的目录项生成文件目录。It can be seen that when the electronic equipment provided by the above embodiments is used to generate the catalog, the computer program stored in the computer-readable storage medium provided by the above embodiments is used to generate the catalog, and the computer program product provided by the above embodiments is executed on the computer. When the directory is generated, the directory entry for generating the directory is determined from the file according to the preset sequence number judgment rule, and the distribution position of each directory entry in the file is obtained, and then the directory number and the directory number included in each directory entry are obtained. The distribution position of each directory item is determined, the directory level of each directory item is determined, and finally a file directory is generated for the directory item after the directory level is determined.

本发明实施例提供的电子设备、可读存储介质以及计算机程序产品,可以快速准确地实现本发明实施例提供的目录生成方法,与现有技术相比,应用本发明实施例提供的方案,不再需要人工查找目录项和设置目录层级,而是利用目录项的序号判断规则来查找目录项,再利用目录项的目录序号和分布位置对目录项进行分级。由此可见,应用本发明实施例提供的方案生成目录时,可以提高文件目录的生成效率。The electronic device, readable storage medium, and computer program product provided by the embodiment of the present invention can quickly and accurately implement the directory generation method provided by the embodiment of the present invention. Compared with the prior art, applying the solution provided by the embodiment of the present invention does not It is then necessary to manually search for directory items and set the directory level, but use the sequence number judgment rule of the directory items to find the directory items, and then use the directory numbers and distribution positions of the directory items to classify the directory items. It can be seen that, when a directory is generated by applying the solution provided by the embodiment of the present invention, the generation efficiency of the file directory can be improved.

在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), among others.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion such that a process, method, article or device comprising a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例、电子设备实施例、计算机可读存储介质实施例以及计算机程序产品实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer-readable storage medium embodiments, and the computer program product embodiments, since they are basically similar to the method embodiments, the descriptions are relatively simple, and for relevant details, refer to the method embodiments part of the description.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (10)

1.一种目录生成方法,其特征在于,所述方法包括:1. a catalog generation method, is characterized in that, described method comprises: 根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,其中,所述目录项包括:目录序号和目录内容,所述目录序号位于段落的起始位置,所述目录内容与所述目录序号位置相邻;According to the pre-set sequence number judgment rule, the directory entry for generating the directory is determined from the file, and the distribution position of each directory entry in the file is obtained, wherein the directory entry includes: the directory number and the directory content, the The table of contents sequence number is located at the starting position of the paragraph, and the content of the table of contents is adjacent to the position of the table of contents sequence number; 根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级;Determine the directory level of each directory entry according to the directory sequence number included in each directory entry and the distribution position of each directory entry; 对确定目录层级后的目录项生成文件目录。A file directory is generated for the directory item after the directory level is determined. 2.根据权利要求1所述的方法,其特征在于,所述根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,包括:2. The method according to claim 1, characterized in that, determining the directory entry for generating the directory from the file according to a preset sequence number judgment rule, comprising: 根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。According to the pre-set sequence number judgment rule, the directory entries for generating the directory, arranged in paragraph order, are determined from the file. 3.根据权利要求2所述的方法,其特征在于,所述根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级,包括:3. The method according to claim 2, wherein, determining the directory level of each directory item according to the directory sequence number included in each directory item and the distribution position of each directory item, comprising: 按照预设的目录层级确定规则,确定各个目录项的目录层级;Determine the directory level of each directory item according to the preset directory level determination rules; 其中,所述目录层级确定规则为:Wherein, the directory level determination rule is: 在当前目录项为第一个目录项时,When the current directory entry is the first directory entry, 第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry; 在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy; 在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry, 在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy; 第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item; 第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item; 第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry. 4.根据权利要求1-3中任一项所述的方法,其特征在于,4. The method according to any one of claims 1-3, characterized in that, 所述序号判断规则为:由表示序号形式的字符和序号字符串形成的正则表达式;The sequence number judgment rule is: a regular expression formed by a character in the form of a sequence number and a sequence number string; 其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type. 5.一种目录生成装置,其特征在于,所述装置包括:5. A directory generation device, wherein the device comprises: 目录项确定模块,用于根据预先设定的序号判断规则,从文件中确定用于生成目录的目录项,并获得各个目录项在所述文件中的分布位置,其中,所述目录项包括:目录序号和目录内容,所述目录序号位于段落的起始位置,所述目录内容与所述目录序号位置相邻;A directory entry determination module, configured to determine directory entries for generating directories from a file according to a preset sequence number judgment rule, and obtain the distribution positions of each directory entry in the file, wherein the directory entries include: Catalogue number and catalogue content, the catalogue sequence number is located at the starting position of the paragraph, and the catalogue content is adjacent to the catalogue sequence number position; 层级确定模块,用于根据各个目录项包括的目录序号和各个目录项的分布位置,确定各个目录项的目录层级;The level determination module is used to determine the directory level of each directory item according to the directory serial number included in each directory item and the distribution position of each directory item; 目录生成模块,用于对确定目录层级后的目录项生成文件目录。The directory generation module is used to generate a file directory for the directory item after the directory level is determined. 6.根据权利要求5所述的装置,其特征在于,所述目录项确定模块,具体用于:6. The apparatus according to claim 5, wherein the directory entry determination module is specifically used for: 根据预先设定的序号判断规则,从文件中确定按照段落顺序排列的、用于生成目录的目录项。According to the pre-set sequence number judgment rule, the directory entries for generating the directory, arranged in paragraph order, are determined from the file. 7.根据权利要求6所述的装置,其特征在于,所述层级确定模块,具体用于:7. The apparatus according to claim 6, wherein the level determination module is specifically configured to: 按照预设的目录层级确定规则,确定各个目录项的目录层级;Determine the directory level of each directory item according to the preset directory level determination rules; 其中,所述目录层级确定规则为:Wherein, the directory level determination rule is: 在当前目录项为第一个目录项时,When the current directory entry is the first directory entry, 第一类目录项的目录层级与第一个目录项的目录层级相同,其中,所述第一类目录项为:所包括目录序号的类型与第一个目录项包括的目录序号的类型相同的目录项;The directory level of the first type of directory entry is the same as the directory level of the first directory entry, wherein the first type of directory entry is: the type of the directory serial number included is the same as the type of the directory serial number included in the first directory entry. directory entry; 在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy; 在当前目录项不为第一个目录项时,When the current directory entry is not the first directory entry, 在第一序号的第一类型与第二序号的第二类型不一致时,当前目录项与第三目录项之间、类型为第一类型的目录序号所在的目录项的目录层级为当前目录项的目录层级的下一目录层级;When the first type of the first serial number is inconsistent with the second type of the second serial number, between the current directory entry and the third directory entry, the directory level of the directory entry where the type is the directory serial number of the first type is located at the directory level of the current directory entry. the next directory level in the directory hierarchy; 第一序号为:当前目录项的下一目录项中包括的目录序号;The first sequence number is: the catalog sequence number included in the next catalog item of the current catalog item; 第二序号为:当前目录项中包括的目录序号;The second sequence number is: the catalog sequence number included in the current catalog item; 第三目录项为:第一序号所在的目录项之后的第一个层级高于或者等于当前目录项层级的目录项。The third directory entry is: a directory entry whose first level after the directory entry where the first serial number is located is higher than or equal to the level of the current directory entry. 8.根据权利要求5-7中任一项所述的装置,其特征在于,8. The device according to any one of claims 5-7, characterized in that, 所述序号判断规则为:由表示序号形式的字符和序号字符串形成的正则表达式;The sequence number judgment rule is: a regular expression formed by a character in the form of a sequence number and a sequence number string; 其中,序号字符串为:分别表示同一类型中各个序号的字符形成的字符串。The serial number string is: a string formed by characters representing each serial number in the same type. 9.一种电子设备,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;9. An electronic device, characterized in that it comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus; 存储器,用于存放计算机程序;memory for storing computer programs; 处理器,用于执行存储器上所存放的程序时,实现权利要求1-4任一所述的方法步骤。The processor is configured to implement the method steps described in any one of claims 1-4 when executing the program stored in the memory. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-4任一所述的方法步骤。10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method steps of any one of claims 1-4 are implemented.
CN201910500726.4A 2019-06-11 2019-06-11 A method and device for generating a directory Active CN112069126B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910500726.4A CN112069126B (en) 2019-06-11 2019-06-11 A method and device for generating a directory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910500726.4A CN112069126B (en) 2019-06-11 2019-06-11 A method and device for generating a directory

Publications (2)

Publication Number Publication Date
CN112069126A true CN112069126A (en) 2020-12-11
CN112069126B CN112069126B (en) 2024-10-01

Family

ID=73658270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910500726.4A Active CN112069126B (en) 2019-06-11 2019-06-11 A method and device for generating a directory

Country Status (1)

Country Link
CN (1) CN112069126B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5355497A (en) * 1992-06-10 1994-10-11 Physiotronics Corporation File directory structure generator and retrevial tool with document locator module mapping the directory structure of files to a real world hierarchical file structure
CN102855244A (en) * 2011-06-28 2013-01-02 北大方正集团有限公司 Method and device for file catalogue processing
CN104111922A (en) * 2013-04-16 2014-10-22 北大方正集团有限公司 Processing method and device of streaming document
CN105630748A (en) * 2014-10-31 2016-06-01 富士通株式会社 Information processing device and information processing method
US20160335280A1 (en) * 2015-05-12 2016-11-17 Y. Jerry Shmerl System and method for organizing, retrieving and displaying information using html indices
CN106951540A (en) * 2017-03-23 2017-07-14 掌阅科技股份有限公司 Generation method, device, server and the computer-readable storage medium of file directory

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5355497A (en) * 1992-06-10 1994-10-11 Physiotronics Corporation File directory structure generator and retrevial tool with document locator module mapping the directory structure of files to a real world hierarchical file structure
CN102855244A (en) * 2011-06-28 2013-01-02 北大方正集团有限公司 Method and device for file catalogue processing
CN104111922A (en) * 2013-04-16 2014-10-22 北大方正集团有限公司 Processing method and device of streaming document
CN105630748A (en) * 2014-10-31 2016-06-01 富士通株式会社 Information processing device and information processing method
US20160335280A1 (en) * 2015-05-12 2016-11-17 Y. Jerry Shmerl System and method for organizing, retrieving and displaying information using html indices
CN106951540A (en) * 2017-03-23 2017-07-14 掌阅科技股份有限公司 Generation method, device, server and the computer-readable storage medium of file directory

Also Published As

Publication number Publication date
CN112069126B (en) 2024-10-01

Similar Documents

Publication Publication Date Title
US20170293696A1 (en) Related entity discovery
CN110851308A (en) Test method, test device, electronic equipment and storage medium
WO2016201819A1 (en) Method and apparatus for detecting malicious file
CN109948122B (en) Error correction method and device for input text and electronic equipment
WO2021164231A1 (en) Official document abstract extraction method and apparatus, and device and computer readable storage medium
WO2018010579A1 (en) Character string segmentation method, apparatus and device
CN105630763B (en) Method and system for disambiguation in mention detection
CN109977233A (en) Idiom knowledge graph construction method and device
CN107958039A (en) A kind of term error correction method, device and server
WO2016191912A1 (en) Comment-centered news reader
CN110851438A (en) Database index optimization suggestion and verification method and device
CN111078697B (en) A data storage method, device, storage medium and electronic equipment
CN111553130A (en) A chapter title style conversion method, device, electronic device and storage medium
CN111414727A (en) Method and device for editing header and footer of PDF (Portable document Format) document and electronic equipment
JP6680472B2 (en) Information processing apparatus, information processing method, and information processing program
CN115146194B (en) Content quality determination method, device, equipment and storage medium
CN112069126A (en) Catalog generation method and device
CN112130828A (en) Software source code modification method, device, equipment and storage medium
CN109977423B (en) Method and device for processing word, electronic equipment and readable storage medium
CN110309423A (en) A kind of sensitive information recognition methods, device and electronic equipment
CN110335114A (en) Product classification method, device and equipment
CN109522928A (en) Theme sentiment analysis method, apparatus, electronic equipment and the storage medium of text
CN109992749A (en) A kind of character displaying method, device, electronic equipment and readable storage medium storing program for executing
CN107943965A (en) Similar article search method and device
CN112001988A (en) Animation effect generation method and device

Legal Events

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