# US 2021/0342357 A1 · Command-line script generation with relevance search

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0342357 A1
- Document ID: US20210342357A1
- Status: Published application
- Kind: A1
- Application number: 16/865,252
- Filed: 2020-05-01
- Published: 2021-11-04
- Earliest claimed: 2020-05-01
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC.
- Inventors: SPANDAN GARG; YEVHEN MOHYLEVSKYY; JASON R. SHAVER; NEELAKANTAN SUNDARESAN; ROSHANAK ZILOUCHIAN MOGHADDAM
- Web page: https://patentgrep.com/patent/US20210342357A1

## CPC

- G06F 9/45512: {Command shells}
- G06F 8/30: Creation or generation of source code
- G06F 8/31: {Programming languages or programming paradigms}
- G06F 16/243: {Natural language query formulation}
- G06F 16/24578: {using ranking}
- G06F 18/22: Matching criteria, e.g. proximity measures
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A term-weighting and document-scoring function is used to search for a command line interface (CLI) script that is likely relevant to an operation specified in a natural language query. CLI scripts are created to perform various operations of a CLI-based application. A CLI script is associated with a description document having keywords associated with the individual commands used in the CLI script. The relevance of a CLI script to an intended operation is based on the term-weighting and document-scoring function which is applied to each component of each command in a CLI script and weighted accordingly.

## Claims

### Claim 1

A system comprising:
one or more processors coupled to a memory; and
one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions that:
provide command-line interface (CLI) scripts, a CLI script having one or more commands that when executed perform an operation in a CLI-based application, a CLI script associated with a description document that contains keywords for each command in the CLI script;
receive a natural language query;
find one or more CLI scripts relevant to the natural language query through generation of a relevance score for each CLI script, the relevance score based on an estimation of terms in the natural language query matching keywords in the description document of each CLI script; and
return a select number of CLI scripts having a highest relevance score.

### Claim 2 (depends on 1)

The system of claim 1, wherein the one or more programs include further instructions that:
partition the commands of a CLI into multiple components; and
derive a relevance score for each component of a command in the CLI script.

### Claim 3 (depends on 2)

The system of claim 2, wherein the one or more programs include further instructions that:
apply a weight to the relevance score of at least one component; and
compute the relevance score for a CLI script as a weighted sum of relevance scores of each component of each command within a CLI script.

### Claim 4 (depends on 1)

The system of claim 1, wherein the relevance score is based on a term-weighting and document-scoring function.

### Claim 5 (depends on 1)

The system of claim 1, wherein the relevance score is based on a Best Match 25 score.

### Claim 6 (depends on 1)

The system of claim 1, wherein the one or more programs include further instructions that:
obtain telemetry data from multiple user sessions;
determine a portion of the telemetry data pertaining to a first user session; and
aggregate commands in the portion of the telemetry data using similar resources into a CLI script.

### Claim 7 (depends on 1)

The system of claim 1, wherein the one or more programs include further instructions that:
generate the keywords of the description document from documentation of the CLI.

### Claim 8

A method, comprising:
providing a plurality of command-line interface (CLI) scripts, a CLI script having an ordered sequence of one or more commands, a command associated with one or more related components;
searching for a command-line interface (CLI) script relevant to a query by calculating a relevance score for each CLI script, the relevance score for a CLI script including a relevance score for each command in the CLI script; and
selecting one or more CLI scripts having a highest relevance score.

### Claim 9 (depends on 8)

The method of claim 8, further comprising:
calculating the relevance score for a CLI script as a sum of a plurality of relevance scores, the plurality of relevance scores including a relevance score of the command and relevance scores of the related components of the command, wherein a relevance score is based on a frequency of occurrence of keywords in the query in description documents pertaining to the command and the related components of the command.

### Claim 10 (depends on 9)

The method of claim 9, wherein the relevance score of the CLI script is based on a frequency of occurrence of the CLI script derived from a training dataset used to generate the plurality of CLI scripts.

### Claim 11 (depends on 9)

The method of claim 9, further comprising:
applying a weight to one or more of the plurality of relevance scores.

### Claim 12 (depends on 8)

The method of claim 8, wherein the relevance score is based on a Best Matching 25 function.

### Claim 13 (depends on 9)

The method of claim 9, further comprising:
obtaining telemetry data from production runs of a CLI-based application;
extracting a sequence of commands initiated during a user session from the telemetry data; and
generating a CLI script from the extracted sequence of commands.

### Claim 14 (depends on 13)

The method of claim 13, further comprising:
aggregating CLI scripts within similar commands into a unique CLI script; and
associating a frequency count with the unique CLI script representing a number of aggregated CLI scripts.

### Claim 15 (depends on 13)

The method of claim 13, further comprising:
associating a description document for each command in the generated CLI script.

### Claim 16

A device, comprising:
at least one processor and memory;
wherein the at least one processor is configured to:
receive a query for a command-line interface (CLI) script to perform an operation on a CLI-based application;
obtain a plurality of CLI scripts, a CLI script having an ordered sequence of one or more commands, a command associated with one or more related components of a command structure of the CLI-based application, a CLI script associated with a set of keywords for each command in the CLI script;
generate a relevance score for each CLI script, the relevance score estimating a relevance of the CLI script for the query, the relevance score based on a frequency of occurrence of keywords in the query with the set of keywords of each command in the CLI script; and
select one or more CLI scripts having a highest relevance score.

### Claim 17 (depends on 16)

The device of claim 16, wherein the relevance score for each CLI script is a sum of relevance scores of each command in a CLI script.

### Claim 18 (depends on 17)

The device of claim 17, wherein the relevance score for each command in a CLI script includes a relevance score for each related component of the command.

### Claim 19 (depends on 16)

The device of claim 16, wherein the at least one processor is further configured to:
generate a CLI script from the plurality of scripts from a sequence of commands issued within a user session, wherein the sequence of commands operate on a common set of resources.

### Claim 20 (depends on 16)

The device of claim 16, wherein the relevance score is based on a term-weighting and document scoring function.
