rgmf / pygiftparser Goto Github PK
View Code? Open in Web Editor NEWPython Moodle GIFT parser.
License: GNU Affero General Public License v3.0
Python Moodle GIFT parser.
License: GNU Affero General Public License v3.0
The parser doesn't work with escape character () to escape lexical characters.
The parser doesn't parse matching questions.
Added to the parser feedback option.
For now only this forma is accepted:
question {
list of answers one per line
}
GIFT files can has multiline questions like this:
[html]¿Qué elemento de red representa el siguiente símbolo?
<br>
<img width\="200" src\="https://3.bp.blogspot.com/-oEMazpptpR8/UWOET9aDYgI/AAAAAAAAAH0/XZFW7gxWrgI/s1600/Cisco-Router-Commands-images.jpg"/>
{
=%100%Router
=%100%Enrutador
}
Like you can see, open brace can begin in the line just below the question and the question has more than one line.
When answers are malformed then parser should trigger an error.
Space characters have to be removed from string questions and answers.
Parser doesn't accepts extra lines at the end of the file.
This https://docs.moodle.org/38/en/GIFT_format#Making_questions_case_sensitive is not covered.
Multiple choice with multiple right answers
That is, using checkboxes, not radio buttons:
What two people are entombed in Grant's tomb? {
~%-100%No one
~%50%Grant
~%50%Grant's wife
~%-100%Grant's father
}
When you import several files and there is an error in one of them then the question reference is wrong.
For example, in a file a.txt there is an error in question 3 but when you import several files like a.txt, b.txt and c.txt, for instance, then the parser informs the error is in question 85 instead of 3, for example.
There are not numerical questions in the example files.
When parser stumble upon a colon it fails because it's key work in the GIFT language (::).
When an answer is "matching answer" type then it must has at least three options.
The parser doesn't parse missing word questions.
In this example:
Está bien {}
Está bien
Este está mal {
Está bien {}
The error is: Syntax error at 'Está bien ' in question number 3.
So the number of question is good, 3, but not the context text "Está bien".
At this moment the parser doesn't accept category specification.
https://docs.moodle.org/38/en/GIFT_format#Specifying_Categories
Hi, thanks for your work, I tried to use this library for playing with different quiz formats and I discovered that not it doesn't support "general feedback" option for questions. Link to docs:
https://docs.moodle.org/400/en/GIFT_format#Format_symbols
####general feedback
In the quiz, it looks like this:
// question: 47 name: Algebraic Expressions
::Algebraic Expressions::[html]<p dir\="ltr" style\="text-align\: left;">Rate your knowledge on Algebraic Expressions</p>{
=<p dir\="ltr" style\="text-align\: left;">5</p>
=<p dir\="ltr" style\="text-align\: left;">4</p>
=<p dir\="ltr" style\="text-align\: left;">3</p>
=<p dir\="ltr" style\="text-align\: left;">2</p>
=<p dir\="ltr" style\="text-align\: left;">1</p>
####<p dir\="ltr" style\="text-align\: left;">Thanks for answer!</p>
}
And now it is parsed like this:
(=) Option: <p dir\="ltr" style\="text-align\: left;">5</p> [1.0]
(=) Option: <p dir\="ltr" style\="text-align\: left;">4</p> [1.0]
(=) Option: <p dir\="ltr" style\="text-align\: left;">3</p> [1.0]
(=) Option: <p dir\="ltr" style\="text-align\: left;">2</p> [1.0]
(=) Option: <p dir\="ltr" style\="text-align\: left;">1</p> [1.0] (###<p dir\)
(=) Option: "ltr" style\="text-align\: left;">Thanks for answer!</p> [1.0]
[HTML also seems to be not supported straight out of the box, but I roughly fix it after parsing. Maybe better to fix it in preprocessing, but it's not so easy]
This seems like not a big issue, but I'm stuck with adding new regexp or modifying existing ones. Could you help me?
command python -m unittest discover -v -s tests/.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.