CN117555908A - Input method word stock management method, device, equipment and storage medium - Google Patents

Input method word stock management method, device, equipment and storage medium Download PDF

Info

Publication number
CN117555908A
CN117555908A CN202210940079.0A CN202210940079A CN117555908A CN 117555908 A CN117555908 A CN 117555908A CN 202210940079 A CN202210940079 A CN 202210940079A CN 117555908 A CN117555908 A CN 117555908A
Authority
CN
China
Prior art keywords
version number
word stock
updated
word
public
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210940079.0A
Other languages
Chinese (zh)
Inventor
费腾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210940079.0A priority Critical patent/CN117555908A/en
Publication of CN117555908A publication Critical patent/CN117555908A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The application provides an input method word stock management method, device, equipment and storage medium, wherein the method comprises the following steps: responding to an input method triggering operation on a first application process, and acquiring a process version number of a word stock corresponding to the first application process and a public version number of the word stock, wherein the process version number is a word stock version number corresponding to the first application process at the current moment, and the public version number is the latest version number of the word stock at the current moment; and if the process version number is inconsistent with the common version number, reloading the lexicon to enable the process version number corresponding to the first application process to be consistent with the common version number. The method and the device have the advantages that the process version number and the public version number are set for the word stock, the process version number currently maintained by the process is compared with the public version number of the word stock when the process is input each time, whether the word stock is updated is judged, and when the word stock is detected to be updated, the word stock is reloaded, so that the updating efficiency of the word stock is improved.

Description

