简体   繁体   中英

Machine learning model

Can someone help me with the below requirement which is:

I want to build a model that should understand a piece of code and predict the programming language based on the code contents.

Any lead would be highly appreciated.

eg:

private int input = 0;
 
public int getter() {
   return input;
}
public void setter(int in) {
  input = in;
}

Output - Java

Thanks

Maybe use some pretrained language model to run on the test data. Test data can be some statements and the language they belong to and you can proceed as a classification task.

You can use N-grams to understand which keyword belongs to which language. You can check it out: ngram resource

You can find source codes by web scraping through GitHub. So, you can create a source code and programming language dataset by yourself. If you want to go deeper, there are books about this topic. programming language detection book

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM