Searching data of dictionary type, store method and searching system
Technical field
The present invention relates to a kind of technology of retrieval and preservation of data, specifically, relate to a kind of searching data of dictionary type, store method and searching system.
Background technology
The user often needs key word is translated when browsing information, by looking into the respective explanations that speech software returns key word.
At application number is in the application for a patent for invention of " 03801487.4 ", a kind of electronic dictionary terminal, electronic dictionary server and recording medium are disclosed, in passing through the dictionary retrieving of electronic dictionary, if be not stored in the built-in dictionary data with the entry word of searched targets speech coupling, then register this searched targets speech with the form of network dictionary retrieve object listing.When dictionary is upgraded in indication, send dictionary data and also download in the dictionary server, thereby upgrade and store built-in dictionary data.Use above-mentioned electronic dictionary terminal, can realize the retrieval of term on the webserver, and can on the webserver, download new dictionary, therefore the user is when needs use different dictionaries, needn't upgrade electronic dictionary, get final product and only need connect the new dictionary of electronic dictionary downloaded.
But because the capacity of memory device of electronic dictionary is limited, the download of new dictionary data will be subject to the capacity of memory device, so the user may need to use a new dictionary, but not have enough space storages; Simultaneously, along with data quantity stored in the electronic dictionary increases, the average consumed time of searched targets speech institute is elongated, causes searched targets speech inefficiency, and period of reservation of number is long.
Summary of the invention
The invention provides a kind of searching data of dictionary type, can solving dictionary-like data, to take storage space excessive, causes recall precision low, the problem that retrieval time is long.
Technical scheme is as follows:
Searching data of dictionary type comprises the following steps:
(1) key word that obtains and target dictionary identifier number;
(2) in local storage file, extract the corresponding target dictionary of current goal dictionary identifier number;
(3) take out the decryption of key word correspondence in the current goal dictionary, and send;
(4) show the decryption that obtains.
Preferably, in the step (1), key word obtains by screen word-selecting or keyboard input.
Preferably, the target dictionary identifier number in the step (1) is at least one.
Preferably, step (3) also comprises, preserves the target dictionary identifier number of retrieval failure.
Preferably, also comprise the step of judging whether traversal is finished, when traversal is not finished, extract next target dictionary identifier number execution in step (2).
Preferably, also comprise the following steps:
(5) when traversal is finished, target dictionary identifier number and key word that retrieval is failed send to server end;
(6) server end is retrieved corresponding decryption according to the key word and the target dictionary identifier number that receive in the target dictionary;
(7) decryption that retrieves is sent to client;
(8) show the decryption that receives.
Preferably, step (7) is specially, and the decryption that retrieves is spliced into packet, sends to client after the compression;
Step (8) is specially, and after the decryption that obtains is decompressed, shows.
Preferably, further comprise: decompress from the decryption of server end, be kept at client then.
Preferably, the step of preservation decryption is as follows:
Target dictionary numbering in a, the traversal result for retrieval;
B, in local storage file, travel through each dictionary node, the dictionary node of retrieval current goal dictionary identifier number correspondence;
C, under the target dictionary of current goal dictionary identifier number correspondence, travel through each key word node, retrieve current key word;
D, under current key word node, store decryption.
Preferably, step b further comprises: when client does not have local storage file, create local storage file.
Preferably, step b further comprises: when not retrieving the node of current goal dictionary identifier number correspondence, in local storage file, create a node, be used to preserve current target dictionary identifier number.
Preferably, step b further comprises: when not preserving key word under current goal dictionary node, create a node under this target word code node, be used to preserve key word.
Preserve the method for server end transmission result for retrieval, step is as follows:
Target dictionary identifier number in I, the traversal result for retrieval;
II, in local storage file, travel through each dictionary node, the dictionary node of retrieval current goal dictionary identifier number correspondence;
III, under the dictionary node of current goal dictionary identifier number correspondence, travel through each key word node, retrieve current key word;
IV, under current key word node, store decryption.
Preferably, step I further comprises: when traversal is not finished, and execution in step II.
Preferably, Step II further comprises, when local storage file does not exist, creates local storage file.
Preferably, Step II further comprises: when not retrieving the dictionary node of current goal dictionary identifier number correspondence, create a node, be used to preserve current target dictionary identifier number.
Preferably, Step II I further comprises: when not preserving key word under current goal dictionary node, create a child node under this target dictionary, be used to preserve key word.
The searching system of dictionary-like data comprises the server end that client is connected, and it is characterized in that, described client comprises:
The key word processing module receives the keyword message of importing, and keyword message is sent;
Control module is retrieved according to this keyword message, and result for retrieval is sent;
Memory module is sent decryption to control module, perhaps the result for retrieval of server end is preserved;
Display module shows result for retrieval;
The client network administration module is connected with described server end, is used for client and the transmission of server end establishment of connection, data, the disconnection that is connected;
Described server end comprises:
The server end network management module is connected with client, is used for client and the transmission of server end establishment of connection, data, the disconnection that is connected;
The dictionaries store module and is looked into the speech module and is connected, and is used for sending decryption to looking into the speech module;
Look into the speech module, be connected,, in the dictionaries store module, retrieve according to the keyword message that receives with server end network management module, dictionaries store module.
Preferably, described control module judges further whether the decryption of key word is stored in memory module, if exist, then obtains this decryption; If do not exist, keyword message is sent to server end by the client network transport module.
Preferably, be provided with storage file in the memory module, be provided with node at this storage file, be used to preserve target dictionary identifier number, under target dictionary identifier number node, created a child node, be used to preserve key word, under the key word node, create a child node, be used to preserve decryption.
Preferably, in the described dictionaries store module, dictionary has unique dictionary identifier number.
Preferably, the described speech module of looking into is retrieved according to the key word and the target dictionary identifier number thereof that receive, and the decryption of key word in each target dictionary is spliced into packet, and compression, sends to client.
Be provided with memory module in client, the decryption that retrieves is kept in the local storage file, reduced effectively and repeated to look into the request of speech, thereby reduce the waste of repeated retrieval bandwidth and cpu resource to server end.Creating with target dictionary identifier number in local storage file is the node of index, under each target dictionary identifier number node is the key word node of user inquiring, be decryption below the key word node, just the key word of target dictionary identifier number and user inquiring is equivalent to file, and the data of real storage are the decryptions under the key word node, this structured storage has greatly reduced storage file taking for disk, simultaneously, in user search, promoted the efficient that the user reads structured storage file effectively, improve recall precision, reduce taking of client resource and Internet resources, and quick feedback user result for retrieval.Simultaneously, make things convenient for the upgrade maintenance of dictionary, need not the user and manually carry out.
Description of drawings
Fig. 1 is the structural representation of the searching system of dictionary-like data;
Fig. 2 is the structural representation of storage file;
Fig. 3 is the structural representation of splicing back packet;
Fig. 4 is the searching data of dictionary type process flow diagram;
Fig. 5 preserves the method flow diagram that server end sends result for retrieval.
Embodiment
With reference to the accompanying drawings the preferred embodiments of the present invention are described in detail.
Shown in seeing figures.1.and.2, the searching system of dictionary-like data comprises client 110 and server end 120 generally.
Wherein, client 110 comprises key word processing module 111, control module 114, memory module 115, display module 112, client network administration module 113.
Key word processing module 111 receives the key word of input, and keyword message is sent to control module 114, and key word can be imported by keyboard, and perhaps mode such as screen word-selecting is obtained.
Control module 114 receives keyword message, according to this keyword message, retrieves in the content of storage in the memory module 115 of client 110, and result for retrieval is sent to display module 112.In the process of control module 114 retrieval decryptions, control module 114 judges whether the decryption of key word is stored in the local storage file 200 of memory module 115, if in the storage file 200 decryption is arranged, then obtain this decryption, sending to display module 112 as result for retrieval shows, if there is not decryption in the storage file 200, will not exist the current dictionary identifier number of Search Results to be kept in the memory module 114.After control module 114 has traveled through dictionary in each local storage file 200, extract the dictionary identifier number that does not have key word in the memory module 114, by client network transport module 113 this identifier number and key word are sent to server end 120.
Memory module 115 stores local storage file 200, and deposits the dictionary identifier number that does not have Search Results temporarily, if do not retrieve decryption in local storage file 200, then the result for retrieval that server end 120 is returned is preserved.
Specifically, when local storage file 200 is not set, a local storage file 200 is set in memory module 115 in memory module; 200 times dictionary node 211 is set at local storage file, is used to preserve the target dictionary identifier number of result for retrieval, a plurality of unique target word code nodes 211 can be set for 200 times at local storage file; This target word code node 211 times, create child node 212, be used to preserve key word, target word code node 211 times, a plurality of unique key word nodes 212 can be set, created a child node 213 for 212 times at the key word node, be used to preserve decryption.
112 pairs of result for retrieval of display module show, comprise the result for retrieval of client 110 and server end 120.
Client network administration module 113 is connected with server end 120, is used for client 110 and the transmission of server end 120 establishment of connections, data, the disconnection that is connected.
Server end 120 comprises server end network management module 121, dictionaries store module 123, looks into speech module 122.
Server end network management module 121 is used for client 110 and the transmission of server end 120 establishment of connections, data, the disconnection that is connected.
Dictionaries store module 123 stores a plurality of dictionaries, and each dictionary has corresponding dictionary identifier number corresponding.Dictionaries store module 123 can constantly deposit new dictionary in, and each dictionary in the dictionaries store module 123 can both upgrade and deposit in new decryption.
Look into key word and dictionary identifier number that speech module 122 receives according to server end network management module 121, dictionary in the traversal dictionaries store module 123, retrieve decryption in each dictionary, and the decryption in each dictionary in the dictionaries store module 123 is spliced into packet, send to the client network administration module 113 of client 110 after the compression.Decryption in each dictionary comprises: dictionary identifier number and the key word decryption in current dictionary.
In above-mentioned dictionaries store module 123 and the memory module 115, each dictionary has unique target dictionary identifier number corresponding, and this dictionary can be divided according to different classification character.
With reference to Fig. 3, packet is spliced by the decryption in a plurality of dictionaries of key word and server end 120, after splicing is finished, with this packet compression, send to client 110 then, after the display module 115 of client 110 decompresses, show and preserve.
With reference to Fig. 4 and Fig. 5 searching data of dictionary type of the present invention is described in detail.
Searching data of dictionary type comprises the following steps:
Step S301: the target dictionary identifier number of key word that obtains and desire retrieval.
When the user desires to carry out key search,,, carry out choosing of key word as screen word-selecting or keyboard input by the preset keyword retrieval mode.Under the default situations, the target dictionary is the default individual dictionary of N (N represents natural number) of application program, and promptly the user returns the decryption of key word in this N dictionary when key word is retrieved.Key word processing module 111 is obtained key word and target dictionary identifier number, sends to control module 114.
Memory module 115 has judged whether local storage file 200, if find local storage file 200, then execution in step S302.If in memory module 115, do not find local storage file 200, control module 114 temporarily is kept at key word and the target dictionary identifier number that obtains in the memory module 115, and execution in step S309, be that control module 114 sends to server end 120 by key word and the target dictionary identifier number that client network administration module 113 will temporarily be stored in the memory module 115, retrieve at server end 120.
Step S302: at first, retrieve in the dictionary 221 that control module 114 has been stored in local storage file 200, according to target dictionary identifier number, retrieval current target dictionary.
Step S303: control module 114 judges whether retrieve the decryption of current key word in the current goal dictionary in local storage file 200.
Step S304: with the decryption instant playback that retrieves.
Step S305: in local storage file 200,, then preserve the current goal dictionary identifier number of retrieval failure if control module 114 does not retrieve the decryption of current key word in the current goal dictionary.
Step S306: control module 114 is extracted next target dictionary identifier number.
Step S307: control module 114 judges whether traversal is finished, and when in local storage file 200 traversal of N dictionary being finished, execution in step S308 is when the traversal in local storage file 200 is not finished execution in step S302.
Step S308: control module 114 judges whether the target dictionary that retrieval is failed, and when not retrieving the target dictionary of failure, finishes retrieval, when retrieving the target dictionary of failing, and execution in step S309.
Step S309: extract the current goal dictionary identifier number of retrieval failure, send to server end 120 together with key word and retrieve.When the target dictionary identifier number of a plurality of failures, the target dictionary identifier number of these a plurality of failures is sent simultaneously together with key word.
Step S310: server end 120 sends to client network administration module 113 by server end network management module 121 with the result for retrieval packet that retrieves.
Step S311: display module decompresses the result for retrieval packet that receives, and shows.
Step S312: the result for retrieval after memory module 115 will decompress is saved in the local storage file 200.
In order to realize the continual renovation of local storage file, fast query after being convenient to, above-mentioned steps also are included in client 110 and preserve the result for retrieval that server end 120 sends, and concrete steps are as follows:
Step S501: client 110 receives the result for retrieval of transmission, the result for retrieval packet that memory module 115 decompresses and sends from server end 120.
Step S502: memory module 115 judges whether to exist local storage file 200.
Step S504: when not having local storage file 200, create local storage file 200.
Step S503: in local storage file 200, each the target dictionary identifier number in the traversal result for retrieval.
Step S505: judge whether current dictionary identifier number is stored in the local storage file 200.
Step S507: when in local storage file 200, not retrieving current target dictionary identifier number, in local storage file, create a node 211, be used to preserve current dictionary identifier number.
Step S506: in current target dictionary identifier number, judge whether the key word node of current dictionary identifier number node 211 preserves the decryption of current key word for 212 times.
When retrieving key word node 212, preserve the decryption 213 of current key word, then execution in step S509 for 212 times at current key word node; When not retrieving key word node 212, create a child node, preserve current key word.
When the decryption 213 of not preserving current key word at current key word node for 212 times, then create a child node, execution in step S508 212 times at this key word node.
Step S508: the child node 213 times that decryption is kept at key word node 212.
Step S509: judge whether traversal is finished,, then finish when traversal is finished; Do not finish when traveling through, then execution in step S503.
The disclosed preservation server end of Fig. 5 sends the method for result for retrieval, both can be used as the part of searching data of dictionary type, again can be separately as a complete technical scheme.
The storage of above-mentioned local storage file 200 adopts tree, greatly reduced memory contents for the taking of disk, and improved recall precision simultaneously, makes things convenient for the upgrade maintenance of dictionary.