CodEx-Introduction: Difference between revisions
No edit summary |
(codex discontinued) |
||
(19 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
When reading this page, you've probably already gone a long way in learning about machine translation. Nice work! | |||
Our MT Talks are occasionally complemented with programming exercises. We invite you (and strongly recommend) to go beyond watching our videos and try solving some or all of these exercises. Pick a programming language from our choice, write the short program and submit it to our system for evaluation -- a set of fully automatic tests. | |||
The exercises are implemented in The Code Examiner ('''CodEx''', https://codex3.ms.mff.cuni.cz/codex-trans/). | |||
'''UNFORTUNATELY, CODEX HAS BEEN REPLACED WITH A NEWER VERSION''' but we don't have the capacity to redo our exercises in the new version. Please get in touch if you would be able to help us in porting the old exercises. | |||
This page briefly describes how to use CodEx in general: | |||
* How to get a CodEx account | * How to get a CodEx account | ||
Line 8: | Line 14: | ||
* How to submit a solution for evaluation | * How to submit a solution for evaluation | ||
The individual exercises are described both in the CodEx system, as well as on the corresponding MT talk page here. | |||
== How to get a CodEx account == | == How to get a CodEx account == | ||
Line 22: | Line 28: | ||
=== For non-CUNI students === | === For non-CUNI students === | ||
Please send an email to [mailto:mttalks@ufal.mff.cuni.cz?Subject=Request%20for%20CodEx%20account | Please send an email to [mailto:mttalks@ufal.mff.cuni.cz?Subject=Request%20for%20MT%20Talks%20CodEx%20account&body=Hello!%0D%0A%0D%0APlease%20create%20a%20CodEx%20account%20for%20me.%0D%0A%0D%0AMy%20name:%09%0D%0AInstitution:%09%0D%0A%0D%0A%20Thank%20you. mttalks@ufal.mff.cuni.cz] mentioning your name and institution to request an account. He will create the account for you and add it to '''MT talks''' CodEx group right away. | ||
== How to login and join a group == | == How to login and join a group == | ||
Line 29: | Line 34: | ||
[[File:codex-welcome-page.png|thumb|200px|'''Codex Welcome''']] | [[File:codex-welcome-page.png|thumb|200px|'''Codex Welcome''']] | ||
Once you have your login alias/password, come back to the login page: https://codex3.ms.mff.cuni.cz/codex-trans. After logging in, you are directed to the welcome page which displays all | Once you have your login alias/password, come back to the login page: https://codex3.ms.mff.cuni.cz/codex-trans. After logging in, you are directed to the welcome page which displays all documentation and news related to your account. | ||
In the left hand column, there is an internal link '''group'''. It directs to the list of all groups that you could join. When you join a group, you are responsible to do all the exercises of the group. | |||
[[File:codex-group.png|thumb|200px|'''List of groups''']] | [[File:codex-group.png|thumb|200px|'''List of groups''']] | ||
For | For MT talks exercises, please join the group '''MT talks''' if you have not done it yet (shown in picture: list of groups). | ||
== How to pick an exercise, solve it and submit your solution == | |||
== How to pick, solve and submit | |||
After joining a group, you are able to see all the exercises assigned to that group. | After joining a group, you are able to see all the exercises assigned to that group. | ||
In the left-handed sidebar, under '''group -> task''', there are three options: ''specification, new submit, submits''. They mean ''read the specification, submit a new solution'' and ''manage old submissions'', respectively. | |||
[[File:codex-submit.png|thumb|200px|'''Submit a new solution''']] | [[File:codex-submit.png|thumb|200px|'''Submit a new solution''']] | ||
[[File:codex-eval.png|thumb|200px|'''Manage your submissions''']] | [[File:codex-eval.png|thumb|200px|'''Manage your submissions''']] | ||
For every exercise, please read the specification carefully. You are | For every exercise, please read the specification carefully. You are asked to write a complete program (not just a function). You can pick any of these programming languages: ''Pascal, C, C++, C#, Haskell, Python and Java'' | ||
Your solution has to fit in one single file and process standard input to standard output. | |||
To submit a solution, there are two ways: | To submit a solution, there are two ways: | ||
* Upload from text area: You write your solution into the text box, select the extension according to your programming language, then submit. | * Upload from text area: You write your solution into the text box directly on the web page, select the extension according to your programming language, then submit. | ||
* Upload from file: Simply write your solution into a file with an appropriate extension and submit | * Upload from file: Simply write your solution into a file with an appropriate extension, upload and submit it. | ||
In the evaluation process, your program is run several times with several | In the evaluation process, your program is run several times with several inputs to validate the correctness. There are also built-in time and memory limits, which any sensible solution should easily meet. You will pass the exercise if your program passes a given number of these tests, we generally require to pass all the tests. | ||
In the left-handed sidebar, under '''group''', there are links to page '''results''' and '''bonus points''' where you can keep track of your results throughout the course. | |||
=== Example === | === Example === | ||
Exercise '''Hello World!''': Your task is to write a program which | Exercise '''Hello World!''': Your task is to write a program which reads names of people and says 'Hello' to each of them. Each input line should be turned into a greeting. | ||
'''Input''': sample.in | '''Input''': << standard input >> < sample.in | ||
John | John | ||
Marry | Marry | ||
Marry and Kate | Marry and Kate | ||
'''Ouput'': <<standard output | '''Ouput''': <<standard output >> | ||
Hello John! | Hello John! | ||
Hello Marry! | Hello Marry! | ||
Hello Marry and Kate! | Hello Marry and Kate! | ||
''' Sample solution''': Read the input file line-by-line, trim the string, concatenate the line with "Hello " and "!" then print it. | ''' Sample solution''': Read the input file line-by-line, trim the string, concatenate the line with "Hello " and "!" then print it. | ||
Line 82: | Line 85: | ||
if __name__ == '__main__': | if __name__ == '__main__': | ||
for line in fileinput.input(): | for line in fileinput.input(): | ||
print "Hello | print "Hello " + line.strip() + "!" | ||
To test it manually, run: ./helloworld.py sample.in | |||
'''Java''' | '''Java''' | ||
import java.io. | import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | |||
import java.io.IOException; | import java.io.IOException; | ||
public class | public class CodEx{ | ||
public static void main(String[] args) { | public static void main(String[] args) { | ||
BufferedReader br = null; | BufferedReader br = null; | ||
try { | try { | ||
br = new BufferedReader(new | br = new BufferedReader(new InputStreamReader(System.in)); | ||
String line; | String line; | ||
while ((line = br.readLine()) != null) { | while ((line = br.readLine()) != null) { | ||
Line 102: | Line 108: | ||
} | } | ||
} | } | ||
To test it manually, run: javac CodEx.java; java CodEx < sample.in | |||
'''Note''': If you choose Java to be your programming language, your program must not declare any package, the main class must be "CodEx". For CodEx limitiations for other languages, please read the CodEx manual. |
Latest revision as of 11:34, 23 May 2019
When reading this page, you've probably already gone a long way in learning about machine translation. Nice work!
Our MT Talks are occasionally complemented with programming exercises. We invite you (and strongly recommend) to go beyond watching our videos and try solving some or all of these exercises. Pick a programming language from our choice, write the short program and submit it to our system for evaluation -- a set of fully automatic tests.
The exercises are implemented in The Code Examiner (CodEx, https://codex3.ms.mff.cuni.cz/codex-trans/).
UNFORTUNATELY, CODEX HAS BEEN REPLACED WITH A NEWER VERSION but we don't have the capacity to redo our exercises in the new version. Please get in touch if you would be able to help us in porting the old exercises.
This page briefly describes how to use CodEx in general:
- How to get a CodEx account
- How to login to CodEx
- How to pick a task to solve
- How to submit a solution for evaluation
The individual exercises are described both in the CodEx system, as well as on the corresponding MT talk page here.
How to get a CodEx account
Before venturing your journey though all the tasks, you need to get an account. There are two options to obtain an account in CodEx
For CUNI students
Please access the SIS registration page: https://codex3.ms.mff.cuni.cz/codex-trans/?module=sisregistration. You will be asked to verify your account, then click verify. If everything is fine, you could proceed to create your own account by following the instruction.
For non-CUNI students
Please send an email to mttalks@ufal.mff.cuni.cz mentioning your name and institution to request an account. He will create the account for you and add it to MT talks CodEx group right away.
How to login and join a group
Once you have your login alias/password, come back to the login page: https://codex3.ms.mff.cuni.cz/codex-trans. After logging in, you are directed to the welcome page which displays all documentation and news related to your account.
In the left hand column, there is an internal link group. It directs to the list of all groups that you could join. When you join a group, you are responsible to do all the exercises of the group.
For MT talks exercises, please join the group MT talks if you have not done it yet (shown in picture: list of groups).
How to pick an exercise, solve it and submit your solution
After joining a group, you are able to see all the exercises assigned to that group. In the left-handed sidebar, under group -> task, there are three options: specification, new submit, submits. They mean read the specification, submit a new solution and manage old submissions, respectively.
For every exercise, please read the specification carefully. You are asked to write a complete program (not just a function). You can pick any of these programming languages: Pascal, C, C++, C#, Haskell, Python and Java
Your solution has to fit in one single file and process standard input to standard output.
To submit a solution, there are two ways:
- Upload from text area: You write your solution into the text box directly on the web page, select the extension according to your programming language, then submit.
- Upload from file: Simply write your solution into a file with an appropriate extension, upload and submit it.
In the evaluation process, your program is run several times with several inputs to validate the correctness. There are also built-in time and memory limits, which any sensible solution should easily meet. You will pass the exercise if your program passes a given number of these tests, we generally require to pass all the tests.
In the left-handed sidebar, under group, there are links to page results and bonus points where you can keep track of your results throughout the course.
Example
Exercise Hello World!: Your task is to write a program which reads names of people and says 'Hello' to each of them. Each input line should be turned into a greeting.
Input: << standard input >> < sample.in
John Marry Marry and Kate
Ouput: <<standard output >>
Hello John! Hello Marry! Hello Marry and Kate!
Sample solution: Read the input file line-by-line, trim the string, concatenate the line with "Hello " and "!" then print it.
Python
#!/usr/bin/env python import fileinput if __name__ == '__main__': for line in fileinput.input(): print "Hello " + line.strip() + "!"
To test it manually, run: ./helloworld.py sample.in
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class CodEx{ public static void main(String[] args) { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = br.readLine()) != null) { System.out.println("Hello " + line + "!"); } } catch (IOException e) { e.printStackTrace(); } } }
To test it manually, run: javac CodEx.java; java CodEx < sample.in
Note: If you choose Java to be your programming language, your program must not declare any package, the main class must be "CodEx". For CodEx limitiations for other languages, please read the CodEx manual.