Content-Based Textual File Type Detection at Scale
Not on the map. Why?
Abstract (arXiv)
Programming language detection is a common need in the analysis of large source code bases. It is supported by a number of existing tools that rely on several features, and most notably file extensions, to determine file types. We consider the problem of accurately detecting the type of files commonly found in software code bases, based solely on textual file content. Doing so is helpful to classify source code that lack file extensions (e.g., code snippets posted on the Web or executable scripts), to avoid misclassifying source code that has been recorded with wrong or uncommon file extensions, and also shed some light on the intrinsic recognizability of source code files. We propose a simple model that (a) use a language-agnostic word tokenizer for textual files, (b) group tokens in 1-/2-grams, (c) build feature vectors based on N-gram frequencies, and (d) use a simple fully connected neural network as classifier. As training set we use textual files extracted from GitHub repositories with at least 1000 stars, using existing file extensions as ground truth. Despite its simplicity the proposed model reaches 85% in our experiments for a relatively high number of recognized classes (more than 130 file types).
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 6 of its 41 references that are in the map. First posted on arXiv 21 Jan 2021.
Builds on
6 of 41 references.
References · 6
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2017Comparative Study of CNN and RNN for Natural Language Processingcited by 81
- 2018What's in a GitHub Star? Understanding Repository Starring Practices in a Social Coding Platformcited by 25
- 2014A Comparative Study of Programming Languages in Rosetta Codecited by 19
- 2019On the Impact of Programming Languages on Code Qualitycited by 6
Built on by
Not cited yet.