-2
\$\begingroup\$

Challenge

You must write a program which correctly identifies the language a passage is written in.

Rules

The passage will be a string passed to your program either via STDIN or function arguments.

You may not use any external sources except for a local text file with words. The length of the text file must be included in your overall program length.

To know that your program meets the spec, it should correctly identify the languages of the following websites:

<code>.wikipedia.org/wiki/<Word for Wikipedia>
<code>.wikipedia.org/wiki/<Language name>

Where <code> is replaced by the language's code. For example, in English:

en.wikipedia.org/wiki/Wikipedia
en.wikipedia.org/wiki/English

For Lojban:

jbo.wikipedia.org/wiki/uikipidias
jbo.wikipedia.org/wiki/lojban.

You are strictly forbidden to hardcode any of the content or HTML code of the links.

To make sure that changes to the wiki don't affect your results, you should use the latest edit to the wiki page before the 15th August 2015, 21:00 BST (GMT+1).

If your language cannot identify the language in which the passage is written, you must return the following phrase:

Ich ne know pas

You can only identify languages which are on this list.

When you return the language name, you should return its English name, and in brackets its name in its own language.

In your answer, you should have a list of the languages that you identify.

Examples

French (Français)

Une baguette de pain ou simplement baguette, ou encore pain français (québécisme et belgicisme), est une variété de pain, reconnaissable à sa forme allongée. Cette forme de pain est emblématique de la France, et l'était déjà avant l'invention de la baguette, quand les pains longs étonnaient les visiteurs. La baguette est aussi typique de l'Algérie.

German (Deutsch)

Die Wurst war und ist auch heute noch das Produkt des Wunsches nach einer möglichst großen Verwertung eines (geschlachteten) Tieres. Durch die Verarbeitung zur Wurst kann so auch das Fleisch länger haltbar gemacht werden. Die ersten Würste, wenn auch nicht im heutigen Sinne, wurden vermutlich bereits in der Antike oder sogar schon vorher hergestellt; siehe dazu auch Haggis oder Saumagen. Erste chinesische Erwähnung findet sich um das Jahr 589 v. Chr. zu einer Wurst, bei der Lamm- und Ziegenfleisch verwendet wurden.

Welsh (Cymraeg)

Bara llaith o Gymru sy'n cynnwys cyrens, rhesins neu syltanas, croen candi, a sbeis melys yw bara brith. Gweinir yn dafellau gyda menyn gan amlaf, am de'r prynhawn neu de mawr. Teisen furum yw bara brith yn draddodiadol, ond mae nifer o ryseitiau modern yn defnyddio ychwanegion megis soda pobi i'w lefeinio.

English (English)

A steak pie is a traditional meat pie served in Britain. It is made from stewing steak and beef gravy, enclosed in a pastry shell. Sometimes mixed vegetables are included in the filling. In Ireland Guinness Stout is commonly added along with bacon and onions, and the result is commonly referred to as a Steak and Guinness Pie (or Guinness Pie for short). A Steak and Ale pie is a similar creation, popular in British pubs, using one of a variety of ales in place of the Guinness. The dish is often served with "steak chips" (thickly sliced potatoes fried, sometimes fried in beef dripping). Steak pies are also available from chip shops, served with normal chips, referred to in Scotland as a steak pie supper.

Scoring

Your score is the length in bytes of your program and any text files that you use divided by the number of languages that you support. The person with the lowest score wins.

score = (length of program + length of text file)/number of languages
\$\endgroup\$

closed as unclear what you're asking by Peter Taylor, qwr, Downgoat, lirtosiast, Alex A. Aug 15 '15 at 23:23

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ What do you mean by cannot identify? Most (all?) approaches would be probabilistic and if the input is in an unidentifiable language, the only thing that would happen would be that the probabilities for all the languages would be really low. \$\endgroup\$ – Maltysen Aug 15 '15 at 19:25
  • \$\begingroup\$ @Maltysen Why do you think it's probabilistic? \$\endgroup\$ – Beta Decay Aug 15 '15 at 19:27
  • \$\begingroup\$ en.wikipedia.org/wiki/Language_identification All of them involve making probability models on letters. Unless you were going for the angle of storing dictionaries for each language. Then it becomes a compression challenge. \$\endgroup\$ – Maltysen Aug 15 '15 at 19:34
  • \$\begingroup\$ You haven't yet addressed the issues raised in chat: what do you mean by "the languages of the following websites"? How are you going to ensure that changes to publicly editable wiki pages don't make answers which met the criteria cease to meet them? \$\endgroup\$ – Peter Taylor Aug 15 '15 at 19:42
  • \$\begingroup\$ @PeterTaylor Well I'd hope that the moderators of Wikipedia would keep the pages correct, especially for these pretty important pages \$\endgroup\$ – Beta Decay Aug 15 '15 at 19:49
4
\$\begingroup\$

///, 8

Correctly identifies one language, Twi. Uses no text file.

Twi[Twi]
\$\endgroup\$
  • \$\begingroup\$ How does this work? \$\endgroup\$ – Beta Decay Aug 15 '15 at 22:20
  • \$\begingroup\$ I don't know ///, but it was the first language I could find to directly output its source, and Twi is the shortest language name I could find. \$\endgroup\$ – lirtosiast Aug 15 '15 at 22:21
  • \$\begingroup\$ I see :P. Do you mind if I add a rule into the question? \$\endgroup\$ – Beta Decay Aug 15 '15 at 22:26
  • 1
    \$\begingroup\$ I don't mind, but if all you do is add one rule, a different trivial answer will win. \$\endgroup\$ – lirtosiast Aug 15 '15 at 22:40
  • \$\begingroup\$ It would be that the program has to fail on all languages which it isn't said to recognise \$\endgroup\$ – Beta Decay Aug 15 '15 at 22:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.