-
Notifications
You must be signed in to change notification settings - Fork 1
Better Branch Names #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Within CodeEdit here https://github.com/octaviuslabs/walter/blob/main/src/code-generator.ts#L240 we need to return a short super descriptor of the code changes that can be used in a branch name. Any thoughts on what we can do? |
Queued for processing... |
To generate a short super descriptor of the code changes that can be used in a branch name, you can use the following steps in pseudocode:
Here's the pseudocode for the solution:
You can integrate this pseudocode into the |
What natural language processing technique are you thinking for the extraction? |
Queued for processing... |
For extracting the main action or intent from the action string, you can use the following natural language processing techniques:
Here's a simple pseudocode for keyword extraction using spaCy:
Here's a simple pseudocode for extractive summarization using Gensim's TextRank:
Please note that these techniques might require additional preprocessing of the action string, like converting it to lowercase, removing special characters, and tokenizing the text. You can choose the technique that best fits your requirements and available resources. |
Is this possible in typescript? |
Queued for processing... |
Yes, it is possible to implement natural language processing techniques in TypeScript. You can use the following libraries for this purpose:
Here's a simple example of keyword extraction using import * as nlp from 'compromise';
function extractMainAction(actionString: string): string {
const doc = nlp(actionString);
const keywords = doc
.nouns()
.concat(doc.verbs())
.out('array');
const mainAction = keywords.join('-');
return mainAction;
}
Here's a simple example of text summarization using the Hugging Face API and import axios from 'axios';
async function extractMainAction(actionString: string): Promise<string> {
const response = await axios.post(
'https://api-inference.huggingface.co/models/t5-small',
{
inputs: `summarize: ${actionString}`,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer YOUR_API_KEY`,
},
}
);
const summary = response.data[0].generated_text;
const mainAction = summary.replace(/\s+/g, '-');
return mainAction;
} Please note that you need to replace Keep in mind that using external libraries or APIs may have an impact on the performance and resource usage of your application. Choose the approach that best fits your requirements and available resources. |
what about the openai api? |
Queued for processing... |
You can use the OpenAI API to perform text summarization or extract the main action from the action string using GPT-3. To do this in TypeScript, you can use the Here's a simple example of text summarization using the OpenAI API and import axios from 'axios';
async function extractMainAction(actionString: string): Promise<string> {
const response = await axios.post(
'https://api.openai.com/v1/engines/davinci-codex/completions',
{
prompt: `summarize: ${actionString}`,
max_tokens: 20,
n: 1,
stop: null,
temperature: 0.5,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer YOUR_API_KEY`,
},
}
);
const summary = response.data.choices[0].text;
const mainAction = summary.trim().replace(/\s+/g, '-');
return mainAction;
} Please note that you need to replace Before using the OpenAI API, make sure you have an API key and are aware of the usage limits and costs associated with it. You can find more information about the OpenAI API and GPT-3 in the official documentation. |
No description provided.
The text was updated successfully, but these errors were encountered: