CN107305542B - A kind of spell checking methods and device - Google Patents
A kind of spell checking methods and device Download PDFInfo
- Publication number
- CN107305542B CN107305542B CN201610257505.5A CN201610257505A CN107305542B CN 107305542 B CN107305542 B CN 107305542B CN 201610257505 A CN201610257505 A CN 201610257505A CN 107305542 B CN107305542 B CN 107305542B
- Authority
- CN
- China
- Prior art keywords
- target
- character string
- word
- address
- target character
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 58
- 238000001514 detection method Methods 0.000 claims abstract description 88
- 230000009471 action Effects 0.000 claims description 32
- 230000008569 process Effects 0.000 claims description 18
- 230000008719 thickening Effects 0.000 claims description 6
- 238000000605 extraction Methods 0.000 claims description 4
- 238000012544 monitoring process Methods 0.000 claims description 2
- 238000011897 real-time detection Methods 0.000 abstract description 8
- 241000334160 Isatis Species 0.000 description 12
- 238000010586 diagram Methods 0.000 description 4
- 239000012634 fragment Substances 0.000 description 3
- 239000002023 wood Substances 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/232—Orthographic correction, e.g. spell checking or vowelisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Machine Translation (AREA)
- Document Processing Apparatus (AREA)
Abstract
The embodiment of the invention provides a kind of spell checking methods and devices.Wherein, the spell checking methods and device are applied to electronic equipment, including:Real-time detection character entering function;After detecting character entering function, the position that first object word hyphenation symbol and the second target word hyphenation accord with is determined from cursor current location, target string to be detected is extracted between the position that the first object word hyphenation accords with and the position that the second target word hyphenation accords with, wherein, the first object word hyphenation symbol is the nearest word hyphenation symbol in the current location left side, and the second target word hyphenation symbol is word hyphenation symbol nearest on the right of the current location;Error detection processing is carried out to the target string;It executes and is acted with processing corresponding to error detection processing acquired results.By this programme, the long problem of error detection feedback cycle can solve.
Description
Technical Field
The present invention relates to error detection technology, and more particularly, to a spell checking method and apparatus.
Background
Since a user often spells words in the editing process of documents, short messages, mails and the like, an automatic spell checking method is developed to help the user to ensure the word spelling accuracy, so that the quality of input texts is improved. Among them, the word is usually composed of a character string, for example: the English word is composed of at least one English letter.
The traditional spell checking method applied to the document comprises the following steps: after a user enters a complete sentence, multiple words included in the sentence are checked for errors. Although the method can realize error detection, the condition that the error detection is triggered is that the error detection result feedback period is relatively long after each sentence is input, so that the error detection result is not fed back timely. In particular, when the user is time-critical, the feedback result is easily ignored, and the user input information expression is ambiguous or ambiguous.
It is clear that this traditional spell checking method is not well suited to the current extremely efficient computer era.
Disclosure of Invention
An object of the embodiments of the present invention is to provide a spell checking method and apparatus, so as to solve the problem that the error detection result has a relatively long feedback period. The specific technical scheme is as follows:
in a first aspect, the present invention provides a spell checking method, comprising:
detecting character input operation in real time;
after the character input operation is detected, determining the positions of a first target word breaking character and a second target word breaking character from the current position of a cursor, and extracting a target character string to be detected from the position between the position of the first target word breaking character and the position of the second target word breaking character, wherein the first target word breaking character is the word breaking character closest to the left of the current position, and the second target word breaking character is the word breaking character closest to the right of the current position;
performing error detection processing on the target character string;
and executing the processing action corresponding to the result of the error detection processing.
Optionally, the performing error detection processing on the target character string includes:
and judging whether the target character string is the same as the word in the preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong.
Optionally, performing error detection processing on the target character string includes:
judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
Optionally, when the result obtained by the error detection processing is correct spelling, the corresponding processing action is: not processing;
when the error detection processing result is a spelling error, the corresponding processing action is as follows: and acquiring a starting position address and an ending position address of the target character string, and highlighting the target character string based on the starting position address and the ending position address.
Optionally, the category of the word breaking token includes:
punctuation marks and spaces.
Optionally, the highlighting the target character string based on the starting location address and the ending location address includes:
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
or,
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string.
Optionally, when a click operation that a click position meets a predetermined condition is detected, a target character string corresponding to the click position is determined, where the predetermined condition is: the target character string is located in the area where the result of the error detection processing is misspelled;
and displaying a similar word list of the target character string corresponding to the click position.
Optionally, when a selection operation for a word in the similar word list is detected, replacing the target character string corresponding to the click position with the word targeted by the selection operation.
In a second aspect, an embodiment of the present invention further provides a spell checking apparatus, including:
the real-time monitoring module is used for detecting the character input operation in real time;
the target character string extraction module is used for determining the positions of a first target word breaking character and a second target word breaking character from the current position of a cursor after detecting a character input operation, and extracting a target character string to be detected from the position between the position of the first target word breaking character and the position of the second target word breaking character, wherein the first target word breaking character is the nearest word breaking character on the left side of the current position, and the second target word breaking character is the nearest word breaking character on the right side of the current position;
the error detection processing module is used for carrying out error detection processing on the target character string;
and the processing action execution module is used for executing the processing action corresponding to the result obtained by the error detection processing.
Optionally, the error detection processing module is specifically configured to:
and judging whether the target character string is the same as the word in the preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong.
Optionally, the error detection processing module is specifically configured to:
judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
Optionally, when the result obtained by the error detection processing is correct spelling, the error detection processing module does not process the result;
and when the error detection processing result is a spelling error, the error detection processing module acquires the initial position address and the end position address of the target character string, and highlights the target character string based on the initial position address and the end position address.
Optionally, the category of the word breaking token includes:
punctuation marks and spaces.
Optionally, the highlighting the target character string based on the starting location address and the ending location address includes:
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
or,
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string.
Optionally, when a click operation that a click position meets a predetermined condition is detected, a target character string corresponding to the click position is determined, where the predetermined condition is: the target character string is located in the area where the result of the error detection processing is misspelled;
and displaying a similar word list of the target character string corresponding to the click position.
Optionally, when a selection operation for a word in the similar word list is detected, replacing the target character string corresponding to the click position with the word targeted by the selection operation.
In the embodiment of the invention, in the process of spelling the word, after each character is input, the currently existing character string is extracted for error detection processing, and the processing action corresponding to the result obtained by the error detection processing is executed, so that the aim of real-time detection is fulfilled.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of a spell checking method according to an embodiment of the invention;
FIG. 2 is another flow chart of a spell checking method according to an embodiment of the invention;
FIG. 3 is a flowchart of a spell checking method according to an embodiment of the invention;
FIG. 4 is a diagram of a similar words list provided by an embodiment of the present invention;
FIG. 5 is a block diagram of a spell checking device according to an embodiment of the invention;
FIG. 6 is a schematic diagram of another structure of a spell checking device according to an embodiment of the invention;
fig. 7 is a schematic structural diagram of a spell checking device according to an embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a spell checking method and a device, which are used for solving the problem of long error detection result feedback period.
First, a spell checking method according to an embodiment of the present invention will be described.
It should be noted that, the spell checking method provided by the embodiment of the present invention is applied to an electronic device, and in practical application, the electronic device may include: notebook computer, desktop computer, panel computer, smart mobile phone etc..
In addition, it should be noted that the functional software for implementing the spell checking method provided by the embodiment of the present invention may be a specific function carried by a certain software, or may be a special client, for example, the special client may be a client having a word spelling scenario, such as a short message application program, a mailbox application program, a document application program, and the like; alternatively, the functional software for implementing the spell checking method provided by the embodiment of the present invention may also be a functional plug-in of an existing client, for example, the existing plug-in may be a plug-in embedded in a scene with word spelling, such as a short message application, a mailbox application, a document application, and the like, which is reasonable.
As shown in fig. 1, a spell checking method provided by an embodiment of the present invention may include the following steps:
s101, detecting character input operation in real time;
in the process of word spelling, each letter can be the starting point of input error, so that in order to ensure the instant feedback of error detection results, the character input operation can be used as the trigger condition of spell check, and the character input operation can be detected in real time in the process of word spelling. It is understood that the prior art can be adopted to detect the character input operation in real time, and is not limited herein.
It is emphasized that the word according to the embodiment of the present invention is information constituted by a character string. For example: the english word is a word suitable for the embodiment of the present invention, and is composed of at least one english alphabet, and of course, the word of the embodiment of the present invention is not limited to the english word, and any information composed of character strings may be the word mentioned in the embodiment of the present invention, such as chinese, korean, japanese, arabic, and the like.
S102, after character input operation is detected, determining the positions of a first target word breaking character and a second target word breaking character from the current position of a cursor, and extracting a target character string to be detected from the position between the position of the first target word breaking character and the position of the second target word breaking character;
it is understood that the categories of word breaks may include: punctuation marks and spaces.
As a specific implementation manner, when the character input operation is a character input operation of sequentially spelling a word, after the character input operation is detected, it indicates that a trigger condition of spell check is satisfied, and therefore, positions of a first target word break and a second target word break can be determined, and since there is no character string at the right of a current position of a cursor at this time, a position of the cursor is used as a position where a second target word fragment exists, a target character string to be detected is extracted from between the positions of the first target word break and the second target word fragment. For example: for the English sentence: "hello word! "what it includes is a word breaker: one space and one punctuation mark! ". Then, in the process of inputting the english sentence, after each character is input, the target character string is extracted according to the step described in S102, and the extracted target character strings sequentially include: "h", "he", "hel", "hell", "hello", "w", … … "word".
As another specific implementation, when the character input operation is an operation when returning to modify one or some characters of a previously written word, after detecting the character input operation, indicating that a trigger condition of spell check is satisfied, positions of a first target word break letter and a second target word break letter may be determined, and a target character string to be detected is extracted from between the position of the first target word break letter and the position of the second target word fragment letter. For example: for the English sentence: "hello word! For example, assuming that the current position of the cursor is located between two "ll" of "hello", after each character is input in "ll", the target character string is extracted according to step S102, and when the input characters are "p", "i" and "w", the extracted target character string is: "helplo", "helpilo", "helpiwlo". It is emphasized that when the input character is a space, the English sentence is modified to "hellowword! "when the cursor is positioned after the space, the extracted target character string is" lo ", and when the cursor is positioned before the space, the extracted target character string is" hel ".
It should be emphasized that after each character is input, the target character string to be detected is extracted from between the position of the first target word breaking character and the position of the second target word breaking character, so that the target character string is not necessarily the whole word, but may be a word which is not input. In addition, since the purpose is to detect errors in words and phrases, spaces and punctuation marks that do not have referential properties are not eliminated as objects for character input operations. Moreover, it can be understood that any specific implementation manner in the prior art may be adopted to extract the target character string to be detected from between the word breaks of the target word and the word characters, which is not described herein again.
S103, carrying out error detection processing on the target character string;
after the target character string is extracted, error detection processing is carried out on the target character string according to a preset mode, and corresponding processing actions are executed according to the result obtained by the error detection processing.
Specifically, in an implementation manner, performing error detection processing on the target string may include:
and judging whether the target character string is the same as the word in the preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong.
For example, assuming that the currently extracted target character string is "wo", matching is found in a preset dictionary library, and although there are "woad", "woe", "word", and the like in the preset dictionary library, there is no "wo", and therefore, the result of the error detection processing is a spelling error; further, assuming that the currently extracted target string is "wod", since the target string "wod" does not match any word in the predetermined dictionary base, the result of the error detection process is still a spelling error.
In another implementation, performing error detection processing on the target string may include: judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
For example: assuming that the currently extracted target character string is "wo", because the target character string "wo" is matched with "woad", "woe" and "word" … … in the preset dictionary library, that is, the extracted target character string is the same as the character string which is contained in each word and starts with the initial letter of the target character string, the result of the error detection processing is spelling correct; further, assuming that the currently extracted target string is "wod", since the target string "wod" does not match at least one word in the preset dictionary bank, the result of the error detection process is a spelling error.
It can be understood that the preset dictionary database may be constructed in the prior art, and details are not described herein. In addition, the specific implementation manner of performing error detection processing on the target character string is given as an example only, and should not constitute a limitation to the embodiments of the present invention, and it should be emphasized that any implementation manner capable of checking whether the target character string is a word that is not input completely may be used.
S104, executing the processing action corresponding to the result of the error detection processing.
After the error detection processing is performed on the target character string, the processing action corresponding to the result obtained by the error detection processing can be executed, so that the error detection result can be fed back to the user in time, and the purpose of shortening the feedback period is achieved.
Specifically, when the result of the error detection processing is correct spelling, the corresponding processing action is: not processing;
if the result of the error detection process is a spelling error, the corresponding process action is: and acquiring the starting position address and the ending position address of the target character string, and highlighting the target character string based on the starting position and the ending position of the target character string in the editing area.
There are various specific implementation manners for highlighting the target character string based on the starting position and the ending position of the target character string in the editing area, for example:
in one implementation, the highlighting the target string based on the starting location address and the ending location address may include:
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
in another implementation, the highlighting the target string based on the starting location address and the ending location address may include:
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string. Wherein the underlined line type includes at least: single straight lines, double straight lines, dashed lines, wavy lines, etc. Of course, the so-called highlighting may also be adding animated special effects, such as flashing target strings, or triggering audible alarm devices, etc.
It will be appreciated that the above-described manners of highlighting the target string may be used in combination to improve the prominence of the target string. In addition, the above-mentioned implementation of highlighting the target character string is only an example, and should not be construed as limiting the embodiments of the present invention.
It will be understood by those skilled in the art that the start position address and the end position address of the target character string are addresses at which the target character string is actually recorded in the database, and are different concepts from the start position and the end position at which the target character string is displayed in the edit area. The display position is adjusted according to the size of the display screen and corresponds to a display position address, and the start position address and the end position address of the target character string which are actually recorded in the database are addresses of the character string which is actually stored on hardware and are not different according to the display condition of an external display.
It is emphasized that the start position address and the end position address of the acquisition target character string can be obtained by the prior art. And, can obtain the address of initial position and end position of the target character string immediately after the target character string is extracted, at this moment, can store the address of initial position and end position of the target character string and target character string in the record table correspondingly, so as to be while utilizing the address of initial position and end position of the target character string subsequently, withdraw the address of initial position and end position that the target character string corresponds to from the record table directly; of course, the start address and the end address of the target character string may not be obtained immediately after the target character string is extracted, but when the result of the error detection processing is a spelling error, the start address and the end address corresponding to the target character string are obtained, and the target character string is highlighted based on the start address and the end address of the target character string.
In the embodiment of the invention, in the process of spelling the word, after each character is input, the currently existing character string is extracted for error detection processing, and the processing action corresponding to the result obtained by the error detection processing is executed, so that the aim of real-time detection is fulfilled.
Furthermore, in order to facilitate the user to immediately know why the wrong character string is wrong and which correct candidate words correspond to the wrong character string, on the basis of the embodiment shown in fig. 1 and as shown in fig. 2, the spell checking method provided by the embodiment of the present invention may further include the steps of:
s105, when the click operation that the click position meets the preset condition is detected, determining a target character string corresponding to the click position;
wherein the predetermined conditions are: the position of the clicking operation is located in the area where the target character string with the misspelled spelling result is obtained by the error detection processing. That is, the location address of the click location is obtained, the location address is queried and scanned in the record table, and if the location address is a certain start location address, or a certain end location address, or falls between a certain start location address and an end location address, the click location is determined to meet the predetermined condition. It should be emphasized that the character string with the error result detected in step S103 and the start position address and the end position address corresponding to the detected error character string are stored in advance, where the specific storage method is implemented by the prior art and is not described herein.
For example, a record table records a start position address and an end position address of an error character string and a corresponding relation of the error character string, and since the record table records a corresponding relation between a storage space between a certain start position address and an end position address and a target character string, a step of determining the target character string corresponding to the click position is performed, that is, in the record table, the click position address is searched for a certain start position address and an end position address where the position address is located through query, and then the target character string corresponding to the certain start position address and the end position address is taken out.
When a user wants to check a correct alternative word corresponding to the wrong character string, a click operation with a click position meeting a preset condition can be sent out; correspondingly, when the electronic equipment detects the click operation of which the click position meets the condition, the electronic equipment can determine the target character string corresponding to the click position, and then execute the subsequent operation.
For the electronic device supporting the mouse, the click operation may be a right key operation sent by the mouse, and certainly, may also be a left key operation; in addition, for an electronic device supporting a touch operation, the click operation may be a click operation issued by a touch object, and the touch object may be a stylus or a finger of a user.
And S106, displaying a similar word list of the target character string corresponding to the click position.
After the target character string corresponding to the click position is determined, a similar word list of the target character string corresponding to the click position can be displayed, wherein words in the similar word list are words in a preset dictionary library and have certain similarity with the target character string. In practical applications, the similar word list may include not only words, but also other functional options, such as: all ignored, added to a dictionary, translated, etc.
It is to be understood that, in one implementation given above, performing error detection processing on the target string may include: judging whether the target character string is the same as a word in a preset dictionary library or not, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong;
accordingly, the words in the similar word list are words whose similarity to the target character string exceeds a predetermined threshold, wherein the similarity between the words can be calculated by using the prior art, which is not limited herein.
In addition, in another implementation manner given above, performing error detection processing on the target string may include: judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string which is contained in the word and takes the first letter of the word as the starting point;
then, correspondingly, the similar word list includes: and the error detection result shows that the part of the character string with correct spelling is the word beginning with the target character string corresponding to the click position.
In addition, in the preset dictionary library, with the target character string corresponding to the click position, the error detection result indicates that the part of the character string with correct spelling is the beginning word, the number of the words is usually large, and the display area of the similar word list is limited, so that a plurality of words can be sorted according to the weight value, and the part of the words with the weight value larger than a certain value or the sorting result before the predetermined ranking can be displayed in the similar word list. The weighted value of each word may be set according to the frequency of use of each word counted in advance, and may also be set in other ways.
For example: when the user wishes to see why the underlined word is wrong and which correct word can be selected, the user can position the cursor over any letter of the underlined word, such as between "o" and "d" in the word "wod", and then click the right mouse button, thereby calling up a list of similar words corresponding to "wod", such as the list of similar words shown in fig. 4, which includes not only the word: woad, woe, wold, wood, and also includes three functions of ignoring, adding to a dictionary, and translating.
Therefore, in the embodiment, while the feedback period is shortened, the user can conveniently and immediately know the error of the wrong character string and the corresponding correct alternative words through the similar word list, and the use experience of the user is improved.
Furthermore, to facilitate the user to correct the error character string, based on the embodiment shown in fig. 2, as shown in fig. 3, the spell checking method provided by the embodiment of the invention may further include the steps of:
s107, when the selection operation for a word in the similar word list is detected, replacing the target character string corresponding to the click position by the word targeted by the selected operation.
Wherein, the selecting operation can be: clicking operations, such as: a left mouse button operation or a touch operation by a touch object.
For example: as shown in FIG. 4, when the target string is "wod", the error detection result is a spelling error and is highlighted under "wod", and the list of similar words of the target string has been displayed to the user; when detecting that the user selects the word "woad" in the similar word list shown in fig. 4, acquiring the word "woad" selected by the user, replacing "wod" in the figure with "woad", wherein the specific method for acquiring the word "woad" selected by the user and replacing "wod" in the figure with "woad" is as follows: acquiring a word 'woad' selected by a user, acquiring the length of a 'woad' text, and acquiring a starting position address and an ending position address of 'wod'; according to the length of the 'woad' text, sequentially changing the position addresses of all other texts behind the ending position address; "wod" is selected, then "wod" is deleted, and "woad" is placed in the text corresponding to the starting location address.
If the word selected by the user is 'woo', the position addresses of all other texts behind the ending position address do not need to be changed according to the length of the 'woo' text; selecting wod, then deleting wod, and putting wood in the text corresponding to the initial position address.
If the word selected by the user is 'we', sequentially changing the position addresses of all other texts behind the ending position address according to the length of the 'we' text; selecting wod, deleting wod, putting we in the text corresponding to the initial position address, and modifying the ending address of the text.
It is emphasized that while the target string corresponding to the click position is replaced with the word for which the selected operation is directed, the unchanged strings around this replacement position are moved forward or backward.
Therefore, in the embodiment, while the feedback period is shortened, the user can conveniently know which correct alternative words correspond to the wrong character string in real time through the similar word list, and can conveniently correct the wrong character string, so that the use experience of the user is further improved.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a spell checking apparatus, which is applied to an electronic device, and as shown in fig. 5, the apparatus may include:
a real-time detection module 510, configured to detect a character input operation in real time during a word spelling process;
a target character string extracting module 520, configured to determine, after a character input operation is detected, positions of a first target word breaking indicator and a second target word breaking indicator from a current position of a cursor, and extract a target character string to be detected from a position between the position of the first target word breaking indicator and the position of the second target word breaking indicator, where the first target word breaking indicator is a word breaking indicator nearest to the left of the current position, and the second target word breaking indicator is a word breaking indicator nearest to the right of the current position;
an error detection processing module 530, configured to perform error detection processing on the target character string;
a processing action executing module 540, configured to execute a processing action corresponding to a result of the error detection processing.
In the embodiment of the invention, in the process of spelling the word, after each character is input, the currently existing character string is extracted for error detection processing, and the processing action corresponding to the result obtained by the error detection processing is executed, so that the aim of real-time detection is fulfilled.
Specifically, the error detection processing module 530 may include:
the error detection processing unit is used for judging whether the target character string is the same as a word in a preset dictionary library or not, if so, the spelling is correct, and otherwise, the spelling is wrong; or
The method is used for judging whether the target character string is matched with at least one word in the preset dictionary library, if so, the spelling is correct, otherwise, the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
Specifically, when the result of the error detection processing is correct spelling, the corresponding processing action executed by the processing action executing module 540 is: not processing;
the error detection processing result is a spelling error, and the corresponding processing action executed by the processing action executing module 540 is:
the error detection processing module acquires a starting position address and an ending position address of the target character string, and highlights the target character string based on the starting position address and the ending position address.
Specifically, the types of word breaks include:
punctuation marks and spaces.
Specifically, the processing action executing module is specifically configured to, when a result of the error detection processing is a spelling error,
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
or,
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string.
In the embodiment of the invention, in the process of spelling the word, after each character is input, the currently existing character string is extracted for error detection processing, and the processing action corresponding to the result obtained by the error detection processing is executed, so that the aim of real-time detection is fulfilled.
Furthermore, in order to facilitate the user to immediately know why the wrong character string is wrong and which correct candidate words correspond to the wrong character string, on the basis of the real-time detection module 510, the target character string extraction module 520, the error detection processing module 530 and the processing action execution module 540, as shown in fig. 6, the spell checking apparatus provided by the embodiment of the present invention may further include:
a character string determining module 550, configured to determine, when a click operation is detected that a click position meets a predetermined condition, a target character string corresponding to the click position, where the predetermined condition is: the target character string is located in the area where the result of the error detection processing is misspelled;
and a list display module 560, configured to display a similar word list of the target character string corresponding to the click position.
Therefore, in the embodiment, while the feedback period is shortened, the user can conveniently and immediately know the error of the wrong character string and the corresponding correct alternative words through the similar word list, and the use experience of the user is improved.
Furthermore, in order to facilitate the user to correct the error string, as shown in fig. 7, on the basis of including the real-time detection module 510, the target string extraction module 520, the error detection processing module 530, the processing action execution module 540, the string determination module 550 and the list display module 560, the spell checking apparatus provided in the embodiment of the present invention may further include:
and the character replacing module 570 is used for replacing the target character string corresponding to the click position by the word aimed by the selection operation when the selection operation aiming at one word in the similar word list is detected.
Therefore, in the embodiment, while the feedback period is shortened, the user can conveniently know which correct alternative words correspond to the wrong character string in real time through the similar word list, and can conveniently correct the wrong character string, so that the use experience of the user is further improved.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (14)
1. A spell checking method, applied to an electronic device, the method comprising:
detecting character input operation in real time;
after the character input operation is detected, determining the positions of a first target word breaking character and a second target word breaking character from the current position of a cursor, and extracting a target character string to be detected from the position between the position of the first target word breaking character and the position of the second target word breaking character, wherein the first target word breaking character is the word breaking character closest to the left of the current position, and the second target word breaking character is the word breaking character closest to the right of the current position;
performing error detection processing on the target character string;
executing a processing action corresponding to a result obtained by the error detection processing;
the method further comprises the following steps:
when the click operation that the click position meets the preset condition is detected, determining a target character string corresponding to the click position, wherein the preset condition is as follows: the target character string is located in the area where the result of the error detection processing is misspelled;
displaying a similar word list of the target character string corresponding to the click position;
the predetermined conditions are specifically: the position address of the click position is the address of the starting position recorded in a recording table, or the address of the ending position recorded in the recording table, or falls between the address of the starting position and the address of the ending position recorded in the recording table;
the recording table is used for recording the starting position address and the ending position address of the target character string;
the starting position address and the ending position address are addresses of the target character strings which are actually recorded in the database.
2. The method of claim 1, wherein the performing error detection processing on the target string comprises:
and judging whether the target character string is the same as the word in the preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong.
3. The method of claim 1, wherein performing error detection processing on the target string comprises:
judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
4. The method according to claim 2 or 3,
when the result obtained by the error detection processing is correct spelling, the corresponding processing action is as follows: not processing;
when the error detection processing result is a spelling error, the corresponding processing action is as follows: and acquiring a starting position address and an ending position address of the target character string, and highlighting the target character string based on the starting position address and the ending position address.
5. The method of claim 1, wherein the category of word breaks comprises:
punctuation marks and spaces.
6. The method of claim 4, wherein highlighting the target string based on the starting location address and the ending location address comprises:
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
or,
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string.
7. The method of claim 1, further comprising:
when a selection operation aiming at one word in the similar word list is detected, replacing the target character string corresponding to the click position by the word aiming at the selection operation.
8. A spell checking apparatus, applied to an electronic device, the apparatus comprising:
the real-time monitoring module is used for detecting the character input operation in real time;
the target character string extraction module is used for determining the positions of a first target word breaking character and a second target word breaking character from the current position of a cursor after detecting a character input operation, and extracting a target character string to be detected from the position between the position of the first target word breaking character and the position of the second target word breaking character, wherein the first target word breaking character is the nearest word breaking character on the left side of the current position, and the second target word breaking character is the nearest word breaking character on the right side of the current position;
the error detection processing module is used for carrying out error detection processing on the target character string;
a processing action executing module for executing the processing action corresponding to the result obtained by the error detection processing;
the device further comprises:
the character string determining module is used for determining a target character string corresponding to a click position when the click operation that the click position meets a preset condition is detected, wherein the preset condition is as follows: the target character string is located in the area where the result of the error detection processing is misspelled;
the list display module is used for displaying a similar word list of the target character string corresponding to the click position;
the predetermined conditions are specifically: the position address of the click position is the address of the starting position recorded in a recording table, or the address of the ending position recorded in the recording table, or falls between the address of the starting position and the address of the ending position recorded in the recording table;
the recording table is used for recording the starting position address and the ending position address of the target character string;
the starting position address and the ending position address are addresses of the target character strings which are actually recorded in the database.
9. The apparatus according to claim 8, wherein the error detection processing module is specifically configured to:
and judging whether the target character string is the same as the word in the preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong.
10. The apparatus according to claim 8, wherein the error detection processing module is specifically configured to:
judging whether the target character string is matched with at least one word in a preset dictionary library, if so, indicating that the spelling is correct, otherwise, indicating that the spelling is wrong, wherein the matching of the target character string and the word is as follows: the target character string is the same as the character string contained by the word starting with the first letter of the word.
11. The apparatus of claim 9 or 10, wherein:
when the result of the error detection processing is correct spelling, the error detection processing module does not process the result;
and when the error detection processing result is a spelling error, the error detection processing module acquires the initial position address and the end position address of the target character string, and highlights the target character string based on the initial position address and the end position address.
12. The apparatus of claim 8, wherein the category of word breaks comprises:
punctuation marks and spaces.
13. The apparatus according to claim 11, wherein the processing action performing module is specifically configured to:
underlining a distance from the starting point to the end point by using a position corresponding to the target starting position address as a starting point and a position corresponding to the end position address as an end point to highlight the target character string;
or,
and using the position corresponding to the starting position address as a starting point, using the position corresponding to the ending position address as an ending point, and thickening, inclining or adjusting the font color of each character from the starting point to the ending point so as to highlight the target character string.
14. The apparatus of claim 8, further comprising:
and the character replacing module is used for replacing the target character string corresponding to the click position by using the word aiming at the selection operation when the selection operation aiming at one word in the similar word list is detected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610257505.5A CN107305542B (en) | 2016-04-21 | 2016-04-21 | A kind of spell checking methods and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610257505.5A CN107305542B (en) | 2016-04-21 | 2016-04-21 | A kind of spell checking methods and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107305542A CN107305542A (en) | 2017-10-31 |
CN107305542B true CN107305542B (en) | 2018-11-16 |
Family
ID=60150208
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610257505.5A Active CN107305542B (en) | 2016-04-21 | 2016-04-21 | A kind of spell checking methods and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107305542B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1254135A (en) * | 1998-11-12 | 2000-05-24 | 英业达集团(上海)电子技术有限公司 | Writing aid system and its method |
CN102298577A (en) * | 2011-09-21 | 2011-12-28 | 深圳市万兴软件有限公司 | Method and device for detecting spelling of document edition |
CN102629160A (en) * | 2012-03-16 | 2012-08-08 | 华为终端有限公司 | Input method, input device and terminal |
CN102937949A (en) * | 2012-10-15 | 2013-02-20 | 福建榕基软件股份有限公司 | Method and system for checking English spelling in rich text editor |
CN103885938A (en) * | 2014-04-14 | 2014-06-25 | 东南大学 | Industry spelling mistake checking method based on user feedback |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7032174B2 (en) * | 2001-03-27 | 2006-04-18 | Microsoft Corporation | Automatically adding proper names to a database |
CN101661331B (en) * | 2008-08-28 | 2012-05-30 | 北京搜狗科技发展有限公司 | Word input method and input method system |
US20120284308A1 (en) * | 2011-05-02 | 2012-11-08 | Vistaprint Technologies Limited | Statistical spell checker |
CN102750003B (en) * | 2012-05-30 | 2016-08-10 | 华为技术有限公司 | The method and apparatus of text input |
-
2016
- 2016-04-21 CN CN201610257505.5A patent/CN107305542B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1254135A (en) * | 1998-11-12 | 2000-05-24 | 英业达集团(上海)电子技术有限公司 | Writing aid system and its method |
CN102298577A (en) * | 2011-09-21 | 2011-12-28 | 深圳市万兴软件有限公司 | Method and device for detecting spelling of document edition |
CN102629160A (en) * | 2012-03-16 | 2012-08-08 | 华为终端有限公司 | Input method, input device and terminal |
CN102937949A (en) * | 2012-10-15 | 2013-02-20 | 福建榕基软件股份有限公司 | Method and system for checking English spelling in rich text editor |
CN103885938A (en) * | 2014-04-14 | 2014-06-25 | 东南大学 | Industry spelling mistake checking method based on user feedback |
Also Published As
Publication number | Publication date |
---|---|
CN107305542A (en) | 2017-10-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3141015B2 (en) | Handwritten kanji recognition method and apparatus | |
US9058105B2 (en) | Automated adjustment of input configuration | |
US20080077393A1 (en) | Virtual keyboard adaptation for multilingual input | |
US20140129991A1 (en) | Character input prompting method and electronic device | |
US10769370B2 (en) | Methods and apparatus for spell checking | |
CN105824804A (en) | English spelling error correction tool and method based on word bank | |
EP2897055A1 (en) | Information processing device, information processing method, and program | |
CN109917982B (en) | Voice input method, device, equipment and readable storage medium | |
US20220222292A1 (en) | Method and system for ideogram character analysis | |
US20130191110A1 (en) | Method for character correction | |
EP3029567B1 (en) | Method and device for updating input method system, computer storage medium, and device | |
US20140380169A1 (en) | Language input method editor to disambiguate ambiguous phrases via diacriticization | |
WO2014159763A2 (en) | User-guided term suggestions | |
CN112230811A (en) | Input method, device, equipment and storage medium | |
EP3467633B1 (en) | Method, device, and terminal device for extracting data | |
CN115509413A (en) | Display method, display device, dictionary pen, electronic device and storage medium | |
CN104076945B (en) | Apparatus and method for showing input keyboard in the terminal | |
WO2016155643A1 (en) | Input-based candidate word display method and device | |
JP2010267083A (en) | Form retrieval device, form retrieval program and form retrieval method | |
CN107305542B (en) | A kind of spell checking methods and device | |
CN107766826B (en) | Method for searching word paraphrase and electronic equipment | |
CN117313675A (en) | Text modification method, apparatus, computer device and computer readable storage medium | |
JP5271526B2 (en) | Trademark search system and trademark search server | |
CN106293368B (en) | Data processing method and electronic equipment | |
KR20180007183A (en) | sentence input method and devices using the Representative of alphabet with the spaces |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |