CN113900635A - Code recommendation method and device - Google Patents

Code recommendation method and device Download PDF

Info

Publication number
CN113900635A
CN113900635A CN202010642143.8A CN202010642143A CN113900635A CN 113900635 A CN113900635 A CN 113900635A CN 202010642143 A CN202010642143 A CN 202010642143A CN 113900635 A CN113900635 A CN 113900635A
Authority
CN
China
Prior art keywords
word
words
code
user
prompt
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
CN202010642143.8A
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010642143.8A priority Critical patent/CN113900635A/en
Publication of CN113900635A publication Critical patent/CN113900635A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
    • G06F3/0233Character input methods
    • 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/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a code recommendation method and device. The method and the device can realize unification of statement style, naming style, input normalization and the like of codes developed for the same software project by different users or the same user, facilitate later maintenance, and reduce labor cost of the later maintenance. In addition, the method and the device can automatically recommend the cue words to the user according to the codes input for developing the software project, so that the user does not need to spend time to be familiar with the sentence style, the naming style, the input normalization and the like of the codes input for developing the software project before, and the user can complete the development of the software project only by continuously inputting the codes after the currently input real-time codes in the development platform according to the recommended cue words. The sentence style, the naming style, the input normalization and the like of codes which are input for developing software projects before the users are familiar with the time are omitted, so that the workload of the users can be reduced, and the development efficiency of the users can be improved.

Description

Code recommendation method and device
Technical Field
The present application relates to the field of internet, and in particular, to a code recommendation method and apparatus.
Background
Currently, when a larger-scale software project is developed, a software development team is often required to cooperate with the development, and different developers in the development team develop different contents in the software project. The input sentence style, naming style, and input normalization of different developers when inputting computer program codes are different.
In a software development team, a situation of staff movement may sometimes occur, and after an old developer leaves the software development team, a new developer enters the software development team.
However, if the new developer takes time to become familiar with the sentence style, naming style, input specification, etc. of the content input by the old developer after taking the lead of the old developer, the new developer needs to continue to develop the software project based on the sentence style, naming style, input specification, etc. of the content input by the old developer.
However, this places a large workload on new developers and reduces the efficiency of developing software projects.
Disclosure of Invention
In order to improve the efficiency of developing software projects, the application shows a code recommendation method and device.
In a first aspect, the present application shows a code recommendation method, including:
receiving a code input by a user, and segmenting the code according to a preset rule;
obtaining the line end word of the line where the cursor position of the user is located in the segmentation result;
and recommending prompt words for the user according to the line end words of the line where the cursor position is located.
In an optional implementation, the method further includes:
establishing a real-time word bank for the segmentation result;
recommending a prompt word for the user according to the end word of the line of the cursor position, wherein the recommending comprises:
searching words with prompt weights matched with the last words in the real-time word bank as prompt words;
and recommending the searched prompt words for the user.
In an optional implementation manner, the recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located includes:
searching words with prompt weights matched with the last-line words in a pre-established word index table to serve as prompt words;
and recommending the searched prompt words for the user.
In an optional implementation manner, the recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located includes:
obtaining word segmentation results of the line where the cursor position is located;
searching words with prompt weights matched with word segmentation results of a line where the cursor is located and the last words in a pre-established ngram word index table to serve as prompt words;
and recommending the searched prompt words for the user.
In an optional implementation manner, the recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located includes:
obtaining word segmentation results of the line where the cursor position is located;
searching words with prompt weights matched with word segmentation results of the line where the cursor is located and the last words in the line in a pre-established ngram whole-line index table to serve as prompt words;
and recommending the searched prompt words for the user.
In an optional implementation, the method further includes:
if a plurality of prompt words exist, screening and sequencing the prompt words;
then, the recommending prompt words for the user includes:
and recommending the at least two ordered prompt words for the user.
In an optional implementation, the method further includes:
obtaining a history code;
segmenting the historical code to obtain a segmentation result of the historical code;
establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes;
and establishing the word index table according to the code word dictionary.
In an alternative implementation, the creating the word index table according to the dictionary of words for codes includes:
calculating the prompt weight of the word according to the word frequency of the word in the dictionary of the code word;
and establishing the word index table according to the prompt weight of the word.
In an optional implementation, the method further includes:
obtaining a history code;
segmenting the historical code to obtain a segmentation result of the historical code;
establishing an ngram word list according to the segmentation result of the historical code;
and establishing the ngram word index table and/or the ngram whole line index table according to the ngram word list.
In a second aspect, the present application shows a code recommendation apparatus comprising:
the receiving module is used for receiving a code input by a user and segmenting the code according to a preset rule;
the obtaining module is used for obtaining the line end word of the line where the cursor position of the user is located in the segmentation result;
and the recommending module is used for recommending prompt words for the user according to the line end words of the line where the cursor position is located.
In an optional implementation, the apparatus further comprises:
the establishing module is used for establishing a real-time word bank for the segmentation result;
the recommendation module comprises:
the first searching unit is used for searching words with prompt weights matched with the end-of-line words in the real-time word bank as prompt words;
and the first recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the second searching unit is used for searching words with the prompting weight matched with the line end words in a pre-established word index table to serve as prompting words;
and the second recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the first obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a third searching unit, configured to search, in a pre-established ngram word index table, words whose prompt weights are matched with the word segmentation result of the line where the cursor is located and the word at the end of the line, as prompt words;
and the third recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the second obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a fourth searching unit, configured to search, in a pre-established ngram whole-row index table, a word whose prompt weight matches the word segmentation result of the row where the cursor is located and the word at the end of the row, and use the word as a prompt word;
and the fourth recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation manner, the recommendation module includes:
the sorting unit is used for screening and sorting the plurality of cue words if the plurality of cue words exist;
and the fifth recommending unit is used for recommending the sorted at least two prompt words for the user.
In an optional implementation manner, the recommendation module further includes:
a third obtaining unit configured to obtain a history code;
the first segmentation unit is used for segmenting the historical code to obtain a segmentation result of the historical code;
the first establishing unit is used for establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes;
and the second establishing unit is used for establishing the word index table according to the code word dictionary.
In an optional implementation manner, the second establishing unit includes:
the calculation subunit is used for calculating the prompt weight of the word according to the word frequency of the word in the code word dictionary;
and the establishing subunit is used for establishing the word index table according to the prompt weight of the word.
In an optional implementation manner, the recommendation module further includes:
a fourth obtaining unit configured to obtain a history code;
the second segmentation unit is used for segmenting the historical code to obtain the segmentation result of the historical code;
the third establishing unit is used for establishing an ngram word list according to the segmentation result of the historical codes;
and the fourth establishing unit is used for establishing the ngram word index table and/or the ngram whole-line index table according to the ngram word list.
In a third aspect, the present application shows an electronic device comprising:
a processor; and
a memory having executable code stored thereon, which when executed, causes the processor to perform the code recommendation method of the first aspect.
In a fourth aspect, the present application shows one or more machine-readable media having executable code stored thereon that, when executed, causes a processor to perform a code recommendation method as described in the first aspect.
Compared with the prior art, the embodiment of the application has the following advantages:
in the application, a code input by a user is received, and the code is segmented according to a preset rule; acquiring the line end word of the line where the cursor position of the user is located in the segmentation result; and recommending prompt words for the user according to the line end words of the line where the cursor position is located.
Wherein the code input by the user may include real-time code currently input by the user in the development platform for developing the software project,
the hint words predicted from the user-entered code may be real-time code and/or words that have appeared in historical code, including historical code that the user or other users had entered for developing the software project prior to the user-entered real-time code. The method comprises the steps that a user already appears in a real-time code and/or a historical code for developing a software project under the condition that a last word in a real-time code currently input by the user is adjacent to a prompt word in front and back, and/or the condition that last M adjacent words in the real-time code currently input are adjacent to the prompt word in front and back is already present in the real-time code and/or the historical code, wherein M is an integer greater than or equal to 2.
Based on the habit of inputting codes, under the condition that the function of a software project can be met, a user can select a cue word as a code which needs to be actually input after a currently input real-time code, and can not manually input a word which is different from the cue word in characters but has the same function as the cue word, so that the sentence style, the naming style, the input normalization and the like of the code input after the currently input real-time code by the user can be the same as the sentence style, the naming style, the input normalization and the like of the real-time code and/or the historical code.
Therefore, the unification of the statement style, the naming style, the input normalization and the like of the codes developed for the same software project by different users or the same user can be realized, the later maintenance is convenient, and the labor cost of the later maintenance is reduced.
In addition, the method and the device can automatically recommend the cue words to the user according to the codes input for developing the software project, so that the user does not need to spend time to be familiar with the sentence style, the naming style, the input normalization and the like of the codes input for developing the software project before, and the user can complete the development of the software project only by continuously inputting the codes after the currently input real-time codes in the development platform according to the recommended cue words.
The sentence style, the naming style, the input normalization and the like of codes which are input for developing software projects before the users are familiar with the time are omitted, so that the workload of the users can be reduced, and the development efficiency of the users can be improved.
Drawings
Fig. 1 is a flowchart illustrating a code recommendation method according to an exemplary embodiment of the present application.
Fig. 2 is a block diagram illustrating a code recommendation apparatus according to an exemplary embodiment of the present application.
Fig. 3 is a schematic structural diagram of an apparatus according to an embodiment of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
Referring to fig. 1, a flowchart of a code recommendation method applied to an electronic device is shown, where the method may include:
in step S101, a code input by a user is received, and the code is segmented according to a preset rule.
In this application, the electronic device may look up a special symbol in the code entered by the user, the special symbol including: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be filtered in the code input by the user, and then the filtered words and special symbols may be used as a plurality of words included in the code input by the user.
In the present application, the code entered by the user may include real-time code currently entered by the user in the development platform for developing the software project.
Wherein, the code input by the user can be the code input based on the same computer program language.
In the application, when a large-scale software project is developed, a development team consisting of a plurality of users is often required to cooperatively develop the software project, and different users in the development team develop different contents in the software project.
One of the users may develop a portion of content in the software project, and to develop the portion of content in the software project, the user may launch a development platform on the electronic device and then enter code for developing the portion of content in the development platform.
Wherein the user may have developed other content in the software project and/or the other user may have developed other content in the software project before the user enters code for developing the portion of content in the software project in the development platform. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
In the application, in the process that the user inputs the codes for developing the part of the content in the development platform, all words currently input in real time in the development platform for developing the software project are real-time codes at any time. For example, the code used to develop the portion of content that the user currently desires to develop may be considered real-time code.
In order to enable the sentence style, naming style, input normalization and the like of the next word input by the user to be the same as those of the historical codes and the sentence style, naming style, input normalization and the like of the real-time codes when the next word needs to be input by the user, in the application, in the process of the codes input by the user in the development platform for developing the software project, the electronic equipment can acquire the codes input by the user in the development platform for developing the software project, then segment the codes input by the user according to the preset rules, and then execute the step S102.
In step S102, the end word of the line where the cursor position of the user is located is obtained in the segmentation result.
In step S103, a cue word is recommended to the user according to the end-of-line word of the line where the cursor position is located.
In this application, a cue may include one word or may include at least two words in series.
The specific way to obtain the cue words can be seen in the embodiments shown later, and is not detailed here.
In the application, the prompt words can be displayed in the development platform so that a user can check the prompt words, and/or the prompt words can be broadcasted through voice so that the user can perceive the prompt words.
In a possible embodiment, the number of the cue words may be multiple, but what the user actually needs to input is often one of multiple cue words, so that the possibility that each cue word is selected and used by the user at this time can be determined, and then each cue word is recommended to the user according to the sequence from high to low of the possibility that the user selects and uses at this time, for example, each cue word is displayed according to the sequence from high to low of the possibility that the user selects and uses at this time, so that the user can more conveniently view and select the cue word needing to be input.
The manner of determining the possibility that each prompt is selected and used by the user at this time may specifically refer to the following embodiments, which are not described in detail herein.
In the application, a code input by a user is received, and the code is segmented according to a preset rule; acquiring the line end word of the line where the cursor position of the user is located in the segmentation result; and recommending prompt words for the user according to the line end words of the line where the cursor position is located.
The code input by the user may include real-time code currently input by the user in the development platform for developing the software project.
The hint words predicted from the user-entered code may be real-time code and/or words that have appeared in historical code, including historical code that the user or other users had entered for developing the software project prior to the user-entered real-time code. The method comprises the steps that a user already appears in a real-time code and/or a historical code for developing a software project under the condition that a last word in a real-time code currently input by the user is adjacent to a prompt word in front and back, and/or the condition that last M adjacent words in the real-time code currently input are adjacent to the prompt word in front and back is already present in the real-time code and/or the historical code, wherein M is an integer greater than or equal to 2.
Based on the habit of inputting codes, under the condition that the function of a software project can be met, a user can select a cue word as a code which needs to be actually input after a currently input real-time code, and can not manually input a word which is different from the cue word in characters but has the same function as the cue word, so that the sentence style, the naming style, the input normalization and the like of the code input after the currently input real-time code by the user can be the same as the sentence style, the naming style, the input normalization and the like of the real-time code and/or the historical code.
Therefore, the unification of the statement style, the naming style, the input normalization and the like of the codes developed for the same software project by different users or the same user can be realized, the later maintenance is convenient, and the labor cost of the later maintenance is reduced.
In addition, the method and the device can automatically recommend the cue words to the user according to the codes input for developing the software project, so that the user does not need to spend time to be familiar with the sentence style, the naming style, the input normalization and the like of the codes input for developing the software project before, and the user can complete the development of the software project only by continuously inputting the codes after the currently input real-time codes in the development platform according to the recommended cue words.
The sentence style, the naming style, the input normalization and the like of codes which are input for developing software projects before the users are familiar with the time are omitted, so that the workload of the users can be reduced, and the development efficiency of the users can be improved.
If the prompt words are displayed in the development platform, after the user sees the prompt words, if the prompt words are words which are actually required to be input by the user, the user can manually input characters in the prompt words in series in the development platform according to the seen prompt words so as to realize the purpose of inputting the prompt words in the development platform.
However, there may be some cases that the input characters are wrong due to negligence, so that the input prompt words are wrong, a BUG appears in the debugging process at the later stage, and then each word in the code needs to be manually detected again until the wrong word is modified correctly, but the efficiency of developing the software project is reduced.
Therefore, in order to improve the efficiency of software development, it is necessary to avoid the occurrence of a situation where characters in a cue word input by a user are wrong, and to avoid the occurrence of a situation where characters in a cue word input by a user are wrong, the characters in the cue word can be prevented from being manually received by the user, and a recommended cue word can be directly selected.
For example, a user can input a prompt word selection operation in the development platform, the electronic device receives the prompt word selection operation of the user, and then the prompt word can be input in the development platform according to the selection operation, for example, the prompt word is automatically input after a currently input real-time code in the development platform, so that the prompt word is input in the development platform without serially and manually inputting characters by the user, the efficiency of inputting the code in the development platform by the user can be improved, and as long as the recommended prompt word is not wrong, the error of the prompt word input in the development platform can not occur, so that the BUG occurring in the later debugging can be avoided, the code does not need to be manually detected again, and the efficiency of developing the software project can be improved.
In one embodiment, the code entered by the user includes real-time code currently entered by the user in the development platform for developing the software project.
When a user inputs a code in a development platform, the input code is often composed of a plurality of independent words, for example, including english words, numbers, english letters, special symbols, and the like, and the special symbols include symbols supported by the development platform, such as spaces, equal to or greater than a number, smaller than a number, double quotation marks, single quotation marks, brackets, and the like.
For example, assume that a user needs to enter a piece of code in the development platform: "const a ═ abcdefg", where in the above-described code, "const", "", "═ and" abcdefg "are independent words, where" "" represents a space between "const" and "a".
It is assumed that the real-time code currently input by the user in the development platform includes "const a ═ abc", and at this time, the words that have been input include "const", "a", and "═ j". The last word "abc" is a word that has not been input, that is, "abc" is a word that has not been input in the real-time code.
Thus, in an embodiment of the application, after the code is segmented according to the preset rule, a real-time word bank can be established for the segmentation result in real time.
Therefore, when the cue words are recommended for the user according to the end-of-line words in the line where the cursor position is located, words with cue weights matched with the end-of-line words can be searched in the real-time word bank to serve as cue words, and then the searched cue words are recommended for the user.
The process of establishing a word stock for the segmentation result comprises the following steps:
11) and segmenting words of the real-time code currently input by the user to obtain a plurality of words included in the real-time code currently input by the user.
In this application, the electronic device may look up a special symbol in the real-time code currently input by the user, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be screened from the real-time code currently input by the user, and then the screened words and special symbols may be used as a plurality of words included in the currently input real-time code.
12) And establishing a real-time word bank by a plurality of words included in the real-time code currently input by the user.
In an embodiment of the present application, the obtained multiple words may be deduplicated, and for any word after the deduplication, the word frequency of the word in the real-time code currently input by the user is counted, and then the cue weight of the word in the real-time code currently input by the user is calculated according to the word frequency of the word in the real-time code currently input by the user. Then the word and the prompt weight of the word in the real-time code currently input by the user form a corresponding table item, and the corresponding table item is stored in a first corresponding relation between the word and the prompt weight. The above operation is also performed for every other word after the deduplication.
The first corresponding relation is the real-time word stock. And the words in the real-time word bank comprise words in the real-time codes currently input by the user.
In addition, in the process of inputting the code by the user in real time, the first corresponding relation can be updated according to the new words input by the user in real time.
For example, in the process of real-time code input by the user, whenever the user inputs a new word in real time, the electronic device updates the prompt weight of the new word input by the user in real time in the real-time code currently input by the user in the first corresponding relationship.
In addition, searching words with the prompt weight matched with the last word in the real-time word bank as prompt words, and then recommending the searched prompt words for the user, wherein the prompt words comprise:
21) and searching words comprising the last word in the real-time word bank.
22) And under the condition that one searched word is available, the searched word can be recommended to the user.
For example, assume that the words in the real-time thesaurus include: "const", "a", and "abcdefg", etc. If the end-of-line word in the real-time code currently input by the user is "abc", the word including the end-of-line word "abc" can be searched in "const", "a", and "abcdefg", and the like, and one word is searched: "abcdefg".
Therefore, the searched word "abcdefg" can be used as a prompt word, and then the prompt word "abcdefg" can be recommended to the user for the user to select.
23) And under the condition that a plurality of searched words exist, recommending the searched words for the user according to the sequence of the prompt weights of the words in the current input real-time code of the user from large to small.
Sometimes the word in the real-time thesaurus including the end-of-line word may be multiple.
For example, assume that the real-time thesaurus includes: "const", "a", "abcd", "abcxed", and "abcdefg", etc., the last line word in the real-time code currently input by the user is "abc", then the word including the last line word "abc" can be searched in "const", "a", "abcd", "abcxed", and "abcdefg", etc., and the searched word is multiple, for example: "abcd", "abcxed", and "abcdefg", etc., and thus "abcd", "abcxed", and "abcdefg", etc., may be used as the hinters.
At this time, the cue words include "abcd", "abcxed", and "abcdefg", and the like, and then the cue words, abcd "," abcxed ", and" abcdefg ", and the like, may be recommended to the user for the user to select.
In this case, however, the different words found are likely to be used by the user at this time.
And the prompt weights of the searched different words in the real-time code currently input by the user are different.
When the word frequency of the searched word in the real-time code currently input by the user is higher, the prompt weight of the searched word in the real-time code currently input by the user is higher, the possibility that the searched word is the word required to be input by the user when the user inputs the code is higher, namely, the possibility that the searched word is selected and used by the user at this time is higher.
When the word frequency of the searched word in the real-time code currently input by the user is lower, the prompt weight of the searched word in the real-time code currently input by the user is lower, and the possibility that the searched word is the word required to be input by the user when the user inputs the code is smaller, namely, the possibility that the searched word is selected and used by the user at this time is smaller.
Therefore, in order to facilitate the user to view and select the words to be input, in another embodiment of the present application, in 23), the words to be searched are recommended to the user according to the sequence of the prompt weights of the words in the real-time code currently input by the user from large to small, including:
31) and acquiring prompt weights of the searched words in the currently input real-time code respectively.
In the present application, for any word in the plurality of words found, the prompt weight corresponding to the word may be found in the real-time word bank, that is, in the first corresponding relationship between the word and the prompt weight, and is used as the prompt weight of the word in the real-time code currently input by the user. The above operation is also performed for each of the other words in the searched plurality of words. And obtaining the prompt weights of the searched words in the real-time code currently input by the user respectively.
32) And sequencing the searched words at least according to the prompt weight.
In one embodiment of the present application, the found words may be sorted according to the order of the prompt weights in the real-time code currently input by the user from high to low.
In another embodiment of the present application, in addition to the prompt weight in the real-time code currently input by the user, the found words may be sorted by combining the last appearance positions of the found words in the real-time code currently input by the user, respectively.
And the last appearance position of each searched word in the real-time code currently input by the user is different.
The found word which is closer to the end word from the last appearing position in the real-time code currently input by the user is more likely to be the code which needs to be input by the user later, that is, the possibility of being selected and used by the user at this time is higher.
The more distant the last appearing position in the real-time code currently input by the user is from the end-of-line word, the lower the possibility that the searched word is the code that needs to be input by the user later, that is, the lower the possibility that the searched word is selected and used by the user this time.
Of course, the searched words may also be sorted by combining the prompt weights of the searched words in the real-time code currently input by the user and other characteristics of the searched words, and the specific sorting manner is not limited in the present application.
33) And displaying at least part of searched words according to the sorted sequence.
In the present application, sometimes more words are found, however, in general, the words that the user needs to input are often located in the first words after the ranking.
If all searched words are displayed in the development platform, many areas in the development platform are occupied by words which are not needed by the user, so that the normal code input of the user in the development platform is sometimes influenced, and the display resources are wasted.
Therefore, in order to avoid affecting the normal code input of the user and to avoid wasting display resources, in another embodiment of the present application, when the number of the searched multiple words is greater than the preset number, topQ words may be selected from the multiple words according to a sorted order, and then the selected topQ words are displayed in the development platform according to the sorted order, where Q is an integer greater than or equal to 1, Q may also be the preset number, and the preset number includes 3, 4, or 5, and the application does not limit this.
Further, if the user selects one of the found words in the development platform, the electronic device may add a prompt weight corresponding to the selected word in the first corresponding relationship between the word and the prompt weight, so as to update the prompt weight of the word in the real-time code currently input by the user.
Historical codes may also be used when recommending hints for the user. Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
When a user inputs a code in a development platform, the input code is often composed of a plurality of independent words, for example, including english words, numbers, english letters, special symbols, and the like, and the special symbols include symbols supported by the development platform, such as spaces, equal to or greater than a number, smaller than a number, double quotation marks, single quotation marks, brackets, and the like.
For example, assume that a user needs to enter a piece of code in the development platform: "const a ═ abcdefg", where in the above-described code, "const", "", "═ and" abcdefg "are independent words, where" "" represents a space between "const" and "a".
It is assumed that the real-time code currently input by the user in the development platform includes "const a ═ abc", and at this time, the words that have been input include "const", "a", and "═ j". The last word "abc" is a word that has not been input, that is, "abc" is a word that has not been input in the real-time code.
Thus, in one embodiment of the present application, a word index table may be established in advance.
Therefore, when the cue word is recommended for the user according to the end-of-line word of the line where the cursor position is located, the word with the cue weight matched with the end-of-line word can be searched in the pre-established word index table to serve as the cue word, and then the searched cue word is recommended for the user.
The process of establishing the word index table comprises the following steps:
41) and obtaining the history code.
Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
42) And segmenting the historical code to obtain the segmentation result of the historical code.
In this application, the electronic device may look up a special symbol in the history code, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be filtered in the history code, and then the filtered words and special symbols may be used as a plurality of words included in the history code.
43) And establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes.
Wherein, the words obtained by segmentation in 42) can be deduplicated, and the deduplicated words can form a word dictionary.
44) And establishing a word index table according to the code word dictionary.
In one embodiment of the present application, the word index table may be established by calculating the prompt weight of each word in the history code according to the word frequency of the word in the dictionary of words for codes, and then establishing the word index table according to the prompt weight of each word in the history code.
For example, for any word in the dictionary of words for code, the word frequency of the word in the history code is counted, and the prompt weight of the word in the history code is calculated according to the word frequency of the word in the history code. And then the word and the prompt weight of the word in the history code form a corresponding table entry and are stored in a second corresponding relation between the word and the prompt weight. The above-described operation is also performed for each of the other words in the dictionary of words for codes.
The second corresponding relation is a word index table. Wherein the words in the word index table include words in the history codes.
In addition, the second corresponding relationship may also be updated according to a new word input by the user in real time in the process of inputting the code by the user in real time.
For example, in the process of inputting the code in real time by the user, every time the user inputs a new word in real time, the electronic device updates the prompt weight of the new word input in real time by the user in the historical code in real time in the second corresponding relationship.
In addition, searching a word with the prompt weight matched with the last word in a pre-established word index table to serve as a prompt word, and then recommending the searched prompt word for the user, wherein the method comprises the following steps:
51) and searching a word comprising the end-of-line word in the word index table.
52) And under the condition that one searched word is available, the searched word can be recommended to the user.
For example, assume that the words in the word index table include: "const", "a", and "abcdefg", etc. If the end-of-line word in the real-time code currently input by the user is "abc", the word including the end-of-line word "abc" can be searched in "const", "a", and "abcdefg", and the like, and one word is searched: "abcdefg".
Therefore, the searched word "abcdefg" can be used as a prompt word, and then the prompt word "abcdefg" can be recommended to the user for the user to select.
53) And under the condition that a plurality of searched words exist, recommending the searched words for the user according to the sequence of the prompt weights of the words in the historical codes from large to small.
Sometimes the word in the word index table including the end-of-line word may be plural.
For example, assume that the word index table includes: "const", "a", "abcd", "abcxed", and "abcdefg", etc., the last line word in the real-time code currently input by the user is "abc", then the word including the last line word "abc" can be searched in "const", "a", "abcd", "abcxed", and "abcdefg", etc., and the searched word is multiple, for example: "abcd", "abcxed", and "abcdefg", etc., and thus "abcd", "abcxed", and "abcdefg", etc., may be used as the hinters.
At this time, the cue words include "abcd", "abcxed", and "abcdefg", and the like, and then the cue words, abcd "," abcxed ", and" abcdefg ", and the like, may be recommended to the user for the user to select.
In this case, however, the different words found are likely to be used by the user at this time.
And the prompt weights of the searched different words in the historical codes are different.
When the word frequency of the searched word in the history code is higher, the prompt weight of the searched word in the history code is higher, and the possibility that the searched word is the word required to be input by the user when the user inputs the code is higher, that is, the possibility that the searched word is selected and used by the user at this time is higher.
When the word frequency of the searched word in the history code is lower, the prompt weight of the searched word in the history code is lower, and the possibility that the searched word is the word required to be input by the user when the user inputs the code is lower, that is, the possibility that the searched word is selected and used by the user at this time is lower.
Therefore, in order to facilitate the user to view and select the words to be input, in another embodiment of the present application, in 53), the searched words are recommended to the user according to the order of the prompt weight of each word in the history code from large to small, including:
61) and acquiring prompt weights of the searched words in the historical codes respectively.
In the present application, for any word in the plurality of words found, the prompt weight corresponding to the word may be found in the word index table, that is, in the second correspondence between the word and the prompt weight, and is used as the prompt weight of the word in the history code. The above operation is also performed for each of the other words in the searched plurality of words. And obtaining the prompt weight of the searched words in the historical codes respectively.
62) And sequencing the searched words at least according to the prompt weight.
In one embodiment of the present application, the found words may be sorted in order of the hint weights in the history code from high to low.
In another embodiment of the present application, in addition to the prompt weight in the history code, the found words may be sorted according to the last appearance position of the found words in the history code, respectively.
Wherein, the last appearance position of each searched word in the history code is different.
The found word having the last appearance position in the history code closer to the end-of-line word is more likely to be the code to be input by the user later, that is, the more likely to be selected and used by the user this time.
The more distant the last appearance position in the history code from the end word is, the less likely the searched word is the code that needs to be input by the user later, that is, the less likely the word is selected and used by the user this time.
Of course, the searched words may also be sorted by combining the prompt weights of the searched words in the history codes and other characteristics of the searched words, and the specific sorting manner is not limited in the present application.
63) And displaying at least part of searched words according to the sorted sequence.
In the present application, sometimes more words are found, however, in general, the words that the user needs to input are often located in the first words after the ranking.
If all searched words are displayed in the development platform, many areas in the development platform are occupied by words which are not needed by the user, so that the normal code input of the user in the development platform is sometimes influenced, and the display resources are wasted.
Therefore, in order to avoid affecting the normal code input of the user and to avoid wasting display resources, in another embodiment of the present application, when the number of the found multiple words is greater than the preset number, topP words may be selected from the multiple words according to the sorted order, and then the selected topP words are displayed in the development platform according to the sorted order, where P is an integer greater than or equal to 1, P may also be the preset number, and the preset number includes 3, 4, or 5, and the application does not limit this.
Further, if the user selects one of the found words in the development platform, the electronic device may add a prompt weight corresponding to the selected word in a second correspondence between the word and the prompt weight, so as to update the prompt weight of the word in the history code.
Historical codes may also be used when recommending hints for the user. Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
When a user inputs a code in a development platform, the input code is often composed of a plurality of independent words, for example, including english words, numbers, english letters, special symbols, and the like, and the special symbols include symbols supported by the development platform, such as spaces, equal to or greater than a number, smaller than a number, double quotation marks, single quotation marks, brackets, and the like.
In one scenario, a user has entered real-time code in the development platform, and needs to continue entering vocabulary to complete the input vocabulary.
For example, assume that a user needs to enter a piece of code in the development platform: "import as read from read", wherein "import", "" read "," "from", "", and "read" are all independent words in the above code. "" represents a space in the code.
Assume that the real-time code currently entered by the user in the development platform includes "import as read from".
Thus, in an embodiment of the present application, after the historical code is segmented to obtain the segmentation result of the historical code, an ngram word index table may be established.
Therefore, when the prompt word is recommended for the user according to the end-of-line word of the line where the cursor position is located, the word segmentation result of the line where the cursor position is located can be obtained, words with the prompt weights matched with the word segmentation result of the line where the cursor position is located and the end-of-line word are searched in a pre-established ngram word index table to serve as prompt words, and then the searched prompt words are recommended for the user.
Wherein, the process of establishing the ngram word index table comprises the following steps:
71) and obtaining the history code.
Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
72) And segmenting the historical code to obtain the segmentation result of the historical code.
In this application, the electronic device may look up a special symbol in the history code, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be filtered in the history code, and then the filtered words and special symbols may be used as a plurality of words included in the history code.
73) And establishing an ngram word list according to the segmentation result of the historical codes.
For example, based on N-grams, every adjacent N words in the history code are formed into an ngram word. Wherein N is an integer greater than 1. The resulting plurality of ngram words are then grouped into a word list of ngram words.
N may be an integer greater than 1, e.g., N takes 4, then every adjacent 4 words in the history code are formed into an ngram word.
For example, the history code includes: "import as read from return".
Wherein "import", "", "" read ", and" act "are all independent words. "" represents a space in the code.
"import", "", "and" ", can be grouped into an ngram word; "as", "as" and "as" are combined into ngram words, "", "" as "and" "are combined into ngram words," "as", "as" and "React" are combined into ngram words, "" as "," reach "and" "are combined into ngram words," "read", "and" "are combined into ngram words," "read", "from" and "" are combined into ngram words, and "" from "," and "are combined into ngram words, and so on.
Further, N may be two or more numbers, for example, if N is 4 or 5, then every adjacent 4 words in the history code are formed into an ngram word, and every adjacent 5 words in the history code are formed into an ngram word, and the like.
74) And establishing an ngram word index table according to the ngram word table.
In one embodiment of the present application, for any one of the ngram words in the ngram word list, words that follow the ngram word and are adjacent to the ngram word can be looked up in the history code.
Then, the frequency (occurrence frequency) of the ngram word adjacent to each found word in sequence is counted in the historical code, that is, for any found word, the frequency of the situation that the ngram word is located before the word and the ngram word is adjacent to the word in the second code is counted, and then the prompt weight of the word in the historical code corresponding to the ngram word can be obtained according to the frequency. For example, the sum of the word frequencies of each ngram word in the ngram word list, which are adjacent to each word in the history codes, can be counted, and then the ratio between the word frequency of the ngram word in the history codes, which is adjacent to the word, and the sum of the word frequencies of each ngram word in the ngram word list, which are adjacent to each word in the history codes, can be calculated, so as to obtain the prompt weight of the word in the history codes, which corresponds to the ngram word.
And then the ngram word, the word and the prompt weight form a corresponding table entry and are stored in a third corresponding relation among the ngram word, the word and the prompt weight. The above operation is also performed for each of the other words found.
The above is performed for each of the other ngram words in the ngram word list as well.
The third corresponding relation is the index table of ngram words. Wherein the ngram words in the word index table include ngram words in the history code.
In addition, the third corresponding relationship may also be updated according to a new word input by the user in real time in the process of inputting the code by the user in real time.
For example, in the process of inputting a code in real time by the user, each time the user inputs a new word in real time, the electronic device updates the prompt weight of the new word input in real time by the user in the third corresponding relationship.
In addition, the process of recommending the cue words for the user comprises the following steps:
81) and obtaining the word segmentation result of the line where the cursor position is located.
Acquiring N-gram words comprising N adjacent words in the code of the line where the cursor position is located based on the N-gram; the last word in each N-gram word is the last word in the code for the line on which the cursor position is located, and N is an integer greater than 1.
In the application, the word of the code of the line where the cursor position is located can be segmented to obtain a plurality of words included in the code of the line where the cursor position is located.
In this application, the electronic device may look up a special symbol in the code of the row where the cursor is located, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be selected from the code of the row where the cursor position is located, and then the selected words and special symbols may be used as a plurality of words included in the code of the row where the cursor position is located.
And then acquiring the last text in the code of the line where the cursor position is located, sequentially selecting at least one word from the last word forward in sequence from the back to the front based on the N-gram, and then forming N-gram words by the selected word and the last word in the code of the line where the cursor position is located according to the sequence of the selected word and the last word in the code of the line where the cursor position is located.
For example, assume that a user needs to enter a piece of code in the development platform: "import as read from read", wherein "import", "" read "," "from", "", and "read" are all independent words in the above code. "" represents a space in the code.
Assume that the real-time code currently entered by the user in the development platform includes "import as read from".
It is assumed that N, etc. 4 is taken as an example, that is, the N-gram word includes, in addition to the last text "from" in the code of the line where the cursor position is located, the 3 words "" closest to the last word "" in the code of the line where the cursor position is located "," read "and" "for example, the N-gram word is" read from ".
82) And searching words with the prompt weight matched with the word segmentation result of the line where the cursor is located and the word at the end of the line in a pre-established ngram word index table.
In one embodiment, the word found in the history code that is after and adjacent to the ngram word is one.
For example, assuming that the history code includes "import as read from," the word "read" located after and adjacent to the ngram word "read from" can be looked up in the history code "import as read from.
Therefore, the searched word "act" can be used as a prompt word, and then the prompt word "act" can be recommended to the user for the user to select.
However, in another embodiment, sometimes words located after and adjacent to the ngram word found in the history code are multiple.
For example, assume that the history code includes: "import as read from read" and "import as read from read".
Then, the ngram word "read from" can be found in both the history codes "import as read from" and the found words located behind and adjacent to the ngram word "read from" include two kinds, respectively: "REACT" and "REACT".
Thus, "REACT" and "REACT" may be used as the cue words.
In this case, the cue words include "act" and "REACT", and then the cue words "act" and "REACT" may be recommended to the user for the user to select.
In this case, however, the different words found are likely to be used by the user at this time.
The found different words are located behind the ngram words in the historical codes and are adjacent to the ngram words in different frequencies, and therefore the prompt weights of the found different words in the historical codes corresponding to the ngram words are different.
Among the searched various words, the more frequent word located after and adjacent to the ngram word in the history code is the more likely that the word the user needs to input when inputting the code, that is, the more likely to be selected and used by the user this time.
Or, the higher the prompt weight of the searched word in the history code corresponding to the ngram word, the higher the possibility that the searched word is the word that the user needs to input when inputting the code.
Among the searched various words, the less frequently the word located after and adjacent to the ngram word in the history code is the word that the user needs to input when inputting the code is less likely, that is, the less likely to be selected and used by the user this time.
Or, the lower the prompt weight of the searched word in the history code corresponding to the ngram word, the less likely the searched word is the word that the user needs to input when inputting the code.
Therefore, in order to facilitate the user to view and select the words to be input, in another embodiment of the present application, the searching, in 82), the words whose prompt weights match the word segmentation result of the line where the cursor is located and the end word in the pre-established ngram word index table includes:
91) and acquiring prompt weights of the searched multiple words in the historical codes, wherein the prompt weights respectively correspond to the ngram words in the historical codes.
In this application, for any word located after the ngram word and adjacent to the ngram word found in the history code, the prompt weight corresponding to the ngram word and the word can be found in the third corresponding relationship among the ngram word, the word and the prompt weight, and used as the prompt weight of the word corresponding to the ngram word in the history code.
The same is done for every other word after and adjacent to the ngram word that is found in the history code. The prompt weights of the searched words in the historical codes respectively corresponding to the ngram words are obtained.
92) And sequencing the searched words at least according to the frequency.
In one embodiment of the present application, the plurality of words found may be sorted in order of high-to-low prompt weight corresponding to the ngram word in the history code.
In another embodiment of the present application, in addition to the prompt weight corresponding to the ngram word in the history code, the found words may be sorted according to the last appearance position of the found words in the history code, respectively.
Wherein, the last appearance position of each searched word in the history code is different.
The found word having the last appearance position in the history code closer to the end-of-line word is more likely to be the code to be input by the user later, that is, the more likely to be selected and used by the user this time.
The more distant the last appearance position in the history code from the end word is, the less likely the searched word is the code that needs to be input by the user later, that is, the less likely the word is selected and used by the user this time.
Of course, the searched words may also be sorted according to the combination of the found prompt weights of the words and other characteristics of the words, and the specific sorting manner is not limited in the present application.
93) And displaying at least part of searched words according to the sorted sequence.
In the present application, sometimes more words are found, however, in general, the words that the user needs to input are often located in the first words after the ranking.
If all searched words are displayed in the development platform, many areas in the development platform are occupied by words which are not needed by the user, so that the normal code input of the user in the development platform is sometimes influenced, and the display resources are wasted.
Therefore, in order to avoid affecting the normal code input of the user and to avoid wasting display resources, in another embodiment of the present application, when the number of the searched multiple words is greater than the preset number, topE words may be selected from the multiple words according to a sorted order, and then the selected topE words are displayed in the development platform according to the sorted order, where E is an integer greater than or equal to 1, and E may also be the preset number, and the preset number includes 3, 4, or 5, and the application does not limit this.
Further, if the user selects one of the found words in the development platform, the electronic device may add a prompt weight corresponding to the ngram word and the selected word in a third correspondence between the ngram word, the word and the prompt weight, so as to update the prompt weight of the word corresponding to the ngram word in the history code.
Historical codes may also be used when recommending hints for the user. Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
When a user inputs a code in a development platform, the input code is often composed of a plurality of independent words, for example, including english words, numbers, english letters, special symbols, and the like, and the special symbols include symbols supported by the development platform, such as spaces, equal to or greater than a number, smaller than a number, double quotation marks, single quotation marks, brackets, and the like.
In one scenario, a user has entered real-time code in the development platform, and needs to continue entering vocabulary to complete the input vocabulary.
For example, assume that a user needs to enter a piece of code in the development platform: "import as read from read", wherein "import", "" read "," "from", "", and "read" are all independent words in the above code. "" represents a space in the code.
Assume that the real-time code currently entered by the user in the development platform includes "import as read from".
Thus, in an embodiment of the present application, after the historical code is segmented to obtain the segmentation result of the historical code, the entire ngram row index table may be established.
Therefore, when the prompt word is recommended for the user according to the end-of-line word of the line where the cursor position is located, the word segmentation result of the line where the cursor position is located can be obtained, words with the prompt weights matched with the word segmentation result of the line where the cursor position is located and the end-of-line word are searched in a pre-established ngram whole-line index table to serve as prompt words, and then the searched prompt words are recommended for the user.
The process of establishing the ngram whole-row index table comprises the following steps:
111) and obtaining the history code.
Before the user inputs the real-time code for developing a part of content in the software project in the development platform, the user may have developed other content in the software project, and/or other users may have developed other content in the software project. Code used to develop other content in the software project may be viewed as historical code. The history code has been stored in the electronic device.
That is, the historical code may include code that the user or other users have entered in the development platform several times before the user entered real-time code in the development platform for the development software project this time.
112) And segmenting the historical code to obtain the segmentation result of the historical code.
In this application, the electronic device may look up a special symbol in the history code, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be filtered in the history code, and then the filtered words and special symbols may be used as a plurality of words included in the history code.
113) And establishing an ngram word list according to the segmentation result of the historical codes.
For example, based on N-grams, every adjacent N words in the history code are formed into an ngram word. Wherein N is an integer greater than 1. The resulting plurality of ngram words are then grouped into a word list of ngram words.
N may be an integer greater than 1, e.g., N takes 4, then every adjacent 4 words in the history code are formed into an ngram word.
For example, the history code includes: "import as read from return".
Wherein "import", "", "" read ", and" act "are all independent words. "" represents a space in the code.
"import", "", "and" ", can be grouped into an ngram word; "as", "as" and "as" are combined into ngram words, "", "" as "and" "are combined into ngram words," "as", "as" and "React" are combined into ngram words, "" as "," reach "and" "are combined into ngram words," "read", "and" "are combined into ngram words," "read", "from" and "" are combined into ngram words, and "" from "," and "are combined into ngram words, and so on.
Further, N may be two or more numbers, for example, if N is 4 or 5, then every adjacent 4 words in the history code are formed into an ngram word, and every adjacent 5 words in the history code are formed into an ngram word, and the like.
114) And establishing an ngram whole-line index table according to the ngram word list.
In an embodiment of the present application, for any ngram word in the ngram word list, words located in the row where the ngram word is located and located in the whole row after the ngram word may be searched in the history code, that is, all words located after the ngram word in the row where the ngram word is located in the history code.
Then, the frequency (occurrence frequency) of the ngram word adjacent to the whole line of words in sequence is counted in the history code, that is, the frequency of the ngram word before the whole line of words and the frequency of the ngram word in the history code when the ngram word and the whole line of words belong to the same line are counted, then the prompt weight of the whole line of words corresponding to the ngram word can be obtained according to the frequency, for example, the sum of the word frequencies of each ngram word in the ngram word list and the whole line of words after the ngram word in the history code can be counted, then the ratio of the word frequencies of the ngram word in the history code adjacent to the whole line of words before and after the ngram word list to the sum of the word frequencies of each ngram word in the history code adjacent to the whole line of words before and after the whole line of words is calculated, and the prompt weight of the whole line of words in the history code corresponding to the ngram word is obtained.
And then forming a corresponding table entry by the ngram word, the word of the whole line and the prompt weight, and storing the table entry in a fourth corresponding relation among the ngram word, the word of the whole line and the prompt weight.
The above is performed for each of the other ngram words in the ngram word list as well.
The fourth corresponding relation is the index table of the entire row of ngram. Wherein the ngram words in the entire row index table include ngram words in the history code.
In addition, the fourth corresponding relationship may also be updated according to a new word input by the user in real time in the process of inputting the code by the user in real time.
For example, in the process of inputting a code by the user in real time, each time the user inputs a new word in real time, the electronic device updates the prompt weight of the new word input by the user in real time in the fourth corresponding relationship.
In addition, the process of recommending the cue words for the user comprises the following steps:
121) and obtaining the word segmentation result of the line where the cursor position is located.
Acquiring N-gram words comprising N adjacent words in the code of the line where the cursor position is located based on the N-gram; the last word in each N-gram word is the last word in the code for the line on which the cursor position is located, and N is an integer greater than 1.
In the application, the word of the code of the line where the cursor position is located can be segmented to obtain a plurality of words included in the code of the line where the cursor position is located.
In this application, the electronic device may look up a special symbol in the code of the row where the cursor is located, where the special symbol includes: blank, equal to number, greater than number, less than number, double quotation mark, single quotation mark, brackets and the like. Then, words between two adjacent special symbols may be selected from the code of the row where the cursor position is located, and then the selected words and special symbols may be used as a plurality of words included in the code of the row where the cursor position is located.
And then acquiring the last text in the code of the line where the cursor position is located, sequentially selecting at least one word from the last word forward in sequence from the back to the front based on the N-gram, and then forming N-gram words by the selected word and the last word in the code of the line where the cursor position is located according to the sequence of the selected word and the last word in the code of the line where the cursor position is located.
For example, assume that a user needs to enter a piece of code in the development platform: "import as read from read", wherein "import", "" read "," "from", "", and "read" are all independent words in the above code. "" represents a space in the code.
Assume that the real-time code currently entered by the user in the development platform includes "import as read from".
It is assumed that N, etc. 4 is taken as an example, that is, the N-gram word includes, in addition to the last text "from" in the code of the line where the cursor position is located, the 3 words "" closest to the last word "" in the code of the line where the cursor position is located "," read "and" "for example, the N-gram word is" read from ".
122) And searching words with the prompt weight matched with the word segmentation result of the line where the cursor position is located and the word at the end of the line in a pre-established ngram whole-line index table.
In one embodiment, the entire line of words located after the ngram word found in the history code is one.
For example, assuming that the history code includes "import as read from," the entire line of words "React" located after the ngram word "read from" can be looked up in the history code "import as read from".
Therefore, the found word "act" of the whole line can be used as a prompt word, and then the prompt word "act" can be recommended to the user for the user to select.
However, in another embodiment, sometimes the entire line of words after the ngram word found in the history code is multiple.
For example, assume that the history code includes: "import as read from read" and "import as read from read".
Then the ngram word "read from" can be found in both the history codes "import as read from read" and "import as read from read", and the found words in the whole row behind the ngram word "read from" include two, which are: "REACT" and "REACT".
Thus, "REACT" and "REACT" may be used as the cue words.
In this case, the cue words include "act" and "REACT", and then the cue words "act" and "REACT" may be recommended to the user for the user to select.
However, in this case, the possibility that different whole lines of words found are used by the user at this time is different.
The found words of different whole lines are behind the ngram words in the historical codes and have different frequency with the same line of the ngram words, and therefore the found words of different whole lines have different prompting weights corresponding to the ngram words in the historical codes.
Among the searched various words, the higher the frequency of the whole line of words located after the ngram word and on the same line as the ngram word in the history code is, the higher the possibility that the word is a word that the user needs to input when inputting the code is, that is, the higher the possibility that the word is selected and used by the user this time is.
Or, the higher the prompt weight of the searched word of the whole line in the history code corresponding to the ngram word, the higher the possibility that the searched word of the whole line is the word that the user needs to input when inputting the code.
Among the searched various words, the less frequently the words in the entire line located after the ngram word and on the same line as the ngram word in the history code are the words that the user needs to input when inputting the code is less likely, that is, the less likely to be selected and used by the user this time.
Or, the lower the prompt weight of the searched word of the whole line in the history code corresponding to the ngram word, the less likely the searched word of the whole line is the word that the user needs to input when inputting the code.
Therefore, in order to facilitate the user to view and select the words in the whole row that need to be input, in another embodiment of the present application, the searching, in the pre-established ngram whole row index table, for the words whose prompt weights match the word segmentation result and the end word of the row where the cursor is located in 122) includes:
131) and acquiring prompt weights of the searched various words in the whole line in the historical codes, wherein the prompt weights respectively correspond to the ngram words in the historical codes.
In this application, for any whole line word located after the ngram word and on the same line as the ngram word found in the history code, the prompt weight corresponding to the ngram word and the whole line word can be found in the third corresponding relationship among the ngram word, the whole line word and the prompt weight, and the prompt weight is used as the prompt weight of the whole line word corresponding to the ngram word in the history code.
The same is done for every other whole line word that follows the ngram word and is the same line as the ngram word that is found in the history code. The prompt weights of the searched various whole lines of words respectively corresponding to the ngram words in the historical codes are obtained.
132) And sequencing the searched words at least according to the frequency.
In one embodiment of the present application, the found whole lines of words may be sorted in order of high-to-low prompt weight corresponding to the ngram word in the history code.
In another embodiment of the present application, in addition to the prompt weight corresponding to the ngram word in the history code, the found words in the whole lines may be sorted according to the last appearance position of the found words in the history code.
And the last appearance position of each searched word in the whole line in the historical code is different.
The closer the last appearance position in the history code is to the end-of-line word, the higher the possibility that the searched word in the whole line is the code that needs to be input by the user later, that is, the higher the possibility that the word is selected and used by the user this time.
The more distant the last appearance position in the history code from the end word of the line, the less likely that the word of the entire line searched for is the code that needs to be input by the user later, that is, the less likely to be selected and used by the user this time.
Of course, the searched words may also be sorted according to the combination of the found prompt weights of the words in the whole row and other characteristics of the searched words, and the specific sorting manner is not limited in the present application.
133) And displaying at least part of the searched words in the whole line according to the sorted sequence.
In the present application, sometimes, a large number of words are found in a whole line, however, in general, the word that the user needs to input is often located in the first few words in the whole line after the sorting.
If all searched words in the whole line are displayed in the development platform, many areas in the development platform are occupied by words which are not needed by the user, the normal code input of the user in the development platform is sometimes influenced, and the display resources are wasted.
Therefore, in order to avoid affecting the normal code input of the user and to avoid wasting display resources, in another embodiment of the present application, when the number of found words in the whole rows is greater than a preset number, words in the whole rows may be selected according to a sorted order, and then the selected words in the whole rows of topE are displayed in the development platform according to the sorted order, where E is an integer greater than or equal to 1, and E may also be a preset number, and the preset number includes 3, 4, or 5, and the present application does not limit this.
Further, if the user selects one of the found whole lines of words in the development platform, the electronic device may increase the prompt weight corresponding to the ngram word and the selected whole line of words in a fourth correspondence between the ngram word, the whole line of words, and the prompt weight to update the prompt weight of the whole line of words corresponding to the ngram word in the history code.
In another embodiment of the application, if a plurality of cue words exist, the plurality of cue words are screened and sorted; recommending prompt words for the user, including: and recommending the sequenced at least two recommendation cue words for the user.
In another embodiment of the present application, when recommending a cue word to a user, the present application may summarize the found vocabulary in the foregoing embodiment. At least the words after the summary can be sorted according to the order of the determined prompt weights in the respective embodiments from high to low, then the top X sorted prompt words are selected and recommended to the user, X is an integer greater than or equal to 1, for example, X is 4, 5, or 6, and the specific numerical value of X is not limited in the present application.
Referring to fig. 2, a block diagram of a code recommendation apparatus according to an embodiment of the present application is shown, which may specifically include the following modules:
the receiving module 001 is used for receiving a code input by a user and segmenting the code according to a preset rule;
an obtaining module 002, configured to obtain, in the segmentation result, a line end word of a line where the cursor position of the user is located;
and the recommending module 003 is used for recommending prompt words for the user according to the line end words of the line where the cursor position is located.
In an optional implementation, the apparatus further comprises:
the establishing module is used for establishing a real-time word bank for the segmentation result;
the recommendation module comprises:
the first searching unit is used for searching words with prompt weights matched with the end-of-line words in the real-time word bank as prompt words;
and the first recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the second searching unit is used for searching words with the prompting weight matched with the line end words in a pre-established word index table to serve as prompting words;
and the second recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the first obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a third searching unit, configured to search, in a pre-established ngram word index table, words whose prompt weights are matched with the word segmentation result of the line where the cursor is located and the word at the end of the line, as prompt words;
and the third recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation, the recommendation module includes:
the second obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a fourth searching unit, configured to search, in a pre-established ngram whole-row index table, a word whose prompt weight matches the word segmentation result of the row where the cursor is located and the word at the end of the row, and use the word as a prompt word;
and the fourth recommending unit is used for recommending the searched prompt words for the user.
In an optional implementation manner, the recommendation module includes:
the sorting unit is used for screening and sorting the plurality of cue words if the plurality of cue words exist;
and the fifth recommending unit is used for recommending the sorted at least two prompt words for the user.
In an optional implementation manner, the recommendation module further includes:
a third obtaining unit configured to obtain a history code;
the first segmentation unit is used for segmenting the historical code to obtain a segmentation result of the historical code;
the first establishing unit is used for establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes;
and the second establishing unit is used for establishing the word index table according to the code word dictionary.
In an optional implementation manner, the second establishing unit includes:
the calculation subunit is used for calculating the prompt weight of the word according to the word frequency of the word in the code word dictionary;
and the establishing subunit is used for establishing the word index table according to the prompt weight of the word.
In an optional implementation manner, the recommendation module further includes:
a fourth obtaining unit configured to obtain a history code;
the second segmentation unit is used for segmenting the historical code to obtain the segmentation result of the historical code;
the third establishing unit is used for establishing an ngram word list according to the segmentation result of the historical codes;
and the fourth establishing unit is used for establishing the ngram word index table and/or the ngram whole-line index table according to the ngram word list.
In the application, a code input by a user is received, and the code is segmented according to a preset rule; acquiring the line end word of the line where the cursor position of the user is located in the segmentation result; and recommending prompt words for the user according to the line end words of the line where the cursor position is located.
Wherein the code input by the user may include real-time code currently input by the user in the development platform for developing the software project,
the hint words predicted from the user-entered code may be real-time code and/or words that have appeared in historical code, including historical code that the user or other users had entered for developing the software project prior to the user-entered real-time code. The method comprises the steps that a user already appears in a real-time code and/or a historical code for developing a software project under the condition that a last word in a real-time code currently input by the user is adjacent to a prompt word in front and back, and/or the condition that last M adjacent words in the real-time code currently input are adjacent to the prompt word in front and back is already present in the real-time code and/or the historical code, wherein M is an integer greater than or equal to 2.
Based on the habit of inputting codes, under the condition that the function of a software project can be met, a user can select a cue word as a code which needs to be actually input after a currently input real-time code, and can not manually input a word which is different from the cue word in characters but has the same function as the cue word, so that the sentence style, the naming style, the input normalization and the like of the code input after the currently input real-time code by the user can be the same as the sentence style, the naming style, the input normalization and the like of the real-time code and/or the historical code.
Therefore, the unification of the statement style, the naming style, the input normalization and the like of the codes developed for the same software project by different users or the same user can be realized, the later maintenance is convenient, and the labor cost of the later maintenance is reduced.
In addition, the method and the device can automatically recommend the cue words to the user according to the codes input for developing the software project, so that the user does not need to spend time to be familiar with the sentence style, the naming style, the input normalization and the like of the codes input for developing the software project before, and the user can complete the development of the software project only by continuously inputting the codes after the currently input real-time codes in the development platform according to the recommended cue words.
The sentence style, the naming style, the input normalization and the like of codes which are input for developing software projects before the users are familiar with the time are omitted, so that the workload of the users can be reduced, and the development efficiency of the users can be improved.
The present application further provides a non-transitory, readable storage medium, where one or more modules (programs) are stored, and when the one or more modules are applied to a device, the device may execute instructions (instructions) of method steps in this application.
Embodiments of the present application provide one or more machine-readable media having instructions stored thereon, which when executed by one or more processors, cause an electronic device to perform the methods as described in one or more of the above embodiments. In the embodiment of the application, the electronic device comprises a server, a gateway, a sub-device and the like, wherein the sub-device is a device such as an internet of things device.
Embodiments of the present disclosure may be implemented as an apparatus, which may include electronic devices such as servers (clusters), terminal devices such as IoT devices, and the like, using any suitable hardware, firmware, software, or any combination thereof, for a desired configuration.
Fig. 3 schematically illustrates an example apparatus 1300 that can be used to implement various embodiments described herein.
For one embodiment, fig. 3 illustrates an example apparatus 1300 having one or more processors 1302, a control module (chipset) 1304 coupled to at least one of the processor(s) 1302, memory 1306 coupled to the control module 1304, non-volatile memory (NVM)/storage 1308 coupled to the control module 1304, one or more input/output devices 1310 coupled to the control module 1304, and a network interface 1312 coupled to the control module 1306.
Processor 1302 may include one or more single-core or multi-core processors, and processor 1302 may include any combination of general-purpose or special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). In some embodiments, the apparatus 1300 can be a server device such as a gateway described in the embodiments of the present application.
In some embodiments, apparatus 1300 may include one or more computer-readable media (e.g., memory 1306 or NVM/storage 1308) having instructions 1314 and one or more processors 1302, which in combination with the one or more computer-readable media, are configured to execute instructions 1314 to implement modules to perform actions described in this disclosure.
For one embodiment, control module 1304 may include any suitable interface controllers to provide any suitable interface to at least one of the processor(s) 1302 and/or any suitable device or component in communication with control module 1304.
The control module 1304 may include a memory controller module to provide an interface to the memory 1306. The memory controller module may be a hardware module, a software module, and/or a firmware module.
Memory 1306 may be used, for example, to load and store data and/or instructions 1314 for device 1300. For one embodiment, memory 1306 may comprise any suitable volatile memory, such as suitable DRAM. In some embodiments, the memory 1306 may comprise a double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
For one embodiment, control module 1304 may include one or more input/output controllers to provide an interface to NVM/storage 1308 and input/output device(s) 1310.
For example, NVM/storage 1308 may be used to store data and/or instructions 1314. NVM/storage 1308 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., one or more Hard Disk Drives (HDDs), one or more Compact Disc (CD) drives, and/or one or more Digital Versatile Disc (DVD) drives).
NVM/storage 1308 may include storage resources that are physically part of the device on which apparatus 1300 is installed, or it may be accessible by the device and need not be part of the device. For example, NVM/storage 1308 may be accessible over a network via input/output device(s) 1310.
Input/output device(s) 1310 may provide an interface for apparatus 1300 to communicate with any other suitable device, input/output device(s) 1310 may include a communications component, a pinyin component, a sensor component, and so forth. The network interface 1312 may provide an interface for the device 1300 to communicate over one or more networks, and the device 1300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols, such as access to a communication standard-based wireless network, e.g., WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof.
For one embodiment, at least one of the processor(s) 1302 may be packaged together with logic for one or more controllers (e.g., memory controller modules) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be packaged together with logic for one or more controllers of the control module 1304 to form a System In Package (SiP). For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with logic for one or more controller(s) of the control module 1304. For one embodiment, at least one of the processor(s) 1302 may be integrated on the same die with logic of one or more controllers of the control module 1304 to form a system on chip (SoC).
In various embodiments, apparatus 1300 may be, but is not limited to being: a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.), among other terminal devices. In various embodiments, apparatus 1300 may have more or fewer components and/or different architectures. For example, in some embodiments, device 1300 includes one or more cameras, a keyboard, a Liquid Crystal Display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an Application Specific Integrated Circuit (ASIC), and speakers.
An embodiment of the present application provides an electronic device, including: one or more processors; and one or more machine readable media having instructions stored thereon, which when executed by the one or more processors, cause the electronic device to perform a code recommendation method as described in one or more of the present applications.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be 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 terminal 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 terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The code recommendation method and device provided by the present application are introduced in detail, and a specific example is applied in the text to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (20)