Input method word stock management method, device, equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to an input method word stock management method, device and equipment and a storage medium.
Background
The word stock is the basis of the input method and provides words for the input method. For a multi-process system, each process loads an input method, the processes access word libraries of the input method, and at the moment, the word library Memory is a shared Memory (Share Memory), so that an object screens a word in a certain application process, the input method records the word into a user word library, and because the word library adopts the shared Memory, when other application processes use the input method, the word newly recorded into the user word library can also take effect in real time.
In some cases, the word stock of the input method is updated, and currently when the word stock update is detected, a word stock Memory management module (Memory Manager) sends notification information to each process to notify that the word stock has been updated. After each process receives the word stock update message (record), the word stock (Reload) is reloaded.
As can be seen from the above, when the word stock is updated, other processes need to be notified to update the word stock in a communication manner, which consumes time, so that the word stock update efficiency is low, resulting in a stuck input method.
Disclosure of Invention
The application provides an input method lexicon management method, device, equipment and storage medium, which can improve the update efficiency of a lexicon, reduce the blocking of the input method and improve the use experience of the input method.
In a first aspect, the present application provides an input method lexicon management method, including:
responding to an input method triggering operation on a first application process, and acquiring a process version number of a word stock corresponding to the first application process and a public version number of the word stock, wherein the process version number is a word stock version number corresponding to the first application process at the current moment, and the public version number is the latest version number of the word stock at the current moment;
and reloading the word stock if the process version number corresponding to the first application process is inconsistent with the public version number, so that the process version number corresponding to the first application process is consistent with the public version number.
In a second aspect, the present application provides an input method thesaurus management apparatus, including:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for responding to an input method triggering operation on a first application process, acquiring a process version number of a word bank corresponding to the first application process and a public version number of the word bank, wherein the process version number is a word bank version number corresponding to the first application process at the current moment, and the public version number is the latest version number of the word bank at the current moment;
and the processing unit is used for reloading the word stock if the process version number corresponding to the first application process is inconsistent with the public version number, so that the process version number corresponding to the first application process is consistent with the public version number.
In some embodiments, the processing unit is further configured to obtain a version number of the word stock loaded in the memory; and if the version number of the word stock loaded in the memory is smaller than the public version number, reloading the word stock so as to enable the process version number corresponding to the first application process to be consistent with the public version number.
In some embodiments, the processing unit is further configured to update a process version number corresponding to the first application process to the common version number if the version number of the word stock loaded in the memory is the common version number.
In some embodiments, the common version numbers are stored in a first memory, the process version numbers corresponding to the first application process are stored in a memory corresponding to the first application process, and the obtaining unit is further configured to obtain the common version number of the word stock from the first memory in response to an input method triggering operation on the first application process, and obtain the process version number corresponding to the first application process from the memory corresponding to the first application process.
In some embodiments, if the thesaurus is accessed by multiple processes, the public version number of the thesaurus is stored in shared memory.
In some embodiments, the processing unit is further configured to update the public version number of the thesaurus when it is detected that the thesaurus is updated.
In some embodiments, the processing unit is specifically configured to, when it is detected that the thesaurus is updated, add a first value to the currently stored public version number of the thesaurus, to obtain the public version number after the thesaurus is updated.
In some embodiments, if the thesaurus is accessed by a plurality of processes, the processing unit is specifically configured to, when detecting that N processes all update the thesaurus, sequentially update the common version number by the N processes to obtain the updated common version number of the thesaurus, where N is a positive integer.
In some embodiments, the processing unit is specifically configured to, when detecting that the N processes all update the thesaurus, control the N processes to update the common version number in turn based on a lock mechanism, and obtain the public version number after the thesaurus is updated.
In some embodiments, the processing unit is specifically configured to determine, based on a contention mechanism, an update operation order of each of the N processes on the common version number; and controlling the N processes to update the public version numbers in sequence based on the lock mechanism according to the update operation sequence to obtain the updated public version numbers of the word bank.
In some embodiments, the public version number of the word stock is stored in a shared memory, and the processing unit is specifically configured to lock the shared memory by using the ith process in the update sequence, and unlock the shared memory after adding a first value to the latest public version number in the locked shared memory, so as to obtain an update of the public version number by the ith process, where i is a positive integer less than or equal to N; and controlling the (i+1) th process in the updating sequence to continuously update the public version number updated by the (i) th process until the update of the public version number by the N processes is finished, and obtaining the public version number updated by the lexicon.
In some embodiments, the processing unit is further configured to process the word stock in response to an on-screen operation of the word.
In some embodiments, the processing unit is specifically configured to, in response to an on-screen operation of a word, add the word to the word stock when the word stock is detected to be not full.
In some embodiments, the processing unit is specifically configured to respond to an on-screen operation of a word, apply for a new memory for the word stock when the word stock is detected to be full, perform weight reduction or capacity expansion on the word stock on the new memory, write the word into the weight-reduced or capacity-expanded word stock, obtain an updated word stock, and write the updated word stock into a disk; and updating the public version number of the word stock according to the updated word stock.
In some embodiments, the processing unit is further configured to, after updating the public version number of the thesaurus, when detecting an input method trigger operation of a second application process, obtain, in response to the input method trigger operation of the second application process, a process version number of the thesaurus currently corresponding to the second application process and the public version number after the thesaurus is updated; if the process version number corresponding to the second application process is detected to be inconsistent with the updated common version number of the word stock, the updated word stock is loaded into a memory from the disk, so that the process version number corresponding to the second application process is consistent with the updated common version number of the word stock.
In a third aspect, an electronic device is provided that includes a processor and a memory. The memory is configured to store a computer program, and the processor is configured to invoke and execute the computer program stored in the memory, so as to perform the method in the first aspect or each implementation manner thereof.
In a fourth aspect, a chip is provided for implementing the method in any one of the first to second aspects or each implementation thereof. Specifically, the chip includes: a processor for calling and running a computer program from a memory, causing a device on which the chip is mounted to perform the method as in any one of the first aspects or implementations thereof.
In a fifth aspect, a computer-readable storage medium is provided for storing a computer program for causing a computer to perform the method of any one of the above-described first aspects or implementations thereof.
In a sixth aspect, there is provided a computer program product comprising computer program instructions for causing a computer to perform the method of any one of the above aspects or implementations thereof.
In a seventh aspect, there is provided a computer program which, when run on a computer, causes the computer to perform the method of any one of the above-described first aspects or implementations thereof.
In summary, the present application responds to an input method triggering operation on a first application process, and obtains a process version number of a word stock corresponding to the first application process and a public version number of the word stock, where the process version number is a version number of the word stock maintained by the first application process at a current time, and the public version number of the word stock is a latest version number of the word stock at the current time. And then, comparing the process version number corresponding to the first application process with the public version number, and if the process version number is inconsistent with the public version number, normally, the process version number corresponding to the first application process is smaller than the public version number of the word stock, and reloading the word stock at the moment so as to update the word stock corresponding to the first application process into the word stock corresponding to the latest public version number. Thus, the first application process carries out word input based on the updated word stock, and input experience is improved. That is, in this embodiment of the present application, a process version number and a public version number are set for a thesaurus, and when each input is performed, the process version number of the thesaurus currently maintained by an application process is compared with the public version number of the thesaurus to determine whether the thesaurus is updated, and when the thesaurus is detected to be updated (i.e., the process version number of the thesaurus is inconsistent with the public version number), the thesaurus is reloaded, thereby replacing the message notification mechanism that is time-consuming before, further improving the update efficiency of the thesaurus, greatly reducing the blocking condition of the input method when the thesaurus is updated, and improving the input experience.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram of an input example;
FIG. 2 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 3A is a schematic diagram of a word stock management system;
FIG. 3B is a schematic diagram of another word stock management system;
FIG. 4 is a flowchart illustrating a method for word stock management of an input method according to an embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a method for word stock management of an input method according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a core architecture according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a processing of a thesaurus when the thesaurus is not full;
FIG. 8 is a diagram of the update of the thesaurus when the thesaurus is full;
FIG. 9 is a flowchart of an input method thesaurus management method according to an embodiment of the present disclosure;
FIG. 10A is a schematic diagram illustrating an input of the method according to the embodiment of the present application when applied to a computer terminal;
FIG. 10B is a schematic diagram illustrating an input when the method according to the embodiment of the present application is applied to a mobile phone terminal;
FIG. 11 is a schematic block diagram of an input method thesaurus management apparatus according to an embodiment of the present application;
fig. 12 is a schematic block diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be understood that in embodiments of the present invention, "B corresponding to a" means that B is associated with a. In one implementation, B may be determined from a. It should also be understood that determining B from a does not mean determining B from a alone, but may also determine B from a and/or other information.
In the description of the present application, unless otherwise indicated, "a plurality" means two or more than two.
In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", and the like are used to distinguish the same item or similar items having substantially the same function and effect. It will be appreciated by those of skill in the art that the words "first," "second," and the like do not limit the amount and order of execution, and that the words "first," "second," and the like do not necessarily differ.
The method and the device can be applied to platforms with various input modes, such as a keyboard input method and a non-keyboard input method. Namely, the information input by the input method comprises keyboard character strings, handwriting input information, voice input information and the like, and the information input by the input method is required to be used for candidate item ordering by a word stock.
Related concepts of the embodiments of the present application will be described first.
An input method can be understood as a method in which an object screens a character by means of a certain input method.
The word stock is the basis of an input method, for example, as shown in fig. 1, when a user inputs pinyin "zhingg" through the input method, words which are the same as or similar to the pronunciation of the pinyin "zhingg" are queried in the word stock and displayed to the user for the user to select.
The word stock comprises a system word stock and a user word stock, wherein the system word stock can be understood as a word stock of an input method, and the system word stock of different input methods can be different. The system thesaurus is used to provide basic words.
The word stock of the user mainly records a word set generated according to words frequently input by the user. For example, when the word learning function is started, the input method records words typed by the user, and the recorded word sets form a user word stock. Thus, the user lexicon is personalized.
According to the different contents of the user word stock, the method is divided into: chinese user word stock, english user word stock, website mailbox user word stock, and the like.
A narrow definition of Process is an instance (an instance of a computer program that is being executed) of a running program. A broad definition is a single running activity of a program with a certain independent function with respect to a certain data set. It is the basic unit of dynamic execution of the operating system, in which processes are both basic allocation units and basic execution units.
Fig. 2 is a schematic diagram of a system architecture according to an embodiment of the present application. The system comprises: the terminal device 100.
The terminal device 100 may be a cell phone, tablet computer, electronic book reader, laptop portable computer, desktop computer, smart television, vehicle-mounted device, wearable device, industrial device, etc.
The terminal device 100 includes a hardware system 110, an operating system 120, and an application layer 130. The hardware system 110 refers to a physical device that constitutes the terminal device 100, and may be a physical component with functions of calculation, control, storage, and input/output, such as a CPU, a memory, and the like.
Operating system 120 is a computer program that manages hardware and software resources, providing an operational interface for user and system interaction.
The application layer 130 provides applications for the user, including at least application 1 and input method 2. The application 1 includes at least a function of detecting the input of the input method program 2 in the application 1, and the input method program 2 refers to an encoding method employed for inputting various symbols into the electronic device. The application 1 has one or more functions. Controls for inputting text content are provided on at least one program interface of the application 1. The application 1 may be any type of program, such as an instant messaging program, a text editing program, or the like. Alternatively, the application layer 130 may also include other applications, such as application 3.
At present, word stock memory management modes corresponding to different types of terminal equipment may be different, and two types of clients mainly exist:
for a first type of client, such as a Windows client, because of the Windows system requirements, each application process must load one input method, that is, there are multiple processes accessing the word library of the input method. In this case, as shown in fig. 3A, the word stock Memory must be a shared Memory (shared Memory), which means that two or more processes Share a given storage area. Therefore, the user can screen a word in a certain application process, the word is recorded in the user word stock by the input method, and the word stock adopts a shared memory, so that when other application processes use the input method, the word newly recorded in the user word stock can also take effect in real time. In order to prevent a plurality of processes from operating the same word stock at the same time, which leads to abnormal word stock, access of a shared memory needs to be synchronized through a Lock mechanism (Lock), in short, when a certain process accesses the word stock, whether the process is locked is checked, if the process is not locked, the process is locked (Lock) first, and then unlocked (Unlock) after the operation is completed, in the process, if other processes want to operate the word stock, the process can wait until the process is unlocked, and then go to operate. When the word stock is updated, for example, the word stock of the user is full, some useless words need to be thinned, or the word stock is synchronized, words of other devices are downloaded from a server side and combined into the local word stock of the user, after the word stock is updated, a word stock Memory management module (Memory Manager) is required to send a message notification (Notify) to other processes, and the other processes receive (record) word stock update messages and Reload (Reload) the word stock.
For the second type of client, such as Linux, mac, android, IOS, the input method is single-process, as shown in fig. 3B, the word stock memory can be used in two ways, one is to directly use the memory, and is generally used for the word stock needing to be modified, such as a user word stock, and the other is to directly map the file. The direct memory is allocated by the input method process, and the word stock memory corresponding to the direct mapping of the file is allocated by the operating system, and the input method process is only associated. In some embodiments, the constant word stock uses a file mapping approach, such as a system word stock. In the second class of clients, there is also a case of word stock update, and in this case, in the same process, only the memory of the updated word stock and the previous memory need to be exchanged (Swap).
As can be seen from the above, for the first type of client, that is, the plurality of processes access the word stock, when the word stock is updated, the processes are required to be notified to reload the word stock in a manner of sending and receiving the message, which is long in time consumption and low in efficiency, and further causes the blocking of the input method, and reduces the user experience. In addition, as can be seen from fig. 3A and fig. 3B, the word stock memory management modes used by different terminals are different, so that the input method kernels of multiple terminal devices cannot be unified, that is, at least two input method kernels need to be maintained, which wastes labor cost.
In order to solve the above technical problems, in the embodiment of the present application, two version numbers are set for the lexicon, one is common to all processes and called a common version number, and the other is owned by a process and may be called a process version number. When the user triggers the input method, the process version number of the word stock to be accessed by the first application process and the public version number of the word stock are obtained in response to the triggering operation of the input method, and the public version number of the word stock is the latest version number of the word stock at the moment. And then, comparing the process version number of the first application process with the public version number, and if the process version number is inconsistent with the public version number, normally, the process version number corresponding to the first application process is smaller than the public version number of the word stock, and reloading the word stock at the moment so as to update the word stock corresponding to the first application process into the latest public version number. Thus, the first application process performs word input based on the updated word stock. That is, the embodiment of the application judges whether the current word stock is updated or not by comparing the process version number of the current word stock of the process with the public version number, and when the word stock is detected to be updated (namely, the process version number of the current word stock is inconsistent with the public version number), the word stock is directly loaded, a time-consuming message notification mechanism before is replaced, the update efficiency of the word stock is further improved, the blocking condition of an input method during the update of the word stock is greatly reduced, and the input experience is improved.
In addition, the word stock management method of the input method provided by the embodiment of the application can be applied to different terminal equipment, for example, can be applied to a single-process system and a multi-process system, so that the word stock memory management mechanism is unified, and further the whole input method kernel can be unified. Therefore, development and maintenance cost can be greatly saved, and for a user using the multi-terminal input method, the consistency of the results of the multi-terminal input method is maintained, and the user input experience is greatly improved.
The following describes the technical solutions of the embodiments of the present application in detail through some embodiments. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 4 is a flowchart of an input method word stock management method according to an embodiment of the present application. The execution subject of the embodiment of the present application is a device having an input method lexicon management function, for example, an input method lexicon management device. The input method thesaurus management device may be the terminal device shown in fig. 2, or a part of the terminal device, for example, a processor in the terminal device. The terminal device shown in fig. 2 has an input function. For convenience of description, the following description will take an execution subject as a terminal device as an example.
As shown in fig. 4, the method of the embodiment of the present application includes:
s401, responding to an input method triggering operation on a first application process, and acquiring a process version number of a word stock corresponding to the first application process and a public version number of the word stock.
The process version number is the word stock version number corresponding to the first application process at the current moment, and the common version number is the latest version number of the word stock at the current moment.
Multiple application programs exist in the same terminal equipment, and a user can open any application program to operate. When each application program runs, the application process corresponding to the application program loads an input method, and the input method comprises a word stock. When a certain application program is started, a user can start an input method in an application process corresponding to the application program, and when the input method is started for the first time, a word stock is required to be loaded in a memory for the input method to use.
In the embodiment of the application, two version numbers are set for the word stock, one process version number and the other common version number.
Where the common version number is common to all processes, typically the latest version number of the lexicon.
The process version number is self-owned for each application process, i.e., each application process accessing the thesaurus maintains a process version number. The process version number corresponding to the application process can be understood as the version number of the word stock maintained by the application process at the current moment.
For example, at the current time, the latest version number of word stock a is 0.3, i.e., the common version number of word stock a is 0.3. The version number of the word stock A maintained by the application process 1 is 0.2, namely the process version number corresponding to the application process 1 is 0.2. The version number of the word stock A maintained by the application process 2 is 0.1, namely the process version number corresponding to the application process 2 is 0.1. Wherein, the word stock of 0.1 version is the previous version of the word stock of 0.2 version, and the word stock of 0.2 version is the previous version of the word stock of 0.3 version.
In the embodiment of the application, a user starts an input method in a first application process, and the process version number and the public version number of a word stock corresponding to the first application process are obtained in response to the triggering operation of the input method. For example, the process version number of the thesaurus maintained by the first application process at the current time is 0.2, and the common version of the thesaurus is 0.3.
The embodiment of the application does not limit the specific type of the first application process.
In some embodiments, the first application process may be understood as a process corresponding to an application program currently running on the terminal device, for example, a chat tool, a word document, and the like.
The triggering operation of the input method of the user on the first application process can be key operation of the user on a keyboard or key operation of the user on a soft keyboard by using a mouse.
In an application scenario of the embodiment of the present application, a terminal device runs an application program a, a user triggers an input method on an interface of the application program a, for example, the user clicks a keyboard, and in response to an input method triggering operation on the application program a, a process version number and a common version number corresponding to a first application process corresponding to the application program a are obtained.
The embodiment of the application does not limit the specific mode of acquiring the process version number of the word stock currently maintained by the first application process and the public version number of the word stock.
In some embodiments, the process version numbers corresponding to different application processes are stored in different locations, and each application process is allowed to read by the application process and not allowed to read by other application processes. While the common version number of the thesaurus allows all application processes to read.
In some embodiments, at least one of a process version number and a common version number corresponding to the first application process is stored in the memory.
In some embodiments, the common version numbers are all stored in the first memory, and the process version numbers corresponding to the first application process are stored in the memory corresponding to the first application process. At this time, in response to an input method triggering operation on the first application process, a public version number of the word stock is obtained from the first memory, and a process version number corresponding to the first application process is obtained from a memory corresponding to the first application process.
The first memory may be a memory area accessible to any process.
In some embodiments, if the word stock is accessed by a plurality of processes, the common version number of the word stock is stored in the shared memory, i.e. the first memory is the shared memory. At this time, in response to an input method triggering operation on the first application process, a public version number of the word stock is obtained from the shared memory, and a process version number corresponding to the first application process is obtained from a memory corresponding to the first application process.
According to the above method, after the process version number and the common version number of the lexicon accessed by the first application process are obtained, the following step S402 is executed.
S402, reloading the word stock if the process version number corresponding to the first application process is inconsistent with the common version number, so that the process version number corresponding to the first application process is consistent with the common version number.
According to the steps, the process version number corresponding to the first application process and the public version number of the word stock are obtained, if the process version number of the word stock maintained by the first application process at the current moment is consistent with the public version number of the word stock, the word stock is updated to the latest version, and at the moment, word input is directly carried out based on the current word stock without reconstructing the word stock.
If the process version number of the word stock maintained by the first application process at the current moment is inconsistent with the public version number of the word stock, the word stock corresponding to the first application process is required to be updated, specifically, the word stock is rebuilt and loaded so that the word stock corresponding to the first application process is updated to be the word stock corresponding to the public version number, after the update is finished, the version number of the word stock corresponding to the first application process is the public version number, and correspondingly, the process version number corresponding to the first application process is updated to be the public version number.
In some embodiments, for a multi-process system, the word stock is reloaded in the shared memory such that each process can read the updated word stock from the shared memory.
In some embodiments, for a single process system, the word stock is reloaded into memory from which the single process reads the updated word stock.
The embodiment of the application does not limit the mode of reconstructing and loading the word stock.
In one possible implementation, if the process version number corresponding to the first application process is inconsistent with the common version number, it is not determined whether the current word stock has been updated, but the word stock is directly reloaded, and the reloaded word stock is stored in the memory to cover the existing word stock in the memory.
In some embodiments, before the first application process updates the thesaurus, it is first necessary to determine whether other processes have updated the thesaurus. At this time, before reloading the word stock in S402, the embodiment of the present application further includes obtaining the version number of the word stock loaded in the memory. That is, if the process version number corresponding to the first application process is inconsistent with the common version number, the word stock is not immediately reloaded, but the version number of the word stock loaded in the memory at the current moment is obtained, the version number of the word stock loaded in the memory is compared with the common version number of the word stock, if the version number of the word stock loaded in the memory is smaller than the common version number of the word stock, the word stock is reloaded, and the process version number corresponding to the first application process is updated to the common version number, so that the process version number corresponding to the first application process is consistent with the common version number.
In some embodiments, if the process version number corresponding to the first application process is inconsistent with the common version number, and the version number of the word stock loaded in the memory at the current moment is the common version number, it is indicated that the word stock has been updated, and at this time, the word stock is not reloaded, but the process version number corresponding to the first application process is updated to the common version number of the word stock.
According to the input method lexicon management method provided by the embodiment of the application, the process version number of the lexicon corresponding to the first application process and the public version number of the lexicon are obtained in response to the input method triggering operation on the first application process, wherein the process version number is the version number of the lexicon maintained by the first application process at the current moment, and the public version number of the lexicon is the latest version number of the lexicon at the current moment. And then, comparing the process version number corresponding to the first application process with the public version number, and if the process version number is inconsistent with the public version number, normally, the process version number corresponding to the first application process is smaller than the public version number of the word stock, and reloading the word stock at the moment so as to update the word stock corresponding to the first application process into the word stock corresponding to the latest public version number. Thus, the first application process carries out word input based on the updated word stock, and input experience is improved. That is, in this embodiment of the present application, a process version number and a public version number are set for a thesaurus, and when each input is performed, the process version number of the thesaurus currently maintained by a process is compared with the public version number of the thesaurus to determine whether the thesaurus is updated, and when the thesaurus is detected to be updated (i.e., the process version number of the thesaurus is inconsistent with the public version number), the thesaurus is reloaded, thereby replacing the message notification mechanism that is time-consuming before, further improving the update efficiency of the thesaurus, greatly reducing the blocking condition of the input method when the thesaurus is updated, and improving the input experience.
And when the process version number corresponding to the application process is inconsistent with the common version number of the word stock, the process of reloading the word stock is introduced. The update process of the word stock is described below.
In some embodiments, as shown in fig. 5, embodiments of the present application further include:
s501, when the word stock is detected to be updated, updating the public version number of the word stock.
In some cases, the word stock update is triggered, for example, the word stock of the user is full, the word stock is triggered to be thinned to eliminate some useless words, or the word stock synchronization is triggered, for example, the words of other devices are downloaded from a server to be combined into the local word stock of the user, and the cases result in the word stock update.
In the embodiment of the present application, since the common version is the latest version of the thesaurus, when the thesaurus is detected to be updated, the common version number of the thesaurus needs to be updated. The application process can compare the process version number maintained by the application process with the updated public version number to judge whether the word stock is updated or not, and reload the word stock in time when determining the update of the word stock so as to maintain the input reliability.
Exemplary implementations of the common version number of the word stock in S501 include, but are not limited to, the following:
In the first mode, when the word stock is detected to be updated, the public version number a of the currently stored word stock is updated to be a preset value b, namely the public version number after the word stock is updated is b.
In a second aspect, the step S501 includes the following steps S501-a:
S501-A, when the word stock is detected to be updated, adding a first numerical value to the public version number of the currently stored word stock to obtain the public version number after the word stock is updated.
For example, the public version number of the currently stored thesaurus is a, and assuming that the first value is b, the public version number of the thesaurus after updating is a+b.
The specific values of a and b are not limited in the embodiment of the application.
In one example, assuming a is 7.1 and b is 0.1, the updated public version number of the thesaurus is 7.2.
In one possible implementation manner of the second aspect, if the word stock is accessed by a plurality of processes, the S501-a includes the following S501-a:
S501-A, when N processes are detected to update the lexicon, the public version numbers are sequentially updated through the N processes to obtain the public version numbers after the lexicon is updated, wherein N is a positive integer.
In this implementation, if the lexicon is accessible by multiple processes, there is a possibility that the multiple processes update the lexicon, for example, N processes update the lexicon, and if it is detected that all of the N processes update the lexicon, then the N processes sequentially update the public version number of the lexicon to obtain the public version number after the lexicon update.
For example, if the N processes include process a and process B, assume that the first value is 1. The process a and the process B both update the thesaurus 1, specifically, the process a updates the thesaurus 1 to the thesaurus 2, and the process B updates the thesaurus 1 to the thesaurus 3. At this time, if both the process a and the process a execute the operation of adding 1, the public version number of the word stock 1 is updated simultaneously, which may eventually cause the public version number of the word stock 1 to be added only 1, resulting in an error of the public version number of the word stock 1.
In order to solve the technical problem, when detecting that N processes all update the lexicon, the embodiment of the application sequentially updates the public version numbers through the N processes to obtain the public version numbers after the lexicon is updated. For example, the control process a updates the public version number of the word stock 1, and the control process B updates the updated public version number of the process a. Or, the control process B updates the public version number of the word stock 1, and then the control process A updates the updated public version number of the process B, so that the addition of 2 to the public version number of the word stock 1 is finally realized.
In some embodiments, the thesaurus 1 is updated at the same time as the public version number of thesaurus 1 is updated.
For example, the common version number of thesaurus 1 is 7.1 and the first value is 1. Assume that the control process B updates the public version number of the word stock 1 to obtain an updated public version number of 8.1, and updates the word stock 1 according to the word stock 3 to obtain an updated word stock 13. Next, the control process a updates the updated common version number 8.1 of the process B to obtain an updated common version number 9.1, and updates the word stock 13 according to the word stock 2 to obtain an updated word stock 132.
In one example, the word stock 1 is updated according to the word stock 3 to obtain an updated word stock 13, and the word stock 1 may be updated to the word stock 3, or the word stock 1 and the word stock 3 may be combined to obtain an updated word stock 13.
In one example, the word stock 13 is updated according to the word stock 2 to obtain an updated word stock 132, and the word stock 13 may be updated to the word stock 2, or the word stock 13 and the word stock 2 may be combined to obtain an updated word stock 132.
For another example, the common version number of thesaurus 1 is 7.1 and the first value is 1. Assume that the control process a updates the public version number of the word stock 1 to obtain an updated public version number of 8.1, and updates the word stock 1 according to the word stock 2 to obtain an updated word stock 12. Next, the control process B updates the updated common version number 8.1 of the process a to obtain an updated common version number 9.1, and updates the word stock 12 according to the word stock 3 to obtain an updated word stock 123.
In one example, the word stock 1 is updated according to the word stock 2 to obtain an updated word stock 12, and the word stock 1 may be updated to the word stock 2, or the word stock 1 and the word stock 2 may be combined to obtain an updated word stock 12.
In one example, the word stock 12 is updated according to the word stock 3 to obtain an updated word stock 123, and the word stock 12 may be updated to the word stock 3, or the word stock 12 and the word stock 3 may be combined to obtain an updated word stock 123.
In some embodiments, to prevent other processes from accessing the common version number of the thesaurus during the process of updating the common version number, S501-A includes the following S501-A1:
S501-A1, when detecting that N processes all update the lexicon, controlling the N processes to update the public version numbers in sequence based on a lock mechanism, and obtaining the public version numbers after the lexicon is updated.
Taking the example that the N processes comprise a process A and a process B, if the process A updates the common version number of the word stock first, the process A locks the memory where the common version number of the word stock is located, updates the common version number in the locked memory, and unlocks after updating is finished. And then, the process B locks the memory again, updates the public version number in the locked memory, and unlocks after the updating is finished, so that the updating reliability of the public version number is improved.
Optionally, the memory in which the common version number of the word stock is located is a shared memory.
The embodiment of the application does not limit the sequence of the specific updating of the common version number by the N processes in sequence.
In some embodiments, the update sequence is preset.
In some embodiments, the update order is determined based on a contention mechanism, and at this time, the above-mentioned S501-A1 includes the steps of S501-a11 and S501-a12 as follows:
S501-A11, determining an updating operation sequence of each process in N processes to a common version number based on a competition mechanism;
S501-A12, controlling N processes to update the public version numbers in sequence based on a lock mechanism according to the update operation sequence, and obtaining the public version numbers after the lexicon update.
Fig. 6 is a schematic diagram of a kernel architecture according to an embodiment of the present application, as shown in fig. 6, including a word stock memory, a memory management module, and a version management module, where the word stock memory includes a direct memory, a memory file map, and a shared memory, the version management module includes a single-process version management unit and a multi-process version management unit, a public version number of the word stock is stored in the direct memory in a single process, and a public version number of the word stock is stored in the shared memory in a multi-process. In some embodiments, the system thesaurus may be stored in a memory file. For multiple processes, when modifying the common version number in the shared memory, the modification is based on a lock mechanism.
That is, when N processes modify the lexicon, the N processes contend for the lock resource based on a contention mechanism to implement an update to the common version number.
In one implementation of this embodiment, an order of update operations of the common version number by each of the N processes is first determined based on a contention mechanism. Thus, according to the updating operation sequence, controlling N processes to update the public version numbers in sequence based on a lock mechanism, and obtaining the public version numbers after the word stock is updated. For example, according to the contention mechanism, it is determined that the process a updates first, and then the process B updates the common version number after the process a updates the common version number after the process B updates the process a.
In some embodiments, the common version number of the word stock is stored in the shared memory, and the updating process of S501-a12 includes: for the ith process in the updating sequence, locking the shared memory through the ith process, adding a first numerical value to the latest public version number in the locked shared memory, and then unlocking to obtain the updating of the public version number by the ith process, wherein i is a positive integer less than or equal to N; and controlling the (i+1) th process in the updating sequence to continuously update the common version number updated by the (i) th process until the update of the common version number by the N processes is finished, and obtaining the common version number updated by the lexicon.
For example, assuming that the N processes include a process a and a process B, the determined update sequence is that the process a updates first, and then the process B updates later, at this time, as shown in fig. 6, the process a may be controlled to lock the shared memory first, and update the common version number in the shared memory, for example, unlock after executing the 1-adding operation. And then, the control process B locks the shared memory, updates the updated public version number in the shared memory, for example, unlocks after executing the 1-adding operation, and realizes the sequential updating of the public version number of the word stock.
In some embodiments, the N processes determine the update order by competing multiple times, e.g., N processes include process A, process B, and process C. Firstly, a process A, a process B and a process C compete for unique lock resources based on a competition mechanism, if the process B wins in the competition round to obtain the lock resources, the process B locks the shared memory, updates the updated public version number in the shared memory, for example, performs 1-adding operation and then unlocks. Then, the process a and the process C compete again for the lock resource based on the contention mechanism, and if the process C wins in the round of contention to obtain the lock resource, the process C locks the shared memory, updates the updated common version number in the shared memory, for example, performs the 1-adding operation again and then unlocks. And finally, the process A locks the shared memory, updates the updated public version number in the shared memory, and unlocks the shared memory after executing 1-locking operation.
The update process of the word stock is described below.
The word stock updating method according to the embodiment of the application includes, but is not limited to, the following:
in the first mode, word stock synchronization is realized, for example, the word stock of other devices is downloaded from a server side, and the downloaded word stock is combined into a local user word stock to realize word stock updating.
In the second mode, the word stock is full, and the word stock needs to be thinned, useless words are eliminated, or the word stock is expanded, so that the update of the word stock is realized.
In one example of the second mode, the terminal device performs slimming or expansion on the word stock when it detects that the vocabulary amount in the word stock reaches a certain amount.
In another example of the second mode, the user presses a key to input a word, inputs the word into a current display interface, refers to a process of word on-screen operation, and processes a word stock in response to the word on-screen operation.
In the embodiment of the application, the processing of the word stock in response to the word screen operation specifically includes the following two cases:
in case 1, in response to the on-screen operation of the word, if the current word stock is not full, the word can be directly added into the word stock.
In an example of this case 1, as shown in fig. 7, the process of performing word stock processing by each module in the terminal device assumes that an application program located in a business layer starts a word learning function, that is, when a user inputs a word in the application process of the application program, the input word is added to the user word stock, and thus the word is referred to as a word learning function. As shown in fig. 7, assuming that the current word stock is not full, the learning word does not trigger a slimming operation, and at this time, the word stock is modified by organizing data by an application process (also referred to as an application instance), specifically, the learning word is added to the word stock by the application process. In one example, if the lexicon is stored in the shared memory, the learning word is directly written into the shared memory, and if the lexicon is stored in the memory, the learning word is directly written into the memory.
In some embodiments, after the memory is written with the certain learning word successfully, the application process sends response information to the application process, and the application process sends the response information to the service layer.
2, responding to the screen operation of the words, applying a new memory for the word stock when the word stock is detected to be full, slimming or expanding the word stock on the new memory, writing the words into the word stock after slimming or expanding to obtain an updated word stock, and writing the updated word stock into a magnetic disk; and updating the public version number of the word stock according to the updated word stock.
In case 2, in response to the operation of word on screen, when the word stock is detected to be full, the word stock is updated, specifically, a new memory is applied for the word stock, the word stock is thinned on the new memory to remove unnecessary words, or the word stock is expanded to increase the capacity of the word stock. Since the thesaurus sends updates, the public version number of the thesaurus also needs to be updated synchronously.
In an example of this case 2, as shown in fig. 8, assuming that the current word stock is full, the word learning triggers a slimming operation, and at this time, an application process (also referred to as an application instance) applies for a new memory, and performs a slimming or expansion operation on the new memory to obtain an updated word stock. And then writing the updated word stock into a disk or a file. After the application process updates the word stock, the application process sends notification information to the memory, also called the word stock memory, wherein the notification information is used for indicating the update of the word stock. The word stock memory sends the notification information to the version management module so that the version management module updates the public version number of the word stock according to the updated word stock, for example, 1 is added on the basis of the existing public version number, and the updated public version number is obtained.
In some embodiments, after updating the common version number of the lexicon, when detecting an input method triggering operation of the second application process, responding to the input method triggering operation of the second application process, and acquiring the process version number of the lexicon currently corresponding to the second application process and the updated common version number of the lexicon; if the process version number corresponding to the second application process is detected to be inconsistent with the public version number updated by the word stock, the updated word stock is loaded into the memory from the disk, so that the process version number corresponding to the second application process is consistent with the public version number updated by the word stock.
The second application process may be any application process that accesses the thesaurus. Alternatively, the second application process may be the first application process, or may be another application process different from the first application process.
In this embodiment of the present application, after updating a lexicon and a public version number of the lexicon according to the method in the above case 2, when an input method triggering operation of a second application process is detected, a process version number of the lexicon currently corresponding to the second application process and the public version number after the lexicon update are obtained in response to the input method triggering operation of the second application process, and the process version number corresponding to the second application process is compared with the public version number after the lexicon update. If it is detected that the process version number corresponding to the second application process is inconsistent with the updated common version number of the lexicon, that is, the process version number corresponding to the second application process is generally smaller than the updated common version number, rebuilding and loading the updated lexicon into the memory or the shared memory from the disk so that the process version number corresponding to the second application process is consistent with the updated common version number of the lexicon, and thus, the vocabulary can be read from the updated lexicon by the input method of the second application process.
According to the word stock management method of the input method, the word stock is updated, when the word stock is detected to be updated, the public version number of the word stock is updated, so that when the word stock is accessed next time by other processes, the word stock is reloaded when the fact that the current application process of the process is inconsistent with the public version number of the word stock is judged, notification information of the update of the word stock is not required to be sent independently, further the update efficiency of the word stock is improved, the blocking condition of the input method during the update of the word stock is greatly reduced, and input experience is improved.
The word stock update and the word stock reload procedure are described above. The whole process of lexicon management of the input method according to the embodiment of the application is described below.
Fig. 9 is a schematic flow chart of an input method word stock management method according to an embodiment of the present application, and fig. 9 can be understood as a specific embodiment of fig. 4 and fig. 5.
As shown in fig. 9, the embodiment of the present application includes:
s601, updating a word stock.
In one example, word stock synchronization, for example, downloading word stocks of other devices from a server, and merging the downloaded word stocks into a local user word stock, achieves word stock update.
In another example, the lexicon is full, the lexicon needs to be slimming, some useless words are eliminated, or the lexicon is expanded, so that the lexicon is updated.
It should be noted that, in addition to the above two examples, other thesaurus update issues are also included, which is not limited in this embodiment of the present application.
S602, updating the public version number of the word stock.
For example, when it is detected that the thesaurus is updated, a first value (e.g., 1) is added to the public version number of the currently stored thesaurus, so as to obtain the public version number after the thesaurus is updated.
For another example, when it is detected that all N processes update the thesaurus, the public version numbers are updated sequentially through the N processes, so as to obtain the public version number after the thesaurus is updated, where N is a positive integer.
The specific implementation process of S602 may refer to the description related to S501, which is not described herein.
S603, responding to an input method triggering operation on the first application process, and acquiring a process version number of a word stock corresponding to the first application process and a public version number of the word stock.
The word stock accessed by the first application process is the updated word stock.
In some embodiments, the common version number of the thesaurus is stored in the shared memory, such that the common version number of the thesaurus can be obtained from the shared memory. And acquiring a process version number corresponding to the first application process from the memory corresponding to the first application process.
The specific implementation process of S603 may refer to the specific implementation process of S401, which is not described herein.
S604, judging whether the process version number is consistent with the public version number.
If it is determined that the process version number corresponding to the first application process is inconsistent with the common version number of the thesaurus, the following S606 is executed.
If it is determined that the process version number corresponding to the first application process is identical to the common version number of the thesaurus, the following S606 is executed.
S605, reloading the word stock and updating the process version number.
And if the process version number corresponding to the first application process is inconsistent with the common version number of the word stock, indicating that the word stock stored in the current memory is not the latest version, reloading the word stock into the memory.
And simultaneously, after reloading the word stock into the memory, updating the process version number corresponding to the first application process, namely updating the process version number corresponding to the first application process into the common version number of the current word stock.
S606, reading words from the updated word stock.
As can be seen from the foregoing, after the lexicon is updated, the embodiment of the present application does not need to send a notification message to other processes to update the lexicon, but the processes determine whether to update the lexicon by comparing the process version number of the process with the common version number of the lexicon, for example, when the process version number is inconsistent with the common version number, the lexicon is directly reloaded. Compared with the existing message notification mechanism, the overall efficiency of the word bank update at the Windows end is improved by about 40%, and the situation of the input method blocking during the word bank update is greatly reduced.
In addition, the method of the embodiment of the application can be applied to various types of terminals, supports word stock management of the input methods of all ends, further achieves unification of cores of the input methods of all ends, can greatly save development and maintenance cost, enables the input methods of all ends to use the same set of word stock and core, enables candidates provided by the input methods of all ends to be consistent, and is very good in experience for users using the input methods of all ends. For example, as shown in fig. 10A and 10B, "meinv" is input to a computer and a mobile phone, respectively, and the candidate are in the same order, so that the user does not feel strange no matter on which platform the user uses the input method.
It should be understood that fig. 4-10B are only examples of the present application and should not be construed as limiting the present application.
The preferred embodiments of the present application have been described in detail above with reference to the accompanying drawings, but the present application is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solutions of the present application within the scope of the technical concept of the present application, and all the simple modifications belong to the protection scope of the present application. For example, the specific features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various possible combinations are not described in detail. As another example, any combination of the various embodiments of the present application may be made without departing from the spirit of the present application, which should also be considered as disclosed herein.
Method embodiments of the present application are described above in detail in connection with fig. 4-10B, and apparatus embodiments of the present application are described below in connection with fig. 5-6.
Fig. 11 is a schematic block diagram of an input method thesaurus management apparatus according to an embodiment of the present application.
As shown in fig. 11, the input method thesaurus management apparatus 10 includes:
an obtaining unit 11, configured to obtain, in response to an input method trigger operation on a first application process, a process version number of a word bank corresponding to the first application process, and a public version number of the word bank, where the process version number is a word bank version number corresponding to the first application process at a current time, and the public version number is an latest version number of the word bank at the current time;
and the processing unit 12 is configured to reload the word stock if the process version number corresponding to the first application process is inconsistent with the common version number, so that the process version number corresponding to the first application process is consistent with the common version number.
In some embodiments, the processing unit 12 is further configured to obtain a version number of the word stock loaded in the memory; and if the version number of the word stock loaded in the memory is smaller than the public version number, reloading the word stock so as to enable the process version number corresponding to the first application process to be consistent with the public version number.
In some embodiments, the processing unit 12 is further configured to update a process version number corresponding to the first application process to the common version number if the version number of the word stock loaded in the memory is the common version number.
In some embodiments, the common version numbers are stored in a first memory, the process version numbers corresponding to the first application process are stored in a memory corresponding to the first application process, and the obtaining unit 11 is further configured to obtain, in response to an input method trigger operation on the first application process, the common version number of the lexicon from the first memory, and obtain, in the memory corresponding to the first application process, the process version number corresponding to the first application process.
In some embodiments, if the thesaurus is accessed by multiple processes, the public version number of the thesaurus is stored in shared memory.
In some embodiments, the processing unit 12 is further configured to update the public version number of the thesaurus when it is detected that the thesaurus is updated.
In some embodiments, the processing unit 12 is specifically configured to, when it is detected that the thesaurus is updated, add a first value to the currently stored public version number of the thesaurus, to obtain the public version number after the thesaurus is updated.
In some embodiments, if the thesaurus is accessed by a plurality of processes, the processing unit 12 is specifically configured to, when detecting that N processes each update the thesaurus, sequentially update the common version number by the N processes to obtain the updated common version number of the thesaurus, where N is a positive integer.
In some embodiments, the processing unit 12 is specifically configured to, when detecting that all of the N processes update the thesaurus, control the N processes to update the common version number sequentially based on a lock mechanism, and obtain the updated common version number of the thesaurus.
In some embodiments, the processing unit 12 is specifically configured to determine, based on a contention mechanism, an update operation order of each process of the N processes to the common version number; and controlling the N processes to update the public version numbers in sequence based on the lock mechanism according to the update operation sequence to obtain the updated public version numbers of the word bank.
In some embodiments, the public version number of the word stock is stored in a shared memory, and the processing unit 12 is specifically configured to lock the shared memory by the ith process in the update order, and unlock the shared memory after adding a first value to the latest public version number in the locked shared memory, so as to obtain an update of the public version number by the ith process, where i is a positive integer less than or equal to N; and controlling the (i+1) th process in the updating sequence to continuously update the public version number updated by the (i) th process until the update of the public version number by the N processes is finished, and obtaining the public version number updated by the lexicon.
In some embodiments, the processing unit 12 is further configured to process the word stock in response to an on-screen operation of the word.
In some embodiments, the processing unit 12 is specifically configured to, in response to an on-screen operation of a word, add the word to the word stock when the word stock is detected to be not full.
In some embodiments, the processing unit 12 is specifically configured to respond to an on-screen operation of a word, apply for a new memory for the word stock when the word stock is detected to be full, perform weight reduction or capacity expansion on the word stock on the new memory, write the word into the weight-reduced or capacity-expanded word stock, obtain an updated word stock, and write the updated word stock into a disk; and updating the public version number of the word stock according to the updated word stock.
In some embodiments, the processing unit 12 is further configured to, after updating the public version number of the thesaurus, when detecting an input method trigger operation of a second application process, obtain, in response to the input method trigger operation of the second application process, a process version number of the thesaurus currently corresponding to the second application process and the public version number after the thesaurus is updated; if the process version number corresponding to the second application process is detected to be inconsistent with the updated common version number of the word stock, the updated word stock is loaded into a memory from the disk, so that the process version number corresponding to the second application process is consistent with the updated common version number of the word stock.
It should be understood that apparatus embodiments and method embodiments may correspond with each other and that similar descriptions may refer to the method embodiments. To avoid repetition, no further description is provided here. Specifically, the apparatus shown in fig. 11 may perform the embodiments of the method described above, and the foregoing and other operations and/or functions of each module in the apparatus are respectively for implementing the embodiments of the method described above, which are not repeated herein for brevity.
The apparatus of the embodiments of the present application are described above in terms of functional modules in conjunction with the accompanying drawings. It should be understood that the functional module may be implemented in hardware, or may be implemented by instructions in software, or may be implemented by a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present application may be implemented by an integrated logic circuit of hardware in a processor and/or an instruction in software form, and the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented as a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. Alternatively, the software modules may be located in a well-established storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, and the like. The storage medium is located in a memory, and the processor reads information in the memory, and in combination with hardware, performs the steps in the above method embodiments.
Fig. 12 is a schematic block diagram of an electronic device provided in an embodiment of the present application, which may be the terminal device shown in fig. 2 for performing the above-described method embodiment.
As shown in fig. 12, the robot 30 may include:
a memory 31 and a processor 32, the memory 31 being arranged to store a computer program 33 and to transmit the program code 33 to the processor 32. In other words, the processor 32 may call and run the computer program 33 from the memory 31 to implement the methods in the embodiments of the present application.
For example, the processor 32 may be configured to perform the above-described method steps according to instructions in the computer program 33.
In some embodiments of the present application, the processor 32 may include, but is not limited to:
a general purpose processor, digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
In some embodiments of the present application, the memory 31 includes, but is not limited to:
volatile memory and/or nonvolatile memory. The nonvolatile Memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable EPROM (EEPROM), or a flash Memory. The volatile memory may be random access memory (Random Access Memory, RAM) which acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (Double Data Rate SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct memory bus RAM (DR RAM).
In some embodiments of the present application, the computer program 33 may be partitioned into one or more modules that are stored in the memory 31 and executed by the processor 32 to perform the methods of recording pages provided herein. The one or more modules may be a series of computer program instruction segments capable of performing a specific function for describing the execution of the computer program 33 in the robot.
As shown in fig. 12, the robot 30 may further include:
a transceiver 34, the transceiver 34 being connectable to the processor 32 or the memory 31.
The processor 32 may control the transceiver 34 to communicate with other devices, and in particular, may send information or data to other devices or receive information or data sent by other devices. The transceiver 34 may include a transmitter and a receiver. The transceiver 34 may further include antennas, the number of which may be one or more.
It will be appreciated that the various components in the robot 30 are connected by a bus system that includes, in addition to a data bus, a power bus, a control bus, and a status signal bus.
According to an aspect of the present application, there is provided a computer storage medium having stored thereon a computer program which, when executed by a computer, enables the computer to perform the method of the above-described method embodiments.
Embodiments of the present application also provide a computer program product comprising instructions which, when executed by a computer, cause the computer to perform the method of the method embodiments described above.
According to another aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the robot reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the robot performs the method of the above-described method embodiment.
In other words, when implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces, in whole or in part, a flow or function consistent with embodiments of the present application. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), or the like.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. For example, functional modules in the embodiments of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (18)

1. The word stock management method of the input method is characterized by comprising the following steps of:
responding to an input method triggering operation on a first application process, and acquiring a process version number of a word stock corresponding to the first application process and a public version number of the word stock, wherein the process version number is a word stock version number corresponding to the first application process at the current moment, and the public version number is the latest version number of the word stock at the current moment;
And reloading the word stock if the process version number corresponding to the first application process is inconsistent with the public version number, so that the process version number corresponding to the first application process is consistent with the public version number.
2. The method of claim 1, wherein prior to reloading the thesaurus, the method further comprises:
acquiring the version number of the word stock loaded in the memory;
the reloading the word stock includes:
and if the version number of the word stock loaded in the memory is smaller than the public version number, reloading the word stock so as to enable the process version number corresponding to the first application process to be consistent with the public version number.
3. The method according to claim 2, wherein the method further comprises:
and if the version number of the word stock loaded in the memory is the common version number, updating the process version number corresponding to the first application process to the common version number.
4. The method of claim 1, wherein the common version numbers are stored in a first memory, the process version numbers corresponding to the first application process are stored in a memory corresponding to the first application process, and the obtaining the process version numbers and the common version numbers of the word stock accessed by the first application process in response to an input method triggering operation on the first application process comprises:
And responding to an input method triggering operation on the first application process, acquiring a public version number of the word stock from the first memory, and acquiring a process version number corresponding to the first application process from the memory corresponding to the first application process.
5. The method of claim 4, wherein if the thesaurus is accessed by multiple processes, then the public version number of the thesaurus is stored in shared memory.
6. The method according to any one of claims 1-5, further comprising:
and when the word stock is detected to be updated, updating the public version number of the word stock.
7. The method of claim 6, wherein updating the common version number of the thesaurus upon detecting that the thesaurus is updated comprises:
when the word stock is detected to be updated, a first numerical value is added to the currently stored public version number of the word stock, and the public version number after the word stock is updated is obtained.
8. The method of claim 7, wherein if the thesaurus is accessed by a plurality of processes, the step of adding a first value to the currently stored public version number of the thesaurus to obtain the updated public version number of the thesaurus when the thesaurus is detected to be updated comprises:
When N processes are detected to update the word stock, the public version numbers are sequentially updated through the N processes to obtain the public version numbers after the word stock is updated, and N is a positive integer.
9. The method of claim 8, wherein when it is detected that N processes each update the thesaurus, updating the common version number sequentially by the N processes to obtain the updated common version number of the thesaurus comprises:
and when the N processes are detected to update the word stock, controlling the N processes to update the public version numbers in sequence based on a lock mechanism to obtain the public version numbers after the word stock is updated.
10. The method of claim 9, wherein when the detecting that the N processes each update the thesaurus, controlling the N processes to sequentially update the common version number based on a lock mechanism, to obtain the updated common version number of the thesaurus comprises:
determining an updating operation sequence of each process in the N processes to the common version number based on a competition mechanism;
and controlling the N processes to update the public version numbers in sequence based on the lock mechanism according to the update operation sequence to obtain the updated public version numbers of the word bank.
11. The method of claim 10, wherein the common version numbers of the thesaurus are stored in a shared memory, and the controlling the N processes to sequentially update the common version numbers based on the lock mechanism according to the update operation order, to obtain the updated common version numbers of the thesaurus comprises:
for an ith process in the updating sequence, locking the shared memory through the ith process, and unlocking after adding a first value to the latest common version number in the locked shared memory to obtain the updating of the common version number by the ith process, wherein i is a positive integer less than or equal to N;
and controlling the (i+1) th process in the updating sequence to continuously update the public version number updated by the (i) th process until the update of the public version number by the N processes is finished, and obtaining the public version number updated by the lexicon.
12. The method of claim 6, wherein the method further comprises:
and responding to the screen operation of the words, and processing the word stock.
13. The method of claim 12, wherein the processing the thesaurus process in response to the on-screen operation of the term comprises:
And responding to the screen operation of the words, and adding the words into the word stock when the word stock is detected to be not full.
14. The method of claim 12, wherein the processing the thesaurus process in response to the on-screen operation of the term comprises:
responding to the screen operation of words, when the word stock is detected to be full, applying for a new memory for the word stock, slimming or expanding the word stock on the new memory, writing the words into the word stock after slimming or expanding to obtain an updated word stock, and writing the updated word stock into a magnetic disk;
and updating the public version number of the word stock according to the updated word stock.
15. The method of claim 14, wherein the method further comprises:
after the common version number of the word stock is updated, when the input method triggering operation of a second application process is detected, responding to the input method triggering operation of the second application process, and acquiring the process version number of the word stock corresponding to the second application process currently and the updated common version number of the word stock;
if the process version number corresponding to the second application process is detected to be inconsistent with the updated common version number of the word stock, the updated word stock is loaded into a memory from the disk, so that the process version number corresponding to the second application process is consistent with the updated common version number of the word stock.
16. An input method word stock management device, characterized by comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for responding to an input method triggering operation on a first application process, acquiring a process version number of a word bank corresponding to the first application process and a public version number of the word bank, wherein the process version number is a word bank version number corresponding to the first application process at the current moment, and the public version number is the latest version number of the word bank at the current moment;
and the processing unit is used for reloading the word stock if the process version number corresponding to the first application process is inconsistent with the public version number, so that the process version number corresponding to the first application process is consistent with the public version number.
17. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor for executing the computer program to implement the method of any of the preceding claims 1 to 15.
18. A computer readable storage medium storing a computer program for causing a computer to perform the method of any one of the preceding claims 1 to 15.
CN202210940079.0A 2022-08-05 2022-08-05 Input method word stock management method, device, equipment and storage medium Pending CN117555908A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210940079.0A CN117555908A (en) 2022-08-05 2022-08-05 Input method word stock management method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210940079.0A CN117555908A (en) 2022-08-05 2022-08-05 Input method word stock management method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117555908A true CN117555908A (en) 2024-02-13

