Language Detector

Problem #363

Tags: special c-1 practical lua

Who solved this?

No translations... yet

This task should be implemented in Lua to allow server to run and test the solution. Please check these useful links: Quick Introduction on Lua and online Lua sandbox. Also perhaps start with simpler problems, like Hurkle.

As you may have already found, this web-site tries to automatically recognize the language in which solution is written by user, but is not always doing this correctly.

You now have a chance to try creating better algorithm yourself :)

Write a function in Lua taking a text (program source code) and tells in which language this program is written. In the simplest form it may look like this:

function lang_detect(prog)
    return 'py'
end

You'll see, the checker tests your function against 21 sources - and to succeed we want at least 15 correct guesses. Your function should recognize these seven languages:

Test sources are all picked from various user's submissions to several problems - so you probably may want to have a look at some random submissions for test data to train your algorithm.

That's all, good luck!

You need to login to get test data and submit solution.