1. A code recommendation method, comprising:
receiving a code input by a user, and segmenting the code according to a preset rule;
obtaining the line end word of the line where the cursor position of the user is located in the segmentation result;
and recommending prompt words for the user according to the line end words of the line where the cursor position is located.
2. The method of claim 1, further comprising:
establishing a real-time word bank for the segmentation result;
recommending a prompt word for the user according to the end word of the line of the cursor position, wherein the recommending comprises:
searching words with prompt weights matched with the last words in the real-time word bank as prompt words;
and recommending the searched prompt words for the user.
3. The method according to claim 1, wherein recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located comprises:
searching words with prompt weights matched with the last-line words in a pre-established word index table to serve as prompt words;
and recommending the searched prompt words for the user.
4. The method according to claim 1, wherein recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located comprises:
obtaining word segmentation results of the line where the cursor position is located;
searching words with prompt weights matched with word segmentation results of a line where the cursor is located and the last words in a pre-established ngram word index table to serve as prompt words;
and recommending the searched prompt words for the user.
5. The method according to claim 1, wherein recommending a cue word for a user according to the end-of-line word of the line where the cursor position is located comprises:
obtaining word segmentation results of the line where the cursor position is located;
searching words with prompt weights matched with word segmentation results of the line where the cursor is located and the last words in the line in a pre-established ngram whole-line index table to serve as prompt words;
and recommending the searched prompt words for the user.
6. The method according to any one of claims 1-5, further comprising:
if a plurality of prompt words exist, screening and sequencing the prompt words;
then, the recommending prompt words for the user includes:
and recommending the at least two ordered prompt words for the user.
7. The method of claim 3, further comprising:
obtaining a history code;
segmenting the historical code to obtain a segmentation result of the historical code;
establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes;
and establishing the word index table according to the code word dictionary.
8. The method of claim 7, wherein said building the word index table from the code with a word dictionary comprises:
calculating the prompt weight of the word according to the word frequency of the word in the dictionary of the code word;
and establishing the word index table according to the prompt weight of the word.
9. The method according to claim 4 or 5, characterized in that the method further comprises:
obtaining a history code;
segmenting the historical code to obtain a segmentation result of the historical code;
establishing an ngram word list according to the segmentation result of the historical code;
and establishing the ngram word index table and/or the ngram whole line index table according to the ngram word list.
10. A code recommendation apparatus, comprising:
the receiving module is used for receiving a code input by a user and segmenting the code according to a preset rule;
the obtaining module is used for obtaining the line end word of the line where the cursor position of the user is located in the segmentation result;
and the recommending module is used for recommending prompt words for the user according to the line end words of the line where the cursor position is located.
11. The apparatus of claim 10, further comprising:
the establishing module is used for establishing a real-time word bank for the segmentation result;
the recommendation module comprises:
the first searching unit is used for searching words with prompt weights matched with the end-of-line words in the real-time word bank as prompt words;
and the first recommending unit is used for recommending the searched prompt words for the user.
12. The apparatus of claim 10, wherein the recommendation module comprises:
the second searching unit is used for searching words with the prompting weight matched with the line end words in a pre-established word index table to serve as prompting words;
and the second recommending unit is used for recommending the searched prompt words for the user.
13. The apparatus of claim 10, wherein the recommendation module comprises:
the first obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a third searching unit, configured to search, in a pre-established ngram word index table, words whose prompt weights are matched with the word segmentation result of the line where the cursor is located and the word at the end of the line, as prompt words;
and the third recommending unit is used for recommending the searched prompt words for the user.
14. The apparatus of claim 10, wherein the recommendation module comprises:
the second obtaining unit is used for obtaining word segmentation results of the line where the cursor position is located;
a fourth searching unit, configured to search, in a pre-established ngram whole-row index table, a word whose prompt weight matches the word segmentation result of the row where the cursor is located and the word at the end of the row, and use the word as a prompt word;
and the fourth recommending unit is used for recommending the searched prompt words for the user.
15. The apparatus of any of claims 9-14, wherein the recommendation module comprises:
the sorting unit is used for screening and sorting the plurality of cue words if the plurality of cue words exist;
and the fifth recommending unit is used for recommending the sorted at least two prompt words for the user.
16. The apparatus of claim 12, wherein the recommendation module further comprises:
a third obtaining unit configured to obtain a history code;
the first segmentation unit is used for segmenting the historical code to obtain a segmentation result of the historical code;
the first establishing unit is used for establishing a dictionary for the words used by the codes according to the segmentation result of the historical codes;
and the second establishing unit is used for establishing the word index table according to the code word dictionary.
17. The apparatus of claim 16, wherein the second establishing unit comprises:
the calculation subunit is used for calculating the prompt weight of the word according to the word frequency of the word in the code word dictionary;
and the establishing subunit is used for establishing the word index table according to the prompt weight of the word.
18. The apparatus of claim 13 or 14, wherein the recommendation module further comprises:
a fourth obtaining unit configured to obtain a history code;
the second segmentation unit is used for segmenting the historical code to obtain the segmentation result of the historical code;
the third establishing unit is used for establishing an ngram word list according to the segmentation result of the historical codes;
and the fourth establishing unit is used for establishing the ngram word index table and/or the ngram whole-line index table according to the ngram word list.
19. An electronic device, characterized in that the electronic device comprises:
a processor; and
memory having stored thereon executable code which, when executed, causes the processor to perform a code recommendation method as claimed in one or more of claims 1-9.
20. One or more machine-readable media having executable code stored thereon that, when executed, causes a processor to perform a code recommendation method as recited in one or more of claims 1-9.
CN202010642143.8A 2020-07-06 2020-07-06 Code recommendation method and device Pending CN113900635A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010642143.8A CN113900635A (en) 2020-07-06 2020-07-06 Code recommendation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010642143.8A CN113900635A (en) 2020-07-06 2020-07-06 Code recommendation method and device