Family

ID=89819227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210940079.0A Pending CN117555908A (en) 2022-08-05 2022-08-05 Input method word stock management method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117555908A (en)

Similar Documents

Publication Publication Date Title
US10372383B2 (en) Providing secure access to data in mobile devices
CN103248667A (en) Resource access method and system for distributed system
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
US11018860B2 (en) Highly available and reliable secret distribution infrastructure
CN111666088A (en) Pod replacement method and device, electronic equipment and computer-readable storage medium
CN114020652A (en) Application program management method and electronic equipment
CN114780615A (en) Error code management method and device thereof
CN109739738A (en) Event log management method, system and relevant apparatus based on HTML5
CN111488316B (en) File cache recovery method and device
CN112784283B (en) Capability management method and computer equipment
CN112527416A (en) Task processing method and device, computer equipment and storage medium
CN110096543B (en) Data operation method, device, server and medium of application program
EP4148577A2 (en) Method and apparatus of responding to client fault detection with update operation, electronic device, and storage medium
CN112286594A (en) Object serialization and deserialization method and device, electronic device and medium
CN117555908A (en) Input method word stock management method, device, equipment and storage medium
CN115017436B (en) Data interaction method and device of application program, computer equipment and storage medium
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN116340970A (en) Service system login method, device, electronic equipment and readable storage medium
CN113110846A (en) Method and device for acquiring environment variable
CN113760631A (en) Page loading duration determination method, device, equipment and storage medium
CN118427199B (en) Multi-language document self-adaptive adaptation method and device
CN116680277B (en) Information verification method, device, equipment and storage medium
US12009976B2 (en) Configuration of a server in view of a number of clients connected to the server
CN115826880B (en) Local caching method, device, system, medium and equipment of object storage system
CN112732568B (en) System log acquisition method and device, storage medium and terminal

Legal Events

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