Construction method and device for file index of block chain digital safe box
By building a chaotic index tree based on semantic vectors, the inaccuracy of index caused by irregular naming in blockchain digital safes is solved, efficient file repetition detection and storage resource management are achieved, and file storage and retrieval efficiency is significantly improved.
Patent Information
- Application Number
- CN202411883804.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-21
AI Technical Summary
During the file storage process, blockchain digital safes are inaccurate in the index due to irregular naming, and cannot effectively judge the repetition of storage files. There is a lack of a repetitive mechanism and a mechanism for regularly cleaning redundant files, resulting in wasted storage resources.
By adopting batch file recognition, precise file classification and efficient repetitive detection are achieved by building a chaotic index tree based on semantic vectors. The specific steps include receiving the target file, identifying and generating semantic vectors, inputting them to the Chaos Index Executor to construct the index tree, and each branch node stores a semantic vector of the target file.
It significantly improves file storage and retrieval efficiency, supports automatic and efficient detection of file repetition, avoids waste of storage resources, and can quickly locate stored files similar to newly uploaded files, enhancing the user experience of file storage and retrieval.
Smart Images

Figure CN119669158A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology or other related fields, and in particular to a method and device for constructing a file index for a blockchain digital safe. Background Art
[0002] As an innovative file storage solution, the core advantage of blockchain digital safes is that they use the immutability, traceability and decentralization of blockchain technology to provide a safe and reliable storage and management environment for digital files. However, in practical applications, traditional file classification methods rely on manually created directory structures, or assign file labels through preprocessing methods such as file names, metadata, and image features, and then build hybrid index mechanisms, such as clustering and non-clustering indexes combined with physical hash values. This is an index construction method that relies on preprocessing results, especially when faced with interference factors such as irregular file naming, metadata deviations, and image feature extraction, its accuracy and efficiency will be significantly affected.
[0003] In addition, since blockchain digital safes need to process file upload requests from multiple institutions and users, they often encounter storage problems for duplicate files. The above-mentioned method of judging file duplication through simple file name comparison or mixed index mechanism cannot adapt to the file storage efficiency requirements in the blockchain environment, especially considering the inherent shortcomings of the blockchain system in storage efficiency and performance. It is even more unable to provide accurate conclusions on file duplication judgment, lacks anti-duplication mechanism and mechanism for regularly cleaning up redundant files, resulting in a waste of storage resources.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The main purpose of this application is to provide a method and device for constructing a file index for a blockchain digital safe, so as to at least solve the technical problem in the related art that the non-standard naming during the file storage process leads to inaccurate indexing, thereby making it impossible to effectively judge the duplication of stored files.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for constructing a file index for a blockchain digital safe is provided, the method comprising: receiving N target files, and identifying each of the target files to obtain a target recognition result, wherein the recognition result is used to indicate the area information and text information of the target file, and N is a positive integer; constructing a semantic vector of the target file based on the target recognition result to obtain N semantic vectors, wherein each semantic vector corresponds to one target file; inputting the N semantic vectors into a chaotic index executor to output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, and the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores the semantic vector corresponding to one target file.
[0007] Furthermore, the step of identifying each of the target files and obtaining a target recognition result includes: acquiring image data of the target file; performing region recognition on the image data to obtain the region information, wherein the region information includes M region sets, each of the region sets includes R regions, and M and R are both positive integers; performing text recognition on the image data based on the region information to obtain the text information, wherein each of the regions corresponds to a word information in the text information, and each of the region sets corresponds to a single sentence information in the text information; and generating the target recognition result of the target file based on the text information and the region information.
[0008] Furthermore, the step of generating the target recognition result of the target file based on the text information and the area information includes: determining a first type of separator and a second type of separator; based on the area information, using the first type of separator to separate each of the single sentences in the text information to obtain a first recognition result; for each of the single sentences in the first recognition result, using the second type of separator to separate each of the words to obtain the target recognition result.
[0009] Furthermore, the step of constructing the semantic vector of the target file based on the target recognition result to obtain N semantic vectors includes: for each target recognition result of the target file, setting a weight value for each word information based on the inverse document frequency, wherein the inverse document frequency is the inverse of the document frequency; inputting the target recognition result into a preset semantic vector model, and outputting a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, and S and k are both integers greater than or equal to 2; performing weighted calculation on the S regional semantic vectors in the semantic vector matrix based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
[0010] Furthermore, the chaotic index executor constructs a chaotic index tree through the following steps: determining N target points in a target coordinate system based on N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; determining a target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and selecting a separation point in the target point set based on the target dimension; creating a root node of the chaotic index tree based on the separation point, wherein the root node is the starting point of the chaotic index tree; creating a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point, to obtain the chaotic index tree.
[0011] Furthermore, the step of creating a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point includes: for each remaining target point, comparing the size relationship between the target point and the separation point in the target dimension to obtain a comparison result; if the comparison result indicates that the target point is smaller than the separation point in the target dimension, classifying the target point as a left subtree point, otherwise, classifying the target point as a right subtree point; constructing the left subtree based on all the target points classified as left subtree points, and constructing the right subtree based on all the target points classified as right subtree points.
[0012] Furthermore, the step of constructing a left / right subtree based on the target points of all categories being left / right subtree points includes: S1, updating the target dimension based on the preset dimension recursive strategy; S2, for all the target points of all categories being left / right subtree points, selecting a new separation point based on the updated target dimension; S3, creating a branch node of the chaotic index tree based on the updated separation point, and creating a left branch and a right branch of the branch node; S4, attaching all target points smaller than the branch node on the target dimension to the left branch, and attaching the remaining target points not assigned to the left branch to the right branch; S5, determining the target point attached to the left branch as the updated left subtree point, and determining the target point attached to the right branch as the updated right subtree point; S6, recursively executing steps S1 to S5 until all the target points are attached, and the left / right subtree is obtained.
[0013] Furthermore, after outputting the chaotic index tree, it also includes: when receiving a file to be uploaded, identifying the file to be uploaded, and constructing a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; inputting the vector to be queried into the chaotic index executor, and outputting a query result, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by searching the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
[0014] Furthermore, after outputting the query result, it also includes: when the semantic vector indicated by the query result is the same as the vector to be queried, determining the file to be uploaded corresponding to the vector to be queried as a duplicate file, and refusing to upload the duplicate file to the blockchain digital safe; when the semantic vector indicated by the query result is not the same as the vector to be queried, constructing a new branch node based on the vector to be queried, and updating the chaotic index tree based on the new branch node.
[0015] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a device for constructing a file index for a blockchain digital safe is also provided, and the device includes: a receiving unit, used to receive N target files, and identify each of the target files to obtain a target recognition result, and the recognition result is used to indicate the area information and text information of the target file, wherein N is a positive integer; a construction unit, used to construct a semantic vector of the target file based on the target recognition result, and obtain N semantic vectors, wherein each semantic vector corresponds to one target file; an input unit, used to input the N semantic vectors into a chaotic index executor, and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, and the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to one target file.
[0016] Furthermore, the receiving unit includes: an acquisition module, used to acquire image data of the target file; a first recognition module, used to perform region recognition on the image data to obtain the region information, wherein the region information includes M region sets, each of the region sets includes R regions, and M and R are both positive integers; a second recognition module, used to perform text recognition on the image data based on the region information to obtain the text information, wherein each of the regions corresponds to a word information in the text information, and each of the region sets corresponds to a single sentence information in the text information; and a generation module, used to generate the target recognition result of the target file based on the text information and the region information.
[0017] Furthermore, the generation module includes: a first determination submodule, used to determine the first type of separator and the second type of separator; a first separation submodule, used to use the first type of separator to separate each of the single sentences in the text information based on the area information to obtain a first recognition result; and a second separation submodule, used to use the second type of separator to separate each of the words in each of the single sentences in the first recognition result to obtain the target recognition result.
[0018] Furthermore, the construction unit includes: a setting module, used to set a weight value for each of the word information based on the inverse document frequency for the target recognition result of each of the target files, wherein the inverse document frequency is the inverse of the document frequency; a first input module, used to input the target recognition result into a preset semantic vector model, and output a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, and S and k are both integers greater than or equal to 2; a calculation module, used to perform weighted calculation on the S regional semantic vectors in the semantic vector matrix based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
[0019] Furthermore, the file index construction device for the blockchain digital safe also includes: a first determination module, used to determine N target points in the target coordinate system based on the N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; a second determination module, used to determine the target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and select a separation point in the target point set based on the target dimension; a first creation module, used to create a root node of the chaotic index tree based on the separation point, wherein the root node is the starting point of the chaotic index tree; a second creation module, used to create a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point, to obtain the chaotic index tree.
[0020] Furthermore, the second creation module includes: a comparison submodule, used for comparing the size relationship between the target point and the separation point in the target dimension for each remaining target point to obtain a comparison result; a classification submodule, used for classifying the target point as a left subtree point if the comparison result indicates that the target point is smaller than the separation point in the target dimension, otherwise, classifying the target point as a right subtree point; a first construction submodule, used for constructing the left subtree based on all the target points that are classified as left subtree points, and constructing the right subtree based on all the target points that are classified as right subtree points.
[0021] Furthermore, the first construction submodule includes: an update submodule, used to execute S1, to update the target dimension based on the preset dimension recursive strategy; a selection submodule, used to execute S2, for all the target points classified as left / right subtree points, select new separation points based on the updated target dimension; a creation submodule, used to execute S3, to create a branch node of the chaotic index tree based on the updated separation point, and to create a left branch and a right branch of the branch node; a hanging submodule, used to execute S4, to hang all target points smaller than the branch node on the target dimension to the left branch, and to hang the remaining target points not assigned to the left branch to the right branch; a second determination submodule, used to execute S5, to determine the target point hung on the left branch as the updated left subtree point, and to determine the target point hung on the right branch as the updated right subtree point; a recursive execution submodule, used to execute S6, to recursively execute steps S1 to S5, until all the target points are hung, and the left / right subtree is obtained.
[0022] Furthermore, the file index construction device for the blockchain digital safe also includes: a third identification module, which is used to identify the file to be uploaded after outputting the chaotic index tree, and to construct a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; a second input module, which is used to input the vector to be queried into the chaotic index executor and output the query result, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by searching the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
[0023] Furthermore, the second input module also includes: a third determination submodule, which is used to, after outputting the query result, determine the file to be uploaded corresponding to the vector to be queried as a duplicate file when the semantic vector indicated by the query result is the same as the vector to be queried, and refuse to upload the duplicate file to the blockchain digital safe; a second construction submodule, which is used to construct a new branch node based on the vector to be queried when the semantic vector indicated by the query result is not the same as the vector to be queried, and update the chaotic index tree based on the new branch node.
[0024] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a computer-readable storage medium is also provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for constructing a file index for a blockchain digital safe.
[0025] In order to achieve the above-mentioned purpose, according to another aspect of the present application, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned methods for constructing a file index for a blockchain digital safe.
[0026] The present invention proposes a method for constructing a file index for a blockchain digital safe, which first receives N target files and identifies each target file to obtain a target identification result, wherein the identification result is used to indicate the regional information and text information of the target file, wherein N is a positive integer, and then constructs a semantic vector of the target file based on the target identification result to obtain N semantic vectors, wherein each semantic vector corresponds to a target file, and then inputs the N semantic vectors into a chaotic index executor to output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vector, and the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0027] In the present invention, a batch file recognition method is adopted, and the purpose of accurate file classification and efficient repeatability detection is achieved by constructing a chaotic index tree based on semantic vectors, thereby achieving the technical effect of significantly improving the efficiency of file storage and retrieval. Specifically, by batch recognizing N target files, not only the text content of the file is captured, but also its regional information is keenly parsed to form a target recognition result. Compared with the traditional method, a deep understanding of the file content can be ensured even in the case of inconsistent naming rules. The semantic vector of each file is constructed based on the detailed recognition results to form N independent semantic vector sets, which converts the file information into a mathematical representation, so that the intrinsic semantic structure of the file can be displayed in a multidimensional space in the form of a vector, and the semantic vector is constructed. The vector ensures that even if there are differences in file naming, as long as the content is similar, they can be identified as similar files, which fundamentally solves the problem of duplicate file storage caused by irregular naming. Finally, N semantic vectors are input into the chaotic index executor to generate a chaotic index tree. Each branch node stores the semantic vector of a target file, which not only supports fast file positioning, but also maintains high performance when data and query modes change. It supports automatic and efficient detection of file duplication, avoids the waste of storage resources, and can quickly locate existing files similar to newly uploaded files, enhancing the user experience of file storage and retrieval, thereby solving the technical problem in related technologies that irregular naming during file storage leads to inaccurate indexing, making it impossible to effectively judge the duplication of stored files. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0029] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a construction method of a file index for a blockchain digital safe is shown;
[0030] Figure 2 is a flowchart of an optional method for constructing a file index for a blockchain digital safe according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of an optional blockchain-based file upload and storage process according to an embodiment of the present invention;
[0032] Figure 4 is a flowchart of an optional method for constructing a left / right subtree according to an embodiment of the present invention;
[0033] Figure 5 is a schematic diagram of an optional index tree according to an embodiment of the present invention;
[0034] Figure 6 is a schematic diagram of an optional device for constructing a file index for a blockchain digital safe according to an embodiment of the present invention;
[0035] Figure 7 It is a structural block diagram of an electronic device that executes a construction method of a file index for a blockchain digital safe according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] To facilitate those skilled in the art to understand the present invention, some terms or nouns involved in the embodiments of the present invention are explained below:
[0039] OCR, Optical Character Recognition, is a technology used to recognize text in documents, which can convert text in images into editable and searchable digital text format. In the present invention, the OCR recognizer is used to extract text information from the target file to provide a basis for the construction of semantic vectors.
[0040] NLP, Natural Language Processing, is used to process, understand and parse human language. In the present invention, NLP technology is used to process OCR recognition results and construct the semantic vector of the file.
[0041] Chaotic indexing refers to a file indexing mechanism in a dynamic and complex environment, especially suitable for situations where file information is not completely accurate or constantly changing. In the present invention, chaotic indexing uses semantic vectors and Euclidean distance calculations to achieve rapid file location and similarity judgment, which is the core of efficient file management and anti-duplicate mechanism.
[0042] IDF, Inverse Document Frequency, is a statistical weight widely used in information retrieval and text mining to evaluate the uniqueness of a word to a document set. In the present invention, IDF is used to assign weight values to the word information identified in each target file. Those words that appear less frequently in the document but have unique information will be assigned higher weights, while the weights of common words are relatively low. This means that when constructing a semantic vector, more attention is paid to keywords that can distinguish the content of the file.
[0043] Blockchain digital safe, a secure file storage and management system based on blockchain technology, is used to ensure the integrity and privacy of files. In this invention, the blockchain digital safe is the main body of file storage, identification and index construction, ensuring the decentralization and immutability of file management.
[0044] It should be noted that the construction method and device for file indexing of blockchain digital safes in the present application can be used in the field of blockchain technology for efficiently managing and repeatably detecting files in digital safes, and can also be used in any field outside the field of blockchain technology for efficiently managing and repeatably detecting files in digital safes. The application of the construction method and device for file indexing of blockchain digital safes in the present application does not limit the application field.
[0045] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, processing, transmission, provision, disclosure, use and processing of the relevant data comply with the laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.
[0046] The information collection (for example, user voice, video, and text collection) and analysis operations involved in this application have provided users with corresponding operation entrances when they are executed, allowing users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.
[0047] The following embodiments of the present invention can be applied to various systems / applications / devices that require file management and repeatability detection, and can achieve accurate file classification and fast file repeatability judgment. The present invention uses batch file recognition to extract text information, and then constructs semantic vectors based on this information, which can better reflect the actual content and contextual relationship of the file, and then improves the efficiency and accuracy of file storage and retrieval in the case of irregular naming or insufficient metadata description through the establishment of a chaotic index tree, ensuring the uniqueness of the file and quickly locating similar files, providing users and systems with an efficient, reliable and intelligent file management solution.
[0048] The present invention is described in detail below in conjunction with various embodiments.
[0049] Embodiment 1
[0050] According to an embodiment of the present invention, an embodiment of a method for constructing a file index for a blockchain digital safe is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.
[0051] The method for constructing a file index for a blockchain digital safe provided in the first embodiment of the present invention can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or mobile device) for implementing a construction method of a file index for a blockchain digital safe is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0052] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0053] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the construction method of the file index for the blockchain digital safe in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the construction method of the file index for the blockchain digital safe is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0054] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0055] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0056] Under the above operating environment, the present invention provides Figure 2 The method for constructing a file index for a blockchain digital safe shown in the figure is implemented by a blockchain digital safe system. It combines optical character recognition (OCR) and natural language processing (NLP) technology and is used in file management and retrieval scenarios, especially to solve the index construction and repeatability detection problems caused by irregular file naming. By constructing a chaotic index tree based on semantic vectors, specifically, by receiving target files in batches and identifying, constructing semantic vectors, inputting them into a chaotic index executor and forming an index tree, the purpose of accurate file classification, efficient repeatability detection and rapid file positioning is achieved.
[0057] The embodiment of the present invention is described in detail below in conjunction with various specific steps.
[0058] Figure 2is a flowchart of an optional method for constructing a file index for a blockchain digital safe according to an embodiment of the present invention, such as Figure 2 As shown, the method comprises the following steps:
[0059] Step S201, receiving N target files, and identifying each target file to obtain a target identification result, wherein the identification result is used to indicate the region information and text information of the target file, and N is a positive integer.
[0060] Specifically, the target file refers to the file to be uploaded submitted by the target user to the blockchain digital safe. It can be a digital file in any form, such as PDF, image files (JPEG, PNG), office documents (Word, Excel), etc., which contains information that needs to be extracted, parsed and indexed.
[0061] An exemplary one, Figure 3 is a schematic diagram of an optional blockchain-based file upload and storage process according to an embodiment of the present invention, such as Figure 3 As shown in the figure, in this process, the financial institution management platform uploads the file to the digital safe of the blockchain platform, and then the digital safe transmits it to the OCR recognizer, and the online batch file recognition is started through the batch trigger and the online trigger to obtain the recognition result, and the semantic vector is constructed based on the recognition result, and sent to the chaotic index executor for chaotic index construction, and finally the chaotic index tree is obtained.
[0062] Optionally, the step of identifying each target file and obtaining a target recognition result includes: acquiring image data of the target file; performing region recognition on the image data to obtain region information, wherein the region information includes M region sets, each region set includes R regions, and M and R are both positive integers; performing text recognition on the image data based on the region information to obtain text information, wherein each region corresponds to a word information in the text information, and each region set corresponds to a single sentence information in the text information; and generating a target recognition result for the target file based on the text information and the region information.
[0063] It should be noted that after acquiring the file, the document will be converted into image data to facilitate subsequent image processing and recognition. The conversion process can adopt the method of scanning physical documents or directly processing electronic documents to ensure that the file content can be read by OCR technology.
[0064] Furthermore, region recognition is the process of segmenting the image data of the target file into multiple identifiable regions. An image segmentation algorithm can be used to identify M region sets, each of which is composed of R regions. The target document is structured through regional analysis, so as to better understand the layout and content organization of the file. In the embodiment of the present invention, the region set can be understood as a paragraph or table in a document, and the region corresponds to a sentence in a paragraph or a cell in a table.
[0065] After identifying the regions and region sets, text recognition is performed on each region, and the image data is converted into text data through OCR technology to ensure that each region corresponds to a word in the text information, and each region set corresponds to a single sentence in the text information. Fine recognition can capture every detail of the text content in the file, providing sufficient information for the subsequent semantic vector construction.
[0066] Finally, the text information and region information are combined to generate the recognition result of the target file, which includes not only the text content of the file, but also the location information of the text (such as the specific layout in the document) and possible semantic levels (such as words, sentences and paragraphs).
[0067] The above steps ensure that even in the case of irregular file naming or insufficient metadata description, a comprehensive and accurate recognition result can be constructed through in-depth analysis of the file content, thereby optimizing traditional file processing methods and improving the accuracy and speed of file recognition.
[0068] Optionally, the step of generating a target recognition result of a target file based on text information and regional information includes: determining a first type of separator and a second type of separator; based on the regional information, using the first type of separator to separate each single sentence in the text information to obtain a first recognition result; for each single sentence in the first recognition result, using the second type of separator to separate each word to obtain a target recognition result.
[0069] It should be noted that the first type of separator is a separator used to divide a long text in a text message into different single sentences. The sentence terminators commonly used in natural language processing can be used as the first type of separator, such as a period, a question mark, or an exclamation mark. The structured separators can also be used as the first type of separator, such as the line terminators or paragraph separators in a table. In the financial document processing scenario of the embodiment of the present invention, the first type of separator may include line breaks, table separators (such as tabs), or other symbols that can distinguish different semantic units (such as clauses, items, or data points).
[0070] The second type of separator is used to further divide a single sentence into words or phrases. A space can be used as the second type of separator, or a comma, a semicolon, or a specific separator (for example, a special symbol used to distinguish between numerical values and units) can be used as the second type of separator to ensure accurate division of words or phrases.
[0071] Sentence segmentation is the first step in converting text information based on OCR recognition into structured data. Different semantic levels in the text information, namely single sentences, are identified based on the regional information extracted from the image data. By segmenting the text with the first type of delimiters, long text can be broken down into smaller, meaningful units. For example, in financial documents, a paragraph may contain multiple different clauses or data points. By identifying delimiters such as line breaks or tabs, these contents can be separated into single sentences, providing clear semantic units for subsequent processing.
[0072] After obtaining the sentence segmentation results, we further analyze each single sentence, use the second type of separator to split each single sentence into smaller words or phrases, extract the keywords and phrases in the file, and provide the necessary information for building semantic vectors. For example, when processing financial data, using spaces, commas, or specific numerical separators can decompose single sentences containing numerical values, units, and descriptions into independently assessable elements, further improving the accuracy of file content understanding and index construction.
[0073] Through the above steps, structured information can be extracted from complex file contents. Even in the case of irregular file naming or insufficient metadata description, target recognition results that accurately reflect the semantics and structure of the file can be constructed, providing a solid data foundation for subsequent chaotic index construction and file management. The above multi-level text information processing method can not only improve the efficiency and accuracy of file retrieval, but also maintain the robustness and real-time performance of the index in a complex and dynamic environment.
[0074] Step S202: constructing a semantic vector of the target file based on the target recognition result to obtain N semantic vectors, wherein each semantic vector corresponds to a target file.
[0075] The semantic vector is a mathematical representation generated by NLP technology, which is used to capture the meaning and context of text content and convert the text into a multidimensional vector, where each dimension represents the attribute or feature of the text in a specific semantic space. In the present invention, the semantic vector is used to describe the semantic features of the target file and is the basis for constructing a chaotic index tree.
[0076] Furthermore, each dimension of the semantic vector can correspond to a specific semantic space or subject area. For example, one dimension can represent "financial product type", another dimension can represent "issuance method", and another dimension can reflect "issuance time", etc.
[0077] The value on each dimension of the vector reflects the importance or relevance of the target document on the semantic feature. The value is related to the frequency of occurrence of a specific concept in the document or its importance in the document. For example, in a document about fund issuance, "fund code" is a frequently appearing and key semantic feature in the document. This feature may have a higher value on the dimension of "fund product type". Alternatively, in the case of using inverse document frequency, the more frequent and key semantic features have smaller values. The specific value is related to the specific strategy of vector construction.
[0078] Optionally, step S202 includes: for the target recognition result of each target file, setting a weight value for each word information based on the inverse document frequency, wherein the inverse document frequency is the inverse of the document frequency; inputting the target recognition result into a preset semantic vector model, and outputting a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, and S and k are both integers greater than or equal to 2; performing weighted calculation on the S regional semantic vectors in the semantic vector matrix based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
[0079] It should be noted that the semantic vector model is a pre-trained deep learning model that can convert text into numerical vectors, and each vector dimension represents a specific semantic space. The text information processed by the target recognition result is input into the model, and the semantic vector matrix with S rows and k columns is output, where S represents the total number of words in the target recognition result, and k is the vector dimension set by the model, representing the number of semantic features. Each row in the matrix corresponds to the semantic vector of a word, reflecting the numerical representation of the word in different semantic spaces.
[0080] During the weighted fusion process, the regional semantic vectors of each row in the matrix are weighted averaged to obtain a comprehensive k-dimensional semantic vector. The purpose is to emphasize the unique and important semantic features in the document and ensure that the final semantic vector can accurately reflect the key information of the target file. The result of weighted fusion is a k-dimensional semantic vector that can comprehensively capture and quantify the semantic features of the target file. Even in the case of irregular file naming or missing metadata, efficient retrieval can be performed based on the similarity of file content.
[0081] Through the above steps, semantic features can be extracted from the text and regional information of the target file, and a semantic vector that can reflect its internal logic and semantic association can be constructed, which provides strong data support for the intelligent classification, duplication detection and rapid retrieval of files. It not only maintains high efficiency when processing large-scale files, but also maintains the robustness and real-time nature of the index in an environment where the file content changes dynamically, which is very suitable for the file management needs of blockchain digital safes.
[0082] Step S203, input N semantic vectors into the chaotic index executor, and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0083] Specifically, the branch node is the core component of the chaotic index tree, representing the intermediate state in the process of file location and classification. Each branch node stores a semantic vector of a target file. The role of the branch node is not only to store the vector, but also to serve as a reference point for the index tree division to compare the semantic vector of the uploaded file to decide whether to search the left subtree or the right subtree, so as to locate the most similar file.
[0084] The construction process of the branch node in the embodiment of the present invention follows the following principles: when constructing the index, the executor divides according to the dimension value of the semantic vector, selects the median value on a dimension as the separation point (i.e., the branch node), and the left side of the branch node will mount the file vectors whose values on the dimension are less than or equal to the median value, while the right side will mount the file vectors whose values are greater than the median value. As the index tree is recursively constructed, the number of branch nodes will gradually increase until all N files are correctly located.
[0085] The connection relationship is used to describe the structural association between branch nodes in the chaotic index tree. Each branch node in the tree structure has a parent node and zero or more child nodes. The connection relationship clarifies the hierarchical relationship of the branch nodes, which is crucial for the query and search of the index tree. In the query and search process, based on the connection relationship, the tree structure can be traversed from the root node according to the semantic vector of the file, and finally one or more most similar files can be located.
[0086] In the chaotic index tree, the connection relationship also reflects the dynamic changes of data. The index tree is updated regularly as new files are uploaded, and the separation axes and positions of branch nodes are re-evaluated to ensure that the tree structure can adapt to changes in the file set and maintain the effectiveness and efficiency of the index. The above update mechanism ensures that the index tree can still provide accurate positioning and retrieval services in complex and uncertain data environments.
[0087] It should be noted that the chaotic index executor is responsible for receiving the semantic vectors generated by multiple target files and using these vectors to build a chaotic index tree. The chaotic index tree is a special data structure that can efficiently locate and retrieve files in a dynamic and complex data environment. It is essentially a program or algorithm. The workflow includes receiving N semantic vectors, sorting, splitting and recursively processing the vectors, and finally building a chaotic index tree.
[0088] Optionally, the chaotic index executor constructs a chaotic index tree through the following steps: determining N target points in a target coordinate system based on N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; determining a target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and selecting a separation point in the target point set based on the target dimension; creating a root node of the chaotic index tree based on the separation point, wherein the root node is the starting point of the chaotic index tree; creating a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point, to obtain a chaotic index tree.
[0089] It should be noted that a target coordinate system is defined in the k-dimensional space, and the k dimension corresponds to the dimension of the semantic vector generated in step S202. The target coordinate system provides a mathematical framework for the construction of the chaotic index tree, so that the semantic information of the file can be accurately represented and compared in the multidimensional space. The N semantic vectors are mapped to the target coordinate system, each vector corresponds to a point, forming a set of N target points. The positions of all points in the coordinate system reflect the semantic features of the target file and are the basis for constructing the chaotic index tree.
[0090] Based on the preset recursive strategy, a target dimension is first determined for segmentation in the current point set. In the early stage of building the chaotic index tree, the target dimension can be any one of the semantic vector dimensions, but in the subsequent recursive process, the selection of the target dimension will follow a certain order, such as looping through all dimensions or based on a specific dimension selection algorithm.
[0091] After determining the target dimension, the executor selects a separation point on the target point set. The principle of selecting the separation point is to find a point on the target dimension that can evenly divide the point set into two parts. The most common method is to find the median point of the current point set on the target dimension. If the median point does not exist in the point set, the point closest to the median can be selected as the separation point.
[0092] Furthermore, a root node is created based on the first selected separation point as the starting point of the chaotic index tree. The root node not only stores the semantic vector of the separation point, but also represents the starting point for the subsequent index tree construction. Then, according to the size relationship between each target point and the separation point in the target dimension, the point set is divided into two parts, one part is less than or equal to the separation point, and the other part is greater than the separation point, and the left subtree and the right subtree are constructed respectively.
[0093] Optionally, the step of creating a left subtree and a right subtree of a root node based on the remaining target points in the target point set except the separation point includes: for each remaining target point, comparing the size relationship between the target point and the separation point in the target dimension to obtain a comparison result; when the comparison result indicates that the target point is smaller than the separation point in the target dimension, classifying the target point as a left subtree point, otherwise, classifying the target point as a right subtree point; constructing a left subtree based on all target points that are classified as left subtree points, and constructing a right subtree based on all target points that are classified as right subtree points.
[0094] In the process of constructing the left subtree and the right subtree, the executor will select the next target dimension for segmentation, which is usually the next dimension of the current dimension. If all dimensions have been traversed, it will return to the first dimension for segmentation and continue the recursive process until all target points are correctly classified into the leaf nodes of the tree. At this time, the chaotic index tree is constructed.
[0095] Specifically, Figure 4 is a flowchart of an optional method for constructing a left / right subtree according to an embodiment of the present invention. Figure 4 As shown, the method comprises the following steps:
[0096] S401, updating the target dimension based on a preset dimension recursive strategy;
[0097] S402, for all target points of the left / right subtree type, select new separation points based on the updated target dimension;
[0098] S403, creating a branch node of the chaotic index tree based on the updated separation point, and creating a left branch and a right branch of the branch node;
[0099] S404, attach all target points whose target dimension is smaller than the branch node to the left branch, and attach the remaining target points not assigned to the left branch to the right branch;
[0100] S405, determining the target point attached to the left branch as the updated left subtree point, and determining the target point attached to the right branch as the updated right subtree point;
[0101] S406, recursively execute steps S401 to S405 until all target points are connected, and obtain the left / right subtree.
[0102] As an example, assume that N = 6, k = 2, that is, there are 6 target files, and identify vector values (point sets) on 2 dimensions: (2,3), (4,7), (5,4), (7,2), (8,1), (9,6), where the first dimension is recorded as x and the second dimension is recorded as y. Figure 5is a schematic diagram of an optional index tree according to an embodiment of the present invention. The construction process of the index tree is as follows.
[0103] a. When constructing the root node, the target dimension is selected as x. The point set on x is sorted from small to large as (2,3), (4,7), (5,4), (7,2), (8,1), (9,6). (7,2) can be selected as the root node. (Note: The median of 2,4,5,7,8,9 in mathematics is (5+7) / 2=6, but this median does not exist in the point set, so (7,2) can be specified as the root node first;
[0104] b, (2,3), (4,7), (5,4) are attached to the left subtree of the root node (7,2), (8,1), (9,6) are attached to the right subtree of the root node (7,2);
[0105] c. When constructing the left subtree of the (7,2) branch node, the target dimension of the point set (2,3), (4,7), and (5,4) is changed to y, and the median (5,4) is determined as the separation point and branch node. (2,3) is hung on its left subtree, and (4,7) is hung on its right subtree.
[0106] d. When constructing the right subtree of the root node (7,2), the target dimension of the point set (8,1) and (9,6) is also changed to y. The median (9,6) is determined as the separation point and branch node, and (8,1) is hung on its left subtree. At this point, the chaotic index construction is completed, as shown in Figure 5 shown.
[0107] The chaotic index executor in the embodiment of the present invention organizes N semantic vectors in a k-dimensional space through a preset dimensional recursive strategy, forming a chaotic index tree that can efficiently locate and retrieve files. It not only takes into account the multi-dimensional characteristics of file semantics, but also maintains the validity of the index in an environment where the file set changes dynamically. It is a key step in realizing intelligent file management and retrieval in the technical solution of the present invention. By constructing a chaotic index tree, even if the file naming is not standardized or metadata is missing, accurate and fast file location can be performed based on the semantic similarity of the file content.
[0108] After the chaotic index tree is constructed, the embodiment of the present invention further provides a mechanism for identifying, locating, and preventing duplicate files from being uploaded and updating the index tree.
[0109] Optionally, after outputting the chaotic index tree, it also includes: when receiving a file to be uploaded, identifying the file to be uploaded, and constructing a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; inputting the vector to be queried into the chaotic index executor, and outputting the query result, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by searching the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
[0110] It should be noted that when a file to be uploaded is received, it is first subjected to OCR recognition to extract the key text information in the file, which is similar to step S201, but is aimed at a single file to be uploaded. The recognized text information is used to construct a semantic vector to generate a k-dimensional query vector for file location and similarity judgment in the chaotic index tree.
[0111] The chaotic index executor uses the query vector as the coordinate value of the virtual node to locate and compare in the chaotic index tree. It should be noted that the virtual node is not actually stored in the tree, but is used as a comparison benchmark in the retrieval process. Starting from the root node, the executor calculates the Euclidean distance between the virtual node and the semantic vector of each branch node in the tree, recursively searches for the nearest branch node in the tree, and decides whether to search the left subtree or the right subtree based on the comparison of the separation axis dimension value of the current branch node with the virtual node, until the branch node with the smallest distance is found.
[0112] Optionally, after outputting the query result, it also includes: when the semantic vector indicated by the query result is the same as the vector to be queried, determining the to-be-uploaded file corresponding to the vector to be queried as a duplicate file, and refusing to upload the duplicate file to the blockchain digital safe; when the semantic vector indicated by the query result is different from the vector to be queried, constructing a new branch node based on the vector to be queried, and updating the chaotic index tree based on the new branch node.
[0113] It should be noted that if the semantic vector stored in the retrieved nearest branch node is exactly the same as the query vector, the file to be uploaded will be marked as a duplicate file and will be rejected from being uploaded to the blockchain digital safe. The above anti-duplicate mechanism is based on the precise comparison of semantic vectors, ensuring the uniqueness of the file set and the efficiency of data storage.
[0114] If the semantic vector of the nearest branch node is different from the query vector, it indicates that the file to be uploaded is a new file that is not repeated, and a new branch node is constructed in the chaotic index tree based on the query vector. The creation of a new branch node includes: determining a suitable separation point, splitting the tree based on the separation point, adding the query vector (i.e. the semantic vector of the file to be uploaded) to the appropriate position in the tree, and re-evaluating and adjusting the existing branch nodes to ensure the balance and retrieval efficiency of the chaotic index tree.
[0115] In the embodiment of the present invention, as new files are continuously uploaded, the chaotic index tree is updated periodically or when a certain threshold is reached to reflect the changes in the file set. During the update process, the median of the point set is recalculated, the position of the separation point is adjusted, and the tree structure is optimized to ensure that the index tree can efficiently support file location and retrieval while handling the dynamic changes of the file set.
[0116] The embodiment of the present invention constructs a virtual node and retrieves the chaotic index tree to quickly determine whether the file to be uploaded is a duplicate file, thereby avoiding unnecessary storage; at the same time, it accurately locates non-duplicate new files and adds them to the index tree, maintaining the integrity of the index tree and the efficiency of the retrieval mechanism, which not only greatly improves the level of intelligent file management in the blockchain digital safe, but also effectively responds to the challenges brought about by the dynamic changes of the file set, ensuring the robustness and adaptability of the index tree.
[0117] Through the above steps S201 to S203, N target files can be first received, and each target file can be identified to obtain a target identification result, wherein the identification result is used to indicate the regional information and text information of the target file, wherein N is a positive integer, and then a semantic vector of the target file is constructed based on the target identification result to obtain N semantic vectors, wherein each semantic vector corresponds to a target file, and then the N semantic vectors are input into a chaotic index executor to output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vector, and the chaotic index tree contains N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0118] In the embodiment of the present invention, a batch file recognition method is adopted, and the purpose of accurate file classification and efficient repeatability detection is achieved by constructing a chaotic index tree based on semantic vectors, thereby achieving the technical effect of significantly improving the efficiency of file storage and retrieval. Specifically, by batch recognizing N target files, not only the text content of the file is captured, but also its regional information is keenly parsed to form a target recognition result. Compared with the traditional method, a deep understanding of the file content can be ensured even in the case of inconsistent naming rules. The semantic vector of each file is constructed based on the detailed recognition results to form N independent semantic vector sets, which converts the file information into a mathematical representation, so that the intrinsic semantic structure of the file can be displayed in a multidimensional space in the form of a vector, and a vector structure is constructed. The semantic vector ensures that even if there are differences in file naming, as long as the content is similar, they can be identified as similar files, which fundamentally solves the problem of duplicate file storage caused by irregular naming. Finally, N semantic vectors are input into the chaotic index executor to generate a chaotic index tree. Each branch node stores the semantic vector of a target file, which not only supports fast file positioning, but also maintains high performance when data and query modes change. It supports automatic and efficient detection of file duplication, avoids the waste of storage resources, and can quickly locate existing files similar to newly uploaded files, enhancing the user experience of file storage and retrieval, thereby solving the technical problem in related technologies that irregular naming during file storage leads to inaccurate indexing, making it impossible to effectively judge the duplication of stored files.
[0119] The present invention is described below in conjunction with another optional embodiment.
[0120] Embodiment 2
[0121] An embodiment of the present invention also provides a device for constructing a file index for a blockchain digital safe. It should be noted that the device for constructing a file index for a blockchain digital safe in an embodiment of the present invention includes multiple implementation units, which can be used to execute the method for constructing a file index for a blockchain digital safe provided in the above-mentioned embodiment one, and each implementation unit corresponds to each implementation step in the above-mentioned embodiment one.
[0122] Figure 6 is a schematic diagram of an optional device for constructing a file index for a blockchain digital safe according to an embodiment of the present invention, such as Figure 6 As shown, the device may include: a receiving unit 61, a construction unit 62, and an input unit 63.
[0123] The receiving unit 61 is used to receive N target files, identify each target file, and obtain a target identification result, wherein the identification result is used to indicate the area information and text information of the target file, wherein N is a positive integer.
[0124] The construction unit 62 is used to construct a semantic vector of the target file based on the target recognition result to obtain N semantic vectors, wherein each semantic vector corresponds to a target file.
[0125] The input unit 63 is used to input N semantic vectors into the chaotic index executor and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0126] The above-mentioned file index construction device for blockchain digital safe can first receive N target files through the receiving unit 61, and identify each target file to obtain a target recognition result, wherein the recognition result is used to indicate the area information and text information of the target file, wherein N is a positive integer, and then construct a semantic vector of the target file based on the target recognition result through the construction unit 62 to obtain N semantic vectors, wherein each semantic vector corresponds to a target file, and then input the N semantic vectors into the chaotic index executor through the input unit 63, and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vector, and the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0127] In the embodiment of the present invention, a batch file recognition method is adopted, and the purpose of accurate file classification and efficient repeatability detection is achieved by constructing a chaotic index tree based on semantic vectors, thereby achieving the technical effect of significantly improving the efficiency of file storage and retrieval. Specifically, by batch recognizing N target files, not only the text content of the file is captured, but also its regional information is keenly parsed to form a target recognition result. Compared with the traditional method, a deep understanding of the file content can be ensured even in the case of inconsistent naming rules. The semantic vector of each file is constructed based on the detailed recognition results to form N independent semantic vector sets, which converts the file information into a mathematical representation, so that the intrinsic semantic structure of the file can be displayed in a multi-dimensional space in the form of a vector, and the structure is constructed. The semantic vector ensures that even if there are differences in file naming, as long as the content is similar, they can be identified as similar files, which fundamentally solves the problem of duplicate file storage caused by irregular naming. Finally, N semantic vectors are input into the chaotic index executor to generate a chaotic index tree. Each branch node stores the semantic vector of a target file, which not only supports fast file positioning, but also maintains high performance when data and query modes change. It supports automatic and efficient detection of file duplication, avoids the waste of storage resources, and can quickly locate existing files similar to newly uploaded files, enhancing the user experience of file storage and retrieval, thereby solving the technical problem in related technologies that irregular naming during file storage leads to inaccurate indexing, making it impossible to effectively judge the duplication of stored files.
[0128] Optionally, the receiving unit includes: an acquisition module, used to acquire image data of a target file; a first recognition module, used to perform region recognition on the image data to obtain region information, wherein the region information includes M region sets, each region set includes R regions, and M and R are both positive integers; a second recognition module, used to perform text recognition on the image data based on the region information to obtain text information, wherein each region corresponds to a word information in the text information, and each region set corresponds to a single sentence information in the text information; and a generation module, used to generate a target recognition result of the target file based on the text information and the region information.
[0129] Optionally, the generation module includes: a first determination submodule, used to determine a first type of separator and a second type of separator; a first separation submodule, used to separate each single sentence in the text information using the first type of separator based on the area information to obtain a first recognition result; and a second separation submodule, used to separate each word in each single sentence in the first recognition result using the second type of separator to obtain a target recognition result.
[0130] Optionally, the construction unit includes: a setting module, used to set a weight value for each word information based on the inverse document frequency for the target recognition result of each target file, wherein the inverse document frequency is the inverse of the document frequency; a first input module, used to input the target recognition result into a preset semantic vector model, and output a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, and S and k are both integers greater than or equal to 2; a calculation module, used to perform weighted calculation on the S regional semantic vectors in the semantic vector matrix based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
[0131] Optionally, the file index construction device for the blockchain digital safe also includes: a first determination module, used to determine N target points in the target coordinate system based on N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; a second determination module, used to determine the target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and select a separation point in the target point set based on the target dimension; a first creation module, used to create a root node of a chaotic index tree based on the separation point, wherein the root node is the starting point of the chaotic index tree; a second creation module, used to create a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point, to obtain a chaotic index tree.
[0132] Optionally, the second creation module includes: a comparison submodule, used to compare the size relationship between the target point and the separation point in the target dimension for each remaining target point to obtain a comparison result; a classification submodule, used to classify the target point as a left subtree point if the comparison result indicates that the target point is smaller than the separation point in the target dimension, otherwise, classify the target point as a right subtree point; a first construction submodule, used to construct a left subtree based on all target points that are classified as left subtree points, and to construct a right subtree based on all target points that are classified as right subtree points.
[0133] Optionally, the first construction submodule includes: an update submodule, used to execute S1, to update the target dimension based on a preset dimension recursive strategy; a selection submodule, used to execute S2, to select new separation points for all target points classified as left / right subtree points based on the updated target dimension; a creation submodule, used to execute S3, to create a branch node of the chaotic index tree based on the updated separation point, and to create a left branch and a right branch of the branch node; a hanging submodule, used to execute S4, to hang all target points smaller than the branch node on the target dimension to the left branch, and to hang the remaining target points not assigned to the left branch to the right branch; a second determination submodule, used to execute S5, to determine the target point hung on the left branch as the updated left subtree point, and to determine the target point hung on the right branch as the updated right subtree point; a recursive execution submodule, used to execute S6, to recursively execute steps S1 to S5, until all target points are hung, and the left / right subtree is obtained.
[0134] Optionally, the file index construction device for the blockchain digital safe also includes: a third identification module, which is used to identify the file to be uploaded after outputting the chaotic index tree, when the file to be uploaded is received, and to construct a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; a second input module, which is used to input the vector to be queried into the chaotic index executor and output the query result, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by searching the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
[0135] Optionally, the second input module also includes: a third determination submodule, which is used to, after outputting the query result, determine the file to be uploaded corresponding to the vector to be queried as a duplicate file when the semantic vector indicated by the query result is the same as the vector to be queried, and refuse to upload the duplicate file to the blockchain digital safe; a second construction submodule, which is used to construct a new branch node based on the vector to be queried when the semantic vector indicated by the query result is different from the vector to be queried, and update the chaotic index tree based on the new branch node.
[0136] It should be noted that the receiving unit 61, the construction unit 62, and the input unit 63 correspond to steps S201 to S203 in the first embodiment, and the examples and application scenarios implemented by the above units and the corresponding steps are the same, but are not limited to the contents disclosed in the first embodiment. It should be noted that the above modules or units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules or units can also be part of the device and can be run in the computer terminal 10 provided in the first embodiment.
[0137] The present invention is described below in conjunction with another optional embodiment.
[0138] Embodiment 3
[0139] An embodiment of the present invention may also provide an electronic device, Figure 7 is a structural block diagram of an electronic device for executing a method for constructing a file index for a blockchain digital safe according to an embodiment of the present invention, such as Figure 7 As shown, the electronic device may include: one or more ( Figure 7 (only one is shown) processor 702, memory 704, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0140] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the construction method and device for file indexing of blockchain digital safes in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, the construction method for file indexing of blockchain digital safes is realized. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0141] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive N target files, identify each target file, and obtain a target recognition result, wherein the recognition result is used to indicate the area information and text information of the target file, wherein N is a positive integer; construct a semantic vector of the target file based on the target recognition result to obtain N semantic vectors, wherein each semantic vector corresponds to a target file; input the N semantic vectors into a chaotic index executor and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0142] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain image data of the target file; perform region recognition on the image data to obtain region information, wherein the region information includes M region sets, each region set includes R regions, and M and R are both positive integers; perform text recognition on the image data based on the region information to obtain text information, wherein each region corresponds to a word information in the text information, and each region set corresponds to a single sentence information in the text information; generate a target recognition result of the target file based on the text information and the region information.
[0143] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine the first type of separator and the second type of separator; based on the area information, use the first type of separator to separate each single sentence in the text information to obtain a first recognition result; for each single sentence in the first recognition result, use the second type of separator to separate each word to obtain a target recognition result.
[0144] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: for the target recognition result of each target file, set a weight value for each word information based on the inverse document frequency, wherein the inverse document frequency is the inverse of the document frequency; input the target recognition result into a preset semantic vector model, and output a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, and S and k are both integers greater than or equal to 2; perform weighted calculation on the S regional semantic vectors in the semantic vector matrix based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
[0145] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine N target points in the target coordinate system based on N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; determine the target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and select a separation point in the target point set based on the target dimension; create a root node of a chaotic index tree based on the separation point, wherein the root node is the starting point of the chaotic index tree; create a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point, to obtain a chaotic index tree.
[0146] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: for each remaining target point, compare the size relationship between the target point and the separation point in the target dimension to obtain a comparison result; when the comparison result indicates that the target point is smaller than the separation point in the target dimension, classify the target point as a left subtree point, otherwise, classify the target point as a right subtree point; construct a left subtree based on all target points that are classified as left subtree points, and construct a right subtree based on all target points that are classified as right subtree points.
[0147] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: S1, update the target dimension based on the preset dimension recursive strategy; S2, for all target points classified as left / right subtree points, select new separation points based on the updated target dimension; S3, create a branch node of the chaotic index tree based on the updated separation point, and create the left branch and right branch of the branch node; S4, hang all target points smaller than the branch node on the target dimension to the left branch, and hang the remaining target points not assigned to the left branch to the right branch; S5, determine the target point hung on the left branch as the updated left subtree point, and determine the target point hung on the right branch as the updated right subtree point; S6, recursively execute steps S1 to S5 until all target points are hung and the left / right subtree is obtained.
[0148] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: when receiving a file to be uploaded, identify the file to be uploaded, and construct a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; input the vector to be queried into the chaotic index executor and output the query result, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by searching the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
[0149] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: when the semantic vector indicated by the query result is the same as the vector to be queried, the file to be uploaded corresponding to the vector to be queried is determined as a duplicate file, and the duplicate file is refused to be uploaded to the blockchain digital safe; when the semantic vector indicated by the query result is different from the vector to be queried, a new branch node is constructed based on the vector to be queried, and the chaotic index tree is updated based on the new branch node.
[0150] By adopting the embodiment of the present invention, a construction scheme for file indexing of blockchain digital safes is provided. By adopting the method of batch file recognition, the purpose of accurate file classification and efficient repeatability detection is achieved by constructing a chaotic index tree based on semantic vectors, thereby achieving the technical effect of significantly improving the efficiency of file storage and retrieval. Specifically, by batch recognizing N target files, not only the text content of the file is captured, but also its regional information is keenly parsed to form a target recognition result. Compared with traditional methods, a deep understanding of the file content can be ensured even in the case of inconsistent naming rules. The semantic vector of each file is constructed based on the detailed recognition results to form N independent semantic vector sets, which converts the file information into a mathematical representation, so that the intrinsic semantic structure of the file can be displayed in a multidimensional space in the form of a vector, and a semantic vector is constructed. It ensures that even if there are differences in file naming, as long as the content is similar, they can be identified as similar files, which fundamentally solves the problem of duplicate file storage caused by irregular naming. Finally, N semantic vectors are input into the chaotic index executor to generate a chaotic index tree. Each branch node stores the semantic vector of a target file, which not only supports fast file positioning, but also maintains high performance when data and query modes change. It supports automatic and efficient detection of file duplication, avoids the waste of storage resources, and can quickly locate existing files similar to newly uploaded files, enhancing the user experience of file storage and retrieval, thereby solving the technical problem in related technologies that irregular naming during file storage leads to inaccurate indexing, making it impossible to effectively judge the duplication of stored files.
[0151] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only, and the electronic device may also be a smart phone, a tablet computer, a PDA, a mobile Internet device (MID), a PAD or other terminal device. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 7 Different configurations are shown.
[0152] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0153] The present invention is described below in conjunction with another optional embodiment.
[0154] Embodiment 4
[0155] The embodiment of the present invention also provides a computer-readable storage medium. Optionally, in the embodiment of the present invention, the computer-readable storage medium can be used to store the program code executed by the method for constructing a file index for a blockchain digital safe provided in the first embodiment.
[0156] Optionally, in an embodiment of the present invention, the above-mentioned storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0157] An embodiment of the present invention also provides a computer program product, which, when executed on a data processing device, is suitable for executing the steps of a method for constructing a file index for a blockchain digital safe: receiving N target files, identifying each target file, and obtaining a target recognition result, wherein the recognition result is used to indicate the area information and text information of the target file, wherein N is a positive integer; constructing a semantic vector of the target file based on the target recognition result, and obtaining N semantic vectors, wherein each semantic vector corresponds to a target file; inputting the N semantic vectors into a chaotic index executor, and outputting a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, and the chaotic index tree includes N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to a target file.
[0158] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0159] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0160] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0161] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0163] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0164] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for constructing a file index for a blockchain digital safe, characterized in that: include: Receiving N target files, and identifying each of the target files to obtain a target identification result, wherein the identification result is used to indicate the region information and text information of the target file, and N is a positive integer; Constructing a semantic vector of the target file based on the target recognition result to obtain N semantic vectors, wherein each semantic vector corresponds to one target file; Input N of the semantic vectors into a chaotic index executor and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, the chaotic index tree comprises N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to the target file.
2. The construction method according to claim 1, characterized in that: The step of identifying each of the target files and obtaining a target identification result comprises: Acquire image data of the target file; Performing region recognition on the image data to obtain the region information, wherein the region information includes M region sets, each of the region sets includes R regions, and M and R are both positive integers; Performing text recognition on the image data based on the region information to obtain the text information, wherein each of the regions corresponds to a word information in the text information, and each of the region sets corresponds to a single sentence information in the text information; The target recognition result of the target file is generated based on the text information and the area information.
3. The construction method according to claim 2, characterized in that: The step of generating the target recognition result of the target file based on the text information and the area information comprises: Determine the first and second category separators; Based on the region information, using the first type of separator to separate each of the single sentences in the text information to obtain a first recognition result; For each of the single sentences in the first recognition result, the second type of separator is used to separate each of the words to obtain the target recognition result.
4. The construction method according to claim 2, characterized in that: The step of constructing a semantic vector of the target file based on the target recognition result to obtain N semantic vectors includes: For the target recognition result of each target file, a weight value is set for each word information based on an inverse document frequency, wherein the inverse document frequency is an inverse value of a document frequency; Input the target recognition result into a preset semantic vector model, and output a semantic vector matrix, wherein the semantic vector matrix contains S k-dimensional regional semantic vectors, where S and k are both integers greater than or equal to 2; The S regional semantic vectors in the semantic vector matrix are weightedly calculated based on the weight value to obtain the semantic vector of the target file, wherein the semantic vector is k-dimensional.
5. The construction method according to claim 4, characterized in that: The chaotic index executor constructs a chaotic index tree through the following steps: Determine N target points in a target coordinate system based on the N semantic vectors to obtain a target point set, wherein the target coordinate system is k-dimensional; Determine a target dimension in the k dimensions of the target coordinate system based on a preset dimensional recursive strategy, and select a separation point in the target point set based on the target dimension; Creating a root node of the chaotic index tree based on the separation point, wherein the root node is a starting point of the chaotic index tree; The left subtree and the right subtree of the root node are created based on the remaining target points in the target point set except the separation point, so as to obtain the chaotic index tree.
6. The construction method according to claim 5, characterized in that: The step of creating a left subtree and a right subtree of the root node based on the remaining target points in the target point set except the separation point comprises: For each remaining target point, compare the size relationship between the target point and the separation point in the target dimension to obtain a comparison result; If the comparison result indicates that the target point is smaller than the separation point in the target dimension, classify the target point as a left subtree point; otherwise, classify the target point as a right subtree point; The left subtree is constructed based on all the target points that are classified as left subtree points, and the right subtree is constructed based on all the target points that are classified as right subtree points.
7. The construction method according to claim 6, characterized in that: The step of constructing a left / right subtree based on all target points that are classified as left / right subtree points comprises: S1, updating the target dimension based on the preset dimension recursive strategy; S2, for all target points of the left / right subtree point category, select a new separation point based on the updated target dimension; S3, creating a branch node of the chaotic index tree based on the updated separation point, and creating a left branch and a right branch of the branch node; S4, attaching all target points smaller than the branch node in the target dimension to the left branch, and attaching the remaining target points not assigned to the left branch to the right branch; S5, determining the target point attached to the left branch as the updated left subtree point, and determining the target point attached to the right branch as the updated right subtree point; S6, recursively execute steps S1 to S5 until all the target points are connected, thereby obtaining the left / right subtree.
8. The construction method according to claim 1, characterized in that: After outputting the chaotic index tree, it also includes: When receiving a file to be uploaded, identifying the file to be uploaded, and constructing a semantic vector for the file to be uploaded based on the identification result to obtain a vector to be queried; The vector to be queried is input into the chaotic index executor, and the query result is output, wherein the chaotic index executor is also used to construct a virtual node based on the vector to be queried, and determine the branch node closest to the virtual node by retrieving the chaotic index tree, and obtain the semantic vector stored in the branch node to obtain the query result.
9. The construction method according to claim 8, characterized in that: After outputting the query results, it also includes: In the case where the semantic vector indicated by the query result is the same as the vector to be queried, determining the to-be-uploaded file corresponding to the vector to be queried as a duplicate file, and refusing to upload the duplicate file to the blockchain digital safe; In the case that the semantic vector indicated by the query result is different from the vector to be queried, a new branch node is constructed based on the vector to be queried, and the chaotic index tree is updated based on the new branch node.
10. A device for constructing a file index for a blockchain digital safe, characterized in that: include: A receiving unit, used for receiving N target files, identifying each of the target files, and obtaining a target identification result, wherein the identification result is used to indicate the area information and text information of the target file, wherein N is a positive integer; A construction unit, configured to construct a semantic vector of the target file based on the target recognition result, to obtain N semantic vectors, wherein each semantic vector corresponds to one target file; An input unit is used to input N of the semantic vectors into a chaotic index executor and output a chaotic index tree, wherein the chaotic index executor is used to construct an index tree based on the semantic vectors, the chaotic index tree comprises N branch nodes and connection relationships, and each branch node stores a semantic vector corresponding to the target file.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method for constructing a file index for a blockchain digital safe as described in any one of claims 1 to 9.
12. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for constructing a file index for a blockchain digital safe as described in any one of claims 1 to 9.
13. A computer program product, characterized in that The method comprises computer instructions, wherein when the computer instructions are executed by a processor, the steps of the method for constructing a file index for a blockchain digital safe described in any one of claims 1 to 9 are implemented.