WOLFRAM

"ProgrammingLanguage" (Built-in Classifier)

Recognize the programming language of a code snippet.

Classes

Details

  • This classifier assumes the string input is written in a unique programming language. The probabilities reflect the belief in which language the program is written, not the proportion of languages.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Determine the language of a given code:

Out[1]=1

Obtain the probabilities for the most likely classes:

Out[2]=2

Obtain a ClassifierFunction for this classifier:

Out[1]=1

Apply the classifier to a code snippet:

Out[2]=2

Scope  (1)Survey of the scope of standard use cases

Load the ClassifierFunction corresponding to the built-in classifier:

Out[1]=1

Obtain the possible classes:

Out[2]=2

Options  (2)Common values & functionality for each option

ClassPriors  (1)

Use a custom ClassPriors to restrict the possible outputs:

Out[1]=1

IndeterminateThreshold  (1)

Use a custom IndeterminateThreshold:

Out[1]=1

Neat Examples  (1)Surprising or curious use cases

Obtain different possible languages with their corresponding probabilities:

Visualize the result using WordCloud:

Out[2]=2