Doc4code—an AI-driven documentation recommender system to aid programmers
Herein for each source logic in a corpus, a computer stores an identifier of the source logic and operates a logic encoder that infers a distinct fixed-size encoded logic that represents the variable-size source logic. At build time, a multidimensional index is generated and populated based on the encoded logics that represent the source logics in the corpus. At runtime, a user may edit and select a new source logic such as in a text editor or an integrated development environment (IDE). The logic encoder infers a new encoded logic that represents the new source logic. The multidimensional index accepts the new encoded logic as a lookup key and automatically selects and returns a result subset of encoded logics that represent similar source logics in the corpus. For display, the multidimensional index may select and return only encoded logics that are the few nearest neighbors to the new encoded logic.
1 . A method comprising:
for each source logic in a plurality of source logics that include a particular source logic:
storing an identifier of the source logic, and
first inferring a distinct fixed-size encoded logic that represents the source logic;
generating a multidimensional index based on the distinct fixed-size encoded logics that represent the plurality of source logics;
second inferring a new fixed-size encoded logic that represents a new source logic that contains a syntax error;
selecting, based on the multidimensional index, a result subset of the distinct fixed-size encoded logics that represent the plurality of source logics that are nearest neighbors to the new fixed-size encoded logic, wherein the result subset of the distinct fixed-size encoded logics contains the distinct fixed-size encoded logic that represents the particular source logic;
first displaying, on a display of a computer, the identifiers for the result subset of the distinct fixed-size encoded logics that represent the plurality of source logics;
receiving, from an input device of the computer, an interactive selection, on the display of the computer, of the identifier of the particular source logic; and
second displaying, on the display of the computer in response to said receiving, the particular source logic;
wherein the method is performed by one or more computers that includes said computer.
2 . The method of claim 1 wherein:
the identifier of the particular source logic comprises a uniform resource locator (URL) of a webpage;
said second displaying comprises displaying the webpage;
said storing the identifier of the particular source logic comprises extracting the particular source logic from the webpage.
3 . The method of claim 2 wherein the webpage contains a question and an answer that contains the particular source logic.
4 . The method of claim 3 wherein said first displaying comprises displaying at least one selected from a group consisting of the question and a title of the webpage.
5 . The method of claim 2 wherein the webpage contains application program interface (API) reference documentation.
6 . The method of claim 1 wherein the particular source logic comprises a declaration of a subroutine without a definition of the subroutine.
7 . The method of claim 1 wherein said selecting the result subset of the distinct fixed-size encoded logics is performed in an integrated development environment (IDE).
8 . The method of claim 7 wherein said second displaying is performed inside or outside of the IDE.
9 . The method of claim 1 further comprising at least one of:
interactively selecting the particular source logic that is less than an entire subroutine,
automatically selecting a lexical scope that is less than a source file, or
selecting the particular source logic that is multiple files.
10 . The method of claim 1 wherein the plurality of source logics contains at least a million source logics.
11 . One or more non-transitory computer-readable media storing instructions that, when executed by one or more processors, cause:
for each source logic in a plurality of source logics that include a particular source logic:
storing an identifier of the source logic, and
first inferring a distinct fixed-size encoded logic that represents the source logic;
generating a multidimensional index based on the distinct fixed-size encoded logics that represent the plurality of source logics;
second inferring a new fixed-size encoded logic that represents a new source logic that contains a syntax error;
selecting, based on the multidimensional index, a result subset of the distinct fixed-size encoded logics that represent the plurality of source logics that are nearest neighbors to the new fixed-size encoded logic, wherein the result subset of the distinct fixed-size encoded logics contains the distinct fixed-size encoded logic that represents the particular source logic;
first displaying, on a display of a computer, the identifiers for the result subset of the distinct fixed-size encoded logics that represent the plurality of source logics;
receiving, from an input device of the computer, an interactive selection, on the display of the computer, of the identifier of the particular source logic; and
second displaying, on the display of the computer in response to said receiving, the particular source logic.
12 . The one or more non-transitory computer-readable media of claim 11 wherein:
the identifier of the particular source logic comprises a uniform resource locator (URL) of a webpage;
said second displaying comprises displaying the webpage;
said storing the identifier of the particular source logic comprises extracting the particular source logic from the webpage.
13 . The one or more non-transitory computer-readable media of claim 12 wherein the webpage contains a question and an answer that contains the particular source logic.
14 . The one or more non-transitory computer-readable media of claim 13 wherein said first displaying comprises displaying at least one selected from a group consisting of the question and a title of the webpage.
15 . The one or more non-transitory computer-readable media of claim 12 wherein the webpage contains application program interface (API) reference documentation.
16 . The one or more non-transitory computer-readable media of claim 11 wherein the particular source logic comprises a declaration of a subroutine without a definition of the subroutine.
17 . The one or more non-transitory computer-readable media of claim 11 wherein said selecting the result subset of the distinct fixed-size encoded logics is performed in an integrated development environment (IDE).
18 . The one or more non-transitory computer-readable media of claim 17 wherein said second displaying is performed inside or outside of the IDE.
19 . The one or more non-transitory computer-readable media of claim 11 wherein the instructions further cause at least one of:
interactively selecting the particular source logic that is less than an entire subroutine,
automatically selecting a lexical scope that is less than a source file, or
selecting the particular source logic that is multiple files.
20 . The one or more non-transitory computer-readable media of claim 11 wherein the plurality of source logics contains at least a million source logics.