Publications (1)

Publication Number Publication Date
CN113900635A true CN113900635A (en) 2022-01-07

Family

ID=79186702

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010642143.8A Pending CN113900635A (en) 2020-07-06 2020-07-06 Code recommendation method and device

Country Status (1)

Country Link
CN (1) CN113900635A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150378692A1 (en) * 2014-06-30 2015-12-31 Microsoft Corporation Code recommendation
CN105981005A (en) * 2013-12-13 2016-09-28 纽昂斯通信有限公司 Using statistical language models to improve text input
CN110673836A (en) * 2019-08-22 2020-01-10 阿里巴巴集团控股有限公司 Code completion method and device, computing equipment and storage medium
US20200097261A1 (en) * 2018-09-22 2020-03-26 Manhattan Engineering Incorporated Code completion
CN111198620A (en) * 2018-11-20 2020-05-26 北京搜狗科技发展有限公司 Method, device and equipment for presenting input candidate items

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105981005A (en) * 2013-12-13 2016-09-28 纽昂斯通信有限公司 Using statistical language models to improve text input
US20150378692A1 (en) * 2014-06-30 2015-12-31 Microsoft Corporation Code recommendation
CN106462399A (en) * 2014-06-30 2017-02-22 微软技术许可有限责任公司 Code recommendation
US20200097261A1 (en) * 2018-09-22 2020-03-26 Manhattan Engineering Incorporated Code completion
CN111198620A (en) * 2018-11-20 2020-05-26 北京搜狗科技发展有限公司 Method, device and equipment for presenting input candidate items
CN110673836A (en) * 2019-08-22 2020-01-10 阿里巴巴集团控股有限公司 Code completion method and device, computing equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TAM NGUYEN 等: "Personalized Code Recommendation", 《2019 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE AND EVOLUTION (ICSME)》, 5 December 2019 (2019-12-05), pages 313 - 317 *
杨博 等: "智能代码补全研究综述", 《软件学报》, 31 May 2020 (2020-05-31), pages 1206 - 1223 *

