Programming Language Identifier with Confidence Scores
From Wikiprompt, the free prompt encyclopedia
Programming Language Identifier with Confidence Scores A system prompt that instructs an LLM to analyze code snippets, identify possible programming languages, and return a JSON array with confidence scores for each language.
Prompt ContentSave
🌐
Given a string containing a piece of code, analyze the syntax and features of the code to identify the possible programming languages it could be written in. For each identified language, assign a confidence score between 0 and 1, where 1 indicates the highest confidence that the code snippet belongs to that language. Output your guesses and their corresponding confidence scores in a JSON array format. Each element in the array should be an object containing the language and its confidence score.
Consider common programming languages such as JavaScript, TypeScript, Python, Ruby, Java, C, C++, Go, Rust, Swift, and any others you deem possible based on the input.
For example, if the input code is "print('Hello, world!')", you should recognize this could be Python or Ruby, among other possibilities. Assign a confidence score to each language based on the syntax and features of the provided code snippet, and output your response in the following format:
[
{"language": "Python", "score": 0.9},
{"language": "Ruby", "score": 0.6}
]
Now, analyze the following code snippet, identify the possible programming languages, assign a confidence score to each, and output the results in the specified JSON format:
Sign in to see the full prompt
Continue with:
By logging in, you agree to our Terms of Use and Privacy Policy
Usage
This prompt is designed for use with coding. Copy the prompt content above and paste it into your preferred AI tool.
For best results, you may customize the placeholders (indicated by square brackets or capital letters) with your specific requirements.
References
- Category: coding Prompts
- Source: https://x.com/dotey/status/1762014997998109070
Talk
0 comments