Invention content
The present invention is a kind of examination question of the online education website based on SSH batch of proposition in place of the shortcomings of the prior art
Method for uploading is measured, on the basis of word upload modes, need not provide the format for uploading document, so that it may with intelligence, accurately
The examination question in document is parsed, uploading operation is completed, to reduce the workload of editorial staff, improves efficiency.
The present invention is to solve technical problem to adopt the following technical scheme that:
A kind of examination question batch method for uploading of the online education website based on SSH of the present invention, in the online education website
Including exam pool and server, its main feature is that, the examination question batch method for uploading is to carry out as follows:
Step 1 edits four kinds of examination question types in word document, including:Multiple-choice question, gap-filling questions, True-False and question-and-answer problem;
The multiple-choice question includes selection stem and option;
The gap-filling questions include gap-filling questions stem and spcial character;The spcial character includes underscore and round parentheses;
The True-False includes True-False stem and end round parentheses;
The question-and-answer problem includes question-and-answer problem stem;
Four kinds of step 2, server storage interpretive models, including:First interpretive model, the second interpretive model, third
Interpretive model and the 4th interpretive model;
First interpretive model is headed by the combination of letter and punctuation mark or headed by the combination of bracket and letter
Or the form headed by letter and space, indicate the option of multiple-choice question;
Second interpretive model is to carry bracket and the sentence tail in multiple spaces for punctuation mark or comprising underscore and sentence
Tail is the form of punctuation mark, indicates gap-filling questions stem;
The third interpretive model be using the bracket with multiple spaces as sentence tail in the form of, indicate True-False stem;
4th interpretive model is alphabetical or with the combination of letter and punctuation mark or with the combination of bracket and letter
Form indicates the option letter of multiple-choice question;
The word document is uploaded in the online education website by step 3;
Step 4, the server read the word document and carry out segment processing, obtain n paragraph and are sequentially stored into
In array arr [n];
Step 5, define cyclic variable i and j, option-argument C, separator W, examination question type chained list T, examination question stem chained list S,
Examination question option chained list L and identifier flag;It defines flag=1 and indicates that multiple-choice question, flag=2 indicate that gap-filling questions, flag=3 indicate
True-False, flag=4 indicate question-and-answer problem;
Step 6, initialization i=1;
Step 7, the server read arr [i], and judge whether i=1 is true, if so, arr [i] is then stored in institute
It states in examination question stem chained list S;And step 8 is executed, otherwise, execute step 11;
Step 8 judges whether arr [i] is gap-filling questions stem using second interpretive model;If gap-filling questions stem,
Then flag=2;And execute step 10;Otherwise, step 9 is executed;
Step 9 judges whether arr [i] is True-False stem using third interpretive model, if True-False stem, then enable
Flag=3;Otherwise, flag=4 is enabled;
Step 10, after i+1 is assigned to i, return to step 7 execute, until i > n after, execute step 19;
Step 11 judges whether arr [i] is the option of multiple-choice question using the first interpretive model, if so, flag=1 is enabled,
And execute step 12;Otherwise, step 17 is executed;
Arr [i] is split by step 12 according to space, obtains m paragraph dia [m];
Step 13, initialization j=1;
Step 14, judged using the 4th interpretive model j-th paragraph dia [j] whether be multiple-choice question option letter;If
It is that then separator W and j-th of paragraph dia [j] are added to together in option-argument C;Otherwise, j-th of paragraph dia [j] is added
It is added in option-argument C;
Step 15, after j+1 is assigned to j, return to step 14 execute, until j > m;
Step 16, after i+1 is assigned to i, return to step 7 execute, until i > n after, execute step 19;
Flag is stored in examination question type chained list T, and judges whether flag=1 is true by step 17, if so, it then will choosing
Item variable C is stored in the examination question option chained list L, and otherwise, null value is stored in the examination question option chained list L;
Arr [i] is stored in the examination question stem chained list S by step 18, and return to step 8 executes;
Step 19, traversal examination question type chained list T, examination question stem chained list S and examination question option chained list L, obtain each examination respectively
Type, stem and the option of topic are simultaneously stored in the exam pool, and the batch to complete examination question uploads.
Compared with prior art, the beneficial effects of the present invention are:
1, the present invention obtains all paragraphs, the solution defined whether is matched according to paragraph by reading document to server
Analysis pattern is carried out True-False purpose type, and is stored to inside database;To overcome uploaded one by one in conventional method it is inefficient
Rate problem reduces the time for uploading examination question, while overcoming and editing inconvenient problem in excel upload modes, solves existing
There is document in word upload modes to have to comply with certain regular problem, has intelligently parsed document, improved efficiency.
2, the present invention defines comprehensive interpretive model by the feature of all topic types of summary, where judges each paragraph matching
A pattern, so that accurately True-False purpose type, realizes intelligence, accurately parses document.
3, the present invention obtains paragraph array, and lead to by dividing the paragraph for including multiple options using space as separator
Cross interpretive model judge each paragraph whether be option letter part, to make corresponding processing, and then obtain correct
Option portion, solve the case where multiple options are placed on a paragraph in word document and space occur in single option
Situation ensure that the correctness of parsing.
Specific implementation mode
Include exam pool and server, a kind of online education website based on SSH in online education website in the present embodiment
Examination question batch method for uploading be:First, four kinds of interpretive models are defined;Secondly, it uploads document and obtains all paragraphs;Then,
Judge examination question type by interpretive model, if True-False, parses multiple-choice question option portion;Again, the type of per pass examination question,
Stem, option (if having) are put into corresponding chained list, are finally traversed chained list and are stored and arrive database.Specifically, it is by following step
It is rapid to carry out:
Step 1 edits four kinds of examination question types in word document, including:Multiple-choice question, gap-filling questions, True-False and question-and-answer problem;
Multiple-choice question includes selection stem and option;
Gap-filling questions include gap-filling questions stem and spcial character;Spcial character includes underscore and round parentheses;
True-False includes True-False stem and end round parentheses;
Question-and-answer problem includes question-and-answer problem stem;
Four kinds of step 2, server storage interpretive models, including:First interpretive model, the second interpretive model, third parsing
Pattern and the 4th interpretive model;
First interpretive model is headed by the combination of letter and punctuation mark or headed by the combination of bracket and letter or word
Form headed by female and space, indicates the option of multiple-choice question;
Second interpretive model is the bracket with multiple spaces and sentence tail is punctuation mark or comprising underscore and sentence tail is
The form of punctuation mark indicates gap-filling questions stem;
Third interpretive model be using the bracket with multiple spaces as sentence tail in the form of, indicate True-False stem;
4th kind of analysis pattern be letter or by letter and punctuation mark combination or by bracket and letter combination in the form of,
Indicate the option letter of multiple-choice question;
Through analysis, the option of multiple-choice question is started in the form of shaped like four kinds of " A. ", " A, ", " A) " and " (A) ", therefore the
One interpretive model is used for judging the option of multiple-choice question;Can include the form shaped like " () " or " _ _ _ _ _ " in gap-filling questions, so can
With using the second interpretive model to determine whether being for gap-filling questions stem;True-False is ended up in the form of shaped like " () ", institute
Third interpretive model can be utilized to determine whether True-False;And the 4th interpretive model can be explained in step 12.
Word document is uploaded in online education website by step 3;
Step 4, server read word document and carry out segment processing, obtain n paragraph and are sequentially stored into array arr
In [n];
Step 5, define cyclic variable i and j, option-argument C, separator W, examination question type chained list T, examination question stem chained list S,
Examination question option chained list L and identifier flag;It defines flag=1 and indicates that multiple-choice question, flag=2 indicate that gap-filling questions, flag=3 indicate
True-False, flag=4 indicate question-and-answer problem;
The respective option of multiple-choice question is connected by separator W and is stored in option-argument C, and examination question is being read simultaneously from exam pool
When display, the respective option can be obtained by dividing option-argument C by separator W.
Step 6, initialization i=1;
Step 7, server read arr [i], and judge whether i=1 is true, if so, then by arr [i] deposit examination question topics
In dry chained list S;And step 8 is executed, otherwise, execute step 11;
First paragraph of Word document must be the stem part of the first topic, it is possible to directly the first paragraph be stored in and tried
It inscribes in stem chained list, and judges its type, such as step 8, shown in 9;If not the first paragraph, then may be multiple-choice question option portion
The either stem of one of examination question, so to be judged, as shown in step 11.
Step 8 judges whether arr [i] is gap-filling questions stem using the second interpretive model;If gap-filling questions stem, then
Flag=2;And execute step 10;Otherwise, step 9 is executed;
Step 9 judges whether arr [i] is True-False stem using third interpretive model, if True-False stem, then enable
Flag=3;Otherwise, flag=4 is enabled;
Step 10, after i+1 is assigned to i, return to step 7 execute, until i > n after, execute step 19;
Step 11 judges whether arr [i] is the option of multiple-choice question using the first interpretive model, if so, flag=1 is enabled,
And execute step 12;Otherwise, step 17 is executed;
Arr [i] is split by step 12 according to space, obtains m paragraph dia [m];
Because that may include multiple options in a paragraph, be divided again by space between the respective option, so logical
Space is crossed to divide array arr [i], obtains multiple paragraphs, and handled accordingly.
Step 13, initialization j=1;
Step 14, judged using the 4th interpretive model j-th paragraph dia [j] whether be multiple-choice question option letter;If
It is that then separator W and j-th of paragraph dia [j] are added to together in option-argument C;Otherwise, j-th of paragraph dia [j] is added
It is added in option-argument C;
Because might have space in an option, simply multiple paragraphs cannot be connected together, but
Corresponding processing is done by the way that judgement is the option letter of an option.The 4th interpretive model in step 2 is exactly to sentence
Disconnected option letter, if dia [j] be using shaped like " A) ", " (A ", " (A) ", " A, ", " A. " as starting or an only word
It is female, then it is assumed that be option letter, then separator W and dia [j] are added to option-argument C, otherwise dia [j] is not option
Letter, but the content part of an option, then be directly added to option-argument C by dia [j].For example, in following examination question
11. certain row in taking-up relationship, and the relational calculus for eliminating the tuple of repetition is known as ()
A takes column operations B. project C. connection operation D. Selecting operations
The paragraph array obtained after being split using space is that { [A. takes column operations], [B], [project], [C. connects
Connect operation], [D.], [Selecting operation], pass through the 4th interpretive model, it is known that [A. takes column operations], [B], [C. connections operation] and
[D.] is option letter, and [project] and [Selecting operation] are not, so obtained option-argument C, which is WA., takes column operations
W B. project W C. connection operation W D. Selecting operations, to correctly parse the respective option.
Step 15, after j+1 is assigned to j, return to step 14 execute, until j > m;
Step 16, after i+1 is assigned to i, return to step 7 execute, until i > n after, execute step 19;
Flag is stored in examination question type chained list T, and judges whether flag=1 is true by step 17, if so, it then will choosing
It, otherwise, will be in null value deposit examination question option chained list L in item variable C deposit examination question option chained lists L;
If the examination question is multiple-choice question, option-argument is put into option chained list L, otherwise, null value is put into option chain
In table L, to ensure in step 19 while while traversing three chained lists correctly obtains the various pieces of each examination question.
Arr [i] is stored in examination question stem chained list S by step 18, and return to step 8 executes;
Step 19, traversal examination question type chained list T, examination question stem chained list S and examination question option chained list L, obtain each examination respectively
Type, stem and the option of topic are simultaneously stored in exam pool, and the batch to complete examination question uploads, and overcomes in conventional method on one by one
The low efficiency problem of biography reduces the time for uploading examination question, while overcoming and editing inconvenient problem in excel upload modes,
Solve the problems, such as that document has to comply with certain rule in existing word uploads mode.