CN113176878A - Automatic query method, device and equipment - Google Patents

Automatic query method, device and equipment Download PDF

Info

Publication number
CN113176878A
CN113176878A CN202110731091.6A CN202110731091A CN113176878A CN 113176878 A CN113176878 A CN 113176878A CN 202110731091 A CN202110731091 A CN 202110731091A CN 113176878 A CN113176878 A CN 113176878A
Authority
CN
China
Prior art keywords
article
information
target
window
articles
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.)
Granted
Application number
CN202110731091.6A
Other languages
Chinese (zh)
Other versions
CN113176878B (en
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.)
Shenzhen Dimension Data Technology Co Ltd
Original Assignee
Shenzhen Dimension Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Dimension Data Technology Co Ltd filed Critical Shenzhen Dimension Data Technology Co Ltd
Priority to CN202110731091.6A priority Critical patent/CN113176878B/en
Publication of CN113176878A publication Critical patent/CN113176878A/en
Application granted granted Critical
Publication of CN113176878B publication Critical patent/CN113176878B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors

Abstract

The application provides an automatic query method, device and equipment. The method comprises the following steps: and the editor program of the client acquires the information to be inquired. The information to be queried is a code segment in the source code of the first window. And the editor program of the client can acquire a plurality of related articles of the information to be inquired through the crawler instruction in the crawler instruction set. The plurality of related articles constitutes a collection of related articles. An editor program of the client may select a preset number of first target articles from the collection of related articles according to a preset rule. And integrating the first target article by an editor program of the client to obtain the target article. The target article may be displayed in a second window of the editor program. The method improves the efficiency of reading the source code by the user and improves the user experience.

Description