Similar Documents

Publication Publication Date Title
US7953692B2 (en) Predicting candidates using information sources
CN111310440B (en) Text error correction method, device and system
JP5379138B2 (en) Creating an area dictionary
CN108932320B (en) Article searching method and device and electronic equipment
US10402474B2 (en) Keyboard input corresponding to multiple languages
CN110162778B (en) Text abstract generation method and device
CN113204621B (en) Document warehouse-in and document retrieval method, device, equipment and storage medium
CN104881397B (en) Abbreviation extended method and device
JP2015517711A (en) Completing the application interface using search query keywords
WO2013127060A1 (en) Techniques for transliterating input text from a first character set to a second character set
CN112417848A (en) Corpus generation method and device and computer equipment
CN105824436A (en) Character input method and input method system
CN111435406A (en) Method and device for correcting database statement spelling errors
CN111339166A (en) Word stock-based matching recommendation method, electronic device and storage medium
CN111708911B (en) Searching method, searching device, electronic equipment and computer-readable storage medium
CN111368506A (en) Text processing method and device
CN105550217B (en) Scene music searching method and scene music searching device
CN104281275A (en) Method and device for inputting English
CN106953937B (en) Uniform Resource Locator (URL) conversion method and device
CN111597118A (en) Test case generation method and device, computer equipment and storage medium
CN107329964A (en) A kind of text handling method and device
CN111666417B (en) Method, device, electronic equipment and readable storage medium for generating synonyms
CN111797614B (en) Text processing method and device
CN112527967A (en) Text matching method, device, terminal and storage medium
US20180157744A1 (en) Comparison table automatic generation method, device and computer program product of the same

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