Automatic query method, device and equipment
Technical Field
The present application relates to the field of computers, and in particular, to an automatic query method, apparatus, and device.
Background
During programming, the source code can be decomposed into a plurality of code segments according to the logic of the source code, and each code segment comprises a logic content. The programmer may implement the source code by writing these code fragments one by one. Similarly, during the reading of the source code, the programmer may break the source code into a plurality of code sections, each of which includes a logical content. The programmer can realize the combing of the source code by understanding the code segments one by one.
Currently, during the process of reading program code by a programmer, when the programmer cannot understand the code segment, the programmer can acquire relevant information of the code segment through a query mode. For example, the programmer may search the search engine for the code segment, search the text data such as a book for the code segment, and so on. Generally, after the programmer queries the relevant data, the programmer can determine the interpretation of the code segment by collating the queried relevant data.
However, such a query method has a problem of low query efficiency, which further easily causes a reduction in the reading efficiency of the source code by the programmer.
Disclosure of Invention
The application provides an automatic query method, an automatic query device and automatic query equipment, which are used for solving the problem of low query efficiency in the prior art.
In a first aspect, the present application provides an automatic query method, which is applied to a client, where an editor program is run in the client, the editor program includes a first window and a second window, the first window is used for displaying source codes, and the second window is used for displaying target articles; the method comprises the following steps:
acquiring information to be queried, wherein the information to be queried is a code segment in a source code;
acquiring a related article set from a network according to the information to be queried and the crawler instruction set, wherein the related article set comprises at least one related article, and the related article set is formed by the at least one related article;
and determining a target article according to the relevant article set and a preset rule, wherein the target article is displayed on a second window of the editor program.
Optionally, the obtaining of the information to be queried includes at least one of the following:
selecting a code segment in the source code displayed in the first window;
and moving the cursor to the position of the key information displayed in the first window, wherein the key information is a code segment preset in the editor program.
Optionally, the crawler instruction set includes a plurality of crawler instructions, and each crawler instruction is used to instruct to query and obtain at least one web article from a preset website;
the acquiring a relevant article set from a network according to the information to be queried and the crawler instruction set comprises:
acquiring article information of at least one network article from a preset website according to the information to be inquired and the crawler instruction, wherein the article information comprises at least one of comment quantity, praise quantity, click quantity and keyword coincidence;
determining a correlation degree index of each network article according to the article information;
and determining at least one related article from the network articles according to the correlation degree index and the correlation degree threshold value.
Optionally, the determining the target article according to the relevant article set and the preset rule includes:
determining a preset number of first target articles according to the relevant article set and the preset rule;
and determining the target article according to a preset number of first target articles.
Optionally, the determining a target article according to a preset number of first target articles includes:
deleting repeated contents in a preset number of first target articles to obtain a preset number of second target articles;
extracting effective parts of a preset number of second target articles to obtain a preset number of third target articles;
and integrating the preset number of third target articles to obtain the target articles.
Optionally, the preset rule includes at least one of the following:
selecting a preset number of related articles with the highest correlation degree as a first target article according to the correlation degree index of each related article in the related article set;
sequencing according to the source of each related article in the related article set, sequentially selecting a preset number of related articles as a first target article, wherein the source is determined according to a preset website of the crawler instruction;
sequencing according to the name of each related article in the related article set, and sequentially selecting a preset number of related articles as a first target article;
and randomly selecting a preset number of related articles from the related article set as a first target article.
Optionally, the method further includes:
and when the target article is displayed in the second window, deleting the first target article corresponding to the target article from the related article set.
Optionally, the method further includes:
and responding to a refresh command, and determining a new target article according to the relevant article set and the preset rule, wherein the new target article is displayed on a second window of the editor program.
Optionally, the method further includes:
and displaying the website of the first target article corresponding to the target article in the second window.
Optionally, the method further includes:
and displaying the note of the information to be inquired in a third window of the editor program.
Optionally, the method further includes:
and responding to an editing instruction, editing the note in the third window.
Optionally, the method further includes:
and responding to a saving instruction, saving a note in the third window, wherein the note is stored in association with the information to be inquired.
Optionally, the method further includes:
and responding to a login instruction, matching an account and a password on the login interface, and logging in the editor program when the account and the password are matched.
Optionally, the key information is highlighted in a first window of the editor program, and the key information is a code segment preset in the editor program.
Optionally, the method further includes at least one of:
displaying the key information as highlights with different colors according to the category of the key information, wherein the category comprises at least one of a method, a category and a keyword;
and marking the key information into different colors according to the query frequency of the key information.
Optionally, the method further includes:
acquiring information to be inquired;
generating a new preset code segment according to the information to be inquired;
and storing the new preset code segment.
In a second aspect, the present application provides an automatic query apparatus, which is applied to a client, where an editor program is run in the client, the editor program includes a first window and a second window, the first window is used for displaying source codes, and the second window is used for displaying target articles; the apparatus, comprising:
the first acquisition module is used for acquiring information to be inquired, wherein the information to be inquired is a code segment in a source code;
a second obtaining module, configured to obtain a related article set from a network according to the information to be queried and the crawler instruction set, where the related article set includes at least one related article, and the at least one related article forms a related article set;
and the determining module is used for determining a target article according to the relevant article set and a preset rule, and the target article is displayed on a second window of the editor program.
Optionally, the first obtaining module is specifically configured to select a sub-module, and is configured to select a code segment in the source code displayed in the first window; or moving the cursor to the position of the key information displayed in the first window, wherein the key information is a code segment preset in the editor program.
Optionally, the crawler instruction set includes a plurality of crawler instructions, and each crawler instruction is used to instruct to query and obtain at least one web article from a preset website;
the second obtaining module is specifically configured to obtain article information of at least one web article from a preset website according to the information to be queried and the crawler instruction, where the article information includes at least one of a number of comments, a number of praise, a number of clicks, and a keyword overlap ratio; determining a correlation degree index of each network article according to the article information; and determining at least one related article from the network articles according to the correlation degree index and the correlation degree threshold value.
Optionally, the determining module includes:
the first determining submodule is used for determining a preset number of first target articles according to the relevant article set and the preset rule;
and the second determining submodule is used for determining the target article according to the preset number of the first target articles.
Optionally, the second determining sub-module is specifically configured to delete a preset number of repeated contents in the first target article to obtain a preset number of second target articles; extracting effective parts of a preset number of second target articles to obtain a preset number of third target articles; and integrating the preset number of third target articles to obtain the target articles.
Optionally, the preset rule includes at least one of the following:
selecting a preset number of related articles with the highest correlation degree as a first target article according to the correlation degree index of each related article in the related article set;
sequencing according to the source of each related article in the related article set, sequentially selecting a preset number of related articles as a first target article, wherein the source is determined according to a preset website of the crawler instruction;
sequencing according to the name of each related article in the related article set, and sequentially selecting a preset number of related articles as a first target article;
and randomly selecting a preset number of related articles from the related article set as a first target article.
Optionally, the apparatus further includes:
and the deleting module is used for deleting the first target article corresponding to the target article from the related article set when the target article is displayed on the second window.
Optionally, the apparatus further includes:
and the refreshing module is used for responding to a refreshing instruction, determining a new target article according to the relevant article set and the preset rule, and displaying the new target article on a second window of the editor program.
Optionally, the display module is further configured to display a website of the first target article corresponding to the target article in the second window.
Optionally, the apparatus further includes a note module, where the note module includes:
and the note display sub-module is used for displaying the note of the information to be inquired in a third window of the editor program.
Optionally, the note module further includes:
and the note editing module block is used for responding to an editing instruction and editing the note in the third window.
Optionally, the note module further includes:
and the note storage module is used for responding to a storage instruction and storing the note in the third window, wherein the note is stored in association with the information to be inquired.
Optionally, the apparatus further includes:
and the login module is used for responding to a login instruction, matching the account and the password on the login interface, and logging in the editor program when the account and the password are matched.
Optionally, the apparatus further includes:
and the marking module is used for highlighting the key information in a first window of the editor program, wherein the key information is a code segment preset in the editor program.
Optionally, the marking module is specifically configured to display the key information as highlights of different colors according to a category of the key information, where the category includes at least one of a device, a class, and a keyword; or marking the key information into different colors according to the query frequency of the key information.
Optionally, the apparatus further includes a preset code segment updating module, where the preset code segment updating module is specifically configured to obtain information to be queried; generating a new preset code segment according to the information to be inquired; and storing the new preset code segment.
In a third aspect, the present application provides a client, including: a memory and a processor;
the memory is used for storing program instructions; the processor is configured to invoke program instructions in the memory to perform the automatic query method of the first aspect and any one of the possible designs of the first aspect.
In a fourth aspect, the present application provides a readable storage medium, in which a computer program is stored, and when the computer program is executed by at least one processor of a client, the client performs the automatic query method in any one of the possible designs of the first aspect and the first aspect.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by at least one processor of a client, causes the client to perform the method of automatic query in any one of the possible designs of the first aspect and the first aspect.
According to the automatic query method, the automatic query device and the automatic query equipment, the information to be queried is obtained, and the information to be queried is a code segment in a first window source code; combining the information to be queried with each crawler instruction in the crawler instruction set to obtain target urls of a plurality of crawler instructions; acquiring at least one network article from each target url; screening a plurality of related articles from the network articles; the plurality of related articles form a related article set; selecting a preset number of first target articles from the related article set according to a preset rule; and integrating the first target article to obtain a target article, wherein the target article can be displayed in a second window of an editor program, so that the efficiency of reading source codes by a user is improved, and the user experience effect is improved.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of a window of an editor program according to an embodiment of the present application;
fig. 2 is a flowchart of an automatic query method according to an embodiment of the present application;
fig. 3 is a flowchart of another automatic query method according to an embodiment of the present application;
fig. 4 is a flowchart of another automatic query method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an automatic query device according to an embodiment of the present application;
fig. 6 is a schematic diagram of a hardware structure of a client according to an embodiment of the present disclosure.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged where appropriate. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope herein.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Also, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context indicates otherwise.
It will be further understood that the terms "comprises," "comprising," "includes" and/or "including," when used in this specification, specify the presence of stated features, steps, operations, elements, components, items, species, and/or groups, but do not preclude the presence, or addition of one or more other features, steps, operations, elements, components, items, species, and/or groups thereof.
The terms "or" and/or "as used herein are to be construed as inclusive or meaning any one or any combination. Thus, "A, B or C" or "A, B and/or C" means "any of the following: A. B. C. a and B. A and C. B and C. A. B and C ". An exception to this definition will occur only when a combination of elements, functions, steps or operations are inherently mutually exclusive in some way.
During programming, a programmer can write source codes of application programs by using methods such as logic statements, calling classes and methods, limiting by using keywords and the like. Similar to the programming process, a programmer may break down complete source code into very code segments during the reading of the source code. The programmer can realize the combing of the source code by understanding the logic of the code segments one by one. Wherein, the code segment may be a keyword. E.g., public, private, etc. The code fragment may also be a line code. For example, a function call static cv:: Ptr < cv:: dnn:: Layer > create (cv:: dnn:: LayerParams & params) { }, a parameter assignment outShape [2] = outHeight, etc. The code snippet may also be multi-line code. For example, the entire code of a function including the function execution logic.
Currently, during the process of reading program code by a programmer, when the programmer cannot understand the code segment, the programmer can acquire relevant information of the code segment through a query mode. For example, the programmer may search the search engine for the code segment, search the text data such as a book for the code segment, and so on. Generally, after the programmer queries the relevant data, the programmer can determine the interpretation of the code segment by collating the queried relevant data.
However, in reading source code, there may be code fragments that require a programmer to determine the interpretation of the code fragment by way of a query. The querying of the code snippet will shift the attention of the programmer from understanding the source code to the querying of the code snippet. The query operation not only interrupts the arrangement thought of the programmer for the source codes, but also reduces the reading efficiency of the programmer for the source codes. For each code fragment query, the programmer needs to copy the code fragment from the source code to the search engine to perform the search of the code fragment. Even more, for a code snippet that is partially unfamiliar, a programmer may have a need to query once each time the code snippet is encountered. Obviously, such a query method has a problem of low query efficiency.
In order to solve the problems, the application provides an automatic query method. The automatic query method may be run embedded in an editor program. The editor program may be run on the client. The programmer may import the source code into the editor program of the client when it is needed to read the source code. The editor program includes at least a first window and a second window. When the source code is imported into the editor program, the source code is displayed in a first window of the editor program. The editor program can automatically analyze the source code after acquiring the source code to obtain a plurality of key information in the source code. The key information is essentially a code segment in the source code. The editor program can query the key information as the information to be queried one by one.
After determining a piece of information to be queried, the editor program can query the web articles in a preset website by using a python crawler technology. The editor program can also screen at least one related article from the multiple web articles obtained through query according to the indexes of the comment quantity, the praise quantity, the watching quantity, the keyword coincidence rate and the like of the web articles. The editor program can integrate the contents of a plurality of related articles into a piece of target article by deleting repeated contents in the related articles, extracting effective contents in the related articles and the like. When the programmer selects one piece of key information as the information to be queried, the editor program can display the target article corresponding to the key information in the second window.
By the automatic query method, a programmer can directly view the network interpretation of the code segment in the second window. The programmer does not need to manually search the explanation of each code segment through a search engine, and the query efficiency is greatly improved. Meanwhile, the way of viewing the code segment explanation through the second window enables the thinking of reading the source code of the programmer to be more coherent, and the reading efficiency is improved.
The technical solution of the present application will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. In the following embodiments, to avoid ambiguity, the programmer viewing the source code using the editor is named user. The user is the person who views the source code using the editor. The user includes a programmer. The user may also be a person other than the programmer who needs to read the source code using the editor.
Fig. 1 shows a schematic window diagram of an editor program according to an embodiment of the present application. As shown, an editor program is run in the client. The editor program may be executed to display a window of the editor program in a display interface of the client. The window includes a first window and a second window. And the first window displays the source codes imported by the user. The source code may be imported by reading a source code file for an editor program. Where the source code file may be a source code file in a variety of programming languages that the editor program may parse. For example, XX.cpp, XX.h, XX.java, XX.c, XX.py, etc. Alternatively, the source code displayed in the first window may be the source code pasted into the first window by the user. A user may select a code segment in a first window while reading the source code in the first window. For example, a code segment "pool" in the first window as in fig. 1. And the editor program automatically queries to obtain the target article through a crawler according to the code segment as the information to be queried. The editor program displays the target article in a second window. For example, the explanation content of the code segment "pool" is displayed in the second window in fig. 1.
In the present application, a client is used as an execution subject to execute the automatic query method of the following embodiments. Specifically, the execution subject may be a hardware device of the client, or a software application in the client, or a computer-readable storage medium on which the software application implementing the following embodiment is installed, or code of the software application implementing the following embodiment.
Fig. 2 is a flowchart illustrating an automatic query method according to an embodiment of the present application. On the basis of the embodiment shown in fig. 1, as shown in fig. 2, a client is used as an execution subject, and an editor program runs in the client, where the editor program includes a first window and a second window, the first window is used for displaying source codes, and the second window is used for displaying target articles. The method of the embodiment may include the steps of:
s101, obtaining information to be inquired, wherein the information to be inquired is a code segment in a source code.
In this embodiment, an editor program running in the client acquires information to be queried. The information to be queried is a code segment in the source code of the first window. The code segment may be a key in the source code, a function in the source code, a line of code in the source code, a plurality of lines of code in the source code, etc. For example, as shown in fig. 1, the keyword "pool" in the first window is the information to be queried obtained by the editor program in the query. The information to be queried can be acquired when the acquisition instruction is triggered. When the editor program of the client is triggered in the acquisition instruction, the information to be queried can be acquired according to the acquisition instruction. After the editor program of the client acquires the information to be queried, the target article of the information to be queried is queried and generated through the following steps.
In one example, the fetch instruction may be triggered upon selection of a code segment in the source code displayed in the first window.
In this example, the user may view the source code through the first window. When viewing the source code, the user can select a code segment in the source code through a mouse. For example, as shown in FIG. 1, the user may select the keyword "bool" in the source code of the first window. And after the user selects the keyword, the editor program of the client triggers an acquisition instruction of the editor program of the client according to the selection operation of the user. The obtaining instruction instructs an editor program of the client to obtain the content selected by the mouse as the information to be inquired.
In another example, the fetch instruction may be triggered when a code segment in the source code displayed in the first window is selected and the query button is clicked.
In this example, it is considered that when the user views the source code in the first window, an unintentional selection operation may occur while reading. In order to avoid the unconscious selection operation triggering the acquisition instruction, the editor program of the client avoids the error touch of the acquisition instruction by increasing the triggering condition of the acquisition instruction.
Specifically, when the user views the source codes in the first window, a code segment is selected from the source codes in the first window in a mouse selection mode. When the user selects the code snippet, a query button may appear in proximity to the code snippet. The user may click on the query button using a mouse, triggering a fetch instruction. Alternatively, a query button may be included in a window of the client's editor program. When a user selects a code segment, the user can click a query button in the editor program window to trigger an acquisition instruction. The obtaining instruction is used for indicating an editor program of the client to obtain the content selected by the mouse as the information to be inquired.
In yet another example, the obtaining instruction may be triggered when a cursor is moved to a location where the key information displayed in the first window is located. The key information is a code segment preset in the editor program.
In this example, a plurality of code segments may be preset in the editor program of the client. After the editor program of the client acquires the source code, the editor program of the client can analyze the source code according to a plurality of preset code segments. Specifically, the editor program of the client may determine whether the source code includes the preset code segment. When the preset code segment exists in the source code, the editor program of the client marks the code segment in the source code of the first window. The marking mode can change one or more of the font color of the code segment, the font style of the code segment and the font size of the code segment. For example, the code snippet may be highlighted, bolded, italicized and bolded, and so forth. The marking mode is used for distinguishing the code segment from other source code contents. The client may determine that a marked code snippet is a key piece of information.
When the user moves the cursor to the location of the key information, the editor program of the client may trigger the fetch instruction. The obtaining instruction is used for indicating an editor program of the client to obtain the key information as the information to be inquired.
Consider that a mouse may swipe key information in a source code in a first window while a user is viewing the source code. In order to avoid triggering the acquisition instruction when the mouse sweeps key information, the editor program of the client avoids mistaken touch of the acquisition instruction by increasing the triggering condition of the acquisition instruction. For example, the editor program of the client may determine that the obtaining instruction is triggered when the cursor moves to the position of the key information and stays at the position of the key information for a preset time period. For another example, the editor program of the client may determine that when the cursor moves to the location of the key information and the mouse clicks on the key information, the obtaining instruction is triggered. The obtaining instruction is used for indicating an editor program of the client to obtain the key information as the information to be inquired.
S102, acquiring a related article set from the network according to the information to be inquired and the crawler instruction set, wherein the related article set comprises at least one related article.
In this embodiment, a crawler instruction set is stored in an editor program of the client. The crawler instruction set stores a plurality of crawler instructions. Each crawler instruction is used for instructing to query and obtain at least one network article from a preset website.
After the editor program of the client determines the information to be queried, the editor program of the client combines the information to be queried with a Uniform Resource Locator (URL) of a crawler instruction to obtain a target URL of the crawler instruction. When a crawler in an editor program of the client accesses the webpage by using the target url, the webpage jumps to a query webpage corresponding to a query result when the preset website queries the information to be queried. The query webpage can comprise a plurality of network articles related to the information to be queried. The editor program of the client can obtain at least one web article from at least one preset website according to at least one crawler instruction in the crawler instruction set.
The step of determining, by the editor program of the client, a set of related articles according to the web article may include:
step 1, obtaining article information of at least one network article in a preset website according to information to be inquired and a crawler instruction, wherein the article information comprises at least one of comment quantity, praise quantity, click quantity and keyword coincidence degree.
In this step, a crawler in the editor program of the client determines a query web page according to the information to be queried and a crawler instruction. The query webpage comprises abstract information of at least one network article. The crawler may retrieve summary information in the query web page. The summary information may include a title, a full-text summary, a number of comments, a number of prawns, a number of clicks, a url address, an author, a publishing time, and the like. And the crawler extracts the article information of each network article from the abstract information. The article information may include at least one of a number of comments, a number of likes, a number of clicks, and a keyword overlap ratio. The article information such as the number of comments, the number of praise, the number of clicks and the like can be directly extracted from the abstract information. The keyword overlap ratio can be determined according to the ratio of the number of words in the summary information, which is the same as the number of words in the information to be queried, to the total number of words in the summary information.
Alternatively, when the query results are more, multiple query pages may be included. The crawler instruction may jump to the respective query page by modifying the page number in the target url. The crawler can obtain summary information of a preset number of query webpages. The preset number may be 1 page, 2 pages, 3 pages, etc. For example, the predetermined number may be 5 pages. When a query result includes 3 pages of query web pages, the crawler acquires the summary information in the 3 pages of query web pages. When 8 pages of query web pages are included in one query result, the crawler acquires summary information in the query web pages of the first 5 pages.
And 2, determining the relevance index of each network article according to the article information.
In this step, the crawler of the editor program of the client may calculate the relevance index of each web article according to the extracted article information.
In one implementation, the relevancy indicator may be a weighted sum of the number of comments, the number of likes, the number of clicks, and the keyword overlap.
In another implementation manner, the crawler may normalize the number of comments of each web article to be between (0, 1) according to the obtained number of comments of all web articles. After the crawler normalizes the number of comments, the number of praise, the number of clicks and the keyword overlap ratio respectively, the crawler can determine a correlation degree index according to the weighted sum of the normalized parameters.
In another implementation, the crawler may map the number of comments, the number of prawns, the number of clicks, and the keyword overlap ratio to corresponding scores according to a preset magnitude. For example, the number of reviews is less than 100 and is 1 point, the number of reviews is between 100 and 500 and is 2 points, the number of reviews is between 500 and 1000 and is 3 points, etc. The crawler may determine the relevance metric based on a weighted sum of these parameters mapped to scores.
And 3, determining at least one relevant article from the network articles to form a relevant article set according to the relevance degree index and the relevance degree threshold.
In this step, the crawler of the editor program of the client may compare the relevance index of each web article with the relevance threshold. And when the relevance degree index of the network article is larger than the relevance program threshold value, the crawler acquires the url address of the network article from the abstract information of the network article. And the crawler downloads the network article according to the url address of the network article and determines the network article as a related article. All web articles downloaded by the crawler constitute a relevant article set.
In one implementation, the crawler has a relevance threshold in the editor program of the client. The correlation degree threshold is applicable to all preset websites. The crawler can determine the relevance index of a network article after calculating the relevance index of the network article. The crawler compares the correlation threshold with the correlation index. When the relevance degree index is larger than or equal to the relevance degree threshold value, the crawler determines that the network article needs to be downloaded. And the crawler acquires the url address in the abstract information of the network article and downloads the network article. The crawler determines the web article as a related article. Or when the correlation degree index is smaller than the correlation degree threshold value, the crawler directly calculates the correlation degree index of the next network article and carries out the next comparison.
In another implementation, each predetermined website has a threshold of relevance. The relevance threshold is applicable to a preset website. After determining a preset website, the crawler determines a correlation degree threshold corresponding to the preset website. And after the crawler acquires the correlation degree index of one network article from the preset website, comparing the correlation degree threshold with the correlation degree index. When the relevance degree index is larger than or equal to the relevance degree threshold value, the crawler determines that the network article needs to be downloaded. And the crawler acquires the url address in the abstract information of the network article and downloads the network article. The crawler determines the web article as a related article. Or when the correlation degree index is smaller than the correlation degree threshold value, the crawler directly calculates the correlation degree index of the next network article and carries out the next comparison.
In the above two implementations, the crawler may determine whether each web article needs to be downloaded after determining the relevance index of the web article. However, the crawler may also save the summary information of the web article in a temporary data set after acquiring the summary information of the web article. The crawler may determine which of the plurality of web articles need to be downloaded after obtaining a certain amount of web articles. At this time, the crawler may determine the url address of the web article to be downloaded according to the summary information in the temporary data set, and further download the web article.
In another implementation, the threshold of the degree of correlation may be determined according to all web articles obtained by querying a preset website for information to be queried. The crawler can store abstract information of a network article, which is obtained by querying information to be queried through a crawler instruction, in a temporary data set. The temporary data set comprises abstract information of all network articles obtained by inquiring information to be inquired in a preset website. According to the abstract information, the crawler can determine the relevance index of each network article. The crawler may determine a relevance threshold based on all relevance indicators. For example, the crawler may determine the average of all correlation indicators as the correlation threshold. And when the relevance degree index of the network article in the temporary data set is larger than or equal to the mean value, the crawler acquires the network article and determines the network article as a relevant article. As another example, the crawler may rank the relevance indicators of the plurality of web articles in the temporary dataset. The crawler may determine the value of the relevance indicator ranked at the 10 th position as the relevance threshold. The crawler downloads the top 10 web articles ranked by the relevance index and determines the 10 web articles as relevant articles. When the number of the network articles in the temporary data set is less than 10, the crawler can download all the network articles in the temporary data set.
In another implementation manner, the correlation degree threshold may be determined according to all web articles obtained by querying one piece of information to be queried on all preset websites. The crawler can store the abstract information of the web articles obtained by querying the information to be queried through each crawler instruction of the crawler instruction set in the temporary data set. The temporary data set comprises abstract information of all network articles obtained by inquiring information to be inquired in all preset websites. According to the abstract information, the crawler can determine the relevance index of each network article. The crawler may determine a relevance threshold based on all relevance indicators. For example, the crawler may determine the average of all correlation indicators as the correlation threshold. And when the relevance degree index of the network article in the temporary data set is larger than or equal to the mean value, the crawler acquires the network article and determines the network article as a relevant article. As another example, the crawler may rank the relevance indicators of the plurality of web articles in the temporary dataset. The crawler may determine the value of the relevance indicator ranked at the 10 th position as the relevance threshold. The crawler downloads the top 10 web articles ranked by the relevance index and determines the 10 web articles as relevant articles. When the number of the network articles in the temporary data set is less than 10, the crawler can download all the network articles in the temporary data set.
S103, determining a target article according to the relevant article set and a preset rule, wherein the target article is displayed on a second window of the editor program.
In this embodiment, the editor program of the client may generate the target article according to some or all of the related articles in the related article set. The generated target article may be displayed in a second window of the editor program. For example, as shown in the second window in fig. 1. And the editor program of the client selects part or all of the related articles from the related article set according to a preset rule.
In one example, the step of generating, by an editor program of the client, the target article from the related article set may specifically include:
step 1, an editor program of a client determines a preset number of first target articles according to a relevant article set and a preset rule.
In this step, the selection method for selecting a preset number of first target articles from the relevant article set by the editor program of the client may be determined according to a preset rule. Wherein the predetermined number may be set empirically. For example, the preset number may be 2, 5, etc. The implementation manner of selecting the preset number of first target articles by the editor program of the client according to the preset rule may include the following multiple manners.
In one implementation, the preset rule may be that a preset number of related articles with the highest correlation degree are selected as the first target article according to the correlation degree index of each related article in the related article set.
In this implementation, the editor program of the client may determine the relevance index of each relevant article in the relevant article set according to S102. The editor program of the client can sort the related articles in the related article set according to the relevance degree index. The ranking may be from high to low for the relevancy indicator or from low to high for the relevancy indicator. The editor program of the client can select a preset number of related articles from top to bottom according to the sorted related articles. That is, when the relevancy index is ranked from high to low, the editor program of the client selects a preset number of related articles with the highest relevancy as the first target article. When the relevancy index is ranked from low to high, the editor program of the client selects a preset number of related articles with the lowest relevancy as the first target article.
In another implementation, the preset rule may be that the related articles in the related article set are ranked according to the source of each related article, a preset number of related articles are sequentially selected as the first target article, and the source is determined according to a preset website of the crawler instruction.
In this implementation, the editor program of the client may determine the source of each related article in the set of related articles according to S102. The source is a preset website for inquiring the related articles. The editor program of the client may sort the preset websites. The related articles in the related article set can be ranked according to the ranking of the preset website. For example, the predetermined sequence of websites is a website a, a website B, and a website C. The related articles in the related article set are ranked in a manner of the related articles from the site a, the related articles from the site B, and the related articles from the site C. When a plurality of related articles from the A website are included in the related article set, the plurality of related articles can be randomly ordered. Alternatively, the plurality of related articles may be ranked according to the relevance indicator. Alternatively, the plurality of correlation measure indicators may be ordered according to article names. After the related articles of the related article set are sorted, the editor program of the client may sequentially select a preset number of related articles as the first target article.
In another implementation, the preset rule may be sorting according to the name of each related article in the related article set, and sequentially selecting a preset number of related articles as the first target article.
In this implementation, the editor program of the client may obtain the name of each related article in the related article set. The editor program of the client may sort by the name of the relevant article. The editor program of the client obtains the first character of the name of each related article. The first character may be a Chinese character, an English letter, a symbol, etc. When the character is a Chinese character, the editor program of the client acquires the pinyin initial of the Chinese character. And the editor program of the client sorts the related articles according to the initial letters of the pinyin or the English letters or the symbols. When the first pinyin letter or the english letter or symbol of the first character is the same, the editor program of the client may obtain the second character in the name of the relevant article. The editor program of the client performs local sorting according to the pinyin initial or the english letter or symbol of the second character. And so on until the rank of each related article in the set of related articles is determined.
In yet another implementation, the preset rule may be that a preset number of related articles are randomly selected from the related article set as the first target article.
In this implementation manner, the editor program of the client may randomly select a preset number of related articles from the related article set, and determine that the preset number of related articles are the first target article.
And 2, determining the target articles according to the preset quantity of first target articles by an editor program of the client.
In this step, after determining the first target article, the editor program of the client integrates the first target article to obtain the target article. The process of integrating the editor program of the client to obtain the target article may include the following steps:
and 2.1, deleting repeated contents in a preset number of first target articles to obtain a preset number of second target articles.
In the step, the method can be divided into two steps of duplicate checking and duplicate content deleting. Wherein, the duplication checking step can be realized at the client. Or in the duplication checking step, after a preset number of first target articles are uploaded to the server by the client, the server checks duplication by using a preset duplication checking algorithm. And the server feeds back the repeated information to the client. The repeat information may include a name of a first target article in which the repeat content is located and a location of the repeat content in the first target article. The position can be represented by the nth character to the mth character in full text, the nth sentence to the mth sentence, the nth sentence to the pth sentence, and the like. And the client deletes the repeated content in each first target article according to the repeated information to obtain a preset number of second target articles.
The duplication checking algorithm may be an existing algorithm or an improved algorithm, which is not limited in this application. In the duplicate checking process, the specific implementation steps of the client or the server may include:
and 2.1.1, the client or the server randomly selects a first target article from a preset number of first target articles as the existing data.
And 2.1.2, the client or the server randomly selects a first target article from the rest first target articles as an article to be checked.
And 2.1.3, the client or the server checks the duplicate of the article to be checked according to the existing data by using a duplicate checking algorithm. The client or the server determines the repeated information of the article with the duplicate.
And 2.1.4, the client or the server takes the article to be checked with the checked duplicate as the existing data.
And 2.1.5, the client or the server repeats the steps 2.1.2 to 2.1.4 until the preset number of first target articles become the existing data.
And 2.1.6, the client or the server outputs repeated information obtained by checking the duplicate.
And 2.2, extracting effective parts of a preset number of second target articles to obtain a preset number of third target articles.
In this step, the extraction of the effective part can be realized at the client. Or the client may upload a preset number of second target articles to the server, and then the server performs effective part extraction. In each second target article, the extracted effective part forms a third target article. And the server feeds back a preset number of third target articles to the client.
Wherein, the target content extraction can be realized by preset logic. For example, the client or the server may match the key content in the second target article by setting a regular expression. The client or the server may determine, according to the key content, that the sentence or paragraph in which the key content is located is a valid portion. Alternatively, when the key content is in a title, the client or the server may determine that the content corresponding to the title is a valid portion.
And 2.3, integrating a preset number of third target articles to obtain the target articles.
In this step, the client may integrate a preset number of third target articles together to obtain a final target article. Wherein the whole process may be to paste the preset number of third target articles together in sequence.
In the automatic query method provided by the application, an editor program running in a client acquires information to be queried. The information to be queried is a code segment in the source code of the first window. The editor program of the client stores a crawler instruction set. And combining the information to be queried with each crawler instruction in the crawler instruction set by an editor program of the client to obtain a target url of a plurality of crawler instructions. The crawler of the editor program of the client may obtain at least one web article from each target url. A crawler of the client's editor program may screen these web articles for a number of related articles. The plurality of related articles constitutes a collection of related articles. An editor program of the client may select a preset number of first target articles from the collection of related articles according to a preset rule. And integrating the first target article by an editor program of the client to obtain the target article. The target article may be displayed in a second window of the editor program. In the method and the system, the client can directly acquire the query result of the information to be queried by using the crawler instruction, and meanwhile, the query result of the information to be queried can be displayed in the editor by using the editor program, so that a user does not need to query each information to be queried in search software any more, the efficiency of reading source codes by the user is improved, and the user experience is improved.
Fig. 3 is a flowchart illustrating another automatic query method according to an embodiment of the present application. On the basis of the embodiments shown in fig. 1 and fig. 2, as shown in fig. 3, a client is used as an execution subject, and an editor program runs in the client, where the editor program includes a first window and a second window, the first window is used for displaying source codes, and the second window is used for displaying target articles. The method of this embodiment may further include the steps of:
s201, determining key information according to the preset code segment and the source code.
In this embodiment, the editor program of the client stores the preset code segment. The preset code segment may be a self-contained preset code segment in an editor program of the client. The preset code segment is usually determined according to information such as keywords, class names, function names and the like of various languages. Alternatively, the preset code segment may be a preset code segment that is set by the user according to the use experience. The preset code segment may be a code segment directly input by a user. Or, the preset code segment may also be a code segment corresponding to the information to be queried, which is queried by the user in the process of reading the source code. Each preset code segment comprises programming language information corresponding to the code segment.
And after the editor program of the client acquires the source code in the first window of the editor, the client determines the programming language to which the source code belongs according to the source code. And the editor program of the client determines the preset code segment in the editor program according to the programming language. The editor program of the client matches each preset code segment in the source code. When the editor program of the client matches the preset code segment in the source code, the editor program of the client determines that the code segment matched with the preset code segment in the source code is the key information. Wherein one preset code segment may match a plurality of code segments in the source code. The plurality of code fragments are a plurality of key information. Wherein the source code can match a plurality of preset code segments.
In one example, the key information is highlighted in a first window of the editor program, and the key information is a code segment preset in the editor program.
In this example, the client's editor program may mark the key information in the first window. Wherein, the marking mode can be highlight display. For example, as shown in fig. 1, in the source code of the first window, the key information "cool" is in a highlighted state.
In one implementation, the editor program of the client may mark the key information as highlighted in a different color depending on the category of the key information. The category of the key information comprises at least one of a method, a category, a keyword and the like. For example, key information of a method class may be marked as green highlight, key information of a class may be marked as yellow highlight, key information of a keyword may be marked as red highlight, and other key information may be marked as blue highlight. Wherein the other key information may be code segments determined from the query history.
In another implementation, the editor program of the client marks the key information as different colors according to the query frequency of the key information. For example, different depths of color such as brilliant yellow, turmeric, earthy yellow, etc. When the query frequency of a key message is greater than 10 times per day, the editor program of the client may mark the highlight color of the key message as bright yellow. When the frequency of queries for a key message is 5-10 times per day, the client's editor program may mark the key message as turmeric in its highlighted color. When the query frequency of a key message is less than 5 times per day, the editor program of the client may mark the highlight color of the key message as khaki. The query frequency of the key information can be determined according to the use record of the user at the client. Or the query frequency of the key information can also be determined according to the use record of the account.
S202, determining a query result corresponding to each piece of key information according to the key information and the crawler instruction set.
In this step, the editor program of the client may automatically query according to the key information. Since a source code usually includes a plurality of key information, the editor program of the client can query the key information as the information to be queried one by one. The specific query process is similar to the implementation manner of step S102 in the embodiment shown in fig. 2. And the editor program of the client can determine the relevant article set corresponding to the information to be queried according to the information to be queried. And determining the relevant article set as a query result corresponding to the key information by an editor program of the client.
One preset code segment can be matched with a plurality of code segments to generate a plurality of pieces of key information. The multiple pieces of key information are typically the same code snippet. Therefore, when one piece of key information is queried, the corresponding key information does not need to be queried again. For example, when a preset code a is matched in the source code, two code segments are obtained. The key information generated by the two code fragments may be defined as a1 and a 2. When the editor program of the client automatically queries a1, a2 does not need to automatically query any more. And the query result of a1 may be shared by a1 and a 2. That is, when the information to be queried acquired in S103 is a1, the query result of a1 is output. When the information to be queried acquired in S103 is a2, the query result of a1 is also output.
S203, obtaining the information to be inquired.
Step S203 is similar to the step S101 in the embodiment of fig. 2, and this embodiment is not described herein again.
And S204, when the information to be inquired is key information, determining the target article according to the inquiry result.
In this embodiment, the editor program of the client may determine whether the information to be queried is the key information according to the information to be queried. When the information to be queried is not related to information, the editor program of the client may directly obtain the query result of S202. The query result includes a related article set of the information to be queried. And then, the editor program of the client determines the target article according to the query result. The process of determining the target article by the editor program of the client according to the related article set is similar to the implementation manner of step S103 in the embodiment of fig. 2.
In the automatic query method provided by the application, a preset code segment is stored in an editor program of the client. And the client determines the key information in the source code according to the source code and the preset code segment. The editor program of the client can query the key information as the information to be queried one by one. And the editor program of the client determines the relevant article set corresponding to each piece of key information and determines that the relevant article set is the query result corresponding to the key information. And the editor program of the client acquires the information to be inquired. When the information to be queried is key information, the editor program of the client can determine the target article according to the query result. According to the method and the device, the efficiency of inquiring the key information by the user is further improved by inquiring each key information in advance, the network inquiry time after the key information is acquired is shortened, the efficiency of reading the source code by the user is greatly improved, and the user experience is improved.
Fig. 4 is a flowchart illustrating another automatic query method according to an embodiment of the present application. On the basis of the embodiments shown in fig. 1 to fig. 3, as shown in fig. 4, a client is used as an execution main body, an editor program runs in the client, and the editor program includes a first window, a second window and a third window, where the first window is used for displaying source codes, the second window is used for displaying target articles, and the third window is used for displaying notes. The method of this embodiment may further include the steps of:
s301, responding to a refresh command, determining a new target article according to the relevant article set and a preset rule, and displaying the new target article on a second window of the editor program.
In this embodiment, the second window further includes a refresh button. After viewing the target article displayed in the second window, the user can click the refresh button to trigger a refresh command. The refresh command is used for instructing an editor program of the client to generate a new target article and displaying the new target article in the second window. The method for generating a new target article by the editor program of the client is similar to the implementation manner of step S103 in the embodiment of fig. 2.
In one example, when the original target article is displayed in the second window, the first target article corresponding to the original target article is deleted from the related article set.
In this example, when the original target article is displayed in the second window, the first target article corresponding to the original target article is a used related article in the related article set. When a new target article is generated, in order to avoid repeated display of already displayed content, the editor program of the client may delete the first target article corresponding to the original target article from the related article set, so as to avoid repetition of content in the new target article and content in the original target article.
In one example, a first target article corresponding to an original target article may be used as existing data for a new target article.
In this example, when the original target article set is generated, all the first target articles corresponding to the original target article are included in the existing data. When a new target article is generated in a refreshing manner, the existing data used in step 2.1.1 may be the existing data including all the first target articles corresponding to the original target article. The use of the existing data can avoid the repeated content in the target article and improve the effectiveness of the content. Meanwhile, because the existing data is not empty during the refresh, the editor program of the client can skip step 2.1.1 when step 2.1 is executed, and directly execute step 2.1.2, thereby realizing the duplicate checking of each first target article corresponding to the new target article.
In this way, when the refresh button is clicked for the first time, the existing data includes the first target article corresponding to the original target article. When the refresh button is clicked for the second time, the existing data comprises a first target article corresponding to the original target article and a first target article corresponding to the target article when the refresh button is clicked for the first time. When the refresh button is clicked for the third time, the existing data comprises a first target article corresponding to the original target article, a first target article corresponding to the target article when the refresh button is clicked for the first time, and a first target article corresponding to the target article when the refresh button is clicked for the second time
As the existing data content increases, more content may be deleted in each first target article corresponding to the new target article. In order to ensure the data volume of the target article, the number of the first target articles acquired can be increased appropriately. For example, when the preset number is 2, after clicking the refresh, the editor program of the client may obtain 4 first target articles.
Or after the refreshing is clicked, the number of the first target articles determined by the editor program of the client can be determined according to the number of the related articles included in the existing data. For example, when 2 related articles are included in the existing data, the editor of the client may obtain 4 first target articles. When 6 related articles are included in the existing data, the editor of the client may obtain 8 first target articles.
Alternatively, the number of target articles obtained by the editor of the client may be dynamically determined when the refresh is clicked. The dynamic determination process may include the following steps:
step 1, an editor of a client acquires a relevant article from a relevant article set.
And 2, the editor of the client checks the duplication of the first related article to obtain a second related article.
And 3, extracting the second related article by an editor of the client to obtain a third target article.
And 4, integrating the third target article into the target article by the editor of the client.
And 5, deleting the first related article from the related article set by the editor of the client.
And 6, outputting the target article when the content of the target article is more than or equal to the preset data volume or no related article exists in the related article set. Otherwise, repeating the steps 1 to 5.
In one example, when the target article is displayed in the second window, the website of the first target article corresponding to the target article may be displayed in the second window.
In one implementation, the web address may be displayed next to the content corresponding to the first target article. For example, the content corresponding to the first target article is displayed on lines 5 to 15 of the target article. The web address is displayed on line 16. Line 17 of the target article begins to display the content corresponding to the next first target article.
In another implementation, the network can be displayed at the end of the target article in a unified manner.
And S302, displaying a note of the information to be inquired in a third window of the editor program.
In this embodiment, after the editor of the client acquires the information to be queried, the editor of the client displays the target article in the second window and displays the note in the third window. The note is a note corresponding to the information to be inquired.
In one example, the third window may perform a close, minimize, etc. operation in the editor. And when the third window is opened, the editor of the client acquires the information to be inquired, and displays the note in the third window according to the information to be inquired.
And S303, responding to the editing instruction, and editing the note in the third window.
In this embodiment, the third window is an editable window. And after the user moves the cursor to the third window, the editing instruction of the third window is triggered. The user can directly input the text content. Alternatively, the user may paste text, pictures, tables, etc.
S304, responding to the storage instruction, storing the note in the third window, and storing the note and the information to be inquired in a correlation mode.
In this embodiment, the third window further includes a save button. When the user clicks the save button, the save instruction is triggered. The saving instruction is used for storing the note and the information to be inquired in an associated mode.
In one example, the third window may perform a close, minimize, etc. operation in the editor. And triggering the saving instruction when the third window is closed.
In one example, the note may be stored at the client. The note may be obtained by the editor program when the user uses the editor in the client.
In one example, the note may be stored in the cloud. The account may be logged in while the user is using the editor. The note may be stored in a cloud corresponding to the account. When the user logs in the account at another client, the other client can acquire the note from the cloud.
S305, responding to a login instruction, matching an account and a password on a login interface, and logging in an editor program when the account and the password are matched.
In this embodiment, the editor may include a login button. When the user clicks the login button, a login interface is triggered. The user may enter account information at the login interface. The user triggers a login command when clicking a login button. And responding to the login instruction by an editor program of the client, and matching the account and the password in the account information. And when the account number is matched with the password, the user logs in successfully and jumps to a display page of the editor. Otherwise, the login interface pops up a login failure prompt.
In one example, the editor can include cloud storage. The history records generated by the user when using the editor can be stored in the cloud. The user personalized record generated according to the history record can be synchronized to the client terminal logged in by the user when the user logs in.
In one implementation, the personalized record of the user may include query frequency of each preset code segment.
In one implementation, the personalized record of the user may include information to be queried of the user query. When the information to be queried does not have the corresponding preset code segment, the information to be queried can be added into the preset code segment. And when the next query is carried out, the code segment corresponding to the preset code segment in the source code is analyzed to obtain the key information.
In one implementation, the personalized record of the user may include the query result for each piece of information to be queried. The editor program can store the query result of the information to be queried in the preset code segment corresponding to the information to be queried. When the system is used next time, when the preset code segment is analyzed and obtained in the source code, the editor program can directly obtain the query result of the preset code segment from the cloud. The query results may include a collection of related articles. Or the cloud end can also read preset code segments stored in the cloud end regularly. The cloud end can automatically query the query result of each preset code segment periodically to update the query result.
It should be noted that the above information may be stored in the client when the editor does not need to log in. An editor program of a client may determine personalization data for a user of the client based on a history stored at the client.
In the automatic query method provided by the application, the second window further comprises a refresh button. The user may click the refresh button, triggering a refresh command. The refresh command is used for instructing an editor program of the client to generate a new target article and displaying the new target article in the second window. After the editor of the client acquires the information to be queried, the editor of the client can also display the note corresponding to the information to be queried in the third window. In response to the edit instruction, the editor of the client may also edit the note in the third window. In response to the saving instruction, the editor of the client may further save a note in the third window, where the note is stored in association with the information to be queried. And responding to the login instruction by an editor program of the client, and matching the account and the password in the account information. And when the account number is matched with the password, the user logs in successfully and jumps to a display page of the editor. Otherwise, the login interface pops up a login failure prompt. In the application, the third window can be used for editing the note of the information to be inquired. The note can improve the understanding efficiency of the user on the information to be queried, so that the efficiency of reading the source code by the user is further improved, and the user experience is improved. Meanwhile, the related articles obtained by query are displayed in a small amount for multiple times by using the refresh button, so that a user can conveniently and quickly check the target articles at each time, the phenomenon that the source code reading thought is discontinuous due to the fact that the target articles are checked for too long time is avoided, the source code reading efficiency of the user is improved, and the user experience is improved. Meanwhile, the user can log in through the account number, so that the user can store the related information in the account number, and the information can be synchronized when the user replaces the equipment.
Fig. 5 is a schematic structural diagram of an automatic query apparatus according to an embodiment of the present application, and as shown in fig. 5, an automatic query apparatus 10 according to this embodiment is configured to implement an operation corresponding to a client in any one of the method embodiments described above, where the client runs an editor program, the editor program includes a first window and a second window, the first window is used for displaying a source code, and the second window is used for displaying a target article. The automatic query method device 10 of the present embodiment includes:
the first obtaining module 11 is configured to obtain information to be queried, where the information to be queried is a code segment in a source code.
The second obtaining module 12 is configured to obtain a related article set from the network according to the information to be queried and the crawler instruction set, where the related article set includes at least one related article, and the at least one related article forms the related article set.
And the determining module 13 is configured to determine a target article according to the relevant article set and a preset rule, where the target article is displayed in a second window of the editor program.
In an example, the first obtaining module 11 is specifically configured to select a sub-module, which is used to select a code segment in the source code displayed in the first window. Or moving the cursor to the position of the key information displayed in the first window, wherein the key information is a code segment preset in the editor program.
In one example, the set of crawler instructions includes a plurality of crawler instructions, and each crawler instruction is used for instructing to query and obtain at least one web article from a preset website. The second obtaining module 12 is specifically configured to obtain article information of at least one web article from a preset website according to the information to be queried and the crawler instruction, where the article information includes at least one of a number of comments, a number of praise, a number of clicks, and a keyword overlap ratio. And determining the relevance degree index of each network article according to the article information. And determining at least one related article from the network articles according to the correlation degree index and the correlation degree threshold value.
In one example, the determining module 13 includes:
the first determining sub-module 131 is configured to determine a preset number of first target articles according to the relevant article set and a preset rule.
The second determining sub-module 132 is configured to determine the target articles according to a preset number of first target articles.
In one example, the second determining sub-module 132 is specifically configured to delete the repeated contents in a preset number of first target articles, so as to obtain a preset number of second target articles. And extracting effective parts of a preset number of second target articles to obtain a preset number of third target articles. And integrating a preset number of third target articles to obtain the target articles.
In one example, the preset rules include at least one of:
and selecting a preset number of related articles with the highest correlation degree as a first target article according to the correlation degree index of each related article in the related article set.
And sequencing according to the source of each related article in the related article set, sequentially selecting a preset number of related articles as a first target article, and determining the source according to a preset website of a crawler instruction.
And sequencing according to the name of each related article in the related article set, and sequentially selecting a preset number of related articles as a first target article.
A preset number of related articles are randomly selected from the set of related articles as a first target article.
In one example, the automatic query device 10 further includes:
and the deleting module 14 is configured to delete the first target article corresponding to the target article from the related article set when the target article is displayed in the second window.
In one example, the automatic query device 10 further includes:
and the refreshing module 15 is configured to determine a new target article according to the relevant article set and a preset rule in response to the refreshing instruction, where the new target article is displayed in a second window of the editor program.
In one example, the second window displays the website of the first target article corresponding to the target article.
In one example, the auto-query device 10 further includes a note module 16, which includes:
and a note display sub-module 161, configured to display a note of the information to be queried in a third window of the editor program.
And a note editing module block 162 for editing the note in the third window in response to the editing instruction.
And the note saving module 163 is configured to, in response to the saving instruction, save the note in the third window, where the note is stored in association with the information to be queried.
In one example, the automatic query device 10 further includes:
and the login module 17 is used for responding to a login instruction, matching the account and the password on the login interface, and logging in the editor program when the account and the password are matched.
In one example, the automatic query device 10 further includes:
and the marking module 18 is used for highlighting the key information in the first window of the editor program, wherein the key information is a code segment preset in the editor program.
In one example, the labeling module 18 is specifically configured to display the key information as different color highlights according to categories of the key information, wherein the categories include at least one of devices, categories, and keywords. Or, according to the query frequency of the key information, marking the key information as different colors.
In one example, the automatic query device 10 further includes a preset code segment update module 19.
The preset code segment updating module 19 is specifically configured to obtain information to be queried. And generating a new preset code segment according to the information to be inquired. And storing the new preset code segment.
The automatic query device 10 provided in the embodiment of the present application may implement the method embodiment, and for specific implementation principles and technical effects, reference may be made to the method embodiment, which is not described herein again.
Fig. 6 shows a hardware structure diagram of a client according to an embodiment of the present application. As shown in fig. 6, the client 20 is configured to implement operations corresponding to the client in any of the method embodiments described above, where the client 20 of this embodiment may include: memory 21, processor 22.
A memory 21 for storing a computer program. The Memory 21 may include a Random Access Memory (RAM), a Non-Volatile Memory (NVM), at least one disk Memory, a usb disk, a removable hard disk, a read-only Memory, a magnetic disk or an optical disk.
A processor 22 for executing the computer program stored in the memory to implement the automatic query method in the above embodiments. Reference may be made in particular to the description relating to the method embodiments described above. The Processor 22 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
Alternatively, the memory 21 may be separate or integrated with the processor 22.
When memory 21 is a separate device from processor 22, client 20 may also include bus 23. The bus 23 is used to connect the memory 21 and the processor 22. The bus 23 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The client provided in this embodiment may be used to execute the above automatic query method, and the implementation manner and the technical effect thereof are similar, and this embodiment is not described herein again.
The present application also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is used for implementing the methods provided by the above-mentioned various embodiments when being executed by a processor.
The computer-readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, a computer readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the computer readable storage medium. Of course, the computer readable storage medium may also be integral to the processor. The processor and the computer-readable storage medium may reside in an Application Specific Integrated Circuit (ASIC). Additionally, the ASIC may reside in user equipment. Of course, the processor and the computer-readable storage medium may also reside as discrete components in a communication device.
In particular, the computer-readable storage medium may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random-Access Memory (SRAM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The present application also provides a computer program product comprising a computer program stored in a computer readable storage medium. The computer program can be read by at least one processor of the device from a computer-readable storage medium, and execution of the computer program by the at least one processor causes the device to implement the methods provided by the various embodiments described above.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of modules is merely a division of logical functions, and an actual implementation may have another division, for example, a plurality of modules may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
Wherein the modules may be physically separated, e.g. mounted at different locations of one device, or mounted on different devices, or distributed over multiple network elements, or distributed over multiple processors. The modules may also be integrated, for example, in the same device, or in a set of codes. The respective modules may exist in the form of hardware, or may also exist in the form of software, or may also be implemented in the form of software plus hardware. The method and the device can select part or all of the modules according to actual needs to achieve the purpose of the scheme of the embodiment.
When the respective modules are implemented as integrated modules in the form of software functional modules, they may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor to execute some steps of the methods according to the embodiments of the present application.
It should be understood that, although the respective steps in the flowcharts in the above-described embodiments are sequentially shown as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, in different orders, and may be performed alternately or at least partially with respect to other steps or sub-steps of other steps.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: it is also possible to modify the solutions described in the previous embodiments or to substitute some or all of them with equivalents. And the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (20)

1. An automatic query method is applied to a client, an editor program runs in the client, the editor program comprises a first window and a second window, the first window is used for displaying source codes, and the second window is used for displaying target articles; the method comprises the following steps:
acquiring information to be queried, wherein the information to be queried is a code segment in a source code;
acquiring a related article set from a network according to the information to be queried and the crawler instruction set, wherein the related article set comprises at least one related article, and the related article set is formed by the at least one related article;
and determining a target article according to the relevant article set and a preset rule, wherein the target article is displayed on a second window of the editor program.
2. The automatic query method according to claim 1, wherein obtaining information to be queried comprises at least one of:
selecting a code segment in the source code displayed in the first window;
and moving the cursor to the position of the key information displayed in the first window, wherein the key information is a code segment preset in the editor program.
3. The automatic query method according to claim 1, wherein the set of crawler instructions includes a plurality of crawler instructions, each of the crawler instructions is used for instructing to query and obtain at least one web article from a preset website;
the acquiring a relevant article set from a network according to the information to be queried and the crawler instruction set comprises:
acquiring article information of at least one network article from a preset website according to the information to be inquired and the crawler instruction, wherein the article information comprises at least one of comment quantity, praise quantity, click quantity and keyword coincidence;
determining a correlation degree index of each network article according to the article information;
and determining at least one related article from the network articles according to the correlation degree index and the correlation degree threshold value.
4. The automatic query method of claim 1, wherein the determining a target article according to the relevant article set and a preset rule comprises:
determining a preset number of first target articles according to the relevant article set and the preset rule;
and determining the target article according to a preset number of first target articles.
5. The automatic query method of claim 4, wherein the determining a target article according to a preset number of the first target articles comprises:
deleting repeated contents in a preset number of first target articles to obtain a preset number of second target articles;
extracting effective parts of a preset number of second target articles to obtain a preset number of third target articles;
and integrating the preset number of third target articles to obtain the target articles.
6. The method according to claim 4, wherein the preset rule comprises at least one of the following:
selecting a preset number of related articles with the highest correlation degree as a first target article according to the correlation degree index of each related article in the related article set;
sequencing according to the source of each related article in the related article set, sequentially selecting a preset number of related articles as a first target article, wherein the source is determined according to a preset website of the crawler instruction;
sequencing according to the name of each related article in the related article set, and sequentially selecting a preset number of related articles as a first target article;
and randomly selecting a preset number of related articles from the related article set as a first target article.
7. The method of claim 4, further comprising:
and when the target article is displayed in the second window, deleting the first target article corresponding to the target article from the related article set.
8. The method of any one of claims 1-7, wherein the method further comprises:
and responding to a refresh command, and determining a new target article according to the relevant article set and the preset rule, wherein the new target article is displayed on a second window of the editor program.
9. The method of any one of claims 1-7, wherein the method further comprises:
and displaying the website of the first target article corresponding to the target article in the second window.
10. The method of any one of claims 1-7, wherein the method further comprises:
and displaying the note of the information to be inquired in a third window of the editor program.
11. The method of claim 10, further comprising:
and responding to an editing instruction, editing the note in the third window.
12. The method of claim 10, further comprising:
and responding to a saving instruction, saving a note in the third window, wherein the note is stored in association with the information to be inquired.
13. The method of any one of claims 1-7, wherein the method further comprises:
and responding to a login instruction, matching an account and a password on a login interface, and logging in the editor program when the account and the password are matched.
14. The automatic query method according to any one of claims 1 to 7, wherein key information is highlighted in the first window of the editor program, and the key information is a code segment preset in the editor program.
15. The method of claim 14, further comprising at least one of:
displaying the key information as highlights with different colors according to the category of the key information, wherein the category comprises at least one of a method, a category and a keyword;
and marking the key information into different colors according to the query frequency of the key information.
16. The method of any one of claims 1-7, wherein the method further comprises:
acquiring information to be inquired;
generating a new preset code segment according to the information to be inquired;
and storing the new preset code segment.
17. An automatic query device, the device comprising:
the first acquisition module is used for acquiring information to be inquired, wherein the information to be inquired is a code segment in a source code;
a second obtaining module, configured to obtain a relevant article set from a network according to the information to be queried and the crawler instruction set, where the relevant article set includes at least one relevant article;
and the determining module is used for determining a target article according to the relevant article set and a preset rule, and the target article is displayed on a second window of the editor program.
18. A client, the client comprising: a memory, a processor;
the memory is used for storing a computer program; the processor is configured to implement the automatic query method of any one of claims 1-16 in accordance with a computer program stored in the memory.
19. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, is adapted to carry out the automatic query method according to any one of claims 1 to 16.
20. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the automatic query method of any one of claims 1-16.
CN202110731091.6A 2021-06-30 2021-06-30 Automatic query method, device and equipment Active CN113176878B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110731091.6A CN113176878B (en) 2021-06-30 2021-06-30 Automatic query method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110731091.6A CN113176878B (en) 2021-06-30 2021-06-30 Automatic query method, device and equipment

Publications (2)

Publication Number Publication Date
CN113176878A true CN113176878A (en) 2021-07-27
CN113176878B CN113176878B (en) 2021-10-08

Family

ID=76927926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110731091.6A Active CN113176878B (en) 2021-06-30 2021-06-30 Automatic query method, device and equipment

Country Status (1)

Country Link
CN (1) CN113176878B (en)

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110173178A1 (en) * 2002-06-19 2011-07-14 Craig Conboy Method and system for obtaining script related information for website crawling
CN104199874A (en) * 2014-08-20 2014-12-10 哈尔滨工程大学 Webpage recommendation method based on user browsing behaviors
CN105512285A (en) * 2015-12-07 2016-04-20 南京大学 Self-adaption web crawler method based on machine learning
CN106681708A (en) * 2016-11-16 2017-05-17 中国科学院软件研究所 Automatic source code annotation generation method based on data mining
CN107577783A (en) * 2017-09-15 2018-01-12 电子科技大学 The type of webpage automatic identifying method excavated based on Web architectural features
US20190026443A1 (en) * 2017-07-24 2019-01-24 Wix.Com Ltd. Segregated user-uploaded plugins to avoid affecting co-hosted websites
CN109800019A (en) * 2018-12-17 2019-05-24 北京达佳互联信息技术有限公司 Code administration method, system, electronic equipment and computer readable storage medium
CN109976743A (en) * 2019-04-09 2019-07-05 苏州浪潮智能科技有限公司 A kind of method and device of code prompt
CN110347386A (en) * 2019-06-28 2019-10-18 北京淇瑀信息科技有限公司 A kind of method, apparatus and electronic equipment of the data visualization analysis based on SQL code editor
CN110399162A (en) * 2019-07-09 2019-11-01 北京航空航天大学 A kind of source code annotation automatic generation method
WO2019212873A1 (en) * 2018-05-03 2019-11-07 Microsoft Technology Licensing, Llc Difference view mode for integrated development environments
US20190354469A1 (en) * 2014-03-04 2019-11-21 International Business Machines Corporation Regression testing of sql execution plans for sql statements
CN110532019A (en) * 2019-06-27 2019-12-03 北京大学 A kind of method of software code fragment history retrospect
US20190391992A1 (en) * 2018-06-26 2019-12-26 Tata Consultancy Services Limited Methods and systems for performing a model driven domain specific search
CN111159361A (en) * 2019-12-30 2020-05-15 北京阿尔山区块链联盟科技有限公司 Method and device for acquiring article and electronic equipment
CN111177532A (en) * 2019-12-02 2020-05-19 平安资产管理有限责任公司 Vertical search method, device, computer system and readable storage medium
US20200364238A1 (en) * 2014-02-19 2020-11-19 Snowflake Inc. Push model for scheduling query plans
CN112596738A (en) * 2020-12-28 2021-04-02 北京字跳网络技术有限公司 Method and device for determining front-end page to be tested, storage medium and electronic equipment

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110173178A1 (en) * 2002-06-19 2011-07-14 Craig Conboy Method and system for obtaining script related information for website crawling
US20200364238A1 (en) * 2014-02-19 2020-11-19 Snowflake Inc. Push model for scheduling query plans
US20190354469A1 (en) * 2014-03-04 2019-11-21 International Business Machines Corporation Regression testing of sql execution plans for sql statements
CN104199874A (en) * 2014-08-20 2014-12-10 哈尔滨工程大学 Webpage recommendation method based on user browsing behaviors
CN105512285A (en) * 2015-12-07 2016-04-20 南京大学 Self-adaption web crawler method based on machine learning
CN106681708A (en) * 2016-11-16 2017-05-17 中国科学院软件研究所 Automatic source code annotation generation method based on data mining
US20190026443A1 (en) * 2017-07-24 2019-01-24 Wix.Com Ltd. Segregated user-uploaded plugins to avoid affecting co-hosted websites
CN107577783A (en) * 2017-09-15 2018-01-12 电子科技大学 The type of webpage automatic identifying method excavated based on Web architectural features
WO2019212873A1 (en) * 2018-05-03 2019-11-07 Microsoft Technology Licensing, Llc Difference view mode for integrated development environments
US20190391992A1 (en) * 2018-06-26 2019-12-26 Tata Consultancy Services Limited Methods and systems for performing a model driven domain specific search
CN109800019A (en) * 2018-12-17 2019-05-24 北京达佳互联信息技术有限公司 Code administration method, system, electronic equipment and computer readable storage medium
CN109976743A (en) * 2019-04-09 2019-07-05 苏州浪潮智能科技有限公司 A kind of method and device of code prompt
CN110532019A (en) * 2019-06-27 2019-12-03 北京大学 A kind of method of software code fragment history retrospect
CN110347386A (en) * 2019-06-28 2019-10-18 北京淇瑀信息科技有限公司 A kind of method, apparatus and electronic equipment of the data visualization analysis based on SQL code editor
CN110399162A (en) * 2019-07-09 2019-11-01 北京航空航天大学 A kind of source code annotation automatic generation method
CN111177532A (en) * 2019-12-02 2020-05-19 平安资产管理有限责任公司 Vertical search method, device, computer system and readable storage medium
CN111159361A (en) * 2019-12-30 2020-05-15 北京阿尔山区块链联盟科技有限公司 Method and device for acquiring article and electronic equipment
CN112596738A (en) * 2020-12-28 2021-04-02 北京字跳网络技术有限公司 Method and device for determining front-end page to be tested, storage medium and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
苏艺航 等: "基于Python爬虫的校园数据获取", 《电脑知识与技术》 *

Also Published As

Publication number Publication date
CN113176878B (en) 2021-10-08

Similar Documents

Publication Publication Date Title
US11409777B2 (en) Entity-centric knowledge discovery
US10942981B2 (en) Online publication system and method
US8874542B2 (en) Displaying browse sequence with search results
US10380197B2 (en) Network searching method and network searching system
US8954893B2 (en) Visually representing a hierarchy of category nodes
US9613003B1 (en) Identifying topics in a digital work
US9342233B1 (en) Dynamic dictionary based on context
US10210211B2 (en) Code searching and ranking
US9852217B2 (en) Searching and ranking of code in videos
KR20160106527A (en) System and method for online handwriting recognition in web queries
US20110191381A1 (en) Interactive System for Extracting Data from a Website
US11481733B2 (en) Automated interfaces with interactive keywords between employment postings and candidate profiles
Hsiao et al. Screenqa: Large-scale question-answer pairs over mobile app screenshots
CN114297143A (en) File searching method, file displaying device and mobile terminal
CN110489032B (en) Dictionary query method for electronic book and electronic equipment
CN113176878B (en) Automatic query method, device and equipment
CN111782958A (en) Recommendation word determining method and device, electronic device and storage medium
CN112579937A (en) Character highlight display method and device
US11921797B2 (en) Computer service for indexing threaded comments with pagination support
KR20100014116A (en) Wi-the mechanism of rule-based user defined for tab
CN111061863B (en) Journal catalog display method, device and equipment
Ma et al. A Template Independent Approach for Web News and Blog Content Extraction
CN117389538A (en) Page component content development method, device, equipment and storage medium
CN115358187A (en) Method and device for displaying hierarchy information and storage medium
CN115390953A (en) Information processing method, information processing device, electronic equipment and computer readable storage medium

Legal Events

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